<?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();
$id 	=	isset($_POST['mainid'])	?	trim(strip_tags($_POST['mainid']))	:	"";
$reserveId 	=	isset($_POST['mainrid'])	?	trim(strip_tags($_POST['mainrid']))	:	"";
$main		=	array();
$mecon->query("SELECT Id, ReservationId, DATE_FORMAT(ChequeDate,'%m/%d/%Y') as ChequeDate, ChequeNo, Bank, Amount, Remarks, ChequeStatus, ChequeProcessDate, ReturnRemarks, OrNum, ReplaceOption, ModePayment, Transcode, PenaltyStatus, ReplaceDate, 
ReplaceOption, ReplaceCashAmount ,ReplaceReference, ReplaceBank, ReplaceChequeNo, ReplaceAmount, (SELECT CONCAT(LastName,', ',FirstName,' ',MiddleName) FROM reservation WHERE Id=buyer_cheque_monitoring_past_due.ReservationId ) as FullName, (SELECT Block FROM reservation WHERE Id=buyer_cheque_monitoring_past_due.ReservationId ) as Block, (SELECT Lot FROM reservation WHERE Id=buyer_cheque_monitoring_past_due.ReservationId ) as Lot FROM buyer_cheque_monitoring_past_due WHERE Status = :status AND ReservationId = :rid AND Id=:id ORDER BY ChequeDate");
$mecon->bind(':status', 'active');
$mecon->bind(':rid', $reserveId);
$mecon->bind(':id', $id);
$main = $mecon->resultset();
print_r(json_encode($main));