<?php if ($ac == '') { ?>
      <?php
	  include"fungsi.php";
	  $id = $_GET['id'];
$tab=fetch($koneksi,'tabungan',['id' => $_GET['id']]);
$penabung=fetch($koneksi,'penabung',['idsiswa' => $tab['idsiswa']]);
$siswa=fetch($koneksi,'siswa',['id_siswa' =>$tab['idsiswa']]);

?>

	  <div class='row'>
        <div class='col-md-12'>
            <div class="card">
             <div class="card-header">	
			 <div class='right'>
				     <button class='btn btn-md btn-flat btn-primary' onclick="frames['frameresult'].print()"><i class='fa fa-print'></i> Cetak</button>
		  </div>
            <h5 class='box-title'><i class="fas fa-credit-card"></i> Detail Tabungan <?= $siswa['nama'] ?></h5>
                    </div>
           
           <div class='box-body'>
                    <center><h4>STRUK TABUNGAN SEKOLAH</h4></center>
   <center></center>
   <hr>
   <div style="padding-left:20px;margin-right:50px ;" class="col-md-12">
    <table>
	<tbody>
           
                <tr>
                <td width='100px'>ID</td>
                <td width='10px'>:</td>
                <td><?= $penabung['id_tab'] ?></td>
				<td width='400px'></td>
				<td width='100px'>Tanggal</td>
                <td width='10px'>:</td>
                <td><?= $tab['tanggal'] ?></td>
				</tr>
				
				<tr>
                <td width='100px'>Nama</td>
                <td width='10px'>:</td>
                <td><?= $siswa['nama'] ?></td>
				<td width='400px'></td>
				<td width='100px'>Reff</td>
                <td width='10px'>:</td>
                <td><?= $tab['bukti'] ?></td>
				</tr>
				<tr>
                <td width='100px'>Debet</td>
                <td width='10px'>:</td>
                <td>Rp <?= format_rupiah($tab['setoran']) ?></td>
				<td width='400px'></td>
				<td width='100px'>Kredit</td>
                <td width='10px'>:</td>
                <td>Rp <?= format_rupiah($tab['penarikan']) ?></td>
				</tr>
				
				<tr>
                <td width='100px'>Saldo</td>
                <td width='10px'>:</td>
                <td><b>Rp <?= format_rupiah($tab['saldo']) ?></b></td>
				<td width='400px'></td>
				<td width='100px'></td>
                <td width='10px'></td>
                <td></td>
				</tr>
			</tbody>
    </table>
	 <p><center>Struk ini merupaka tanda bukti menabung/penarikan tabungan sekolah yang sah</center></p>
	</div>
  <hr>
                </div>
            </div>
        </div>
    	<iframe id='loadframe' name='frameresult' src='sandik_tabungan/cetaktab.php?id=<?= $id ?>' style='display:none'></iframe>
 
 <?php } elseif ($ac == 'struk') { ?>
       <?php
	   include"fungsi.php";
		   $idsiswa=$_GET['idsiswa'];
		   $tanggal=date('Y-m-d');
		   $tabungan=fetch($koneksi,'tabungan',['idsiswa'=>$idsiswa,'tanggal'=>$tanggal,'ket'=>'Setor']);
		  $penabung=fetch($koneksi,'penabung',['idsiswa' => $tabungan['idsiswa']]);
          $siswa=fetch($koneksi,'siswa',['id_siswa' =>$tabungan['idsiswa']]);

?>

	  <div class='row'>
        <div class='col-md-12'>
            <div class='box box-solid'>
                <div class='box-header with-border '>
                    <h3 class='box-title'><i class="fas fa-credit-card"></i> Detail Tabungan <?= $siswa['nama'] ?></h3>
                    <div class='box-tools pull-right'>
				     <button class='btn btn-md btn-flat btn-primary' onclick="frames['frameresultQ'].print()"><i class='fa fa-print'></i> Cetak</button>
                    <a href="?pg=setoran&ac=kirimwa&idsiswa=<?= $idsiswa ?>" class='btn btn-md bg-maroon' title='Batal'><i class='fa fa-times'></i></a>
		  </div>
         </div>
           
           <div class='box-body'>
                    <center><h3>STRUK TABUNGAN SEKOLAH</h3></center>
   <center></center>
   <hr>
   <div style="padding-left:20px;margin-right:50px ;" class="col-md-12">
    <table>
	<tbody>
           
                <tr>
                <td width='100px'>ID</td>
                <td width='10px'>:</td>
                <td><?= $penabung['id_tab'] ?></td>
				<td width='400px'></td>
				<td width='100px'>Tanggal</td>
                <td width='10px'>:</td>
                <td><?= $tabungan['tanggal'] ?></td>
				</tr>
				
				<tr>
                <td width='100px'>Nama</td>
                <td width='10px'>:</td>
                <td><?= $siswa['nama'] ?></td>
				<td width='400px'></td>
				<td width='100px'>Reff</td>
                <td width='10px'>:</td>
                <td><?= $tabungan['bukti'] ?></td>
				</tr>
				<tr>
                <td width='100px'>Debet</td>
                <td width='10px'>:</td>
                <td>Rp <?= format_rupiah($tabungan['setoran']) ?></td>
				<td width='400px'></td>
				<td width='100px'>Kredit</td>
                <td width='10px'>:</td>
                <td>Rp <?= format_rupiah($tabungan['penarikan']) ?></td>
				</tr>
				
				<tr>
                <td width='100px'>Saldo</td>
                <td width='10px'>:</td>
                <td><b>Rp <?= format_rupiah($tabungan['saldo']) ?></b></td>
				<td width='400px'></td>
				<td width='100px'></td>
                <td width='10px'></td>
                <td></td>
				</tr>
			</tbody>
    </table>
	 <p><center>Struk ini merupaka tanda bukti menabung/penarikan tabungan sekolah yang sah</center></p>
	</div>
  <hr>
                </div>
            </div>
        </div>
    	<iframe id='loadframe' name='frameresultQ' src="m_tabungan/cetakstruk.php?idsiswa=<?= $_GET['idsiswa'] ?>" style='display:none'></iframe>
		
		<?php } elseif ($ac == 'struktarik') { ?>
       <?php
	   include"fungsi.php";
		   $idsiswa=$_GET['idsiswa'];
		   $tanggal=date('Y-m-d');
		   $tabungan=fetch($koneksi,'tabungan',['idsiswa'=>$idsiswa,'tanggal'=>$tanggal,'ket'=>'Tarik']);
		  $penabung=fetch($koneksi,'penabung',['idsiswa' => $tabungan['idsiswa']]);
          $siswa=fetch($koneksi,'siswa',['id_siswa' =>$tabungan['idsiswa']]);

?>

	  <div class='row'>
        <div class='col-md-12'>
            <div class='box box-solid'>
                <div class='box-header with-border '>
                    <h3 class='box-title'><i class="fas fa-credit-card"></i> Detail Tabungan <?= $siswa['nama'] ?></h3>
                    <div class='box-tools pull-right'>
				     <button class='btn btn-md btn-flat btn-primary' onclick="frames['frameresultP'].print()"><i class='fa fa-print'></i> Cetak</button>
                    <a href="?pg=penarikan&ac=kirimwa&idsiswa=<?= $idsiswa ?>" class='btn btn-md bg-maroon' title='Batal'><i class='fa fa-times'></i></a>
		  </div>
         </div>
           
           <div class='box-body'>
                    <center><h3>STRUK TABUNGAN SEKOLAH</h3></center>
   <center></center>
   <hr>
   <div style="padding-left:20px;margin-right:50px ;" class="col-md-12">
    <table>
	<tbody>
           
                <tr>
                <td width='100px'>ID</td>
                <td width='10px'>:</td>
                <td><?= $penabung['id_tab'] ?></td>
				<td width='400px'></td>
				<td width='100px'>Tanggal</td>
                <td width='10px'>:</td>
                <td><?= $tabungan['tanggal'] ?></td>
				</tr>
				
				<tr>
                <td width='100px'>Nama</td>
                <td width='10px'>:</td>
                <td><?= $siswa['nama'] ?></td>
				<td width='400px'></td>
				<td width='100px'>Reff</td>
                <td width='10px'>:</td>
                <td><?= $tabungan['bukti'] ?></td>
				</tr>
				<tr>
                <td width='100px'>Debet</td>
                <td width='10px'>:</td>
                <td>Rp <?= format_rupiah($tabungan['setoran']) ?></td>
				<td width='400px'></td>
				<td width='100px'>Kredit</td>
                <td width='10px'>:</td>
                <td>Rp <?= format_rupiah($tabungan['penarikan']) ?></td>
				</tr>
				
				<tr>
                <td width='100px'>Saldo</td>
                <td width='10px'>:</td>
                <td><b>Rp <?= format_rupiah($tabungan['saldo']) ?></b></td>
				<td width='400px'></td>
				<td width='100px'></td>
                <td width='10px'></td>
                <td></td>
				</tr>
			</tbody>
    </table>
	 <p><center>Struk ini merupaka tanda bukti menabung/penarikan tabungan sekolah yang sah</center></p>
	</div>
  <hr>
                </div>
            </div>
        </div>
    	<iframe id='loadframe' name='frameresultP' src="sandik_tabungan/cetakstruktarik.php?idsiswa=<?= $_GET['idsiswa'] ?>" style='display:none'></iframe>
 <?php } ?>