      <?php
	  include"fungsi.php";
	
 $q1 = mysqli_query($koneksi, "SELECT * FROM trx  ORDER BY idt DESC LIMIT 1");
  $bayar = mysqli_fetch_array($q1);
$ids=$bayar['idsiswa'];
$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;
?>

	  <div class='row'>
         <div class='col-md-12'>
            <div class="card">
             <div class="card-header">									
                  <h5 class="card-title"><i class="fas fa-bars"></i> <?= $siswa['nama'] ?></h5>
                </div>
				
			  
				 <div class='card-body'>
                    <div class='right'>
				     <button class='btn  btn-primary' onclick="frames['frameresult'].print()"><i class='fa fa-print'></i> Cetak</button>
                    <a href="?pg=transaksi" class='btn  btn-outline-danger'><i class='fa fa-times-circle'></i></a>
		  </div>
        
                    <center><h3>TANDA BUKTI PEMBAYARAN</h3></center>
  
   <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='250px'></td>
				<td width='150px'>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='250px'></td>
				<td width='150px'>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='250px'></td>
				<td width='150px'>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='250px'></td>
				<td width='150px'>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='250px'></td>
				<td width='150px'>Pembayaran Ke</td>
                <td width='10px'>:</td>
                <td><?= $ke ?></td>
				</tr>
			</tbody>
    </table>
	 <p><center>Struk ini Merupakan Tanda Bukti Pembayaran Sekolah Yang Sah</center></p>
	</div>
  <hr>
                </div>
            </div>
        </div>
    	<iframe id='loadframe' name='frameresult' src="sandik_bayar/cetakbayar.php?ids=<?= $ids ?>" style='display:none'></iframe>
 