<!-- Printing -->
<link rel="stylesheet" href="css/printing.css">

<?php
include("sess_check.php");
include("dist/function/format_tanggal.php");
include("dist/function/format_rupiah.php");
if ($_GET) {
	$kode = $_GET['id'];
	$sql = "SELECT kehilangan.id_kehilangan, kelurahan.nama_pejabat FROM kehilangan INNER JOIN kelurahan ON kehilangaN.id_kelurahan=kelurahan.id_kelurahan WHERE kehilangan.id_kehilangan='" . $_GET['id'] . "'";
	$query = mysqli_query($conn, $sql);
	$result = mysqli_fetch_array($query);
} else {
	echo "Nomor Transaksi Tidak Terbaca";
	exit;
}
?>
<html>

<head>
</head>

<body>
	<div id="section-to-print">
		<section id="header-kop">
			<div class="container-fluid">
				<table class="table table-borderless">
					<tbody>
						<tr>
							<td class="text-left" width="20%">
								<img src="foto/mansapas.png" alt="logo-dkm" width="70" />
							</td>
							<td class="text-center" width="60%">
								<b>POGAR BANGIL</b> <br>
								Jl. Balai Desa Gelanggang N0.3 Gelanggang Beji Pasuruan<br>
								Telp: (0343) 742690<br>
							<td class="text-right" width="20%">
							</td>
						</tr>
					</tbody>
				</table>
				<hr class="line-top" />
			</div>
		</section>

		<section id="body-of-report">
			<div class="container-fluid">
				<h4 class="text-center">Bukti Transaksi Pembayaran SPP</h4>
				<br />
				<table width="100%">
					<tr>
						<td width="20%"><b>ID. Transaksi</b></td>
						<td width="2%"><b>:</b></td>
						<td width="78%">00<?php echo $result['id_kehilangan']; ?></td>
					</tr>
					<tr>
						<td width="20%"><b>Tanggal</b></td>
						<td width="2%"><b>:</b></td>
						<td width="78%"><?php echo format_tanggal($result['tgl_trx']); ?></td>
					</tr>
					<tr>
						<td width="20%"><b>Nis</b></td>
						<td width="2%"><b>:</b></td>
						<td width="78%"><?php echo $result['nis']; ?></td>
					</tr>
					<tr>
						<td width="20%"><b>Siswa</b></td>
						<td width="2%"><b>:</b></td>
						<td width="78%"><?php echo $result['nama_lengkap']; ?></td>
					</tr>

					<tr>
						<td width="20%"><b>Kelas</b></td>
						<td width="2%"><b>:</b></td>
						<td width="78%"><?php echo $result['nama_kelas']; ?></td>
					</tr>
					<tr>
						<td width="20%"><b>Kasir</b></td>
						<td width="2%"><b>:</b></td>
						<td width="78%"><?php echo $result['nama_kasir']; ?></td>
					</tr>
				</table>
				</br>
				<table class="table table-bordered table-keuangan">
					<thead>
						<tr>
							<th width="1%">No</th>
							<th width="10%">Nama Bulan</th>


							<th width="10%">Dibayar</th>
							<th width="10%">Bulan Dibayarkan</th>
							<th width="10%">Keterangan Bulan</th>
						</tr>
					</thead>
					<tbody>
						<?php
						$i = 1;
						$grand = 0;
						$sqltmp = "SELECT trx.*, siswa.*, kelas.*, tingkatan.*, spp.*, tahun_pelajaran.*, status.*, kasir.* FROM trx, siswa, kelas, tingkatan, spp, tahun_pelajaran, status, kasir WHERE trx.nis=siswa.nis and siswa.id_kelas=kelas.id_kelas and kelas.id_tingkatan=tingkatan.id_tingkatan and tingkatan.id_tingkatan=spp.id_tingkatan and tahun_pelajaran.id_tahun=tingkatan.id_tahun and status.id_status=tahun_pelajaran.id_status and kasir.id_kasir=trx.id_kasir
								AND trx.id_trx='$kode' ORDER BY trx.id_trx ASC";
						$querytmp = mysqli_query($conn, $sqltmp);

						while ($data = mysqli_fetch_array($querytmp)) {
							$ttl = $data['bayar'];
							echo '<tr>';
							echo '<td class="text-center">' . $i . '</td>';
							echo '<td>' . $data['nama_pembayaranspp'] . '</td>';
							echo '<td>' . format_rupiah($ttl) . '</td>';
							echo '<td>' . $data['qty_bulan'] . '</td>';
							echo '<td>' . $data['keterangan_bulan'] . '</td>';
							echo '</tr>';
							$i++;
							$grand += $ttl;
						}
						?>
					</tbody>
					<tfoot>
						<tr>
							<th colspan="4" class="text-center">Total </th>
							<th class="text-right"><?php echo format_rupiah($grand); ?></th>
						</tr>
					</tfoot>
				</table>
				<br />
			</div><!-- /.container -->
		</section>
		<div class="modal-footer">
			<a href="trx_cetak.php?id=<?php echo $kode; ?>" target="_blank" class="btn btn-warning">Cetak</a>
			<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
		</div>
	</div>

</body>

</html>