<?php
	require "../commonincludefiles.php";
   	$objCustomerMgmt = new CustomerMgmt();
	$i=0;
	$order_field=" customer_orgname";
	$order_type=" ASC ";
	$query = Escape($_POST["query"]);
	if($query != "")
	{ 
		$where = " and customer_orgname like '%".$query."%'";
	}
	$rs = $objCustomerMgmt->getAllRecords($limit,$start,$where,$order_field,$order_type);
	$total = dbRows($rs);
	$CustomerData = array("count" => $total, "data" => array());
	if(dbRows($rs) > 0){
		while($row = dbArray($rs)){
			
			$temparray["customer_id"]  	= $row["customer_id"];
			$temparray["customer_name"]  	= encode($row["customer_orgname"]);
			
			$CustomerData["data"][$i] = $temparray;   
			$i++;
		}
	}
	echo json_encode($CustomerData);	
?>