<?   
error_reporting(0);
if (substr_count($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip')) ob_start("ob_gzhandler"); else ob_start();
session_start();
session_cache_limiter('private');
$cache_limiter 	= session_cache_limiter();
session_cache_expire(60);
$cache_expire 	= session_cache_expire(); 
date_default_timezone_set('Asia/Manila'); 
$CURRENT_DATE 	= date('Y-m-d H:i:s');
include_once('../config/minho.php');
include_once('../config/autoloadClass.php');
$autoload	=	new autoloadClass();
$mecon		=	new condbClass();
$formClass	=	new formClass();
$main		=	array();
$main2		=	array();
$arr3		=	array();
$main3		=	array();
$main4		=	array();
$block		=	(isset($_POST['block'])) ? $_POST['block'] : "";
$lot		=	(isset($_POST['lot'])) ? $_POST['lot'] : "";





$mecon->query("SELECT Id, Block, Lot, TaxDecLandProcessed, TaxDecLandReleased, TaxDecBuildingProcessed, TaxDecBuildingReleased, TaxReceiptLandProcessed,TaxReceiptLandReleased,TaxReceiptBuildingProcessed,TaxReceiptBuildingReleased,BuildingPermitProcessed,BuildingPermitReleased,ElectricalPermitProcessed,ElectricalPermitReleased,SanitaryPermitProcessed,SanitaryPermitReleased,OccupancyPermitProcessed,OccupancyPermitReleased FROM permits_and_licenses WHERE Block = :block AND Lot = :lot  ");
$mecon->bind(':block', $block);
$mecon->bind(':lot', $lot);
$main = $mecon->resultset(); 
$counter = count($main); 
$arr1 = array();
$arr2 = array();
$arr3 = array(); 
$userType	=	$_SESSION['castalia_user_type'];
for($a=0; $a<$counter; $a++){ 
		  
		$arr1['id']						= $main[$a]['Id']; 
		$arr1['block']					= $main[$a]['Block']; 
		$arr1['lot']					= $main[$a]['Lot']; 
 
$arr1['TaxDecLandProcessed']			= $main[$a]['TaxDecLandProcessed'];
$arr1['TaxDecLandReleased']				= $main[$a]['TaxDecLandReleased'];
$arr1['TaxDecBuildingProcessed']		= $main[$a]['TaxDecBuildingProcessed'];
$arr1['TaxDecBuildingReleased']			= $main[$a]['TaxDecBuildingReleased'];
$arr1['TaxReceiptLandProcessed']		= $main[$a]['TaxReceiptLandProcessed'];
$arr1['TaxReceiptLandReleased']			= $main[$a]['TaxReceiptLandReleased'];
$arr1['TaxReceiptBuildingProcessed']	= $main[$a]['TaxReceiptBuildingProcessed'];
$arr1['TaxReceiptBuildingReleased']	= $main[$a]['TaxReceiptBuildingReleased'];
$arr1['BuildingPermitProcessed']	= $main[$a]['BuildingPermitProcessed'];
$arr1['BuildingPermitReleased']		= $main[$a]['BuildingPermitReleased'];
$arr1['ElectricalPermitProcessed']	= $main[$a]['ElectricalPermitProcessed'];
$arr1['ElectricalPermitReleased']	= $main[$a]['ElectricalPermitReleased'];
$arr1['SanitaryPermitProcessed']	= $main[$a]['SanitaryPermitProcessed'];
$arr1['SanitaryPermitReleased']		= $main[$a]['SanitaryPermitReleased'];
$arr1['OccupancyPermitProcessed']	= $main[$a]['OccupancyPermitProcessed'];
$arr1['OccupancyPermitReleased']	= $main[$a]['OccupancyPermitReleased'];



	$arr2[] = $arr1;
}
$arr3['data'] = $arr2;
echo json_encode($arr3); 
exit();
ob_end_flush();