<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';
include '../../inc/fungsi_tanggal.php';

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

echo "<table id='theList' width='100%'>
		<tr>
			<th>No.</th>
			<th>Kode Pembelian</th>
			<th>Tanggal</th>
			<th>Nomor Faktur</th>
			<th>Supplier</th>
			<th>Total Item</th>
			<th>Total Unit</th>
			<th>Total Harga</th>		
		</tr>";
		$sql = "SELECT kode_pb,tanggal,nomor_fk,nama_sup,count(kode_st) as totitem,sum(jml_unit) as totunit,sum(jumlah) as totjumlah FROM faktur_pb WHERE tanggal BETWEEN '$tgl_awal' AND '$tgl_akhir' AND posting='' AND batal='' GROUP BY kode_pb";

		$query = mysql_query($sql);
		
		$no=1;
		while($r_data=mysql_fetch_array($query)){
			$total = $r_data['total'];
			echo "<tr>
					<td align='center'>$no</td>
					<td align='center'>$r_data[kode_pb]</td>
					<td align='center'>".jin_date_str($r_data['tanggal'])."</td>
					<td>$r_data[nomor_fk]</td>
					<td>$r_data[nama_sup]</td>
					<td align='center'>$r_data[totitem]</td>
					<td align='right'>$r_data[totunit]</td>
					<td align='right'>$r_data[totjumlah]</td>					
				</tr>";
			$no++;
			$g_total=$g_total+$total;
		}
		
	echo "</table>";
?>