<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';
$cari	= $_GET[cari];
$nu=1;

echo "<table id='theList' width='100%'>
		<tr>
			<th>No.</th>
			<th>Kode</th>
			<th>Nama Barang</th>
			<th>Satuan</th>
			<th>Harga Pokok</th>
			<th>Jumlah Stok</th>
			<th>Hasil Opname</th>
		</tr>";
		
		if(!empty($cari))
			$sql = "SELECT * FROM stock WHERE (kode_st LIKE '%$cari%' OR nama_st LIKE '%$cari%') ORDER BY kode_st";
		else
			$sql = "SELECT * FROM stock ORDER BY kode_st";
		$query = mysql_query($sql);		
	
		while($r_data=mysql_fetch_array($query)){
			$nu=$nu+1;
			echo "<tr>
					<td align='right'>$nu</td>
					<td>$r_data[kode_st]</td>
					<td>$r_data[nama_st]</td>
					<td>$r_data[satuan]</td>
					<td align='right'>".number_format($r_data[hg_beli],2)."</td>
					<td align='right'>".number_format($r_data[jml_stok],2)."</td>
					<td></td>
				</tr>";						
		}			
	
	echo "</table>";
	
echo "</div>";
?>
