<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	= 10;
$jml = 0;

echo "<div id='info'>	
		<table id='theList' width='100%'>
		<tr>
			<th>No.</th>
			<th>Kode Inv.</th>
			<th>Nama Inventaris</th>
			<th>Jumlah Jatah</th>
			<th>Jumlah Ambil</th>
			<th>Tgl.Pengambilan</th>
			<th>Jumlah Sisa</th>
		</tr>";
		
		$query2	= "SELECT * FROM data_fas WHERE kode_dep='$kode' GROUP BY kode_kar";
		$data2	= mysql_query($query2);
		while($r_data2=mysql_fetch_array($data2)){

	echo "<tr>			
			<td><b>$r_data2[kode_kar]</b></td>
			<td><b> - </b></td>
			<td><b>$r_data2[nama_kar]</b></td>
		</tr>";
			
		$sql = "SELECT * FROM data_fas WHERE kode_dep='$kode' ORDER BY kode_kar LIMIT $hal,$lim";		
		$query = mysql_query($sql);
		
		$no=1+$hal;
		while($r_data=mysql_fetch_array($query)){
			$sisa=$r_data[jatah]-$r_data[jumlah];
			echo "<tr>
				<td align='center'>$no</td>
				<td align='center'>$r_data[kode_fas]</td>
				<td>$r_data[nama_fas]</td>
				<td align='center'>$r_data[jatah]</td>
				<td align='center'>$r_data[jumlah]</td>
				<td align='center'>".jin_date_str($r_data[tanggal_amb])."</td>
				<td align='center'>$sisa</td>
				</tr>";
			$no++;
			$jml++;
		}
	}
	
	echo "</table>";
	echo "<table width='100%'>
		<tr>
			<td>Jumlah Data : $jml</td>
			<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>";
?>
