<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");
            }
        );
    });
});
</script>

<?php
include '../../inc/inc.koneksi.php';

$bulan= $_GET['bulan'];
$tahun= $_GET['tahun'];
$nik1 = $_GET['nik1'];
$nik2 = $_GET['nik2'];

echo "<table id='theList' width='100%'>
		<tr>
			<th>NIK</th>
			<th>Nama Karyawan</th>
			<th>Jabatan</th>
			<th>Sakit</th>
			<th>Ijin</th>
			<th>Alpa</th>
			<th>Gaji Pokok</th>
			<th>Uang Makan</th>
			<th>Tunj. BPJS</th>
			<th>Tunj. Jabatan</th>
			<th>Tunj. Lain</th>
			<th>Jumlah TL</th>
			<th>Total Gaji</th>
			<th>Potong. Absen</th>
			<th>UM Gaji</th>
			<th>Angsuran</th>
			<th>Potong. BPJS</th>
			<th>Potong. PPh 21</th>
			<th>Potong. Lain</th>
			<th>Jumlah PL</th>
			<th>Gaji Bersih</th>
		</tr>";
		
		if(!($nik2==''))
			$sql = "SELECT * FROM gaji WHERE bulan='$bulan' AND tahun='$tahun' AND nik BETWEEN '$nik1' AND '$nik2' ORDER BY kode_gj";
		else
			$sql = "SELECT * FROM gaji WHERE bulan='$bulan' AND tahun='$tahun' ORDER BY kode_gj";
				
		$query = mysql_query($sql);
		$no=0;
		$t_gapok  = 0;
		$t_tunmak = 0;
		$t_tunjab = 0;
		$t_tunbpjs= 0;
		$t_tunpph = 0;
		$t_tunlain= 0;		
		$t_totgaji= 0;
				
		$t_potabs = 0;
		$t_umgaji = 0;
		$t_angsur = 0;
		$t_potbpjs= 0;
		$t_potpph = 0;
		$t_potlain= 0;
		$t_gaber  = 0;
		
		while($r_data=mysql_fetch_array($query)){
			
			echo "<tr>					
					<td>$r_data[nik]</td>
					<td>$r_data[nama]</td>
					<td>$r_data[jabatan]</td>
					<td align='center'>$r_data[sakit]</td>
					<td align='center'>$r_data[ijin]</td>
					<td align='center'>$r_data[alpa]</td>
					<td align='right'>".number_format($r_data[gapok],0)."</td>
					<td align='right'>".number_format($r_data[tunj_mak],0)."</td>
					<td align='right'>".number_format($r_data[tunj_bpjs],0)."</td>
					<td align='right'>".number_format($r_data[tunj_jab],0)."</td>
					<td>$r_data[nama_tl]</td>
					<td align='right'>".number_format($r_data[jumlah_tl],0)."</td>
					<td align='right'>".number_format($r_data[tot_gaji],0)."</td>
					<td align='right'>".number_format($r_data[pot_absen],0)."</td>
					<td align='right'>".number_format($r_data[um_gaji],0)."</td>
					<td align='right'>".number_format($r_data[angsuran],0)."</td>
					<td align='right'>".number_format($r_data[pot_bpjs],0)."</td>
					<td align='right'>".number_format($r_data[pot_pph21],0)."</td>
					<td>$r_data[nama_pl]</td>
					<td align='right'>".number_format($r_data[jumlah_pl],0)."</td>
					<td align='right'>".number_format($r_data[gaber],0)."</td>
				</tr>";
			$no++;
			$t_gapok  =$t_gapok+$r_data[gapok];
			$t_tunmak =$t_tunmak+$r_data[tunj_mak];
			$t_tunbpjs=$t_tunbpjs+$r_data[tunj_bpjs];
			$t_tunjab =$t_tunjab+$r_data[tunj_jab];
			$t_tunlain=$t_tunlain+$r_data[jumlah_tl];
			$t_totgaji=$t_totgaji+$r_data[tot_gaji];
			$t_potabs =$t_potabs+$r_data[pot_absen];
			$t_umgaji =$t_umgaji+$r_data[um_gaji];
			$t_angsur =$t_angsur+$r_data[angsuran];
			$t_potbpjs=$t_potbpjs+$r_data[pot_bpjs];
			$t_potpph =$t_potpph+$r_data[pot_pph21];
			$t_potlain=$t_potlain+$r_data[jumlah_pl];
			$t_gaber  =$t_gaber+$r_data[gaber];
		}
		echo "<tr>
			<td></td>
			<td></td>
			<td></td>
			<td></td>
			<td></td>
			<td align='right'>Total</td>
			<td aligh='right'>".number_format($t_gapok,0)."</td>
			<td align='right'>".number_format($t_tunmak,0)."</td>
			<td align='right'>".number_format($t_tunbpjs,0)."</td>
			<td align='right'>".number_format($t_tunjab,0)."</td>
			<td></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_potabs,0)."</td>
			<td align='right'>".number_format($t_umgaji,0)."</td>
			<td align='right'>".number_format($t_angsur,0)."</td>
			<td align='right'>".number_format($t_potbpjs,0)."</td>
			<td align='right'>".number_format($t_potpph,0)."</td>
			<td></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 : $no</td>
		</tr>
		</table>";
?>
