<?php
error_reporting(0); //7dec25
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();
$main		=	array();
$main2		=	array();
$arr3		=	array();
$main3		=	array();
$main4		=	array();
$project			=	(isset($_POST['project'])) ? str_replace("_"," ",$_POST['project']) : "";
$model				=	(isset($_POST['model'])) ? str_replace("_"," ",$_POST['model']) : "";
$phase				=	(isset($_POST['phase'])) ? $_POST['phase'] : "";
$reservedDate		=	(isset($_POST['reserved_date'])) ? $_POST['reserved_date'] : "";
$reservedDate = date('Y-m-d', strtotime($reservedDate));
 
$mecon->query("SELECT Id, PricelistDetails, Status FROM pricelist WHERE Status = :status AND Project = :project AND Model = :model AND PricelistDate <= :resdate ORDER BY Id DESC ");
$mecon->bind(':status', 'active');
 $mecon->bind(':resdate', $reservedDate);
$mecon->bind(':project', $project);
$mecon->bind(':model', $model);
$main = $mecon->resultset(); 
$counter = count($main); 
$arr1 = array();
$arr2 = array();
$arr3 = array(); 
for($a=0; $a<$counter; $a++){ 
	$arr1['id']				= $main[$a]['Id'];
	$arr1['block_details']	= $main[$a]['PricelistDetails'];
	$arr2[] = $arr1;
} 
$arr3['data'] = $arr2;
echo json_encode($arr3); 
exit();
ob_end_flush();