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

$kode 	= $_GET['kode'];

echo "<table id='theList' width='100%'>
		<tr>
			<th>No.</th>
			<th>Kode Asal</th>
			<th>Nama Barang</th>
			<th>Satuan</th>
			<th>Harga Pokok</th>
			<th>Jml. Unit</th>
			<th>Jumlah Harga</th>
			<th>Kode Hasil</th>
			<th>Nama Barang</th>
			<th>Satuan</th>
			<th>Harga Pokok</th>
			<th>Jml. Unit</th>
			<th>Jumlah Harga</th>			
		</tr>";		
					
		$tql=mysql_query("SELECT * FROM jurpsb WHERE kode_psb='$kode' ORDER BY no_urut");
				
		$no=1;
		$tunit1=0;
		$tjumlah1=0;
		$tunit2=0;
		$tjumlah2=0;
		while($r=mysql_fetch_array($tql)){
			echo "<tr>
				<td align='center'>$no</td>
				<td>$r[kode_st1]</td>
				<td>$r[nama_st1]</td>
				<td>$r[satuan1]</td>
				<td align='right'>".number_format($r['hg_beli1'],2)."</td>
				<td align='right'>".number_format($r['jml_unit1'],0)."</td>
				<td align='right'>".number_format($r['jumlah1'],0)."</td>
				<td>$r[kode_st2]</td>
				<td>$r[nama_st2]</td>
				<td>$r[satuan2]</td>
				<td align='right'>".number_format($r['hg_beli2'],2)."</td>
				<td align='right'>".number_format($r['jml_unit2'],0)."</td>
				<td align='right'>".number_format($r['jumlah2'],0)."</td>
			</tr>";
			$no++;
			$tunit1=$tunit1+$r['jml_unit1'];
			$tjumlah1=$tjumlah1+$r['jumlah1'];
			$tunit2=$tunit2+$r['jml_unit2'];
			$tjumlah2=$tjumlah2+$r['jumlah2'];
		}
		echo "<tr>
			<td></td>
			<td></td>
			<td></td>
			<td></td>
			<td align='right'>Jumlah </td>
			<td align='right'>".number_format($tunit1,0)."</td>
			<td align='right'>".number_format($tjumlah1,0)."</td>
			<td></td>
			<td></td>
			<td></td>
			<td></td>
			<td align='right'>".number_format($tunit2,0)."</td>
			<td align='right'>".number_format($tjumlah2,0)."</td>
		</tr>		
	</table>";
?>