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

        $("#theList.barang tr").hover(
            function() {
                $(this).toggleClass("highlight");
            },
            function() {
                $(this).toggleClass("highlight");
            }
        );
    });	
});

	function pilih(ID){
		var kode = ID;
		
		$("#kasir").val(kode);
		$('#form_cari_kasir').dialog('close');
	}
</script>
<?php
include '../../inc/inc.koneksi.php';

$cari	= $_GET['cari'];
$kodecab= $_GET['kodecab'];

echo "<table id='theList' class='barang' width='100%'>
		<tr>
			<th>No.</th>
			<th>Kasir</th>
			<th>Cabang</th>
			<th>Ambil</th>
		</tr>";
		if(!empty($cari))
			$sql = "SELECT * FROM admins WHERE username LIKE '%$cari%' AND kode_cab='$kodecab' AND level='Kasir' ORDER BY username";
		else
			$sql = "SELECT * FROM admins WHERE kode_cab='$kodecab' AND level='Kasir' ORDER BY username";
		$query = mysql_query($sql);
		
		$no=1;
		while($r=mysql_fetch_array($query)){
			echo "<tr>
				<td align='center'>$no</td>
				<td>$r[username]</td>
				<td>$r[kode_cab]</td>
				<td align='center'>
					<a href='javascript:void(0)' onClick=\"pilih('$r[username]')\">
					<img src='icon/download.gif' border='0' id='tambah_data' title='Tambah' width='12' height='12' >
					</a>					
				</td>
			</tr>";
			$no++;			
		}
	echo "</table>";
?>