<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");
            }
        );
    });	
});
		
	function hapus_data(ID){
		var pilih = confirm('Hapus data label kode barang '+ID+' ?');
		if (pilih==true) {
		var kode = ID;
		var user	= $("#l_user").val();
		$.ajax({
			type	: "POST",
			url		: "modul/inventory/hapus_lb.php",
			data	: "kode="+kode+
					"&user="+user,
			success	: function(data){
				$("#info").html(data);
				tampil_detail();
			}
		});
		}
	}
	
	function tampil_detail(){
		var user = $("#l_user").val();

		$("#data_detail_lb").show();
		$("#data_detail_lb").load("modul/inventory/tampil_data_label.php?user="+user);
		$("#l_barcode").focus();
	}
</script>

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

$user=$_GET['user'];

echo "<table id='theList' class='detail' width='100%'>
		<tr>
		    <th>No.</th>
			<th>Kode</th>
			<th>Nama Barang</th>
			<th>Kode Sup.</th>
			<th>Barcode</th>
			<th>Harga Jual</th>
			<th>Hapus</th>
		</tr>";
		
		$query	= mysql_query("SELECT * FROM label WHERE user='$user' ORDER BY kode_st");
		$jml  	= mysql_num_rows($query);
		$limit	= 17;
		$hide 	= $jml-$limit;
		$no		= 1;
		
		while($r=mysql_fetch_array($query)){			
			if($no>$hide){
			echo "<tr>
			    <td align='center'>$no</td>
				<td>$r[kode_st]</td>
				<td>$r[nama_st]</td>
				<td>$r[kode_sp]</td>
				<td>$r[barcode]</td>				
				<td align='right'>".number_format($r['hg_jual'],0)."</td>
				<td align='center'>
					<a href='javascript:void(0)' onClick=\"hapus_data('$r[kode_st]')\">
						<img src='icon/thumb_down.png' border='0' id='hapus' title='Hapus' width='12' height='12' >
					</a>
				</td>
			</tr>";
			}
			$no++;
		}		
	echo "</table>";
?>