<?php
include 'connection.php'; 
session_start();
if (!isset($_SESSION['is_logged_in'])) {
    header("Location:login.php");
    die();
    }
	
$query = "select * from users where username = '". $_SESSION["LOGIN_NAME"]."' AND password = '".$_SESSION["EMPLOYEE_PASSWORD"]."'";
//echo $query;
		                 $result = mysql_query($query,$conn);
						 while($row=mysql_fetch_array($result))
	                                              	{
													   $staff_name = $row['full_name'];
													  $full_name = $row['full_name'];
													  $avatar = $row['avatar'];
													  $department_name = $row['department_name'];
													  $staff_id  = $row['id'];
													  $username = $row['username'];
													  $our_company = $row['active_company'];
													  $designation = $row['designation'];
													  $sales_group = $row['sales_group'];
													  $head = $row['head'];
													  $region = $row['region'];
													  $district = $row['district'];
													  $email = $row['email'];
													  $mobile_no = $row['mobile_no'];
													  $staff_id_self  = $row['id'];
													  //echo $Branch;
													  }	
													   ?>	
													   <?php


if(isset($_POST['customer_id']))
{

$name=trim($_POST['customer_id']);
if(strlen(trim($name)) >= 1) {


$query31=mysql_query("SELECT * FROM customer_master WHERE customer_name LIKE '%$name%'");
 $num_rows = mysql_num_rows($query31);

}

 if($num_rows=='0')
{



?>
<table style="border-collapse:collapse; width:100%; border-radius:3px 3px 3px 3px">
  <tr>
    <td colspan="5" bgcolor="#fff">
	<div align="left" style="padding:2px;"><font color="#000000">(Record Not Found)</font></div>
	</td>
  </tr></table>
<? }else{

?>
  
  <? 
  while($query3=mysql_fetch_array($query31))
{

  ?>
  <table style="border-collapse:collapse; width:100%; border-radius:3px 3px 3px 3px" bgcolor="#fff">
  <tr>
    <td colspan="5" bgcolor="#fff">
	
	<? echo $customer_type;?>

	<div align="left" style="padding:2px;" onclick='fillsale("<?php echo $query3['customer_id']; ?>")'><font color="#000000" onclick='fillsale1("<?php echo $query3['customer_name']; ?>")'><strong><?php echo $query3['customer_name']; ?> </strong>&nbsp;&nbsp; ( Address : <?php echo $query3['address']; ?> , Mobile No : <?php echo $query3['phone_no']; ?> ) </font></div>
	</td> </tr>
	
	

 
</table><? }
} ?>
 
<?php


}
?>

