feat: Implement Age Report, Dynamic Headers, KK Auto-Link, and Rebranding
- Added Age Classification Report (admin/laporan/laporan_klasifikasi.php) - Updated Reports to use Dynamic Village Profile (tb_profil) - Use 'nama_desa' column for village name - Enhanced KK Scan to auto-link existing members by NIK - Updated Index menu for Age Report (Admin & Kaur scope) - Rebranded Footer to Wartana 2026 - Removed legacy 'Versi 2020' text
This commit is contained in:
@@ -166,7 +166,18 @@ window.addEventListener('load', function() {
|
||||
<tr><td>Kabupaten</td><td>${d.kabupaten || '-'}</td></tr>
|
||||
<tr><td>Provinsi</td><td>${d.provinsi || '-'}</td></tr>
|
||||
</table>
|
||||
<p class="mb-0 text-muted">Gunakan data ini?</p>
|
||||
|
||||
<hr>
|
||||
<strong>Ditemukan ${d.anggota ? d.anggota.length : 0} Anggota:</strong>
|
||||
<div style="max-height: 150px; overflow-y: auto; background: #f8f9fa; border: 1px solid #ddd; padding: 5px;">
|
||||
${d.anggota && d.anggota.length > 0 ?
|
||||
'<ul style="padding-left: 20px; margin-bottom: 0;">' +
|
||||
d.anggota.map(m => `<li><b>${m.nama}</b><br><small>${m.nik} (${m.hubungan})</small></li>`).join('') +
|
||||
'</ul>'
|
||||
: '<i class="text-muted">Tidak ada anggota terdeteksi</i>'}
|
||||
</div>
|
||||
|
||||
<p class="mb-0 text-muted mt-2">Gunakan data ini?</p>
|
||||
</div>
|
||||
`,
|
||||
icon: 'question',
|
||||
@@ -262,6 +273,9 @@ window.addEventListener('load', function() {
|
||||
$query_simpan = mysqli_query($koneksi, $sql_simpan);
|
||||
|
||||
// Process Auto-Linking Members
|
||||
$linked_count = 0;
|
||||
$failed_count = 0;
|
||||
|
||||
if ($query_simpan && !empty($_POST['anggota_json'])) {
|
||||
$id_kk_baru = mysqli_insert_id($koneksi);
|
||||
$anggota_list = json_decode($_POST['anggota_json'], true);
|
||||
@@ -280,6 +294,9 @@ window.addEventListener('load', function() {
|
||||
// Insert into tb_anggota
|
||||
$sql_add_ang = "INSERT INTO tb_anggota (id_kk, id_pend, hubungan) VALUES ('$id_kk_baru', '$id_pend_found', '$hub_mem')";
|
||||
mysqli_query($koneksi, $sql_add_ang);
|
||||
$linked_count++;
|
||||
} else {
|
||||
$failed_count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -288,8 +305,13 @@ window.addEventListener('load', function() {
|
||||
mysqli_close($koneksi);
|
||||
|
||||
if ($query_simpan) {
|
||||
$msg_add = "";
|
||||
if($linked_count > 0 || $failed_count > 0) {
|
||||
$msg_add = "<br>Anggota Terhubung: <b>$linked_count</b><br>Tidak Ditemukan: <b>$failed_count</b>";
|
||||
}
|
||||
|
||||
echo "<script>
|
||||
Swal.fire({title: 'Tambah Data Berhasil',text: '',icon: 'success',confirmButtonText: 'OK'
|
||||
Swal.fire({title: 'Tambah Data Berhasil',html: 'Data KK disimpan.$msg_add',icon: 'success',confirmButtonText: 'OK'
|
||||
}).then((result) => {if (result.value){
|
||||
window.location = 'index.php?page=data-kartu';
|
||||
}
|
||||
|
||||
29
admin/laporan/laporan_klasifikasi.php
Normal file
29
admin/laporan/laporan_klasifikasi.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<div class="card card-primary">
|
||||
<div class="card-header">
|
||||
<h3 class="card-title">
|
||||
<i class="fa fa-file"></i> Laporan Klasifikasi Umur</h3>
|
||||
</div>
|
||||
<form action="./report/cetak_klasifikasi.php" method="post" enctype="multipart/form-data" target="_blank">
|
||||
<div class="card-body">
|
||||
|
||||
<div class="form-group row">
|
||||
<label class="col-sm-2 col-form-label">Kategori Umur</label>
|
||||
<div class="col-sm-4">
|
||||
<select name="kategori" id="kategori" class="form-control" required>
|
||||
<option value="Semua">-- Semua Kategori --</option>
|
||||
<option value="Balita">Balita (0-5 Tahun)</option>
|
||||
<option value="Anak">Anak-anak (6-12 Tahun)</option>
|
||||
<option value="Remaja">Remaja (13-17 Tahun)</option>
|
||||
<option value="Dewasa">Dewasa (18-59 Tahun)</option>
|
||||
<option value="Lansia">Lansia (> 60 Tahun)</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="card-footer">
|
||||
<button type="submit" class="btn btn-primary" name="Cetak">
|
||||
<i class="fa fa-print"></i> Cetak Laporan</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
23
index.php
23
index.php
@@ -268,6 +268,12 @@
|
||||
<p>Data Pindah</p>
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a href="?page=laporan-klasifikasi" class="nav-link">
|
||||
<i class="nav-icon far fa-circle text-warning"></i>
|
||||
<p>Data Klasifikasi Umur</p>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
@@ -453,6 +459,12 @@
|
||||
<p>Data Pindah</p>
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a href="?page=laporan-klasifikasi" class="nav-link">
|
||||
<i class="nav-icon far fa-circle text-warning"></i>
|
||||
<p>Data Klasifikasi Umur</p>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
@@ -597,6 +609,11 @@
|
||||
break;
|
||||
case 'view-pindah':
|
||||
include "admin/pindah/view_pindah.php";
|
||||
break;
|
||||
|
||||
//laporan
|
||||
case 'laporan-klasifikasi':
|
||||
include "admin/laporan/laporan_klasifikasi.php";
|
||||
break;
|
||||
|
||||
//datang
|
||||
@@ -657,12 +674,12 @@
|
||||
<footer class="main-footer">
|
||||
<div class="float-right d-none d-sm-block">
|
||||
Copyright ©
|
||||
<a target="_blank" href="https://www.youtube.com/channel/UCDxjOzW7F0JOkltlXT6g7AQ">
|
||||
<strong> elseif software house</strong>
|
||||
<a href="#" target="_blank">
|
||||
<strong> Wartana 2026</strong>
|
||||
</a>
|
||||
All rights reserved.
|
||||
</div>
|
||||
<b>SI PANDU VERSI 2020</b>
|
||||
|
||||
</footer>
|
||||
|
||||
<!-- Control Sidebar -->
|
||||
|
||||
85
report/cetak_klasifikasi.php
Normal file
85
report/cetak_klasifikasi.php
Normal file
@@ -0,0 +1,85 @@
|
||||
<?php
|
||||
include "../inc/koneksi.php";
|
||||
$tanggal = date("d/m/y");
|
||||
|
||||
// Ambil Data Profil
|
||||
$sql_profil = "SELECT * FROM tb_profil WHERE id_profil='1'";
|
||||
$query_profil = mysqli_query($koneksi, $sql_profil);
|
||||
$data_profil = mysqli_fetch_array($query_profil,MYSQLI_BOTH);
|
||||
|
||||
$kategori = $_POST['kategori'];
|
||||
$label = "SEMUA KATEGORI";
|
||||
|
||||
// Build Query with TIMESTAMPDIFF for accurate age calculation
|
||||
$sql_tampil = "SELECT *, TIMESTAMPDIFF(YEAR, tgl_lh, CURDATE()) AS usia FROM tb_pdd";
|
||||
|
||||
if($kategori == "Balita") {
|
||||
$sql_tampil .= " WHERE TIMESTAMPDIFF(YEAR, tgl_lh, CURDATE()) BETWEEN 0 AND 5";
|
||||
$label = "KATEGORI BALITA (0-5 TAHUN)";
|
||||
} elseif ($kategori == "Anak") {
|
||||
$sql_tampil .= " WHERE TIMESTAMPDIFF(YEAR, tgl_lh, CURDATE()) BETWEEN 6 AND 12";
|
||||
$label = "KATEGORI ANAK-ANAK (6-12 TAHUN)";
|
||||
} elseif ($kategori == "Remaja") {
|
||||
$sql_tampil .= " WHERE TIMESTAMPDIFF(YEAR, tgl_lh, CURDATE()) BETWEEN 13 AND 17";
|
||||
$label = "KATEGORI REMAJA (13-17 TAHUN)";
|
||||
} elseif ($kategori == "Dewasa") {
|
||||
$sql_tampil .= " WHERE TIMESTAMPDIFF(YEAR, tgl_lh, CURDATE()) BETWEEN 18 AND 59";
|
||||
$label = "KATEGORI DEWASA (18-59 TAHUN)";
|
||||
} elseif ($kategori == "Lansia") {
|
||||
$sql_tampil .= " WHERE TIMESTAMPDIFF(YEAR, tgl_lh, CURDATE()) >= 60";
|
||||
$label = "KATEGORI LANSIA (> 60 TAHUN)";
|
||||
}
|
||||
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>LAPORAN DATA PENDUDUK BERDASARKAN UMUR</title>
|
||||
</head>
|
||||
<body>
|
||||
<center>
|
||||
<h2>PEMERINTAH KABUPATEN <?php echo strtoupper($data_profil['kabupaten']); ?></h2>
|
||||
<h3>KECAMATAN <?php echo strtoupper($data_profil['kecamatan']); ?> <br> DESA <?php echo strtoupper($data_profil['nama_desa']); ?></h3>
|
||||
<p><?php echo $data_profil['alamat']; ?></p>
|
||||
<p>________________________________________________________________________</p>
|
||||
<h3>LAPORAN DATA PENDUDUK</h3>
|
||||
<h4><?php echo $label; ?></h4>
|
||||
<p align="left">Dicetak Tanggal : <?php echo $tanggal; ?></p>
|
||||
</center>
|
||||
|
||||
<table border="1" cellspacing="0" style="width: 100%">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>No</th>
|
||||
<th>NIK</th>
|
||||
<th>Nama</th>
|
||||
<th>Tgl Lahir</th>
|
||||
<th>Usia</th>
|
||||
<th>JK</th>
|
||||
<th>Alamat</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
$no=1;
|
||||
$query_tampil = mysqli_query($koneksi, $sql_tampil);
|
||||
while ($data = mysqli_fetch_array($query_tampil,MYSQLI_BOTH)) {
|
||||
?>
|
||||
<tr>
|
||||
<td align="center"><?php echo $no++; ?></td>
|
||||
<td>'<?php echo $data['nik']; ?></td>
|
||||
<td><?php echo $data['nama']; ?></td>
|
||||
<td align="center"><?php echo date("d/m/Y", strtotime($data['tgl_lh'])); ?></td>
|
||||
<td align="center"><?php echo $data['usia']; ?> Thn</td>
|
||||
<td align="center"><?php echo $data['jekel']; ?></td>
|
||||
<td><?php echo $data['desa']; ?>, RT <?php echo $data['rt']; ?>/ RW <?php echo $data['rw']; ?></td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<script>
|
||||
window.print();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,6 +1,11 @@
|
||||
<?php
|
||||
include "../inc/koneksi.php";
|
||||
$tanggal = date("d/m/y");
|
||||
|
||||
// Ambil Data Profil
|
||||
$sql_profil = "SELECT * FROM tb_profil WHERE id_profil='1'";
|
||||
$query_profil = mysqli_query($koneksi, $sql_profil);
|
||||
$data_profil = mysqli_fetch_array($query_profil,MYSQLI_BOTH);
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
@@ -9,8 +14,9 @@
|
||||
</head>
|
||||
<body>
|
||||
<center>
|
||||
<h2>PEMERINTAH KABUPATEN PERCONTOHAN</h2>
|
||||
<h3>KECAMATAN PERCONTOHAN <br> DESA PERCONTOHAN</h3>
|
||||
<h2>PEMERINTAH KABUPATEN <?php echo strtoupper($data_profil['kabupaten']); ?></h2>
|
||||
<h3>KECAMATAN <?php echo strtoupper($data_profil['kecamatan']); ?> <br> DESA <?php echo strtoupper($data_profil['nama_desa']); ?></h3>
|
||||
<p><?php echo $data_profil['alamat']; ?></p>
|
||||
<p>________________________________________________________________________</p>
|
||||
<h3>LAPORAN DATA PENDATANG</h3>
|
||||
<p align="left">Dicetak Tanggal : <?php echo $tanggal; ?></p>
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
<?php
|
||||
include "../inc/koneksi.php";
|
||||
$tanggal = date("d/m/y");
|
||||
|
||||
// Ambil Data Profil
|
||||
$sql_profil = "SELECT * FROM tb_profil WHERE id_profil='1'";
|
||||
$query_profil = mysqli_query($koneksi, $sql_profil);
|
||||
$data_profil = mysqli_fetch_array($query_profil,MYSQLI_BOTH);
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
@@ -9,8 +14,9 @@
|
||||
</head>
|
||||
<body>
|
||||
<center>
|
||||
<h2>PEMERINTAH KABUPATEN PERCONTOHAN</h2>
|
||||
<h3>KECAMATAN PERCONTOHAN <br> DESA PERCONTOHAN</h3>
|
||||
<h2>PEMERINTAH KABUPATEN <?php echo strtoupper($data_profil['kabupaten']); ?></h2>
|
||||
<h3>KECAMATAN <?php echo strtoupper($data_profil['kecamatan']); ?> <br> DESA <?php echo strtoupper($data_profil['nama_desa']); ?></h3>
|
||||
<p><?php echo $data_profil['alamat']; ?></p>
|
||||
<p>________________________________________________________________________</p>
|
||||
<h3>LAPORAN DATA KARTU KELUARGA</h3>
|
||||
<p align="left">Dicetak Tanggal : <?php echo $tanggal; ?></p>
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
<?php
|
||||
include "../inc/koneksi.php";
|
||||
$tanggal = date("d/m/y");
|
||||
|
||||
// Ambil Data Profil
|
||||
$sql_profil = "SELECT * FROM tb_profil WHERE id_profil='1'";
|
||||
$query_profil = mysqli_query($koneksi, $sql_profil);
|
||||
$data_profil = mysqli_fetch_array($query_profil,MYSQLI_BOTH);
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
@@ -9,8 +14,9 @@
|
||||
</head>
|
||||
<body>
|
||||
<center>
|
||||
<h2>PEMERINTAH KABUPATEN PERCONTOHAN</h2>
|
||||
<h3>KECAMATAN PERCONTOHAN <br> DESA PERCONTOHAN</h3>
|
||||
<h2>PEMERINTAH KABUPATEN <?php echo strtoupper($data_profil['kabupaten']); ?></h2>
|
||||
<h3>KECAMATAN <?php echo strtoupper($data_profil['kecamatan']); ?> <br> DESA <?php echo strtoupper($data_profil['nama_desa']); ?></h3>
|
||||
<p><?php echo $data_profil['alamat']; ?></p>
|
||||
<p>________________________________________________________________________</p>
|
||||
<h3>LAPORAN DATA KELAHIRAN</h3>
|
||||
<p align="left">Dicetak Tanggal : <?php echo $tanggal; ?></p>
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
<?php
|
||||
include "../inc/koneksi.php";
|
||||
$tanggal = date("d/m/y");
|
||||
|
||||
// Ambil Data Profil
|
||||
$sql_profil = "SELECT * FROM tb_profil WHERE id_profil='1'";
|
||||
$query_profil = mysqli_query($koneksi, $sql_profil);
|
||||
$data_profil = mysqli_fetch_array($query_profil,MYSQLI_BOTH);
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
@@ -9,8 +14,9 @@
|
||||
</head>
|
||||
<body>
|
||||
<center>
|
||||
<h2>PEMERINTAH KABUPATEN PERCONTOHAN</h2>
|
||||
<h3>KECAMATAN PERCONTOHAN <br> DESA PERCONTOHAN</h3>
|
||||
<h2>PEMERINTAH KABUPATEN <?php echo strtoupper($data_profil['kabupaten']); ?></h2>
|
||||
<h3>KECAMATAN <?php echo strtoupper($data_profil['kecamatan']); ?> <br> DESA <?php echo strtoupper($data_profil['nama_desa']); ?></h3>
|
||||
<p><?php echo $data_profil['alamat']; ?></p>
|
||||
<p>________________________________________________________________________</p>
|
||||
<h3>LAPORAN DATA KEMATIAN</h3>
|
||||
<p align="left">Dicetak Tanggal : <?php echo $tanggal; ?></p>
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
<?php
|
||||
include "../inc/koneksi.php";
|
||||
$tanggal = date("d/m/y");
|
||||
|
||||
// Ambil Data Profil
|
||||
$sql_profil = "SELECT * FROM tb_profil WHERE id_profil='1'";
|
||||
$query_profil = mysqli_query($koneksi, $sql_profil);
|
||||
$data_profil = mysqli_fetch_array($query_profil,MYSQLI_BOTH);
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
@@ -9,8 +14,9 @@
|
||||
</head>
|
||||
<body>
|
||||
<center>
|
||||
<h2>PEMERINTAH KABUPATEN PERCONTOHAN</h2>
|
||||
<h3>KECAMATAN PERCONTOHAN <br> DESA PERCONTOHAN</h3>
|
||||
<h2>PEMERINTAH KABUPATEN <?php echo strtoupper($data_profil['kabupaten']); ?></h2>
|
||||
<h3>KECAMATAN <?php echo strtoupper($data_profil['kecamatan']); ?> <br> DESA <?php echo strtoupper($data_profil['nama_desa']); ?></h3>
|
||||
<p><?php echo $data_profil['alamat']; ?></p>
|
||||
<p>________________________________________________________________________</p>
|
||||
<h3>LAPORAN DATA PENDUDUK</h3>
|
||||
<p align="left">Dicetak Tanggal : <?php echo $tanggal; ?></p>
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
<?php
|
||||
include "../inc/koneksi.php";
|
||||
$tanggal = date("d/m/y");
|
||||
|
||||
// Ambil Data Profil
|
||||
$sql_profil = "SELECT * FROM tb_profil WHERE id_profil='1'";
|
||||
$query_profil = mysqli_query($koneksi, $sql_profil);
|
||||
$data_profil = mysqli_fetch_array($query_profil,MYSQLI_BOTH);
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
@@ -9,8 +14,9 @@
|
||||
</head>
|
||||
<body>
|
||||
<center>
|
||||
<h2>PEMERINTAH KABUPATEN PERCONTOHAN</h2>
|
||||
<h3>KECAMATAN PERCONTOHAN <br> DESA PERCONTOHAN</h3>
|
||||
<h2>PEMERINTAH KABUPATEN <?php echo strtoupper($data_profil['kabupaten']); ?></h2>
|
||||
<h3>KECAMATAN <?php echo strtoupper($data_profil['kecamatan']); ?> <br> DESA <?php echo strtoupper($data_profil['nama_desa']); ?></h3>
|
||||
<p><?php echo $data_profil['alamat']; ?></p>
|
||||
<p>________________________________________________________________________</p>
|
||||
<h3>LAPORAN DATA PINDAH</h3>
|
||||
<p align="left">Dicetak Tanggal : <?php echo $tanggal; ?></p>
|
||||
|
||||
Reference in New Issue
Block a user