<?php
require "../commonincludefiles.php";
error_reporting(1);

if ($_SESSION["cCompany_id"] != "" && isset($_SESSION["cCompany_id"])) {
	//this file is created by nirav
	$phone = Escape($_POST['phone']);

	/*$objCustomerMgmt = new CustomerMgmt();
	   
	   $limit=0;
	   $start=0;
	   $condition="customer_phone1=".$phone." OR  customer_phone2=".$phone." OR customer_cpmobile1=".$phone ;
	   $order_field="customer_orgname";
	   $order_type="ASC";
	   
	   $result = $objCustomerMgmt->getAllRecords(0,0,$condition,$order_field,$order_type) ;
	   */

	$result = " SELECT `customer_orgname` FROM `lms_customer` WHERE `customer_phone1`='" . $phone . "' OR `customer_phone2`= '" . $phone . "' OR customer_cpmobile1='" . $phone . "'";


	$q = dbQuery($result);

	$total = dbRows($q);
	$i = 0;
	$distictData = array("count" => $total, "rows1" => array());
	if (($total) > 0) {
		$temparray = array();
		while ($row = dbArray($q)) {

			$temparray["customer_id"] = $row["customer_id"];
			$temparray["customer_orgname"] = $row["customer_orgname"];
			$distictData["rows1"][$i] = $temparray;
			$i++;
		}
	}
	echo json_encode($distictData);
}
?>