<?php
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 UnitId, Block, Lot, Road, SideWalkGutter, Meralco, Water, HouseConstruction, HouseConstructionPercentage FROM construction_and_utilities 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['danvillee_user_type'];
for($a=0; $a<$counter; $a++){ 
		  
		$arr1['id']						= $main[$a]['Id']; 
		$arr1['block']					= $main[$a]['Block']; 
		$arr1['lot']					= $main[$a]['Lot']; 
  
		$arr1['road']					= $main[$a]['Road'];  
		$arr1['side_walk'] 				= $main[$a]['SideWalkGutter'];

		$arr1['meralco'] 				= $main[$a]['Meralco']; 
		$arr1['water'] 					= $main[$a]['Water']; 
		$arr1['house_construction']  	= $main[$a]['HouseConstruction']; 
		$arr1['house_construction_percentage'] 				= $main[$a]['HouseConstructionPercentage']; 
  
	$arr2[] = $arr1;
}
$arr3['data'] = $arr2;
echo json_encode($arr3); 
exit();
ob_end_flush();