
<!DOCTYPE html>
<html>
<head>
  <title>Cetak Transaksi Donasi</title>
</head>
<body>

  <style type="text/css">
    body{
      font-family: arial;
    }

    .table{
      width: 100%;
    }

    th,td{
    }
    .table,
    .table th,
    .table td {
      padding: 5px;
      border: 1px solid black;
      border-collapse: collapse;
    }
  </style>
  <?php 
    session_start();
    include '../koneksi.php';
    include '../fungsi_indotgl.php';
    include 'fungsi_penyebut.php' ;
    //include 'header.php'; 

    $kdc        =$_SESSION['kdc'];
    $tgambar    =$_SESSION['logo_kop'];

    $tgl_ini=date('d-m-Y') ;
    $tgl_ini2=date('Y-m-d') ; 
    
    $oleh=$_SESSION['id_kar'];
    $tgl_indo=tgl_indo($tgl_ini2);

        $sql2 = mysqli_query($koneksi, "SELECT kota,keuangan,gambar FROM kdkanca WHERE kd='$kdc'");
        list($kota,$keuangan,$gambar) = mysqli_fetch_array($sql2);
        $jabatan='Petugas';
        
        $kary = mysqli_query($koneksi,"select * from karyawan where id='$oleh' ");
        $k = mysqli_fetch_assoc($kary);   
        
    $nawal = mysqli_query($koneksi,"select * from nawal where noperk='$t[kdj]'");
        $n = mysqli_fetch_assoc($nawal);    
    $perk = str_replace('Pend. ', '', $n['perk']);  
    
    $terbilang = terbilang($t['masuk']);
    ?>  
    
<div>
  <img src="../gambar/<?php echo $gambar ?>" style="width: 400px; height: auto;">
</div>    
   

	<table border="0" width="100%" style="border-collapse:collapse;" align="center">
    	<tr class="tableheader">
            <tr class="tr-title">
              <thead>
                <tr>
                    <th Style="text-align:center" colspan="4" >Daftar Penerimaan Donasi</th>
                </tr>  
                <tr>
                    <th Style="text-align:center" colspan="4" >Tanggal : <?php echo $tgl_indo ;?> </th>
                </tr> 
                <tr>
                    <th Style="text-align:center" colspan="4" >Petugas : <?php echo $k[nama] ; ?> </th>
                </tr>                 
                <tr>
                    <th style="border-top: 2px solid black; border-bottom: 1px solid black; border-right: 1px solid white; text-align:center" colspan="3" bgcolor="#B0C4DE">Keterangan</th>
                    <th style="border-top: 2px solid black; border-bottom: 1px solid black; border-right: 0px solid white; text-align:center" colspan="1" bgcolor="#B0C4DE">Jumlah </th>
                </tr>
              </thead> 
          <tbody>
            <?php 
            $no=1;
            $nol=0;
            //
            $data = mysqli_query($koneksi,"SELECT * FROM anggota_trans_ao WHERE tanggal='$tgl_ini2' and ao='$oleh' and hapus<>'HAPUS' order by id DESC");
            while($t = mysqli_fetch_array($data)){
                $noang  =$t['angg_no'] ;
                $anggota = mysqli_query($koneksi,"select * from anggota where angg_no='$noang'");
                $a = mysqli_fetch_assoc($anggota);
            ?>	
              <tr>
                <td  style="text-align:center; font-size: 9pt; font-weight:normal;"><?php echo $no++; ?></td>
                <td style="text-align:left; font-size: 10pt; font-weight:normal;"><?php echo $a['nama']; ?></td>
                <td style="text-align:left; font-size: 9pt; font-weight:normal;"><?php echo $a['alamat']; ?> <?php echo $a['rt']; ?> <?php echo $a['rw']; ?></td>
                <td>
                    
                    
                </td> 
            <?php 
            $no=1;
            $nol=0;
            //
            $data = mysqli_query($koneksi,"SELECT * FROM anggota_trans_ao WHERE tanggal='$tgl_ini2' and ao='$oleh' and hapus<>'HAPUS' order by id DESC");
            while($t = mysqli_fetch_array($data)){
                $noang  =$t['angg_no'] ;
                $anggota = mysqli_query($koneksi,"select * from anggota where angg_no='$noang'");
                $a = mysqli_fetch_assoc($anggota);
            ?>	
              <tr>
                <td  style="text-align:center; font-size: 9pt; font-weight:normal;"><?php echo $no++; ?></td>
                <td style="text-align:left; font-size: 10pt; font-weight:normal;"><?php echo $a['nama']; ?></td>
                <td style="text-align:left; font-size: 9pt; font-weight:normal;"><?php echo $a['alamat']; ?> <?php echo $a['rt']; ?> <?php echo $a['rw']; ?></td>
                <td>
                    
                    
                </td>                 
              <?php } ?>                
                
              </tr>
              <?php } ?>
          </tbody>
							<tr>
						    	<td colspan="4" style="border-top: 1px solid black; border-bottom: 1px solid black; border-right: 4px solid white; text-align:center;"></td>
							</tr>                  
          
                <?php 
                    $sql_2 = mysqli_query($koneksi, "SELECT sum(masuk-keluar) AS tsaldo2 FROM anggota_trans_ao WHERE tanggal='$tgl_ini2' and ao='$oleh' and hapus<>'HAPUS' ");
                    list($tsaldo2) = mysqli_fetch_array($sql_2);
                    
                    $terbilang = terbilang($tsaldo2);
            	?>	
							<tr>
						    	<td colspan="3" style="font-weight: bold;text-align: center;">Total </td>																																									
								<td align='right'><style="font-weight: bold;">
								    <?php echo "" . number_format("$tsaldo2", 0, ",", "."); ?>
								</td>
							</tr>  
 							<tr>
						    	<td colspan="4" style="border-top: 1px solid black; border-bottom: 1px solid black; border-right: 4px solid white; text-align:left;">R E K A P   :</td>
							</tr>      
    <tbody>
      <?php 
      $ao=$_SESSION['id_kar'] ;
      $no = 1; 
      $naw = mysqli_query($koneksi,"SELECT * FROM nawal WHERE kt='D' ORDER BY noperk ASC"); 
      while($n = mysqli_fetch_array($naw)){ 
        $noperk=$n['noperk'] ; 
        
        $perk = str_replace('Pend. ', '', $n['perk']);
        $perk = htmlspecialchars($perk, ENT_QUOTES);
        
        $jor = mysqli_query($koneksi,"select sum(masuk-keluar) AS tsaldo from anggota_trans_ao where kdj='$noperk' and tanggal='$tgl_ini2' and ao='$ao' and hapus<>'HAPUS' "); 
        $j = mysqli_fetch_assoc($jor); 
      ?>
      <tr style="background-color: transparent;">
        <td style="text-align:center; font-size: 10pt; font-weight:bold; background-color: transparent;"><?php echo $no++; ?></td>
        <td style="text-align:left; font-size: 10pt; font-weight:bold; background-color: transparent;"><?php echo $perk; ?></td>
        <td style="text-align:right; font-size: 10pt; font-weight:bold; background-color: transparent;"><?php echo "  " . number_format("$j[tsaldo]", 0, ",", "."); ?></td>
        <td>
            <a data-toggle='tooltip' data-placement='top' title='Tambah Trans <?php echo $perk; ?> ' class="btn btn-success btn-sm" href="tugas_trans_jenis_tgl_sd_tgl.php?kdj=<?php echo $n['noperk'] ?>"><i class="bi bi-plus-lg"></i></a>
        </td>
      </tr>
      <?php } ?>
    </tbody>
    
							
 							<tr>
						    	<td colspan="4" style="border-top: 1px solid black; border-bottom: 1px solid black; border-right: 4px solid white; text-align:center;"><?php echo $terbilang ?> </td>
							</tr>         
							
 							<tr>
						    	<td colspan="4" style="border-top: 1px solid black; border-bottom: 1px solid black; border-right: 4px solid white; text-align:center;"></td>
							</tr>                           
          
          
          
          
          
          
          
          
          
          
          
        </table>
        
            <br />
            <div>
                <?php echo $kota ; ?>, <?php echo $tgl_indo ; ?>
            </div>
            <div>
                <?php
                echo $jabatan;
                ?>
            </div>
                <p>
                <br />
                <br />
                </p>            
            <div>
                <?php echo $k[nama] ; ?>
            </div>
            
              </div>

    </h5>

</body>

    <script>
		window.load = print_d();
		function print_d(){
			window.print();
		}
	</script>
</html>