<?php include "../include/config.php"; ?>
<html>
<head>
<link rel='stylesheet' type='text/css' href="../include/css/popup_styles.css" />	
<script language='javascript'>
	function select_go(id,name){			
		eval("opener.document.form.cust_id").value = id;	
		eval("opener.document.form.cust_name").value = name;	
		window.close();
		self.close();	
	}
</script>
</head>
<body>
<div id="popup">
<form action="popup_custout.php" method="post" enctype="multipart/form-data">
<table width="100%">
	<tr>
		<th colspan="2">
		Cari berdasarkan nama :<input type="text" name="cari" size="20">
		      <input type="submit" name="proses" value="CARI">
		</th>
	</tr>
	<tr>
		<th>Kode Penerima</th>
		<th>Nama Penerima</th>
	</tr>
    <?php
	$cari  = isset($_REQUEST['cari']) ? $_REQUEST['cari'] :'';
	if (isset($_REQUEST['proses'])=="CARI"){
		$list = "WHERE cust_status<>100 AND cust_name LIKE '%$cari%'";
	}else{
		$list = "";
	}
	$query = mysql_query("SELECT id,cust_code,cust_name,cust_npwp FROM customer $list ORDER BY cust_name ASC ");
	while($data=mysql_fetch_object($query)){
	?>
	 <tr>
		<td><a href="#" onClick="select_go('<?=$data->id;?>','<?=$data->cust_name;?>')"><?=$data->cust_code;?></a></td>
		<td><?=$data->cust_name;?></td>
	</tr>	
	<?php } ?>
</table>
</form>
</div>
</body>
</html>