<!DOCTYPE html>
<html>

<head>
	<meta charset="utf-8">
	<title>Kelengkapan Rapor</title>
	<style type="text/css">
		body {
			font-family: Arial, Helvetica, sans-serif;
		}
	</style>
</head>

<body>
	<div style="page-break-after:always">

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

			$siswa = "SELECT * FROM peserta_didik WHERE nis = :nis";
			$statement = $pdo->prepare($siswa);
			$statement->bindParam(':nis', $nis, PDO::PARAM_STR);
			$statement->execute();

			if ($row = $statement->fetch(PDO::FETCH_ASSOC)) {
				$filename = $row['nis'] . "-" . $row['nama'];
		?>
				<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>RAPOR PESERTA DIDIK<br>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 style="display:none;">
						<td valign="top">
							<center>
								<h2>KEMENTRIAN PENDIDIKAN,<br>KEBUDAYAAN,RISET DAN TEKNOLOGI<br>REPUBLIK INDONESIA</h2>
							</center>
						</td>
					</tr>
				</table>
	</div>
	<div style="page-break-after:always">
		<?php
				$sekolah = "SELECT * FROM sekolah";
				$statement = $pdo->prepare($sekolah);
				$statement->execute();

				if ($sekolahlist = $statement->fetch(PDO::FETCH_ASSOC)) {
		?>
			<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>: <?= $sekolahlist['nama_sekolah'] ?></td>
				</tr>
				<tr>
					<td>NPSN </td>
					<td>: <?= $sekolahlist['npsn'] ?> </td>
				</tr>
				<tr>
					<td>NIS/NSS/NDS </td>
					<td>: <?= $sekolahlist['nss'] ?></td>
				</tr>
				<tr>
					<td>Alamat Sekolah </td>
					<td>: <?= $sekolahlist['alamat'] ?></td>
				</tr>
				<tr>
					<td>Kelurahan/Desa </td>
					<td>: <?= $sekolahlist['desa_kelurahan'] ?> </td>
				</tr>
				<tr>
					<td>Kecamatan </td>
					<td>: <?= $sekolahlist['kecamatan'] ?> </td>
				</tr>
				<tr>
					<td>Kota/Kabupaten </td>
					<td>: <?= $sekolahlist['kabupaten'] ?> </td>
				</tr>
				<tr>
					<td>Provinsi </td>
					<td>: Jawa Tengah </td>
				</tr>
				<tr>
					<td>Website </td>
					<td>: <?= $sekolahlist['website'] ?></td>
				</tr>
				<tr>
					<td>E-mail </td>
					<td>: <?= $sekolahlist['email'] ?></td>
				</tr>
			</table>
		<?php } ?>
	</div>
	<div style="page-break-after:always">
		<table border="0" cellspacing="0" 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><?= $sekolahlist['kecamatan'] ?>,

								<?php
								$kode_tapel = $_GET['ktp'];
								$statement = $pdo->prepare("SELECT tanggal_identitas FROM tahun_pelajaran WHERE kode_tapel = :kode_tapel");
								$statement->execute([':kode_tapel' => $kode_tapel]);
								echo $result = $statement->fetch(PDO::FETCH_COLUMN);
								?>

							</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><?= $sekolahlist['namaks'] ?></strong></td>
						</tr>
						<tr>
							<td>&nbsp;</td>
							<td> NIP. <?= $sekolahlist['nipks'] ?> </td>
						</tr>
					</table>
				</td>
			</tr>
		</table>

	</div>
	<div style="page-break-after:always">
		<table border="0" cellspacing="0" cellpadding="0" width="100%">
			<tr>
				<td colspan="4" valign="top" align="center">
					<font size="5"><strong>KETERANGAN PINDAH SEKOLAH</strong></font>
				</td>
			</tr>
			<tr>
				<td colspan="4" valign="top">&nbsp;</td>
			</tr>
			<tr>
				<td colspan="4" valign="top">Nama Peserta Didik : <?= $row['nama'] ?></td>
			</tr>
			<tr>
				<td colspan="4" valign="top">&nbsp;</td>
			</tr>
		</table>
		<table border="1" cellspacing="0" cellpadding="3" width="100%">
			<tr>
				<td colspan="4" valign="top" align="center">
					<font size="4"><strong>KELUAR</strong></font>
				</td>
			</tr>
			<tr>
				<td width="5%" align="center">Tanggal </td>
				<td width="10%" align="center">Kelas yang Ditinggalkan </td>
				<td width="15%" align="center">Sebab-sebab Keluar atau Atas Permintaan (Tertulis) </td>
				<td width="25%" align="center">Tanda Tangan Kepala Sekolah, Stempel Sekolah, dan Tanda Tangan Orang Tua/Wali </td>
			</tr>
			<tr>
				<td valign="top">&nbsp;</td>
				<td valign="top">&nbsp;</td>
				<td valign="top">&nbsp;</td>
				<td valign="top">
					<table width="100%" cellpadding="0" cellspacing="0">
						<tr>
							<td colspan="6">&nbsp;</td>
						</tr>
						<tr>
							<td colspan="6" align="center" width="250">............................., ............................</td>
						</tr>
						<tr>
							<td colspan="6" align="center">Kepala Sekolah,</td>
						</tr>
						<tr>
							<td colspan="6">&nbsp;</td>
						</tr>
						<tr>
							<td colspan="6">&nbsp;</td>
						</tr>
						<tr>
							<td colspan="6" align="center">........................................</td>
						</tr>
						<tr>
							<td colspan="6" align="center">NIP</td>
						</tr>
						<tr>
							<td colspan="6">&nbsp;</td>
						</tr>
						<tr>
							<td colspan="6" align="center">Orang Tua/Wali,</td>
						</tr>
						<tr>
							<td colspan="6">&nbsp;</td>
						</tr>
						<tr>
							<td colspan="6">&nbsp;</td>
						</tr>
						<tr>
							<td colspan="6" align="center">........................................</td>
						</tr>
					</table>
				</td>
			</tr>
			<tr>
				<td valign="top">&nbsp;</td>
				<td valign="top">&nbsp;</td>
				<td valign="top">&nbsp;</td>
				<td valign="top">
					<table width="100%" cellpadding="0" cellspacing="0">
						<tr>
							<td colspan="6">&nbsp;</td>
						</tr>
						<tr>
							<td colspan="6" align="center" width="250">............................., ............................</td>
						</tr>
						<tr>
							<td colspan="6" align="center">Kepala Sekolah,</td>
						</tr>
						<tr>
							<td colspan="6">&nbsp;</td>
						</tr>
						<tr>
							<td colspan="6">&nbsp;</td>
						</tr>
						<tr>
							<td colspan="6" align="center">........................................</td>
						</tr>
						<tr>
							<td colspan="6" align="center">NIP</td>
						</tr>
						<tr>
							<td colspan="6">&nbsp;</td>
						</tr>
						<tr>
							<td colspan="6" align="center">Orang Tua/Wali,</td>
						</tr>
						<tr>
							<td colspan="6">&nbsp;</td>
						</tr>
						<tr>
							<td colspan="6">&nbsp;</td>
						</tr>
						<tr>
							<td colspan="6" align="center">........................................</td>
						</tr>
					</table>
				</td>
			</tr>
			<tr>
				<td valign="top">&nbsp;</td>
				<td valign="top">&nbsp;</td>
				<td valign="top">&nbsp;</td>
				<td valign="top">
					<table width="100%" cellpadding="0" cellspacing="0">
						<tr>
							<td colspan="6">&nbsp;</td>
						</tr>
						<tr>
							<td colspan="6" align="center" width="250">............................., ............................</td>
						</tr>
						<tr>
							<td colspan="6" align="center">Kepala Sekolah,</td>
						</tr>
						<tr>
							<td colspan="6">&nbsp;</td>
						</tr>
						<tr>
							<td colspan="6">&nbsp;</td>
						</tr>
						<tr>
							<td colspan="6" align="center">........................................</td>
						</tr>
						<tr>
							<td colspan="6" align="center">NIP</td>
						</tr>
						<tr>
							<td colspan="6">&nbsp;</td>
						</tr>
						<tr>
							<td colspan="6" align="center">Orang Tua/Wali,</td>
						</tr>
						<tr>
							<td colspan="6">&nbsp;</td>
						</tr>
						<tr>
							<td colspan="6">&nbsp;</td>
						</tr>
						<tr>
							<td colspan="6" align="center">........................................</td>
						</tr>
					</table>
				</td>
			</tr>
		</table>

	</div>
	<div style="page-break-after:none">
		<table border="0" cellspacing="0" cellpadding="0" width="100%">
			<tr>
				<td colspan="4" valign="top" align="center">
					<font size="5"><strong>KETERANGAN PINDAH SEKOLAH</strong></font>
				</td>
			</tr>
			<tr>
				<td colspan="4" valign="top">&nbsp;</td>
			</tr>
			<tr>
				<td colspan="4" valign="top">Nama Peserta Didik : <?= $row['nama'] ?></td>
			</tr>
			<tr>
				<td colspan="4" valign="top">&nbsp;</td>
			</tr>
		</table>
		<table border="1" cellspacing="0" cellpadding="3" width="100%">
			<tr>
				<td align="center">NO</td>
				<td colspan="3" align="center">MASUK </td>
			</tr>
			<tr>
				<td width="2%">
					<table border="0" cellspacing="0" cellpadding="8" width="100%">
						<tr>
							<td width="20">1. </td>
						</tr>
						<tr>
							<td width="20">2. </td>
						</tr>
						<tr>
							<td width="20">3. </td>
						</tr>
						<tr>
							<td width="20">4. </td>
						</tr>
						<tr>
							<td width="20">&nbsp;</td>
						</tr>
						<tr>
							<td width="20">&nbsp;</td>
						</tr>
						<tr>
							<td width="20">5. </td>
						</tr>
					</table>
				</td>
				<td width="10%">
					<table border="0" cellspacing="0" cellpadding="8" width="100%">
						<tr>
							<td width="120">Nomor Induk </td>
						</tr>
						<tr>
							<td width="120">Nama Sekolah </td>
						</tr>
						<tr>
							<td width="120">Masuk di Sekolah ini </td>
						</tr>
						<tr>
							<td width="120">a. Tanggal </td>
						</tr>
						<tr>
							<td width="120">b. Di Kelas </td>
						</tr>
						<tr>
							<td width="120">Tahun Pelajaran </td>
						</tr>
						<tr>
							<td width="120">Tahun Pelajaran </td>
						</tr>
					</table>
				</td>
				<td width="50%">&nbsp;</td>
				<td>
					<table border="0" cellspacing="0" cellpadding="8" width="100%">
						<tr>
							<td width="220" align="center">................., ............................</td>
						</tr>
						<tr>
							<td align="center">Kepala Sekolah, </td>
						</tr>
						<tr>
							<td>&nbsp;</td>
						</tr>
						<tr>
							<td>&nbsp;</td>
						</tr>
						<tr>
							<td align="center">.............................................</td>
						</tr>
						<tr>
							<td align="center">NIP. .........................................</td>
						</tr>
					</table>
				</td>
			</tr>
			<tr>
				<td width="2%">
					<table border="0" cellspacing="0" cellpadding="8" width="100%">
						<tr>
							<td width="20">1. </td>
						</tr>
						<tr>
							<td width="20">2. </td>
						</tr>
						<tr>
							<td width="20">3. </td>
						</tr>
						<tr>
							<td width="20">4. </td>
						</tr>
						<tr>
							<td width="20">&nbsp;</td>
						</tr>
						<tr>
							<td width="20">&nbsp;</td>
						</tr>
						<tr>
							<td width="20">5. </td>
						</tr>
					</table>
				</td>
				<td width="10%">
					<table border="0" cellspacing="0" cellpadding="8" width="100%">
						<tr>
							<td width="120">Nomor Induk </td>
						</tr>
						<tr>
							<td width="120">Nama Sekolah </td>
						</tr>
						<tr>
							<td width="120">Masuk di Sekolah ini </td>
						</tr>
						<tr>
							<td width="120">a. Tanggal </td>
						</tr>
						<tr>
							<td width="120">b. Di Kelas </td>
						</tr>
						<tr>
							<td width="120">Tahun Pelajaran </td>
						</tr>
						<tr>
							<td width="120">Tahun Pelajaran </td>
						</tr>
					</table>
				</td>
				<td width="50%">&nbsp;</td>
				<td>
					<table border="0" cellspacing="0" cellpadding="8" width="100%">
						<tr>
							<td width="220" align="center">................., ............................</td>
						</tr>
						<tr>
							<td align="center">Kepala Sekolah, </td>
						</tr>
						<tr>
							<td>&nbsp;</td>
						</tr>
						<tr>
							<td>&nbsp;</td>
						</tr>
						<tr>
							<td align="center">.............................................</td>
						</tr>
						<tr>
							<td align="center">NIP. .........................................</td>
						</tr>
					</table>
				</td>
			</tr>
			<tr>
				<td width="2%">
					<table border="0" cellspacing="0" cellpadding="8" width="100%">
						<tr>
							<td width="20">1. </td>
						</tr>
						<tr>
							<td width="20">2. </td>
						</tr>
						<tr>
							<td width="20">3. </td>
						</tr>
						<tr>
							<td width="20">4. </td>
						</tr>
						<tr>
							<td width="20">&nbsp;</td>
						</tr>
						<tr>
							<td width="20">&nbsp;</td>
						</tr>
						<tr>
							<td width="20">5. </td>
						</tr>
					</table>
				</td>
				<td width="10%">
					<table border="0" cellspacing="0" cellpadding="8" width="100%">
						<tr>
							<td width="120">Nomor Induk </td>
						</tr>
						<tr>
							<td width="120">Nama Sekolah </td>
						</tr>
						<tr>
							<td width="120">Masuk di Sekolah ini </td>
						</tr>
						<tr>
							<td width="120">a. Tanggal </td>
						</tr>
						<tr>
							<td width="120">b. Di Kelas </td>
						</tr>
						<tr>
							<td width="120">Tahun Pelajaran </td>
						</tr>
						<tr>
							<td width="120">Tahun Pelajaran </td>
						</tr>
					</table>
				</td>
				<td width="50%">&nbsp;</td>
				<td>
					<table border="0" cellspacing="0" cellpadding="8" width="100%">
						<tr>
							<td width="220" align="center">................., ............................</td>
						</tr>
						<tr>
							<td align="center">Kepala Sekolah, </td>
						</tr>
						<tr>
							<td>&nbsp;</td>
						</tr>
						<tr>
							<td>&nbsp;</td>
						</tr>
						<tr>
							<td align="center">.............................................</td>
						</tr>
						<tr>
							<td align="center">NIP. .........................................</td>
						</tr>
					</table>
				</td>
			</tr>

		</table>

	</div>
<?php } else {
				echo "Data not found.";
			}
		}

?>
</body>

</html>