<script type="text/javascript">
$(document).ready(function() {
    $(function() {
        $("#theList tr:even").addClass("stripe1");
        $("#theList tr:odd").addClass("stripe2");

        $("#theList tr").hover(
            function() {
                $(this).toggleClass("highlight");
            },
            function() {
                $(this).toggleClass("highlight");
            }
        );
    });
	
	$("#print").click(function(){
		var kode = $("#t_tahun").val()+$("#t_bulan").val()+$("#t_kodedep").val();		
		window.location.href='modul/laporan/daftar_gaji.php?kode='+kode;
	});
	
	$("#close").click(function(){
		document.location='?module=home';
	});
});		
</script>

<?php
include '../../inc/inc.koneksi.php';
$kode	= $_GET['kode'];
$hal	= $_GET['hal'] ? $_GET['hal'] : 0;
$lim	= 10;

echo "<table id='theList' width='100%'>
		<tr>
			<th>No.</th>
			<th>Kode</th>
			<th>Nama Karyawan</th>
			<th>Gaji Pokok</th>
			<th>Pros. Hadir</th>
			<th>Terima Prokok</th>
			<th>Tunj. Jabatan</th>
			<th>Insentif</th>
			<th>Transp.</th>
			<th>Pulsa</th>
			<th>Uang Makan</th>
			<th>Lunsum</th>
			<th>Tunj. Lain</th>
			<th>Total Gaji</th>
			<th>Potong. Koperasi</th>
			<th>Potong. DKK</th>
			<th>Potong. DPLK</th>
			<th>Potong. Toko</th>
			<th>Potong. Gardin</th>
			<th>Potong. Lain</th>
			<th>Gaji Bersih</th>
		</tr>";
		$sql = "SELECT * FROM gaji WHERE kode_id='$kode' ORDER BY kode_kar";
				
		$query = mysql_query($sql);
		$jml_data = mysql_num_rows($query);
		$no=1;
		$t_gapok = 0;
		$t_tunjab = 0;
		$t_insen = 0;
		$t_trans = 0;
		$t_pulsa = 0;
		$t_umak= 0;
		$t_lunsum= 0;
		$t_tunlain= 0;
		$t_totgaji = 0;
		$t_potkop = 0;
		$t_potdkk= 0;
		$t_potdplk= 0;
		$t_pottoko= 0;
		$t_potgdid= 0;
		$t_potlain= 0;
		$t_gaber = 0;
		
		while($r_data=mysql_fetch_array($query)){			
			$j_gapok = $r_data[trm_pokok];
			$j_tunjab= $r_data[tunj_jabatan];
			$j_insen = $r_data[insentif];
			$j_trans = $r_data[transport];
			$j_pulsa = $r_data[pulsa];
			$j_umak = $r_data[uang_mkn];
			$j_lunsum = $r_data[lunsum];
			$j_tunlain = $r_data[tunj_lain];
			$j_totgaji = $r_data[total_gaji];
			$j_potkop = $r_data[pot_kop];
			$j_potdkk= $r_data[pot_dkk];
			$j_potdplk= $r_data[pot_dplk];
			$j_pottoko= $r_data[pot_toko];
			$j_potgdid= $r_data[pot_gardin];
			$j_potlain= $r_data[pot_lain];
			$j_gaber = $r_data[gaji_bersih];
			$kode = $r_data[bulan].'.'.$r_data[tahun].'.'.$r_data[kode_kar];
			
			echo "<tr>
					<td>$no</td>
					<td>$r_data[kode_kar]</td>
					<td>$r_data[nama_kar]</td>
					<td align='right'>".number_format($r_data[gaji_pokok],0)."</td>
					<td align='right'>".number_format($r_data[hadir],0)."</td>
					<td align='right'>".number_format($r_data[trm_pokok],0)."</td>
					<td align='right'>".number_format($r_data[tunj_jabatan],0)."</td>
					<td align='right'>".number_format($r_data[insentif],0)."</td>
					<td align='right'>".number_format($r_data[transport],0)."</td>
					<td align='right'>".number_format($r_data[pulsa],0)."</td>
					<td align='right'>".number_format($r_data[uang_mkn],0)."</td>
					<td align='right'>".number_format($r_data[lunsum],0)."</td>
					<td align='right'>".number_format($r_data[tunj_lain],0)."</td>
					<td align='right'>".number_format($r_data[total_gaji],0)."</td>
					<td align='right'>".number_format($r_data[pot_kop],0)."</td>
					<td align='right'>".number_format($r_data[pot_dkk],0)."</td>
					<td align='right'>".number_format($r_data[pot_dplk],0)."</td>
					<td align='right'>".number_format($r_data[pot_toko],0)."</td>
					<td align='right'>".number_format($r_data[pot_gardin],0)."</td>
					<td align='right'>".number_format($r_data[pot_lain],0)."</td>
					<td align='right'>".number_format($r_data[gaji_bersih],0)."</td>
					</tr>";
			$no++;
			$t_gapok=$t_gapok+$j_gapok;
			$t_tunjab=$t_tunjab+$j_tunjab;
			$t_insen=$t_insen+$j_insen;
			$t_trans=$t_trans+$j_trans;
			$t_pulsa=$t_pulsa+$j_pulsa;
			$t_umak=$t_umak+$j_umak;
			$t_lunsum=$t_lunsum+$j_lunsum;
			$t_tunlain=$t_tunlain+$j_tunlain;
			$t_totgaji=$t_totgaji+$j_totgaji;
			$t_potkop=$t_potkop+$j_potkop;
			$t_potdkk=$t_potdkk+$j_potdkk;
			$t_potdplk=$t_potdplk+$j_potdplk;
			$t_pottoko=$t_pottoko+$j_pottoko;
			$t_potgdid=$t_potgdid+$j_potgdid;
			$t_potlain=$t_potlain+$j_potlain;
			$t_gaber=$t_gaber+$j_gaber;
		}
		echo "
		<tr>
			<td><td>
			<td><td>
			<td align='right'>Total</td>
			<td aligh='right'>".number_format($t_gapok,0)."</td>			
			<td align='right'>".number_format($t_tunjab,0)."</td>
			<td align='right'>".number_format($t_insen,0)."</td>
			<td align='right'>".number_format($t_trans,0)."</td>
			<td align='right'>".number_format($t_pulsa,0)."</td>
			<td align='right'>".number_format($t_umak,0)."</td>
			<td align='right'>".number_format($t_lunsum,0)."</td>
			<td align='right'>".number_format($t_tunlain,0)."</td>
			<td align='right'>".number_format($t_totgaji,0)."</td>
			<td align='right'>".number_format($t_potkop,0)."</td>
			<td align='right'>".number_format($t_potdkk,0)."</td>
			<td align='right'>".number_format($t_potdplk,0)."</td>
			<td align='right'>".number_format($t_pottoko,0)."</td>
			<td align='right'>".number_format($t_potgdid,0)."</td>
			<td align='right'>".number_format($t_potlain,0)."</td>
			<td align='right'>".number_format($t_gaber,0)."</td>
		</tr>
		</table>";
		
	echo "<table width='100%'>
		<tr>
			<td>Jumlah Data : $jml_data</td>			
		</tr>
		</table>";
		
	echo "<table>
		<tr>
		<td align='center'>
			<button name='print' id='print'>Cetak</button>
			<button name='close' id='close'>Tutup</button>
		</td>
		</tr>
		</table>";
?>
