<?php
	// required headers
	header("Access-Control-Allow-Origin: *");
	header("Content-Type: application/json; charset=UTF-8");
	 
	// include database and object files
	include_once '../config/database.php';
	include_once '../objects/customer.php';
	// include_once '../objects/sales.php';
	date_default_timezone_set('Asia/Rangoon'); 
	session_start();
	// instantiate database
	$database = new Database();
	$db = $database->getConnection();
	 
	$customer = new Customer($db);
	$data = json_decode(file_get_contents("php://input"));

	$customer->city = $data->city;
	
	$stmt = $customer->getAllRows();
	$num = $stmt->rowCount();
	$arr=array();
	$arr["records"]=array();
	// $arr["sales_no"]=array();
	if($num>0){


		while ($row = $stmt->fetch(PDO::FETCH_ASSOC)){
			extract($row);
			$item=array(
				"id" => (int)$id,
				"name" => ($name)?$name:"",
				"phone" => ($phone)?$phone:"",
				"member_type" => ($member_type)?$member_type:"",
				"nrc" => ($nrc)?$nrc:"",
				"address" =>($address)?$address:"",
				"c_status" =>($c_status==1)?"Disable":"Active",
				"c_status1" =>$c_status,
			);
			array_push($arr["records"], $item);
		}
	 

	}
	// array_push($arr["sales_no"], $sales->getGenerateSalesNo(date("ymd")));
	echo json_encode($arr);
?>