<script type="text/javascript">
$(function() {
	$("#dataTable tr:even").addClass("stripe1");
	$("#dataTable tr:odd").addClass("stripe2");
	$("#dataTable tr").hover(
		function() {
			$(this).toggleClass("highlight");
		},
		function() {
			$(this).toggleClass("highlight");
		}
	);
});
</script>
<style type="text/css">
.stripe1 {
    background-color:#FBEC88;
}
.stripe2 {
    background-color:#FFF;
}
.highlight {
	-moz-box-shadow: 1px 1px 2px #fff inset;
	-webkit-box-shadow: 1px 1px 2px #fff inset;
	box-shadow: 1px 1px 2px #fff inset;		  
	border:             #aaa solid 1px;
	background-color: #fece2f;
}
</style>
<table id="dataTable" width="100%">
<tr>
	<th>No</th>
    <th>Kode Beli</th>
    <th>Tanggal</th>
    <th>Supplier</th>
    <th>Barang</th>
    <th>Satuan</th>
    <th>Jumlah</th>
    <th>Hrg Beli</th>
    <th>Tot Beli</th>
    <th>Hrg Jual @ Trbaru</th>
    <th>Jth Tempo</th>
    <th>Expired</th>
</tr>
<?php
	if($data->num_rows()>0){
		$g_total = 0;
		$no =1;
		foreach($data->result_array() as $db){  
		$total = $db['jmlbeli']*$db['hargabeli'];
		$tgl = $this->app_model->tgl_sql($db['tglbeli']);
		?>    
    	<tr>
			<td align="center" width="20"><?php echo $no; ?></td>
            <td align="center" width="100" ><?php echo $db['kodebeli']; ?></td>
            <td align="center" width="100"><?php echo $tgl; ?></td>
            <td ><?php echo $db['kode_supplier'].'-'.$db['nama_supplier']; ?></td>
            <td ><?php echo $db['kode_barang'].'-'.$db['nama_barang']; ?></td>
            <td align="center" width="80" ><?php echo $db['satuan']; ?></td>
            <td align="center" width="80" ><?php echo number_format($db['jmlbeli']); ?></td>
            <td align="right" width="80" ><?php echo number_format($db['hargabeli']); ?></td>
            <td align="right" width="100" ><?php echo number_format($total); ?></td>
            <td align="right" width="80" ><?php echo number_format($db['harga_jual']); ?></td>
            <td align="center" width="100" ><?php echo $this->app_model->tgl_sql($db['jth_tempo']); ?></td>
            <td align="center" width="100" ><?php echo $this->app_model->tgl_sql($db['expired']); ?></td>
    </tr>
    <?php
		$no++;
		$g_total =$g_total+$total;
		}
	}else{
		$g_total =0;
	?>
    	<tr>
        	<td colspan="9" align="center" >Tidak Ada Data</td>
        </tr>
    <?php	
	}
?>
<tr>
	<td colspan="8" align="center">TOTAL</td>
    <td align="right"><?php echo number_format($g_total);?></td>
</tr>    
</table>