<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;
		$.ajax({
			type	: "POST",
			url	    : "kasir/penjualan/cari_dokter.php",
			data	: "kode="+kode,
			dataType: "json",
			success	: function(data){
				$("#txt_kodedt").val(kode);
				$("#txt_namadt").val(data.namadt);
				$("#t_kodedt").val(kode);
				$("#t_namadt").val(data.namadt);
				$("#form_cari_dokter").dialog('close');
				$("#txt_kategori").val('RESEP');
				$("#txt_pasien").focus();
			}
		});
	}
</script>

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

$cari= $_GET['cari'];

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