<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';

$tgl_awal = $_GET['tgl_awal'];
$tgl_akhir= $_GET['tgl_akhir'];
$user = $_GET['user'];

echo "<div id='info'>	
	<table id='theList' width='100%'>
	<tr>
		<th>No.</th>
		<th>Kode Barang</th>
		<th>Nama Barang</th>
		<th>Part Number</th>
		<th>Satuan</th>
		<th>Jumlah Unit</th>		
		<th>Total Harga</th>
	</tr>";
		
	$query	= "SELECT kode_st,nama_st,satuan,sum(jml_unit) as totunit,sum(jumlah) as totjumlah FROM faktur_pj 
		WHERE tanggal BETWEEN '$tgl_awal' AND '$tgl_akhir' AND user='$user' AND batal='' GROUP BY kode_st ";
	$data	= mysql_query($query);
	$no=1+$hal;
	$total=0;
	
	while($r_data=mysql_fetch_array($data)){
		echo "<tr>
			<td align='center'>$no</td>
			<td align='center'>$r_data[kode_st]</td>
			<td>$r_data[nama_st]</td>
			<td>$r_data[part_num]</td>
			<td align='center'>$r_data[satuan]</td>
			<td align='right'>$r_data[totunit]</td>			
			<td align='right'>".number_format($r_data[totjumlah])."</td>
			</tr>";
		$total=$total+$r_data[totjumlah];
		$no++;
	}
	
	echo "<tr>
			<td></td>
			<td></td>
			<td></td>			
			<td></td>
			<td></td>
			<td align='right'>Total</td>
			<td align='right'>".number_format($total)."</td>
		</tr>";
		
	echo "</table>";
echo "</div>";
?>
