<?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(); 
$reserveId 	=	isset($_POST['mainrid'])	?	trim(strip_tags($_POST['mainrid']))	:	"";
$main		=	array();
$mecon->query("SELECT Id, Amount, ChequeStatus FROM buyer_cheque_monitoring WHERE Status = :status AND ReservationId = :rid ");
$mecon->bind(':status', 'active');
$mecon->bind(':rid', $reserveId); 
$result			=	$mecon->resultset();
$totalAmount	=	"";
for($a=0; $a<count($result); $a++){

	/*



 

	*/
	if($result[$a]['ChequeStatus']=="Returned to Buyer" || $result[$a]['ChequeStatus']=="Returned by Bank" || $result[$a]['ChequeStatus']=="Closed" || $result[$a]['ChequeStatus']=="Returned" || $result[$a]['ChequeStatus']=="Hold"){ //27JUL25
		//$totalAmount -= $result[$a]['Amount']; 
		$totalAmount += 0;
	}else{
		$totalAmount += $result[$a]['Amount']; 
	}
}


$resultArr 						= array();
$resultArr['output']	  		= $totalAmount; 
echo json_encode($resultArr); 
exit();
ob_end_flush(); 