<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <title>Biodata Peserta Didik Kelas <?= $_GET['k'] ?></title>
    <style type="text/css">
        body {
            font-family: Arial, Helvetica, sans-serif;
        }
    </style>
</head>

<body>

    <?php
    if (isset($_GET['act'])) { ?>
        <?php
        $kode_tapel = $_GET['ktp'];
        $kelas = $_GET['k'];
        $database_file = '../../db/rapor.db';
        $pdo = new PDO("sqlite:$database_file");

        $siswa = "SELECT 
        sekolah.npsn, 
        sekolah.nss, 
        sekolah.nama_sekolah, 
        sekolah.status as status_sekolah, 
        sekolah.website, 
        sekolah.email, 
        sekolah.alamat as alamat_sekolah, 
        sekolah.desa_kelurahan, 
        sekolah.kecamatan, 
        sekolah.kabupaten, 
        sekolah.namaks, 
        sekolah.nipks, 
        peserta_didik.kelas, 
        peserta_didik.nisn, 
        peserta_didik.nis, 
        peserta_didik.nama, 
        peserta_didik.jk, 
        peserta_didik.tmp_lahir, 
        peserta_didik.tgl_lahir, 
        peserta_didik.agama, 
        peserta_didik.status, 
        peserta_didik.anak_ke, 
        peserta_didik.alamat_siswa, 
        peserta_didik.no_hp, 
        peserta_didik.sekolah_asal, 
        peserta_didik.diterima_di_kls, 
        peserta_didik.tanggal, 
        peserta_didik.nama_ayah, 
        peserta_didik.nama_ibu, 
        peserta_didik.alamat, 
        peserta_didik.telepon, 
        peserta_didik.kerja_ayah, 
        peserta_didik.kerja_ibu, 
        peserta_didik.nama_wali, 
        peserta_didik.alamat_wali, 
        peserta_didik.no_telepon, 
        peserta_didik.kerja_wali, 
        tahun_pelajaran.semester, 
        tahun_pelajaran.tanggal_identitas, 
        tahun_pelajaran.tanggal_rapor, 
        tahun_pelajaran.tahun_pelajaran, 
        tahun_pelajaran.kode_tapel
        FROM
        sekolah,
        peserta_didik
        INNER JOIN
        tahun_pelajaran
        ON 
        peserta_didik.kode_tapel = tahun_pelajaran.kode_tapel WHERE tahun_pelajaran.status='Aktif' AND kelas = :kelas ORDER BY pd_id";
        $statement = $pdo->prepare($siswa);
        $statement->bindParam(':kelas', $kelas, PDO::PARAM_STR);
        $statement->execute();
        $no = 1;
        while ($row = $statement->fetch()) {
        ?>
            <div style="page-break-before: auto">
                <table border="0" cellspacing="3" cellpadding="0" width="100%">
                    <tr>
                        <td valign="top">
                            <br><br><br>
                            <center><img src="../images/tut.jpg" width="200px"></center>
                        </td>
                    </tr>
                    <tr>
                        <td valign="top">
                            <center>
                                <h1>SEKOLAH MENENGAH PERTAMA<br>( SMP )</h1>
                            </center>
                        </td>
                    </tr>
                    <tr>
                        <td valign="top">&nbsp;</td>
                    </tr>
                    <tr>
                        <td valign="top">&nbsp;</td>
                    </tr>
                    <tr>
                        <td valign="top">&nbsp;</td>
                    </tr>
                    <tr>
                        <td valign="top">&nbsp;</td>
                    </tr>
                    <tr>
                        <td valign="top">&nbsp;</td>
                    </tr>
                    <tr>
                        <td valign="top">&nbsp;</td>
                    </tr>
                    <tr>
                        <td valign="top">&nbsp;</td>
                    </tr>
                    <tr>
                        <td valign="top">
                            <center>
                                <font size="4"><b>Nama Peserta Didik</b></font>
                            </center>
                        </td>
                    </tr>
                    <tr>
                        <td valign="top" style="border: 1px solid black; text-align: center;">
                            <font size="5"><strong><?= $row['nama'] ?></strong></font>
                        </td>
                    </tr>
                    <tr>
                        <td>&nbsp;</td>
                    </tr>
                    <tr>
                        <td valign="top">
                            <center>
                                <font size="4"><b>NISN / NIS</b></font>
                            </center>
                        </td>
                    </tr>
                    <tr>
                        <td valign="top" style="border: 1px solid black; text-align: center;">
                            <font size="5"><strong><?= $row['nisn'] ?> / <?= $row['nis'] ?></strong></font>
                        </td>
                    </tr>
                    <tr>
                        <td valign="top">&nbsp;</td>
                    </tr>
                    <tr>
                        <td valign="top">&nbsp;</td>
                    </tr>
                    <tr>
                        <td valign="top">&nbsp;</td>
                    </tr>
                    <tr>
                        <td valign="top">&nbsp;</td>
                    </tr>
                    <tr>
                        <td valign="top">&nbsp;</td>
                    </tr>
                    <tr>
                        <td valign="top">&nbsp;</td>
                    </tr>
                    <tr>
                        <td valign="top">
                            <center>
                                <h2>KEMENTERIAN PENDIDIKAN DASAR DAN MENENGAH<br>REPUBLIK INDONESIA</h2>
                            </center>
                        </td>
                    </tr>
                </table>
            </div>
            <div style="page-break-after:always">
                <table border="0" cellspacing="5" cellpadding="0" width="100%">
                    <tr>
                        <td colspan="2">
                            <center>
                                <h2>SEKOLAH MENENGAH PERTAMA<br>( SMP )</h2>
                            </center>
                        </td>
                    </tr>
                    <tr>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                    </tr>
                    <tr>
                        <td>Nama Sekolah </td>
                        <td>: <?= $row['nama_sekolah'] ?></td>
                    </tr>
                    <tr>
                        <td>NPSN </td>
                        <td>: <?= $row['npsn'] ?> </td>
                    </tr>
                    <tr>
                        <td>NIS/NSS/NDS </td>
                        <td>: <?= $row['nss'] ?></td>
                    </tr>
                    <tr>
                        <td>Alamat Sekolah </td>
                        <td>: <?= $row['alamat_sekolah'] ?></td>
                    </tr>
                    <tr>
                        <td>Kelurahan/Desa </td>
                        <td>: <?= $row['desa_kelurahan'] ?> </td>
                    </tr>
                    <tr>
                        <td>Kecamatan </td>
                        <td>: <?= $row['kecamatan'] ?> </td>
                    </tr>
                    <tr>
                        <td>Kota/Kabupaten </td>
                        <td>: <?= $row['kabupaten'] ?> </td>
                    </tr>
                    <tr>
                        <td>Provinsi </td>
                        <td>: Jawa Tengah </td>
                    </tr>
                    <tr>
                        <td>Website </td>
                        <td>: <?= $row['website'] ?></td>
                    </tr>
                    <tr>
                        <td>E-mail </td>
                        <td>: <?= $row['email'] ?></td>
                    </tr>
                </table>
            </div>

            <div style="page-break-after:auto;">
                <table border="0" cellspacing="5" cellpadding="0" width="100%">
                    <tr>
                        <td width="100%" valign="top">
                            <center>
                                <h2>IDENTITAS PESERTA DIDIK</h2>
                            </center>
                        </td>
                    </tr>
                    <tr>
                        <td width="100%" valign="top">
                            <table border="0" cellspacing="0" cellpadding="0" width="100%">
                                <tr>
                                    <td width="5%">1. </td>
                                    <td width="35%">Nama Lengkap Peserta Didik </td>
                                    <td>: <?= $row['nama'] ?> </td>
                                </tr>
                                <tr>
                                    <td width="5%">2. </td>
                                    <td>NISN / Nomor Induk </td>
                                    <td>: <?= $row['nisn'] ?>/ <?= $row['nis'] ?> </td>
                                </tr>
                                <tr>
                                    <td width="5%">3. </td>
                                    <td>Tempat, Tanggal Lahir </td>
                                    <td>: <?= $row['tmp_lahir'] ?> / <?= $row['tgl_lahir'] ?> </td>
                                </tr>
                                <tr>
                                    <td width="5%">4. </td>
                                    <td>Jenis Kelamin </td>
                                    <td>: <?= $row['jk'] ?> </td>
                                </tr>
                                <tr>
                                    <td width="5%">5. </td>
                                    <td>Agama </td>
                                    <td>: <?= $row['agama'] ?> </td>
                                </tr>
                                <tr>
                                    <td width="5%">6. </td>
                                    <td>Status dalam Keluarga </td>
                                    <td>: <?= $row['status'] ?></td>
                                </tr>
                                <tr>
                                    <td width="5%">7. </td>
                                    <td>Anak ke </td>
                                    <td>: <?= $row['anak_ke'] ?> </td>
                                </tr>
                                <tr>
                                    <td width="5%">8. </td>
                                    <td>Alamat Peserta Didik </td>
                                    <td>: <?= $row['alamat_siswa'] ?> </td>
                                </tr>
                                <tr>
                                    <td width="5%">9. </td>
                                    <td>Nomor Telepon Rumah </td>
                                    <td>: <?= $row['no_hp'] ?></td>
                                </tr>
                                <tr>
                                    <td width="5%">10. </td>
                                    <td>Sekolah Asal (SD/MI) </td>
                                    <td>: <?= $row['sekolah_asal'] ?></td>
                                </tr>
                                <tr>
                                    <td width="5%">11. </td>
                                    <td>Diterima di sekolah ini </td>
                                    <td>&nbsp;</td>
                                </tr>
                                <tr>
                                    <td width="5%">&nbsp;</td>
                                    <td>Di Kelas </td>
                                    <td>: <?= $row['diterima_di_kls'] ?> </td>
                                </tr>
                                <tr>
                                    <td width="5%">&nbsp;</td>
                                    <td>Pada Tanggal </td>
                                    <td>: <?= $row['tanggal'] ?> </td>
                                </tr>
                                <tr>
                                    <td width="5%">12. </td>
                                    <td>Nama Orang Tua </td>
                                    <td>&nbsp;</td>
                                </tr>
                                <tr>
                                    <td width="5%">&nbsp;</td>
                                    <td>a. Ayah </td>
                                    <td>: <?= $row['nama_ayah'] ?> </td>
                                </tr>
                                <tr>
                                    <td width="5%">&nbsp;</td>
                                    <td>b. Ibu </td>
                                    <td>: <?= $row['nama_ibu'] ?> </td>
                                </tr>
                                <tr>
                                    <td width="5%">13. </td>
                                    <td>Alamat Orang Tua </td>
                                    <td>: <?= $row['alamat'] ?> </td>
                                </tr>
                                <tr>
                                    <td width="5%">&nbsp;</td>
                                    <td>Nomor Telepon Rumah </td>
                                    <td>: <?= $row['telepon'] ?> </td>
                                </tr>
                                <tr>
                                    <td width="5%">14. </td>
                                    <td>Pekerjaan Orang Tua </td>
                                    <td>&nbsp;</td>
                                </tr>
                                <tr>
                                    <td width="5%">&nbsp;</td>
                                    <td>a. Ayah </td>
                                    <td>: <?= $row['kerja_ayah'] ?> </td>
                                </tr>
                                <tr>
                                    <td width="5%">&nbsp;</td>
                                    <td>b. Ibu </td>
                                    <td>: <?= $row['kerja_ibu'] ?> </td>
                                </tr>
                                <tr>
                                    <td width="5%">15. </td>
                                    <td>Nama Wali Peserta Didik </td>
                                    <td>: <?= $row['nama_wali'] ?> </td>
                                </tr>
                                <tr>
                                    <td width="5%">16. </td>
                                    <td>Alamat Wali Peserta Didik </td>
                                    <td>: <?= $row['alamat_wali'] ?> </td>
                                </tr>
                                <tr>
                                    <td width="5%">&nbsp;</td>
                                    <td>Nomor Telepon Rumah </td>
                                    <td>: <?= $row['no_telepon'] ?> </td>
                                </tr>
                                <tr>
                                    <td width="5%">17. </td>
                                    <td>Pekerjaan Wali Peserta Didik </td>
                                    <td>: <?= $row['kerja_wali'] ?> </td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                    <tr>
                        <td width="100%" valign="top">
                            <table width="100%" border="0" cellpadding="0" cellspacing="0">
                                <tr>
                                    <td>&nbsp;</td>
                                    <td>&nbsp;</td>
                                </tr>
                                <tr>
                                    <td>&nbsp;</td>
                                    <td>&nbsp;</td>
                                </tr>
                                <tr>
                                    <td width="50%">&nbsp;</td>
                                    <td><?= $row['kecamatan'] ?>, <?= $row['tanggal_identitas'] ?> </td>
                                </tr>
                                <tr>
                                    <td>&nbsp;</td>
                                    <td>Kepala Sekolah </td>
                                </tr>
                                <tr>
                                    <td>&nbsp;</td>
                                    <td>&nbsp;</td>
                                </tr>
                                <tr>
                                    <td>&nbsp;</td>
                                    <td>&nbsp;</td>
                                </tr>
                                <tr>
                                    <td>&nbsp;</td>
                                    <td>&nbsp;</td>
                                </tr>
                                <tr>
                                    <td>&nbsp;</td>
                                    <td>&nbsp;</td>
                                </tr>
                                <tr>
                                    <td>&nbsp;</td>
                                    <td>&nbsp;</td>
                                </tr>
                                <tr>
                                    <td>&nbsp;</td>
                                    <td><strong><?= $row['namaks'] ?></strong></td>
                                </tr>
                                <tr>
                                    <td>&nbsp;</td>
                                    <td> NIP. <?= $row['nipks'] ?> </td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                </table>
            </div>
        <?php  } ?>
    <?php } ?>


</body>

</html>