

<!DOCTYPE html>
<html>
<head>
  <title>Cetak Karyawan</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 
  include '../koneksi.php';

    include 'fungsi_bln_indo.php';
    include 'fungsi_tgl_indo.php';
    include 'fungsi_penyebut.php' ;

              $bln = $_GET['bln'];
              $thn = $_GET['thn'];
              
    $tgl=date('Y-m-d') ;  
    
    $bln_indo=$bulan[$bln];
    $tgl_indo=tgl_indo($tgl);
    
        $sql2 = mysqli_query($koneksi, "SELECT kota,admin,gambar FROM kdkanca WHERE kd='01'");
        list($kota,$admin,$gambar) = mysqli_fetch_array($sql2);

      $sql12 = mysqli_query($koneksi, "SELECT tgl AS tgl_bon FROM bon ORDER BY tgl DESC ");
      list($tgl_bon) = mysqli_fetch_array($sql12);       
  ?>  
<!DOCTYPE html PUBLIC "-//W3C//DTD       XHTML       1.0       Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /><title>Untitled Document</title></head><body><img src="../gambar/<?php echo $gambar; ?>"></a><div align="center"></div>
  <center>
    <h5>DAFTAR KARYAWAN DAN PENGELUARAN BIAYA</h5>
  </center>
    <table class="">
      <tr>
        <td width="30%">Biaya Selama Bulan</td>
        <td width="1%">:</td>
        <td><?php echo $bln_indo ; ?>-<?php echo $thn ; ?></td>
      </tr>
      <tr>
        <td width="30%">Bon s/d tanggal</td>
        <td width="1%">:</td>
        <td><?php echo date('d-m-Y', strtotime($tgl_bon)); ?></td>
      </tr>      
    </table>
	<table border="1" width="100%" style="border-collapse:collapse;" align="center">
    	<tr class="tableheader">
                    <tr class="tr-title">
                    <tr>
                        <th Style="text-align:center" rowspan="1" colspan="3" bgcolor="#DCDCDC">KETERANGAN</th>
                        <th Style="text-align:center" colspan="4" bgcolor="#DCDCDC">B  I  A  Y  A</th>
                        <th width="10%" Style="text-align:center" rowspan="2">BON</th>
                    </tr>                         
                    <tr>
                      <th width="5%" class="text-center">No.</th>
                      <th width="15%" class="text-center">Nama</th>
                      <th width="20%" class="text-center">Jabatan</th>
                      <th width="10%" class="text-center">Gaji</th>
                      <th width="10%" class="text-center">Transport</th>
                      <th width="10%" class="text-center">Perawatan</th>
                      <th width="10%" class="text-center">TOTAL</th>
                      
                    </tr>            
                </thead>
                <tbody>
<!--				///////////////////  kode 1 - MULAI //////////////////////      -->   
            <?php 
            $no=1;
            $data = mysqli_query($koneksi,"SELECT * FROM karyawan WHERE hapus<>'HAPUS' ORDER BY id ASC");
            while($d = mysqli_fetch_array($data)){
                $tkdr=$d['id'];
                
                  $sql2 = mysqli_query($koneksi, "SELECT sum(jumlah) AS t_bon FROM bon WHERE id_kary='$tkdr'");
                      list($t_bon) = mysqli_fetch_array($sql2); 
                  $sql3 = mysqli_query($koneksi, "SELECT sum(jumlah) AS t_gaji FROM gaji WHERE id_kary='$tkdr' and month(tgl)='$bln' and year(tgl)='$thn' ");
                      list($t_gaji) = mysqli_fetch_array($sql3);                       
                  $sql4 = mysqli_query($koneksi, "SELECT sum(jumlah) AS t_tran FROM transport WHERE kdr='$tkdr' and month(tgl)='$bln' and year(tgl)='$thn' ");
                      list($t_tran) = mysqli_fetch_array($sql4);                       
                  $sql5 = mysqli_query($koneksi, "SELECT sum(jumlah) AS t_rawat FROM perawatan WHERE kdr='$tkdr' and month(tgl)='$bln' and year(tgl)='$thn' ");
                      list($t_rawat) = mysqli_fetch_array($sql5);  
                  $total=($t_gaji+$t_tran+$t_rawat)  
              ?>
              <tr>
                <td align='center'><?php echo $no++; ?></td>
                <td><?php echo $d['nama']; ?></td>
                <td align='left'><?php echo $d['jabatan']; ?></td>
                <td align='right'><?php echo "" . number_format("$t_gaji", 0, ",", "."); ?></td>
                <td align='right'><?php echo "" . number_format("$t_tran", 0, ",", "."); ?></td>
                <td align='right'><?php echo "" . number_format("$t_rawat", 0, ",", "."); ?></td>
                <td align='right'><?php echo "" . number_format("$total", 0, ",", "."); ?></td>
                <td align='right'><?php echo "" . number_format("$t_bon", 0, ",", "."); ?></td>
              </tr>
              <?php 
            }
            ?>
          </tbody>
                        <?php 
                  $sql2 = mysqli_query($koneksi, "SELECT sum(jumlah) AS t_bon FROM bon ");
                      list($t_bon) = mysqli_fetch_array($sql2); 
                  $sql3 = mysqli_query($koneksi, "SELECT sum(jumlah) AS t_gaji FROM gaji WHERE month(tgl)='$bln' and year(tgl)='$thn' ");
                      list($t_gaji) = mysqli_fetch_array($sql3);                       
                  $sql4 = mysqli_query($koneksi, "SELECT sum(jumlah) AS t_tran FROM transport WHERE month(tgl)='$bln' and year(tgl)='$thn' ");
                      list($t_tran) = mysqli_fetch_array($sql4);                       
                  $sql5 = mysqli_query($koneksi, "SELECT sum(jumlah) AS t_rawat FROM perawatan WHERE month(tgl)='$bln' and year(tgl)='$thn' ");
                      list($t_rawat) = mysqli_fetch_array($sql5);  
                  $total2=($t_gaji+$t_tran+$t_rawat) ; 
                  
                  $terbilang=ucwords(penyebut($total2)); 
                  $terbilang_2=ucwords(penyebut($t_bon)); 
            	        ?>						
							<tr>
						    	<td colspan="3" style="font-weight: bold;text-align: center;">Total Biaya & Sisa Bon</td>																																									
		                        <td align='right'><style="font-weight: bold;"><?php echo "" . number_format("$t_gaji", 0, ",", "."); ?> </td>
								<td align='right'><style="font-weight: bold;"><?php echo "" . number_format("$t_tran", 0, ",", "."); ?> </td>
		                        <td align='right'><style="font-weight: bold;"><?php echo "" . number_format("$t_rawat", 0, ",", "."); ?> </td>
								<td align='right'><style="font-weight: bold;"><?php echo "" . number_format("$total2", 0, ",", "."); ?> </td>	
								<td align='right'><style="font-weight: bold;"><?php echo "" . number_format("$t_bon", 0, ",", "."); ?> </td>	
							</tr>           
          
							<tr>
						    	<td colspan="8" style="text-align: center;"><i>Terbilang Biaya : <?php echo $terbilang; ?> Rupiah saja</i></td>		 </td>																																									
							</tr>
							<tr>
						    	<td colspan="8" style="text-align: center;"><i>Terbilang Bon : <?php echo $terbilang_2; ?> Rupiah saja</i></td>		 </td>																																									
							</tr>							
          </table>

     

            <hr size="1px">                 

            <div>
                <?php echo $kota ; ?>, <?php echo $tgl_indo ; ?>
            </div>
            <div>
                Bag. Administrasi,
            </div>
                </p>
                <br />
                <br />
                <p>            
            <div>
                <?php
                echo $admin;
                ?>
            </div>
            
              </div>

    </h5>

</body>

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