<?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();
$vtype		= isset($_POST['vtype']) 		? strip_tags($_POST['vtype'])  : "";  
$value		= isset($_POST['checkval']) 	? strip_tags($_POST['checkval'])  : "";  
$mid		= isset($_POST['mainid']) 		? str_replace(",","",trim(strip_tags($_POST['mainid']))) : "";    
 
$currentUser 		= $_SESSION['castalia_username'];
$timeStamp		= date('Y-m-d H:i:s');
$curDate 	= date('Y-m-d');
$mainArr			= array();
$mainArr2			= array();
$mainArr3			= array();
$condArr 	= array();
$condArr2 	= array();
$condArr3 	= array();
$output1 			= "";
$output2 			= "";
$output3 			= "";
$output 			= ""; 
$mainArr['ToBeDeliveredDate']  = date('Y-m-d', strtotime($value));
$condArr['Id']		= $mid; 
$output 			= $mecon->updateQuery($mainArr,"reservation",$condArr); 


//update buyer status to pagibig
//if($vtype=='delivered'){
$mainArr2['DateDelivered']  = date('Y-m-d', strtotime($value));
$condArr2['ReservationId']	= $mid; 
$mecon->updateQuery($mainArr2,"buyer_status_folder_pagibig",$condArr2);
//}
 
$resultArr 						= array();
$resultArr['output']	  		= $output; 
echo json_encode($resultArr); 
exit();
ob_end_flush();