<script type="text/javascript">
    $(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';
include '../../inc/fungsi_tanggal.php';

$kode	= $_GET['kode'];

$hal	= $_GET['hal'] ? $_GET['hal'] : 0;
$lim	= 15;

echo "<div id='info'>	
		<table id='theList' width='100%'>
		<tr>
			<th>No.</th>
			<th>NIK</th>
			<th>Nama Karyawan</th>
			<th>Kode Fas.</th>
			<th>Nama Fasilitas</th>
			<th>Tanggal</th>
			<th>Penambahan</th>
			<th>Diambil</th>
			<th>Sisa</th>
		</tr>";
			
		$sql = "SELECT * FROM tambah_fas WHERE kode_dep='$kode' AND jumlah_amb<jumlah ORDER BY kode_tf LIMIT $hal,$lim";		
		$query = mysql_query($sql);
		
		$no=1+$hal;
		while($r_data=mysql_fetch_array($query)){
			$sisa=$r_data[jumlah]-$r_data[jumlah_amb];
			
			echo "<tr>
				<td align='center'>$no</td>
				<td align='center'>$r_data[kode_kar]</td>
				<td>$r_data[nama_kar]</td>
				<td align='center'>$r_data[kode_fas]</td>
				<td>$r_data[nama_fas]</td>
				<td align='center'>".jin_date_str($r_data[tanggal])."</td>
				<td align='center'>$r_data[jumlah]</td>
				<td align='center'>$r_data[jumlah_amb]</td>
				<td align='center'>$sisa</td>	
				</tr>";
			$no++;			
		}
		
	echo "</table>";
	echo "<table width='100%'>
		<tr>			
		<td align='right'>Halaman :";
			for ($h = 1; $h <= $max; $h++) {
					$list[$h] = $lim * $h - $lim;
					echo " <a href='javascript:void(0)' ";?> 
                    onClick="$.get('modul/report/tampil_data_df.php?kode1=<?php echo $_GET['kode'];?>                    
                    &hal=<?php echo $list[$h]; ?>', 
                    null, function(data) {$('#info').html(data);})" <?php echo">".$h."</a> ";
			}
	echo "</td>
		</tr>
		</table>";
	echo "</div>";
?>
