<?php ob_start();
error_reporting(0);
require("../../config/koneksi.php");
require("../../config/function.php");
require("../../config/crud.php");

session_start();
if (!isset($_SESSION['id_user'])) {
    die('Anda tidak diijinkan mengakses langsung');
}
 include"fungsi.php";
	  $ids = $_GET['ids'];
 $q1 = mysqli_query($koneksi, "SELECT * FROM trx WHERE idsiswa='$_GET[ids]' ORDER BY idt DESC");
  $bayar = mysqli_fetch_array($q1);

$siswa=fetch($koneksi,'siswa',['id_siswa' =>$ids]);
$bulane=fetch($koneksi,'bulan',['bln' =>$bayar['untuk']]);
$kodes=fetch($koneksi,'m_bayar',['kode' =>$bayar['kode']]);
$ke = mysqli_num_rows(mysqli_query($koneksi, "SELECT * FROM trx WHERE kode='$kodes[kode]' AND idsiswa='$ids' "));
$jbayar = $kodes['besar'] * $ke;
$sisa=$kodes['total_bayar'] - $jbayar;
?>

<!DOCTYPE html>
<html>

<head>
    <meta charset='utf-8'>

    <title>Struk Pembayaran</title>
<link rel="stylesheet" href="../../plugins/bootstrap/dist/css/bootstrap.min.css">


</head>

<body style="font-size: 12px;">

   <center>TANDA BUKTI PEMBAYARAN <?= strtoupper($kodes['nama_pembayaran']) ?></center>
   <center><?= strtoupper($setting['sekolah']) ?> <br> Alamat : <?= $setting['alamat'] ?> Kec. <?= $setting['kecamatan'] ?> Kota/Kab. <?= $setting['kota'] ?></center>
    <img style="z-index: 800;position:absolute;margin-top:-60px;margin-left:25px" class="img" src="../../<?= $setting['logo'] ?>" width="60px">
   <hr>
   <div style="padding-left:20px;margin-right:50px ;" class="col-md-12">
    <table>
	<tbody>
           
               <tr>
                <td width='150px'>No Ref</td>
                <td width='10px'>:</td>
                <td><?= $bayar['bukti'] ?></td>
				<td width='100px'></td>
				<td width='130px'>Tanggal</td>
                <td width='10px'>:</td>
                <td><?= $bayar['tanggal'] ?></td>
				</tr>
				
				<tr>
                <td width='150px'>Nama</td>
                <td width='10px'>:</td>
                <td><?= $siswa['nama'] ?></td>
				<td width='100px'></td>
				<td width='130px'>Kelas</td>
                <td width='10px'>:</td>
                <td><?= $siswa['id_kelas'] ?></td>
				</tr>
				<tr>
                <td width='150px'>Pembayaran</td>
                <td width='10px'>:</td>
                <td><?= $bayar['kode'] ?></td>
				<td width='100px'></td>
				<td width='130px'>Bulan</td>
                <td width='10px'>:</td>
                <td><?= $bulane['ket'] ?></td>
				</tr>
				
				<tr>
                <td width='150px'>Total Pembayaran</td>
                <td width='10px'>:</td>
                <td><b>Rp <?= format_rupiah($kodes['total_bayar']) ?></b></td>
				<td width='100px'></td>
				<td width='130px'>Sisa Pembayaran</td>
                <td width='10px'>:</td>
                <td><b>Rp <?= format_rupiah($sisa) ?></b></td>
				</tr>
				
				<tr>
                <td width='150px'>Nominal Pembayaran</td>
                <td width='10px'>:</td>
                <td><b>Rp <?= format_rupiah($kodes['besar']) ?></b></td>
				<td width='100px'></td>
				<td width='130px'>Pembayaran Ke</td>
                <td width='10px'>:</td>
                <td><?= $ke ?></td>
				</tr>
			</tbody>
    </table>
	 <p><center>Struk ini Merupakan Tanda Bukti Pembayaran Sekolah Yang Sah (Untuk pegangan Siswa/Wali Murid)</center></p>
	</div>
  <hr>
  <br>
   <center>TANDA BUKTI PEMBAYARAN <?= strtoupper($kodes['nama_pembayaran']) ?></center>
   <center><?= strtoupper($setting['sekolah']) ?> <br> Alamat : <?= $setting['alamat'] ?> Kec. <?= $setting['kecamatan'] ?> Kota/Kab. <?= $setting['kota'] ?></center>
    <img style="z-index: 800;position:absolute;margin-top:-60px;margin-left:25px" class="img" src="../../<?= $setting['logo'] ?>" width="60px">
   <hr>
   <div  class="col-md-12">
    <table>
	<tbody>
           
               <tr>
                <td width='150px'>No Ref</td>
                <td width='10px'>:</td>
                <td><?= $bayar['bukti'] ?></td>
				<td width='100px'></td>
				<td width='130px'>Tanggal</td>
                <td width='10px'>:</td>
                <td><?= $bayar['tanggal'] ?></td>
				</tr>
				
				<tr>
                <td width='150px'>Nama</td>
                <td width='10px'>:</td>
                <td><?= $siswa['nama'] ?></td>
				<td width='100px'></td>
				<td width='130px'>Kelas</td>
                <td width='10px'>:</td>
                <td><?= $siswa['id_kelas'] ?></td>
				</tr>
				<tr>
                <td width='150px'>Pembayaran</td>
                <td width='10px'>:</td>
                <td><?= $bayar['kode'] ?></td>
				<td width='100px'></td>
				<td width='130px'>Bulan</td>
                <td width='10px'>:</td>
                <td><?= $bulane['ket'] ?></td>
				</tr>
				
				<tr>
                <td width='150px'>Total Pembayaran</td>
                <td width='10px'>:</td>
                <td><b>Rp <?= format_rupiah($kodes['total_bayar']) ?></b></td>
				<td width='100px'></td>
				<td width='130px'>Sisa Pembayaran</td>
                <td width='10px'>:</td>
                <td><b>Rp <?= format_rupiah($sisa) ?></b></td>
				</tr>
				
				<tr>
                <td width='150px'>Nominal Pembayaran</td>
                <td width='10px'>:</td>
                <td><b>Rp <?= format_rupiah($kodes['besar']) ?></b></td>
				<td width='100px'></td>
				<td width='130px'>Pembayaran Ke</td>
                <td width='10px'>:</td>
                <td><?= $ke ?></td>
				</tr>
			</tbody>
    </table>
	 <p><center>Struk ini Merupakan Tanda Bukti Pembayaran Sekolah Yang Sah (Untuk pegangan Petugas)</center></p>
	</div>
  <hr>
   
</body>
</html>
