<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>No.Faktur</th>
			<th>Tanggal</th>
			<th>Pelanggan</th>			
			<th>Total Item</th>
			<th>Total Unit</th>
			<th>Total Harga</th>			
		</tr>";
		$sql = "SELECT kode_rj,tanggal,count(kode_st) as totitem,sum(jml_retur) as totunit,nama_plg FROM retur_pj
			WHERE tanggal BETWEEN '$tgl_awal' AND '$tgl_akhir' AND posting='' AND batal='' GROUP BY kode_rj";
		$query = mysql_query($sql);
		
		$no=1;
		$g_total=0;
		while($r_data=mysql_fetch_array($query)){
			$netto = $r_data[tjumlah]-$r_data[tdiskon];
			echo "<tr>
					<td align='center'>$no</td>
					<td align='center'>$r_data[kode_rj]</td>
					<td align='center'>".jin_date_str($r_data[tanggal])."</td>
					<td>$r_data[nama_plg]</td>
					<td align='center'>$r_data[totitem]</td>
					<td align='right'>$r_data[totunit]</td>
					<td align='right'>".number_format($netto,0)."</td>
				</tr>";
			$no++;
			$g_total=$g_total+$netto;
		}
		echo "<tr>
				<td></td>
				<td></td>
				<td></td>
				<td></td>
				<td></td>
				<td align='right'>Total</td>
				<td align='right'>".number_format($g_total,0)."</td>
			</tr>
		</table>";
?>