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

echo "<div id='info'>	
	<table id='theList' width='100%'>
	<tr>
		<th>No.</th>
		<th>Jenis BBM</th>
		<th>Harga Beli</th>
		<th>Jumlah Liter</th>
		<th>Jumlah Harga</th>
	</tr>";
		
	$query	= "SELECT jenis,sum(jml_liter) as j_liter,sum(jumlah) as j_jumlah FROM terima_bbm WHERE tanggal BETWEEN '$tgl_awal' AND '$tgl_akhir' AND batal='' GROUP BY jenis";
	$data	= mysql_query($query);
	
	$no=1;	
	$tliter=0;
	$tjumlah=0;
	
	while($r_data=mysql_fetch_array($data)){		
		$tliter	 =$tliter+$r_data[j_liter];
		$tjumlah =$tjumlah+$r_data[j_jumlah];
		$hgbeli  =$r_data[j_jumlah]/$r_data[j_liter];
		
		echo "<tr>
			<td align='center'>$no</td>
			<td>$r_data[jenis]</td>
			<td align='right'>".number_format($hgbeli,2)."</td>
			<td align='right'>".number_format($r_data[j_liter],2)."</td>
			<td align='right'>".number_format($r_data[j_jumlah],2)."</td>			
		</tr>";		
		$no++;
	}
	
	echo "<tr>
			<td></td>			
			<td align='right'>Total</td>
			<td align='right'>".number_format($tliter,2)."</td>
			<td align='right'>".number_format($tjumlah,2)."</td>			
		</tr>";
		
	echo "</table>";	
echo "</div>";
?>
