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

<?php
	include '../../inc/inc.koneksi.php';
	
	$cari	= $_GET['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 PARAMEDIS</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;font:12px arial'>
		<tr>
			<th>No.</th>
			<th>Kode</th>
			<th>Nama Pelanggan</th>
			<th>Kategori</th>
			<th>Alamat</th>
			<th>Telepon</th>
			<th>Aksi</th>
		</tr>";
		if (!empty($cari))
			$sql= "SELECT * FROM customer WHERE (nama LIKE '%$cari%') ORDER BY kode_pl";
		else
			$sql= "SELECT * FROM customer ORDER BY kode_pl";
		$query = mysql_query($sql);
		
		$no=1;
		while($r=mysql_fetch_array($query)){
			echo "<tr>
				<td align='center'>$no</td>
				<td>$r[kode_pl]</td>
				<td>$r[nama]</td>
				<td>$r[kategori]</td>
				<td>$r[alamat]</td>
				<td>$r[telepon]</td>
				<td align='center'>
					<a href='javascript:void(0)' onClick=\"edit_data('$r[kode_pl]')\">
				    	<img src='icon/thumb_up.png' border='0' id='edit' title='Edit' width='12' height='12' >
					</a>
					<a href='javascript:void(0)' onClick=\"hapus_data('$r[kode_pl]')\">
					    <img src='icon/thumb_down.png' border='0' id='hapus' title='Hapus' width='12' height='12' >
					</a>					
				</td>
			</tr>";
			$no++;
		}
	echo "</table>";
?>
<script type="text/javascript">
	history.back();
</script>