<script type="text/javascript">	
	window.print();
</script>

<?php
	include '../../inc/inc.koneksi.php';
	
	$cari	= $_POST['cari'];
	$tgllap = date('d-m-Y');
		
	$sql  = mysql_query("SELECT * FROM company");
	$r	  = mysql_fetch_assoc($sql);
	$kop1 = $r['nama1'];
	$kop2 = $r['nama2'];
	$kop3 = $r['alamat'];
	
	echo "<table width='100%'>
		<tr>
			<td style='font:11px arial'><b>$kop1</b></td>
		</tr>
		<tr>
			<td style='font:11px arial'>$kop2</td>
		</tr>
		<tr>
			<td style='font:11px arial'>$kop3</td>
		</tr>
	</table>
		
	<table width='100%'>
		<tr>
			<td align='center' style='font:14px arial'><b>DAFTAR NAMA DOKTER</b></td>
		</tr>
		<tr>
			<td align='center' style='font:14px arial'><b>PER TANGGAL $tgllap</b></td>
		</tr>";
		if(!empty($cari)){
			echo "<tr>
				<td align='center' style='font:14px arial'><b>PENCARIAN : $cari</b></td>
			</tr>";
		}
	echo "</table>
	<br>
	
	<table width='100%' border='1' style='font:12px arial;border-collapse:collapse'>
		<tr>
			<th>No.</th>
			<th>Kode</th>
			<th>Nama Dokter</th>
			<th>Spesialis</th>
			<th>Alamat</th>
			<th>Nomor HP</th>
			<th>Komisi</th>
			<th>Update Terakhir</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>$r[nohp]</td>
				<td align='center'>$r[prosen_kom] %</td>
				<td>$r[lastupdate]</td>
			</tr>";
			$no++;
		}
	echo "</table>";
?>
<script type="text/javascript">	
	history.back();
</script>