<?php
    include "../inc/koneksi.php";
    $tanggal = date("d/m/y");
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <title>LAPORAN DATA KEMATIAN</title>
</head>
<body>
    <center>
        <h2>PEMERINTAH KABUPATEN PERCONTOHAN</h2>
        <h3>KECAMATAN PERCONTOHAN <br> DESA PERCONTOHAN</h3>
        <p>________________________________________________________________________</p>
        <h3>LAPORAN DATA KEMATIAN</h3>
        <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>Tanggal Wafat</th>
                <th>Sebab</th>
            </tr>
        </thead>
        <tbody>
            <?php
            $no=1;
            $sql_tampil = "SELECT p.nik, p.nama, m.tgl_mendu, m.sebab 
                          FROM tb_mendu m 
                          INNER JOIN tb_pdd p ON p.id_pend=m.id_pdd";
            $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><?php echo $data['tgl_mendu']; ?></td>
                <td><?php echo $data['sebab']; ?></td>
            </tr>
            <?php } ?>
        </tbody>
    </table>

    <script>
        window.print();
    </script>
</body>
</html>
