<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 Barang</th>
    <th>Nama Barang</th>
    <th>Satuan</th>
    <th>Harga Pesan</th>
    <th>Jumlah</th>
    <th>Total</th>
    <th>Aksi</th>
</tr>
<?php
	if($data->num_rows()>0){
		$g_total=0;
		$no =1;
		foreach($data->result_array() as $db){  
		$total = $db['jmlbeli']*$db['hargabeli'];
		?>    
    	<tr>
			<td align="center" width="20"><?php echo $no; ?></td>
            <td align="center" width="100" ><?php echo $db['kode_barang']; ?></td>
			<td ><?php echo $db['nama_barang']; ?></td>
            <td align="center" width="100" ><?php echo $db['satuan']; ?></td>
            <td align="right" width="100" ><?php echo number_format($db['hargabeli']); ?></td>
            <td align="center" width="100" ><?php echo $db['jmlbeli']; ?></td>
            <td align="right" width="100" ><?php echo number_format($total); ?></td>
            <td align="center" width="80"><a href="<?php echo base_url();?>index.php/pembelian/hapus_detail/<?php echo $db['kodepesan'];?>/<?php echo $db['kode_barang'];?>"
            onClick="return confirm('Anda yakin ingin menghapus data ini?')">
			<img src="<?php echo base_url();?>asset/images/del.png" title='Hapus'>
			</a>
            </td>
    </tr>
    <?php
		$no++;
		$g_total=$g_total+$total;
		}
	}else{
		$g_total=0;
	?>
    	<tr>
        	<td colspan="8" align="center" >Tidak Ada Data</td>
        </tr>
    <?php	
	}
?>
<tr>
	<th colspan="6" align="right">Total</th>
    <th align="right"><?php echo number_format($g_total);?></th>
</tr>    
</table>