<?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();
$formClass		=	new formClass();
$main		=	array();
$main2		=	array();
$arr3		=	array();
$main3		=	array();
$main4		=	array();
$mainId		=	(isset($_POST['mainid'])) ? $_POST['mainid'] : ""; 
 
//check first if reservation id exist in releases_to_broker database table else get records in buyer_payment_monitoring and reservation table
 
$mecon->query("SELECT Id, Contractor, Block, Lot, Units, DateIssued, DatePOIssued, ContractPrice, WHT, NetContractPrice, Details, ReleasesStatus, ReleasesRemarks, RetentionProcessed, RetentionCheck, EWTType FROM releases_to_contractor WHERE Status = :status AND Id = :id ORDER BY Id DESC"); //12AUG24 add RetentionCheck 
 
$mecon->bind(':status', 'active');
$mecon->bind(':id', $mainId);
$main = $mecon->resultset(); 
$counter = count($main); 
$arr1 = array();
$arr2 = array();
$arr3 = array(); 
$other = array(); 
$userType	=	$_SESSION['danvilles_user_type'];
for($a=0; $a<$counter; $a++){  
/********************/ 
$arr1['id']							= trim(html_entity_decode(stripslashes($main[$a]['Id']))); 
$arr1['fullname']					= trim(html_entity_decode(stripslashes($main[$a]['Contractor'])));  
$arr1['block']						= trim(html_entity_decode(stripslashes($main[$a]['Block']))); 
$arr1['lot']						= trim(html_entity_decode(stripslashes($main[$a]['Lot'])));   
$arr1['units']						= trim(html_entity_decode(stripslashes($main[$a]['Units'])));  
$arr1['releases_status']			= trim(html_entity_decode(stripslashes($main[$a]['ReleasesStatus'])));  
$arr1['releases_remarks']			= trim(html_entity_decode(stripslashes($main[$a]['ReleasesRemarks'])));   

$arr1['ewt_type']					= trim(html_entity_decode(stripslashes($main[$a]['EWTType'])));   


 
$arr1['date_po_issued']		= ($main[$a]['DatePOIssued']!='1970-01-01' && $main[$a]['DatePOIssued']!=NULL) ?  date('m/d/Y', strtotime($main[$a]['DatePOIssued'])) : '';  

$arr1['date_issued']		= ($main[$a]['DateIssued']!='1970-01-01' && $main[$a]['DateIssued']!=NULL) ?  date('m/d/Y', strtotime($main[$a]['DateIssued'])) : '';  

$arr1['retention_processed']		= ($main[$a]['RetentionProcessed']!='1970-01-01' && $main[$a]['RetentionProcessed']!=NULL) ?  date('m/d/Y', strtotime($main[$a]['RetentionProcessed'])) : '';  


$arr1['retention_check'] = ($main[$a]['RetentionCheck']!='' && $main[$a]['RetentionCheck']!=NULL) ? $main[$a]['RetentionCheck'] : '';  //12AUG24


$arr1['contract_price']				= trim(html_entity_decode(stripslashes($main[$a]['ContractPrice']))); 
$arr1['wht']						= trim(html_entity_decode(stripslashes($main[$a]['WHT']))); 
$arr1['net_contract_price']			= trim(html_entity_decode(stripslashes($main[$a]['NetContractPrice']))); 
$other								= unserialize($main[$a]['Details']);

$arr1['downpayment_checkbox'] 		= $other['downpayment_checkbox'];
$arr1['downpayment_recoup'] 		= $other['downpayment_recoup'];	
$arr1['downpayment_check'] 			= $other['downpayment_check'];	
$arr1['downpayment_date'] 			= date('m/d/Y', strtotime($other['downpayment_date'])); 
	

$arr1['first_checkbox'] 			= $other['first_checkbox'];
$arr1['first_percentage'] 			= $other['first_percentage'];	
$arr1['first_amount'] 				= (!empty($other['first_amount'])) 		? $other['first_amount'] 		: 0.00;	
$arr1['first_wht'] 					= (!empty($other['first_wht'])) 		? $other['first_wht'] 			: 0.00;		
$arr1['first_recoup'] 				= (!empty($other['first_recoup'])) 		? $other['first_recoup'] 		: 0.00;		
$arr1['first_retention'] 			= (!empty($other['first_retention'])) 	? $other['first_retention']		: 0.00;		
$arr1['first_electricity'] 			= (!empty($other['first_electricity'])) ? $other['first_electricity'] 	: 0.00;		
$arr1['first_others'] 				= (!empty($other['first_others'])) 		? $other['first_others'] 		: 0.00;		
$arr1['first_net'] 					= (!empty($other['first_net'])) 		? $other['first_net'] 			: 0.00;	
$arr1['first_water'] 				= (!empty($other['first_water'])) 		? $other['first_water'] 		: 0.00;		
$arr1['first_check'] 				= $other['first_check'];	
$arr1['first_date'] 				= ($other['first_date']!='1970-01-01') 	? date('m/d/Y', strtotime($other['first_date'])) : ''; 

$arr1['second_checkbox'] 			= $other['second_checkbox'];
$arr1['second_percentage'] 			= $other['second_percentage'];
$arr1['second_amount'] 				= (!empty($other['second_amount'])) 		? $other['second_amount'] 		: 0.00;	
$arr1['second_wht'] 				= (!empty($other['second_wht'])) 			? $other['second_wht'] 			: 0.00;		
$arr1['second_recoup'] 				= (!empty($other['second_recoup'])) 		? $other['second_recoup'] 		: 0.00;	
$arr1['second_retention'] 			= (!empty($other['second_retention'])) 		? $other['second_retention']	: 0.00;	
$arr1['second_electricity'] 		= (!empty($other['second_electricity'])) 	? $other['second_electricity'] 	: 0.00;	
$arr1['second_others'] 				= (!empty($other['second_others'])) 		? $other['second_others'] 		: 0.00;	
$arr1['second_net'] 				= (!empty($other['second_net'])) 			? $other['second_net'] 			: 0.00;
$arr1['second_water'] 				= (!empty($other['second_water'])) 		? $other['second_water'] 		: 0.00;		
$arr1['second_check'] 				= $other['second_check'];	
$arr1['second_date'] 				= ($other['second_date']!='1970-01-01') 	? date('m/d/Y', strtotime($other['second_date'])) : ''; 

$arr1['third_checkbox'] 			= $other['third_checkbox'];
$arr1['third_percentage'] 			= $other['third_percentage'];	
$arr1['third_amount'] 				= (!empty($other['third_amount'])) 			? $other['third_amount'] 		: 0.00;
$arr1['third_wht'] 					= (!empty($other['third_wht'])) 			? $other['third_wht'] 			: 0.00;
$arr1['third_recoup'] 				= (!empty($other['third_recoup'])) 			? $other['third_recoup']		: 0.00;
$arr1['third_retention'] 			= (!empty($other['third_retention'])) 		? $other['third_retention'] 	: 0.00;	
$arr1['third_electricity'] 			= (!empty($other['third_electricity'])) 	? $other['third_electricity']	: 0.00;	
$arr1['third_others'] 				= (!empty($other['third_others'])) 			? $other['third_others'] 		: 0.00;
$arr1['third_net'] 					= (!empty($other['third_net'])) 			? $other['third_net'] 			: 0.00;
$arr1['third_water'] 				= (!empty($other['third_water'])) 		? $other['third_water'] 		: 0.00;		
$arr1['third_check'] 				= $other['third_check'];
$arr1['third_date'] 				= ($other['third_date']!='1970-01-01') 		? date('m/d/Y', strtotime($other['third_date'])) : '';  
								  
$arr1['fourth_checkbox'] 			= $other['fourth_checkbox'];
$arr1['fourth_percentage'] 			= $other['fourth_percentage'];	
$arr1['fourth_amount'] 				= (!empty($other['fourth_amount'])) 		? $other['fourth_amount'] 		: 0.00;	
$arr1['fourth_wht'] 				= (!empty($other['fourth_wht'])) 			? $other['fourth_wht'] 			: 0.00;
$arr1['fourth_recoup'] 				= (!empty($other['fourth_recoup'])) 		? $other['fourth_recoup'] 		: 0.00;
$arr1['fourth_retention'] 			= (!empty($other['fourth_retention'])) 		? $other['fourth_retention'] 	: 0.00;
$arr1['fourth_electricity'] 		= (!empty($other['fourth_electricity'])) 	? $other['fourth_electricity'] 	: 0.00;
$arr1['fourth_others'] 				= (!empty($other['fourth_others'])) 		? $other['fourth_others'] 		: 0.00;
$arr1['fourth_net'] 				= (!empty($other['fourth_net'])) 			? $other['fourth_net'] 			: 0.00;
$arr1['fourth_date'] 				= ($other['fourth_date']!='1970-01-01') 	?  date('m/d/Y', strtotime($other['fourth_date'])) : ''; 
$arr1['fourth_water'] 				= (!empty($other['fourth_water'])) 		? $other['fourth_water'] 		: 0.00;		
$arr1['fourth_check'] 				= $other['fourth_check'];

$arr1['fifth_checkbox'] 			= $other['fifth_checkbox'];
$arr1['fifth_percentage'] 			= $other['fifth_percentage'];	
$arr1['fifth_amount'] 				= (!empty($other['fifth_amount'])) 			? $other['fifth_amount']		: 0.00;	
$arr1['fifth_wht'] 					= (!empty($other['fifth_wht'])) 			? $other['fifth_wht']			: 0.00;	
$arr1['fifth_recoup'] 				= (!empty($other['fifth_recoup'])) 			? $other['fifth_recoup']		: 0.00;		
$arr1['fifth_retention'] 			= (!empty($other['fifth_retention'])) 		? $other['fifth_retention']		: 0.00;		
$arr1['fifth_electricity'] 			= (!empty($other['fifth_electricity'])) 	? $other['fifth_electricity']	: 0.00;		
$arr1['fifth_others'] 				= (!empty($other['fifth_others'])) 			? $other['fifth_others']		: 0.00;		
$arr1['fifth_net'] 					= (!empty($other['fifth_net'])) 			? $other['fifth_net']			: 0.00;		
$arr1['fifth_date'] 				= ($other['fifth_date']!='1970-01-01') ?  date('m/d/Y', strtotime($other['fifth_date'])) : '';  
$arr1['fifth_water'] 				= (!empty($other['fifth_water'])) 		? $other['fifth_water'] 		: 0.00;		
$arr1['fifth_check'] 				= $other['fifth_check'];

$arr1['sixth_checkbox'] 			= $other['sixth_checkbox'];
$arr1['sixth_percentage'] 			= $other['sixth_percentage'];	
$arr1['sixth_amount'] 				= (!empty($other['sixth_amount'])) 			? $other['sixth_amount']		: 0.00;			
$arr1['sixth_wht'] 					= (!empty($other['sixth_wht'])) 			? $other['sixth_wht']			: 0.00;			
$arr1['sixth_recoup'] 				= (!empty($other['sixth_recoup'])) 			? $other['sixth_recoup']		: 0.00;			
$arr1['sixth_retention'] 			= (!empty($other['sixth_retention'])) 		? $other['sixth_retention']		: 0.00;			
$arr1['sixth_electricity'] 			= (!empty($other['sixth_electricity'])) 	? $other['sixth_electricity']	: 0.00;			
$arr1['sixth_others'] 				= (!empty($other['sixth_others'])) 			? $other['sixth_others']		: 0.00;			
$arr1['sixth_net'] 					= (!empty($other['sixth_net'])) 			? $other['sixth_net']			: 0.00;			
$arr1['sixth_date'] 				= ($other['sixth_date']!='1970-01-01') ?  date('m/d/Y', strtotime($other['sixth_date'])) : ''; 
$arr1['sixth_water'] 				= (!empty($other['sixth_water'])) 		? $other['sixth_water'] 		: 0.00;		
$arr1['sixth_check'] 				= $other['sixth_check'];

$arr1['seventh_checkbox'] 			= $other['seventh_checkbox'];
$arr1['seventh_percentage'] 		= $other['seventh_percentage'];	
$arr1['seventh_amount'] 			= (!empty($other['seventh_amount'])) 		? $other['seventh_amount']			: 0.00;	
$arr1['seventh_wht'] 				= (!empty($other['seventh_wht'])) 			? $other['seventh_wht']				: 0.00;	
$arr1['seventh_recoup'] 			= (!empty($other['seventh_recoup'])) 		? $other['seventh_recoup']			: 0.00;	
$arr1['seventh_retention'] 			= (!empty($other['seventh_retention'])) 	? $other['seventh_retention']		: 0.00;	
$arr1['seventh_electricity'] 		= (!empty($other['seventh_electricity'])) 	? $other['seventh_electricity']		: 0.00;	
$arr1['seventh_others'] 			= (!empty($other['seventh_others'])) 		? $other['seventh_others']			: 0.00;	
$arr1['seventh_net'] 				= (!empty($other['seventh_net'])) 			? $other['seventh_net']				: 0.00;	
$arr1['seventh_date'] 				= ($other['seventh_date']!='1970-01-01') ?  date('m/d/Y', strtotime($other['seventh_date'])) : '';  
$arr1['seventh_water'] 				= (!empty($other['seventh_water'])) 		? $other['seventh_water'] 		: 0.00;		
$arr1['seventh_check'] 				= $other['seventh_check'];

$arr1['eight_checkbox'] 			= $other['eight_checkbox'];
$arr1['eight_percentage'] 			= $other['eight_percentage'];	
$arr1['eight_amount'] 				= (!empty($other['eight_amount'])) 			? $other['eight_amount']			: 0.00;		
$arr1['eight_wht'] 					= (!empty($other['eight_wht'])) 			? $other['eight_wht']				: 0.00;	
$arr1['eight_recoup'] 				= (!empty($other['eight_recoup'])) 			? $other['eight_recoup']			: 0.00;	
$arr1['eight_retention'] 			= (!empty($other['eight_retention'])) 		? $other['eight_retention']			: 0.00;	
$arr1['eight_electricity'] 			= (!empty($other['eight_electricity'])) 	? $other['eight_electricity']		: 0.00;	
$arr1['eight_others'] 				= (!empty($other['eight_others'])) 			? $other['eight_others']			: 0.00;		
$arr1['eight_net'] 					= (!empty($other['eight_net'])) 			? $other['eight_net']				: 0.00;	
$arr1['eight_date'] 				= ($other['eight_date']!='1970-01-01') ?  date('m/d/Y', strtotime($other['eight_date'])) : ''; 
$arr1['eight_water'] 				= (!empty($other['eight_water'])) 		? $other['eight_water'] 		: 0.00;		
$arr1['eight_check'] 				= $other['eight_check'];

$arr1['nine_checkbox'] 				= $other['nine_checkbox'];
$arr1['nine_percentage'] 			= $other['nine_percentage'];	
$arr1['nine_amount'] 				= (!empty($other['nine_amount'])) 			? $other['nine_amount']			: 0.00;		
$arr1['nine_wht'] 					= (!empty($other['nine_wht'])) 				? $other['nine_wht']			: 0.00;		
$arr1['nine_recoup'] 				= (!empty($other['nine_recoup'])) 			? $other['nine_recoup']			: 0.00;			
$arr1['nine_retention'] 			= (!empty($other['nine_retention'])) 		? $other['nine_retention']		: 0.00;		
$arr1['nine_electricity'] 			= (!empty($other['nine_electricity'])) 		? $other['nine_electricity']	: 0.00;		
$arr1['nine_others'] 				= (!empty($other['nine_others'])) 			? $other['nine_others']			: 0.00;			
$arr1['nine_net'] 					= (!empty($other['nine_net'])) 				? $other['nine_net']			: 0.00;			
$arr1['nine_date'] 					= ($other['nine_date']!='1970-01-01') ?  date('m/d/Y', strtotime($other['nine_date'])) : ''; 
$arr1['nine_water'] 				= (!empty($other['nine_water'])) 		? $other['nine_water'] 		: 0.00;		
$arr1['nine_check'] 				= $other['nine_check'];

$arr1['ten_checkbox'] 				= $other['ten_checkbox'];
$arr1['ten_percentage'] 			= $other['ten_percentage'];	
$arr1['ten_amount'] 				= (!empty($other['ten_amount'])) 			? $other['ten_amount']			: 0.00;		
$arr1['ten_wht'] 					= (!empty($other['ten_wht'])) 				? $other['ten_wht']				: 0.00;	
$arr1['ten_recoup'] 				= (!empty($other['ten_recoup'])) 			? $other['ten_recoup']			: 0.00;	
$arr1['ten_retention'] 				= (!empty($other['ten_retention'])) 		? $other['ten_retention']		: 0.00;	
$arr1['ten_electricity'] 			= (!empty($other['ten_electricity'])) 		? $other['ten_electricity']		: 0.00;	
$arr1['ten_others'] 				= (!empty($other['ten_others'])) 			? $other['ten_others']			: 0.00;		
$arr1['ten_net'] 					= (!empty($other['ten_net'])) 				? $other['ten_net']				: 0.00;		
$arr1['ten_date'] 					= ($other['ten_date']!='1970-01-01') ?  date('m/d/Y', strtotime($other['ten_date'])) : '';   
$arr1['ten_water'] 					= (!empty($other['ten_water'])) 		? $other['ten_water'] 		: 0.00;		
$arr1['ten_check'] 					= $other['ten_check'];


$arr1['eleven_checkbox'] 			= $other['eleven_checkbox'];
$arr1['eleven_percentage'] 			= $other['eleven_percentage'];	
$arr1['eleven_amount'] 				= (!empty($other['eleven_amount'])) 			? $other['eleven_amount']			: 0.00;		
$arr1['eleven_wht'] 				= (!empty($other['eleven_wht'])) 				? $other['eleven_wht']			: 0.00;		
$arr1['eleven_recoup'] 				= (!empty($other['eleven_recoup'])) 			? $other['eleven_recoup']			: 0.00;			
$arr1['eleven_retention'] 			= (!empty($other['eleven_retention'])) 			? $other['eleven_retention']		: 0.00;		
$arr1['eleven_electricity'] 		= (!empty($other['eleven_electricity'])) 		? $other['eleven_electricity']	: 0.00;		
$arr1['eleven_others'] 				= (!empty($other['eleven_others'])) 			? $other['eleven_others']			: 0.00;			
$arr1['eleven_net'] 				= (!empty($other['eleven_net'])) 				? $other['eleven_net']			: 0.00;			
$arr1['eleven_date'] 				= ($other['eleven_date']!='1970-01-01') ?  date('m/d/Y', strtotime($other['eleven_date'])) : ''; 
$arr1['eleven_water'] 				= (!empty($other['eleven_water'])) 		? $other['eleven_water'] 		: 0.00;		
$arr1['eleven_check'] 				= $other['eleven_check'];



$arr1['twelve_checkbox'] 				= $other['twelve_checkbox'];
$arr1['twelve_percentage'] 			= $other['twelve_percentage'];	
$arr1['twelve_amount'] 				= (!empty($other['twelve_amount'])) 			? $other['twelve_amount']			: 0.00;		
$arr1['twelve_wht'] 					= (!empty($other['twelve_wht'])) 				? $other['twelve_wht']				: 0.00;	
$arr1['twelve_recoup'] 				= (!empty($other['twelve_recoup'])) 			? $other['twelve_recoup']			: 0.00;	
$arr1['twelve_retention'] 				= (!empty($other['twelve_retention'])) 		? $other['twelve_retention']		: 0.00;	
$arr1['twelve_electricity'] 			= (!empty($other['twelve_electricity'])) 		? $other['twelve_electricity']		: 0.00;	
$arr1['twelve_others'] 				= (!empty($other['twelve_others'])) 			? $other['twelve_others']			: 0.00;		
$arr1['twelve_net'] 					= (!empty($other['twelve_net'])) 				? $other['twelve_net']				: 0.00;		
$arr1['twelve_date'] 					= ($other['twelve_date']!='1970-01-01') ?  date('m/d/Y', strtotime($other['twelve_date'])) : '';   
$arr1['twelve_water'] 					= (!empty($other['twelve_water'])) 		? $other['twelve_water'] 		: 0.00;		
$arr1['twelve_check'] 					= $other['twelve_check'];


$arr1['thirteen_checkbox'] 				= $other['thirteen_checkbox'];
$arr1['thirteen_percentage'] 			= $other['thirteen_percentage'];	
$arr1['thirteen_amount'] 				= (!empty($other['thirteen_amount'])) 			? $other['thirteen_amount']			: 0.00;		
$arr1['thirteen_wht'] 					= (!empty($other['thirteen_wht'])) 				? $other['thirteen_wht']			: 0.00;		
$arr1['thirteen_recoup'] 				= (!empty($other['thirteen_recoup'])) 			? $other['thirteen_recoup']			: 0.00;			
$arr1['thirteen_retention'] 			= (!empty($other['thirteen_retention'])) 		? $other['thirteen_retention']		: 0.00;		
$arr1['thirteen_electricity'] 			= (!empty($other['thirteen_electricity'])) 		? $other['thirteen_electricity']	: 0.00;		
$arr1['thirteen_others'] 				= (!empty($other['thirteen_others'])) 			? $other['thirteen_others']			: 0.00;			
$arr1['thirteen_net'] 					= (!empty($other['thirteen_net'])) 				? $other['thirteen_net']			: 0.00;			
$arr1['thirteen_date'] 					= ($other['thirteen_date']!='1970-01-01') ?  date('m/d/Y', strtotime($other['thirteen_date'])) : ''; 
$arr1['thirteen_water'] 				= (!empty($other['thirteen_water'])) 		? $other['thirteen_water'] 		: 0.00;		
$arr1['thirteen_check'] 				= $other['thirteen_check'];


$arr1['fourteen_checkbox'] 				= $other['fourteen_checkbox'];
$arr1['fourteen_percentage'] 			= $other['fourteen_percentage'];	
$arr1['fourteen_amount'] 				= (!empty($other['fourteen_amount'])) 			? $other['fourteen_amount']			: 0.00;		
$arr1['fourteen_wht'] 					= (!empty($other['fourteen_wht'])) 				? $other['fourteen_wht']			: 0.00;		
$arr1['fourteen_recoup'] 				= (!empty($other['fourteen_recoup'])) 			? $other['fourteen_recoup']			: 0.00;			
$arr1['fourteen_retention'] 			= (!empty($other['fourteen_retention'])) 		? $other['fourteen_retention']		: 0.00;		
$arr1['fourteen_electricity'] 			= (!empty($other['fourteen_electricity'])) 		? $other['fourteen_electricity']	: 0.00;		
$arr1['fourteen_others'] 				= (!empty($other['fourteen_others'])) 			? $other['fourteen_others']			: 0.00;			
$arr1['fourteen_net'] 					= (!empty($other['fourteen_net'])) 				? $other['fourteen_net']			: 0.00;			
$arr1['fourteen_date'] 					= ($other['fourteen_date']!='1970-01-01') ?  date('m/d/Y', strtotime($other['fourteen_date'])) : ''; 
$arr1['fourteen_water'] 				= (!empty($other['fourteen_water'])) 		? $other['fourteen_water'] 		: 0.00;		
$arr1['fourteen_check'] 				= $other['fourteen_check'];



$arr1['fifteen_checkbox'] 				= $other['fifteen_checkbox'];
$arr1['fifteen_percentage'] 			= $other['fifteen_percentage'];	
$arr1['fifteen_amount'] 				= (!empty($other['fifteen_amount'])) 			? $other['fifteen_amount']			: 0.00;		
$arr1['fifteen_wht'] 					= (!empty($other['fifteen_wht'])) 				? $other['fifteen_wht']				: 0.00;	
$arr1['fifteen_recoup'] 				= (!empty($other['fifteen_recoup'])) 			? $other['fifteen_recoup']			: 0.00;	
$arr1['fifteen_retention'] 				= (!empty($other['fifteen_retention'])) 		? $other['fifteen_retention']		: 0.00;	
$arr1['fifteen_electricity'] 			= (!empty($other['fifteen_electricity'])) 		? $other['fifteen_electricity']		: 0.00;	
$arr1['fifteen_others'] 				= (!empty($other['fifteen_others'])) 			? $other['fifteen_others']			: 0.00;		
$arr1['fifteen_net'] 					= (!empty($other['fifteen_net'])) 				? $other['fifteen_net']				: 0.00;		
$arr1['fifteen_date'] 					= ($other['fifteen_date']!='1970-01-01') ?  date('m/d/Y', strtotime($other['fifteen_date'])) : '';   
$arr1['fifteen_water'] 					= (!empty($other['fifteen_water'])) 		? $other['fifteen_water'] 		: 0.00;		
$arr1['fifteen_check'] 					= $other['fifteen_check'];


$arr1['sixteen_checkbox'] 				= $other['sixteen_checkbox'];
$arr1['sixteen_percentage'] 			= $other['sixteen_percentage'];	
$arr1['sixteen_amount'] 				= (!empty($other['sixteen_amount'])) 			? $other['sixteen_amount']			: 0.00;		
$arr1['sixteen_wht'] 					= (!empty($other['sixteen_wht'])) 				? $other['sixteen_wht']			: 0.00;		
$arr1['sixteen_recoup'] 				= (!empty($other['sixteen_recoup'])) 			? $other['sixteen_recoup']			: 0.00;			
$arr1['sixteen_retention'] 			= (!empty($other['sixteen_retention'])) 		? $other['sixteen_retention']		: 0.00;		
$arr1['sixteen_electricity'] 			= (!empty($other['sixteen_electricity'])) 		? $other['sixteen_electricity']	: 0.00;		
$arr1['sixteen_others'] 				= (!empty($other['sixteen_others'])) 			? $other['sixteen_others']			: 0.00;			
$arr1['sixteen_net'] 					= (!empty($other['sixteen_net'])) 				? $other['sixteen_net']			: 0.00;			
$arr1['sixteen_date'] 					= ($other['sixteen_date']!='1970-01-01') ?  date('m/d/Y', strtotime($other['sixteen_date'])) : ''; 
$arr1['sixteen_water'] 				= (!empty($other['sixteen_water'])) 		? $other['sixteen_water'] 		: 0.00;		
$arr1['sixteen_check'] 				= $other['sixteen_check'];



$arr1['seventeen_checkbox'] 				= $other['seventeen_checkbox'];
$arr1['seventeen_percentage'] 			= $other['seventeen_percentage'];	
$arr1['seventeen_amount'] 				= (!empty($other['seventeen_amount'])) 			? $other['seventeen_amount']			: 0.00;		
$arr1['seventeen_wht'] 					= (!empty($other['seventeen_wht'])) 				? $other['seventeen_wht']			: 0.00;		
$arr1['seventeen_recoup'] 				= (!empty($other['seventeen_recoup'])) 			? $other['seventeen_recoup']			: 0.00;			
$arr1['seventeen_retention'] 			= (!empty($other['seventeen_retention'])) 		? $other['seventeen_retention']		: 0.00;		
$arr1['seventeen_electricity'] 			= (!empty($other['seventeen_electricity'])) 		? $other['seventeen_electricity']	: 0.00;		
$arr1['seventeen_others'] 				= (!empty($other['seventeen_others'])) 			? $other['seventeen_others']			: 0.00;			
$arr1['seventeen_net'] 					= (!empty($other['seventeen_net'])) 				? $other['seventeen_net']			: 0.00;			
$arr1['seventeen_date'] 					= ($other['seventeen_date']!='1970-01-01') ?  date('m/d/Y', strtotime($other['seventeen_date'])) : ''; 
$arr1['seventeen_water'] 				= (!empty($other['seventeen_water'])) 		? $other['seventeen_water'] 		: 0.00;		
$arr1['seventeen_check'] 				= $other['seventeen_check'];



$arr1['eighteen_checkbox'] 				= $other['eighteen_checkbox'];
$arr1['eighteen_percentage'] 			= $other['eighteen_percentage'];	
$arr1['eighteen_amount'] 				= (!empty($other['eighteen_amount'])) 			? $other['eighteen_amount']			: 0.00;		
$arr1['eighteen_wht'] 					= (!empty($other['eighteen_wht'])) 				? $other['eighteen_wht']				: 0.00;	
$arr1['eighteen_recoup'] 				= (!empty($other['eighteen_recoup'])) 			? $other['eighteen_recoup']			: 0.00;	
$arr1['eighteen_retention'] 				= (!empty($other['eighteen_retention'])) 		? $other['eighteen_retention']		: 0.00;	
$arr1['eighteen_electricity'] 			= (!empty($other['eighteen_electricity'])) 		? $other['eighteen_electricity']		: 0.00;	
$arr1['eighteen_others'] 				= (!empty($other['eighteen_others'])) 			? $other['eighteen_others']			: 0.00;		
$arr1['eighteen_net'] 					= (!empty($other['eighteen_net'])) 				? $other['eighteen_net']				: 0.00;		
$arr1['eighteen_date'] 					= ($other['eighteen_date']!='1970-01-01') ?  date('m/d/Y', strtotime($other['eighteen_date'])) : '';   
$arr1['eighteen_water'] 					= (!empty($other['eighteen_water'])) 		? $other['eighteen_water'] 		: 0.00;		
$arr1['eighteen_check'] 					= $other['eighteen_check'];


$arr1['nineteen_checkbox'] 				= $other['nineteen_checkbox'];
$arr1['nineteen_percentage'] 			= $other['nineteen_percentage'];	
$arr1['nineteen_amount'] 				= (!empty($other['nineteen_amount'])) 			? $other['nineteen_amount']			: 0.00;		
$arr1['nineteen_wht'] 					= (!empty($other['nineteen_wht'])) 				? $other['nineteen_wht']			: 0.00;		
$arr1['nineteen_recoup'] 				= (!empty($other['nineteen_recoup'])) 			? $other['nineteen_recoup']			: 0.00;			
$arr1['nineteen_retention'] 			= (!empty($other['nineteen_retention'])) 		? $other['nineteen_retention']		: 0.00;		
$arr1['nineteen_electricity'] 			= (!empty($other['nineteen_electricity'])) 		? $other['nineteen_electricity']	: 0.00;		
$arr1['nineteen_others'] 				= (!empty($other['nineteen_others'])) 			? $other['nineteen_others']			: 0.00;			
$arr1['nineteen_net'] 					= (!empty($other['nineteen_net'])) 				? $other['nineteen_net']			: 0.00;			
$arr1['nineteen_date'] 					= ($other['nineteen_date']!='1970-01-01') ?  date('m/d/Y', strtotime($other['nineteen_date'])) : ''; 
$arr1['nineteen_water'] 				= (!empty($other['nineteen_water'])) 		? $other['nineteen_water'] 		: 0.00;		
$arr1['nineteen_check'] 				= $other['nineteen_check'];



$arr1['twenty_checkbox'] 				= $other['twenty_checkbox'];
$arr1['twenty_percentage'] 			= $other['twenty_percentage'];	
$arr1['twenty_amount'] 				= (!empty($other['twenty_amount'])) 			? $other['twenty_amount']			: 0.00;		
$arr1['twenty_wht'] 					= (!empty($other['twenty_wht'])) 				? $other['twenty_wht']			: 0.00;		
$arr1['twenty_recoup'] 				= (!empty($other['twenty_recoup'])) 			? $other['twenty_recoup']			: 0.00;			
$arr1['twenty_retention'] 			= (!empty($other['twenty_retention'])) 		? $other['twenty_retention']		: 0.00;		
$arr1['twenty_electricity'] 			= (!empty($other['twenty_electricity'])) 		? $other['twenty_electricity']	: 0.00;		
$arr1['twenty_others'] 				= (!empty($other['twenty_others'])) 			? $other['twenty_others']			: 0.00;			
$arr1['twenty_net'] 					= (!empty($other['twenty_net'])) 				? $other['twenty_net']			: 0.00;			
$arr1['twenty_date'] 					= ($other['twenty_date']!='1970-01-01') ?  date('m/d/Y', strtotime($other['twenty_date'])) : ''; 
$arr1['twenty_water'] 				= (!empty($other['twenty_water'])) 		? $other['twenty_water'] 		: 0.00;		
$arr1['twenty_check'] 				= $other['twenty_check'];





$arr1['total_percentage'] 			= $other['total_percentage'];	
$arr1['total_amount'] 				= (!empty($other['total_amount'])) 			? $other['total_amount']			: 0.00;		
$arr1['total_wht'] 					= (!empty($other['total_wht'])) 			? $other['total_wht']				: 0.00;	
$arr1['total_recoup'] 				= (!empty($other['total_recoup'])) 			? $other['total_recoup']			: 0.00;	
$arr1['total_retention'] 				= (!empty($other['total_retention'])) 	? $other['total_retention']			: 0.00;	
$arr1['total_electricity'] 			= (!empty($other['total_electricity'])) 	? $other['total_electricity']		: 0.00;	
$arr1['total_water'] 				= (!empty($other['total_water'])) 	? $other['total_water']		: 0.00;	
$arr1['total_others'] 				= (!empty($other['total_others'])) 			? $other['total_others']			: 0.00;		
$arr1['total_net'] 					= (!empty($other['total_net'])) 			? $other['total_net']				: 0.00;		

$arr1['balance_amount'] 			= (!empty($other['balance_amount'])) 		? $other['balance_amount']			: 0.00;	
$arr1['balance_wht'] 				= (!empty($other['balance_wht'])) 			? $other['balance_wht']				: 0.00;		
$arr1['balance_recoup'] 			= (!empty($other['balance_recoup'])) 		? $other['balance_recoup']			: 0.00;		

	$arr2[] = $arr1;
}
$arr3['data'] = $arr2;
echo json_encode($arr3); 
exit();
ob_end_flush();

