<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'];
$cari	= $_GET['cari'];

echo "<table id='theList' width='100%'>
		<tr>
			<th>No.</th>
			<th>Kode Tebusan</th>
			<th>Tanggal</th>
			<th>Nomor Bukti</th>
			<th>Rekening Bank</th>
			<th>Jenis BBM</th>
			<th>Jumlah Liter</th>
			<th>Harga Beli</th>
			<th>Jumlah Harga</th>
			<th>PPh Pasal 22</th>
			<th>Jumlah Disetor</th>
		</tr>";
		if(!empty($cari))
			$sql = "SELECT * FROM tebus_do WHERE tanggal BETWEEN '$tgl_awal' AND '$tgl_akhir' AND (jenis LIKE '%$cari%') AND batal='' ORDER BY tanggal,kode_do ";
		else
			$sql = "SELECT * FROM tebus_do WHERE tanggal BETWEEN '$tgl_awal' AND '$tgl_akhir' AND batal='' ORDER BY tanggal,kode_do ";
		$query = mysql_query($sql);
		
		$no=1;
		$tliter=0;
		$tjumlah=0;
		$tpph=0;
		$tsetor=0;
		
		while($r=mysql_fetch_array($query)){
			$tliter = $tliter+$r[jml_liter];
			$tjumlah= $tjumlah+$r[jml_harga];
			$tpph= $tpph+$r[jml_pph];
			$tsetor= $tsetor+$r[jml_setor];
			
			echo "<tr>
				<td align='center'>$no</td>
				<td align='center'>$r[kode_do]</td>
				<td align='center'>".jin_date_str($r[tanggal])."</td>
				<td align='center'>$r[nobukti]</td>
				<td align='center'>$r[namabank]</td>
				<td>$r[jenis]</td>
				<td align='right'>$r[jml_liter]</td>
				<td align='right'>".number_format($r[hg_beli])."</td>
				<td align='right'>".number_format($r[jml_harga])."</td>
				<td align='right'>".number_format($r[jml_pph])."</td>
				<td align='right'>".number_format($r[jml_setor])."</td>
			</tr>";
			$no++;
		}
		echo "<tr>								
			<td></td>
			<td></td>
			<td></td>
			<td></td>
			<td></td>
			<td align='right'>Total</td>
			<td align='right'>$tliter</td>
			<td></td>
			<td align='right'>".number_format($tjumlah)."</td>
			<td align='right'>".number_format($tpph)."</td>
			<td align='right'>".number_format($tsetor)."</td>
		</tr>
	</table>";
?>