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

$tanggal = $_GET['tanggal'];
$shift   = $_GET['shift'];

echo "<table id='theList' width='100%'>
		<tr>
			<th>No.</th>
			<th>Kode Setoran</th>
			<th>Tanggal</th>
			<th>Shift</th>
			<th>No. Teller</th>
			<th>Jenis BBM</th>
			<th>Petugas</th>
			<th>Teller Awal</th>
			<th>Teller Akhir</th>
			<th>Liter Keluar</th>
			<th>Liter Tera</th>
			<th>Liter Bon</th>
			<th>Liter Tunai</th>
			<th>Setor Tunai</th>
		</tr>";
		
		$sql = "SELECT kode_sb,tanggal,shift,kode_tl,jenis,teller_aw,teller_ak,sum(jml_keluar) as keluar,sum(jml_tera) as tera,sum(jml_bon) as bon,sum(jml_tunai) as tunai,sum(nilai_tunai) as niltun FROM setor_bbm WHERE tanggal='$tanggal' AND shift='$shift' AND batal='' GROUP BY kode_sb ";
		$query = mysql_query($sql);
		
		$no=1;
		$ttunai=0;		
		while($r=mysql_fetch_array($query)){
			$ttunai = $ttunai+$r[niltun];
			
			echo "<tr>
				<td align='center'>$no</td>
				<td align='center'>$r[kode_sb]</td>
				<td>".jin_date_str($r[tanggal])."</td>
				<td align='center'>$r[shift]</td>
				<td align='center'>$r[kode_tl]</td>
				<td>$r[jenis]</td>
				<td>$r[petugas]</td>
				<td align='right'>$r[teller_aw]</td>
				<td align='right'>$r[teller_ak]</td>
				<td align='right'>".number_format($r[keluar],2)."</td>
				<td align='right'>".number_format($r[tera],2)."</td>
				<td align='right'>".number_format($r[bon],2)."</td>
				<td align='right'>".number_format($r[tunai],2)."</td>				
				<td align='right'>".number_format($r[niltun])."</td>
			</tr>";
			$no++;
		}
		echo "<tr>				
				<td></td>
				<td></td>
				<td></td>
				<td></td>
				<td></td>
				<td></td>
				<td></td>
				<td></td>
				<td></td>
				<td></td>
				<td></td>
				<td></td>
				<td align='right'>Total</td>
				<td align='right'>".number_format($ttunai)."</td>
			</tr>";
	echo "</table>";
?>