<script type="text/javascript">
$(document).ready(function() {
    $(function() {
        $("#theList.detail tr:even").addClass("stripe1");
        $("#theList.detail tr:odd").addClass("stripe2");

        $("#theList.detail tr").hover(
            function() {
                $(this).toggleClass("highlight");
            },
            function() {
                $(this).toggleClass("highlight");
            }
        );
    });
});	
</script>

<?php
include '../../inc/inc.koneksi.php';

$kode	= $_GET['kode'];

echo "<table id='theList' class='detail' width='100%'>
		<tr>
			<th>No.</th>
			<th>Kode Barang</th>
			<th>Nama Barang</th>			
			<th>Jml. Unit</th>
			<th>Satuan</th>
			<th>Harga Satuan</th>
			<th>Jumlah Harga</th>
			<th>Keterangan</th>
		</tr>";
		$query = mysql_query("SELECT * FROM sopb WHERE kode_opb='$kode' ORDER BY no_urut");
		
		$no=1;
		$total=0;
		$tunit=0;
		while($r=mysql_fetch_array($query)){
			$total= $total+$r['jumlah'];
			$tunit= $tunit+$r['jml_unit'];
			
			echo "<tr>
				<td align='center'>$no</td>
				<td>$r[kode_st]</td>
				<td>$r[nama_st]</td>				
				<td align='right'>".number_format($r['jml_unit'],0)."</td>
				<td>$r[satuan]</td>
				<td align='right'>".number_format($r['harga'],0)."</td>
				<td align='right'>".number_format($r['jumlah'],0)."</td>
				<td>$r[keterangan]</td>
			</tr>";
			$no++;			
		}		
		echo "<tr>
			<td></td>
			<td></td>			
			<td align='right'>Total</td>
			<td align='right'>".number_format($tunit,0)."</td>
			<td align='right'></td>
			<td align='right'></td>
			<td align='right'>".number_format($total,0)."</td>
		</tr>
	</table>";
?>