<?php
include('../config/dbcon.php');
if(isset($_POST['customer_code'])){
	$customer_code=$_POST['customer_code'];
	$update = mysqli_query($connect,"update custsegment_mst set customer_code = '".$customer_code."'") or die(mysqli_last_error());	
	$query = "SELECT * FROM customer_mst WHERE Lower(customer_code) = Lower('".$customer_code."')";
    $result = mysqli_query($connect,$query);    
    while($row = mysqli_fetch_array($result) ){
        $response[] = array("label"=>$row['customer_name'],"value"=>$row['customer_code'],"cust_place"=>$row['cust_place'],"tax_code"=>$row['tax_code'],"cust_gstno"=>$row['cust_gstno'],"transporter_name"=>$row['transporter_name'],"opening"=>$row['opening'],"debit"=>$row['debit'],"credit"=>$row['credit'],"clbalance"=>$row['clbalance'],"cust_address_one"=>$row['cust_address_one'],"cust_address_two"=>$row['cust_address_two'],"cust_address_three"=>$row['cust_address_three'],"cust_pin_code"=>$row['cust_pin_code'],"cust_phone"=>$row['cust_phone'],"cust_mobile"=>$row['cust_mobile'],"cust_st_code"=>$row['cust_st_code'],"cust_pan_no"=>$row['cust_pan_no'],"cust_email"=>$row['cust_email'],"cust_aadhar_no"=>$row['cust_aadhar_no'],"cust_st_name"=>$row['cust_st_name'],"due_days"=>$row['due_days']);		
    }
    echo json_encode($response);
}
exit;
?>