<?php
error_reporting(0); //7dec25
ob_start("ob_gzhandler");
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();
$utility			=	new utilityClass(); 
$task				= 	isset($_POST['action'])		? trim($_POST['action']) : "";
$mainid				= 	isset($_POST['mainid'])		? trim($_POST['mainid']) : "";
 
 
$contractor				= 	isset($_POST['contractor']) 	? trim(strip_tags($_POST['contractor'])) : ""; 
$block					= 	isset($_POST['block']) 			? trim(strip_tags($_POST['block'])) : ""; 
$lot					= 	isset($_POST['lot']) 			? trim(strip_tags($_POST['lot'])) : ""; 
$number_units			= 	isset($_POST['number_units']) 	? trim(strip_tags($_POST['number_units'])) : ""; 
$po_issued				= 	isset($_POST['po_issued']) 		? trim(strip_tags($_POST['po_issued'])) : ""; 
$date_issued			= 	isset($_POST['date_issued']) 		? trim(strip_tags($_POST['date_issued'])) : ""; 
$retention_processed	= 	isset($_POST['retention_processed']) 		? trim(strip_tags($_POST['retention_processed'])) : ""; 


$retention_check		= 	isset($_POST['retention_check']) 		? trim(strip_tags($_POST['retention_check'])) : "";  //12AUG24


$contract_price			= 	isset($_POST['contract_price']) 	? trim(strip_tags($_POST['contract_price'])) : ""; 
$withholding_tax		= 	isset($_POST['withholding_tax']) 	? trim(strip_tags($_POST['withholding_tax'])) : ""; 
$net_contract_price		= 	isset($_POST['net_contract_price']) 	? trim(strip_tags($_POST['net_contract_price'])) : ""; 
$downpayment_checkbox	= 	isset($_POST['downpayment_checkbox']) 	? trim(strip_tags($_POST['downpayment_checkbox'])) : ""; 
$downpayment_recoup		= 	isset($_POST['downpayment_recoup']) 	? trim(strip_tags($_POST['downpayment_recoup'])) : ""; 
$downpayment_date		= 	isset($_POST['downpayment_date']) 		? trim(strip_tags($_POST['downpayment_date'])) : ""; 
   
$first_checkbox			= 	isset($_POST['first_checkbox']) 		? trim(strip_tags($_POST['first_checkbox'])) : ""; 
$first_percentage		= 	isset($_POST['first_percentage']) 		? trim(strip_tags($_POST['first_percentage'])) : ""; 
$first_amount			= 	isset($_POST['first_amount']) 			? trim(strip_tags($_POST['first_amount'])) : ""; 
$first_wht				= 	isset($_POST['first_wht']) 				? trim(strip_tags($_POST['first_wht'])) : ""; 
$first_recoup			= 	isset($_POST['first_recoup']) 			? trim(strip_tags($_POST['first_recoup'])) : ""; 
$first_retention		= 	isset($_POST['first_retention']) 		? trim(strip_tags($_POST['first_retention'])) : ""; 
$first_electricity		= 	isset($_POST['first_electricity']) 		? trim(strip_tags($_POST['first_electricity'])) : ""; 
$first_others			= 	isset($_POST['first_others']) 			? trim(strip_tags($_POST['first_others'])) : ""; 
$first_net				= 	isset($_POST['first_net']) 				? trim(strip_tags($_POST['first_net'])) : ""; 
$first_date				= 	isset($_POST['first_date']) 			? trim(strip_tags($_POST['first_date'])) : ""; 

$second_checkbox		= 	isset($_POST['second_checkbox']) 		? trim(strip_tags($_POST['second_checkbox'])) : ""; 
$second_percentage		= 	isset($_POST['second_percentage']) 		? trim(strip_tags($_POST['second_percentage'])) : ""; 
$second_amount			= 	isset($_POST['second_amount']) 			? trim(strip_tags($_POST['second_amount'])) : ""; 
$second_wht				= 	isset($_POST['second_wht']) 			? trim(strip_tags($_POST['second_wht'])) : ""; 
$second_recoup			= 	isset($_POST['second_recoup']) 			? trim(strip_tags($_POST['second_recoup'])) : ""; 
$second_retention		= 	isset($_POST['second_retention']) 		? trim(strip_tags($_POST['second_retention'])) : ""; 
$second_electricity		= 	isset($_POST['second_electricity']) 	? trim(strip_tags($_POST['second_electricity'])) : ""; 
$second_others			= 	isset($_POST['second_others']) 			? trim(strip_tags($_POST['second_others'])) : ""; 
$second_net				= 	isset($_POST['second_net']) 			? trim(strip_tags($_POST['second_net'])) : ""; 
$second_date			= 	isset($_POST['second_date']) 			? trim(strip_tags($_POST['second_date'])) : ""; 

$third_checkbox			= 	isset($_POST['third_checkbox']) 		? trim(strip_tags($_POST['third_checkbox'])) : ""; 
$third_percentage		= 	isset($_POST['third_percentage']) 		? trim(strip_tags($_POST['third_percentage'])) : ""; 
$third_amount			= 	isset($_POST['third_amount']) 			? trim(strip_tags($_POST['third_amount'])) : ""; 
$third_wht				= 	isset($_POST['third_wht']) 				? trim(strip_tags($_POST['third_wht'])) : ""; 
$third_recoup			= 	isset($_POST['third_recoup']) 			? trim(strip_tags($_POST['third_recoup'])) : ""; 
$third_retention		= 	isset($_POST['third_retention']) 		? trim(strip_tags($_POST['third_retention'])) : ""; 
$third_electricity		= 	isset($_POST['third_electricity']) 		? trim(strip_tags($_POST['third_electricity'])) : ""; 
$third_others			= 	isset($_POST['third_others']) 			? trim(strip_tags($_POST['third_others'])) : ""; 
$third_net				= 	isset($_POST['third_net']) 				? trim(strip_tags($_POST['third_net'])) : ""; 
$third_date				= 	isset($_POST['third_date']) 			? trim(strip_tags($_POST['third_date'])) : ""; 

$fourth_checkbox		= 	isset($_POST['fourth_checkbox']) 		? trim(strip_tags($_POST['fourth_checkbox'])) : ""; 
$fourth_percentage		= 	isset($_POST['fourth_percentage']) 		? trim(strip_tags($_POST['fourth_percentage'])) : ""; 
$fourth_amount			= 	isset($_POST['fourth_amount']) 			? trim(strip_tags($_POST['fourth_amount'])) : ""; 
$fourth_wht				= 	isset($_POST['fourth_wht']) 			? trim(strip_tags($_POST['fourth_wht'])) : ""; 
$fourth_recoup			= 	isset($_POST['fourth_recoup']) 			? trim(strip_tags($_POST['fourth_recoup'])) : ""; 
$fourth_retention		= 	isset($_POST['fourth_retention']) 		? trim(strip_tags($_POST['fourth_retention'])) : ""; 
$fourth_electricity		= 	isset($_POST['fourth_electricity']) 	? trim(strip_tags($_POST['fourth_electricity'])) : ""; 
$fourth_others			= 	isset($_POST['fourth_others']) 			? trim(strip_tags($_POST['fourth_others'])) : ""; 
$fourth_net				= 	isset($_POST['fourth_net']) 			? trim(strip_tags($_POST['fourth_net'])) : ""; 
$fourth_date			= 	isset($_POST['fourth_date']) 			? trim(strip_tags($_POST['fourth_date'])) : ""; 

$fifth_checkbox			= 	isset($_POST['fifth_checkbox']) 		? trim(strip_tags($_POST['fifth_checkbox'])) : ""; 
$fifth_percentage		= 	isset($_POST['fifth_percentage']) 		? trim(strip_tags($_POST['fifth_percentage'])) : ""; 
$fifth_amount			= 	isset($_POST['fifth_amount']) 			? trim(strip_tags($_POST['fifth_amount'])) : ""; 
$fifth_wht				= 	isset($_POST['fifth_wht']) 				? trim(strip_tags($_POST['fifth_wht'])) : ""; 
$fifth_recoup			= 	isset($_POST['fifth_recoup']) 			? trim(strip_tags($_POST['fifth_recoup'])) : ""; 
$fifth_retention		= 	isset($_POST['fifth_retention']) 		? trim(strip_tags($_POST['fifth_retention'])) : ""; 
$fifth_electricity		= 	isset($_POST['fifth_electricity']) 		? trim(strip_tags($_POST['fifth_electricity'])) : ""; 
$fifth_others			= 	isset($_POST['fifth_others']) 			? trim(strip_tags($_POST['fifth_others'])) : ""; 
$fifth_net				= 	isset($_POST['fifth_net']) 				? trim(strip_tags($_POST['fifth_net'])) : ""; 
$fifth_date				= 	isset($_POST['fifth_date']) 			? trim(strip_tags($_POST['fifth_date'])) : ""; 

$sixth_checkbox			= 	isset($_POST['sixth_checkbox']) 		? trim(strip_tags($_POST['sixth_checkbox'])) : ""; 
$sixth_percentage		= 	isset($_POST['sixth_percentage']) 		? trim(strip_tags($_POST['sixth_percentage'])) : ""; 
$sixth_amount			= 	isset($_POST['sixth_amount']) 			? trim(strip_tags($_POST['sixth_amount'])) : ""; 
$sixth_wht				= 	isset($_POST['sixth_wht']) 				? trim(strip_tags($_POST['sixth_wht'])) : ""; 
$sixth_recoup			= 	isset($_POST['sixth_recoup']) 			? trim(strip_tags($_POST['sixth_recoup'])) : ""; 
$sixth_retention		= 	isset($_POST['sixth_retention']) 		? trim(strip_tags($_POST['sixth_retention'])) : ""; 
$sixth_electricity		= 	isset($_POST['sixth_electricity']) 		? trim(strip_tags($_POST['sixth_electricity'])) : ""; 
$sixth_others			= 	isset($_POST['sixth_others']) 			? trim(strip_tags($_POST['sixth_others'])) : ""; 
$sixth_net				= 	isset($_POST['sixth_net']) 				? trim(strip_tags($_POST['sixth_net'])) : ""; 
$sixth_date				= 	isset($_POST['sixth_date']) 			? trim(strip_tags($_POST['sixth_date'])) : ""; 

$seventh_checkbox		= 	isset($_POST['seventh_checkbox']) 		? trim(strip_tags($_POST['seventh_checkbox'])) : ""; 
$seventh_percentage		= 	isset($_POST['seventh_percentage']) 	? trim(strip_tags($_POST['seventh_percentage'])) : ""; 
$seventh_amount			= 	isset($_POST['seventh_amount']) 		? trim(strip_tags($_POST['seventh_amount'])) : ""; 
$seventh_wht			= 	isset($_POST['seventh_wht']) 			? trim(strip_tags($_POST['seventh_wht'])) : ""; 
$seventh_recoup			= 	isset($_POST['seventh_recoup']) 		? trim(strip_tags($_POST['seventh_recoup'])) : ""; 
$seventh_retention		= 	isset($_POST['seventh_retention']) 		? trim(strip_tags($_POST['seventh_retention'])) : ""; 
$seventh_electricity	= 	isset($_POST['seventh_electricity']) 	? trim(strip_tags($_POST['seventh_electricity'])) : ""; 
$seventh_others			= 	isset($_POST['seventh_others']) 		? trim(strip_tags($_POST['seventh_others'])) : ""; 
$seventh_net			= 	isset($_POST['seventh_net']) 			? trim(strip_tags($_POST['seventh_net'])) : ""; 
$seventh_date			= 	isset($_POST['seventh_date']) 			? trim(strip_tags($_POST['seventh_date'])) : ""; 

$eight_checkbox			= 	isset($_POST['eight_checkbox']) 		? trim(strip_tags($_POST['eight_checkbox'])) : ""; 
$eight_percentage		= 	isset($_POST['eight_percentage']) 		? trim(strip_tags($_POST['eight_percentage'])) : ""; 
$eight_amount			= 	isset($_POST['eight_amount']) 			? trim(strip_tags($_POST['eight_amount'])) : ""; 
$eight_wht				= 	isset($_POST['eight_wht']) 				? trim(strip_tags($_POST['eight_wht'])) : ""; 
$eight_recoup			= 	isset($_POST['eight_recoup']) 			? trim(strip_tags($_POST['eight_recoup'])) : ""; 
$eight_retention		= 	isset($_POST['eight_retention']) 		? trim(strip_tags($_POST['eight_retention'])) : ""; 
$eight_electricity		= 	isset($_POST['eight_electricity']) 		? trim(strip_tags($_POST['eight_electricity'])) : ""; 
$eight_others			= 	isset($_POST['eight_others']) 			? trim(strip_tags($_POST['eight_others'])) : ""; 
$eight_net				= 	isset($_POST['eight_net']) 				? trim(strip_tags($_POST['eight_net'])) : ""; 
$eight_date				= 	isset($_POST['eight_date']) 			? trim(strip_tags($_POST['eight_date'])) : ""; 

$nine_checkbox			= 	isset($_POST['nine_checkbox']) 			? trim(strip_tags($_POST['nine_checkbox'])) : ""; 
$nine_percentage		= 	isset($_POST['nine_percentage']) 		? trim(strip_tags($_POST['nine_percentage'])) : ""; 
$nine_amount			= 	isset($_POST['nine_amount']) 			? trim(strip_tags($_POST['nine_amount'])) : ""; 
$nine_wht				= 	isset($_POST['nine_wht']) 				? trim(strip_tags($_POST['nine_wht'])) : ""; 
$nine_recoup			= 	isset($_POST['nine_recoup']) 			? trim(strip_tags($_POST['nine_recoup'])) : ""; 
$nine_retention			= 	isset($_POST['nine_retention']) 		? trim(strip_tags($_POST['nine_retention'])) : ""; 
$nine_electricity		= 	isset($_POST['nine_electricity']) 		? trim(strip_tags($_POST['nine_electricity'])) : ""; 
$nine_others			= 	isset($_POST['nine_others']) 			? trim(strip_tags($_POST['nine_others'])) : ""; 
$nine_net				= 	isset($_POST['nine_net']) 				? trim(strip_tags($_POST['nine_net'])) : ""; 
$nine_date				= 	isset($_POST['nine_date']) 				? trim(strip_tags($_POST['nine_date'])) : ""; 

$ten_checkbox			= 	isset($_POST['ten_checkbox']) 			? trim(strip_tags($_POST['ten_checkbox'])) : ""; 
$ten_percentage			= 	isset($_POST['ten_percentage']) 		? trim(strip_tags($_POST['ten_percentage'])) : ""; 
$ten_amount				= 	isset($_POST['ten_amount']) 			? trim(strip_tags($_POST['ten_amount'])) : ""; 
$ten_wht				= 	isset($_POST['ten_wht']) 				? trim(strip_tags($_POST['ten_wht'])) : ""; 
$ten_recoup				= 	isset($_POST['ten_recoup']) 			? trim(strip_tags($_POST['ten_recoup'])) : ""; 
$ten_retention			= 	isset($_POST['ten_retention']) 			? trim(strip_tags($_POST['ten_retention'])) : ""; 
$ten_electricity		= 	isset($_POST['ten_electricity']) 		? trim(strip_tags($_POST['ten_electricity'])) : ""; 
$ten_others				= 	isset($_POST['ten_others']) 			? trim(strip_tags($_POST['ten_others'])) : ""; 
$ten_net				= 	isset($_POST['ten_net']) 				? trim(strip_tags($_POST['ten_net'])) : ""; 
$ten_date				= 	isset($_POST['ten_date']) 				? trim(strip_tags($_POST['ten_date'])) : ""; 


$eleven_checkbox			= 	isset($_POST['eleven_checkbox']) 		? trim(strip_tags($_POST['eleven_checkbox'])) : ""; 
$eleven_percentage			= 	isset($_POST['eleven_percentage']) 		? trim(strip_tags($_POST['eleven_percentage'])) : ""; 
$eleven_amount				= 	isset($_POST['eleven_amount']) 			? trim(strip_tags($_POST['eleven_amount'])) : ""; 
$eleven_wht					= 	isset($_POST['eleven_wht']) 			? trim(strip_tags($_POST['eleven_wht'])) : ""; 
$eleven_recoup				= 	isset($_POST['eleven_recoup']) 			? trim(strip_tags($_POST['eleven_recoup'])) : ""; 
$eleven_retention			= 	isset($_POST['eleven_retention']) 		? trim(strip_tags($_POST['eleven_retention'])) : ""; 
$eleven_electricity			= 	isset($_POST['eleven_electricity']) 	? trim(strip_tags($_POST['eleven_electricity'])) : ""; 
$eleven_others				= 	isset($_POST['eleven_others']) 			? trim(strip_tags($_POST['eleven_others'])) : ""; 
$eleven_net					= 	isset($_POST['eleven_net']) 			? trim(strip_tags($_POST['eleven_net'])) : ""; 
$eleven_date				= 	isset($_POST['eleven_date']) 			? trim(strip_tags($_POST['eleven_date'])) : ""; 


$twelve_checkbox			= 	isset($_POST['twelve_checkbox']) 		? trim(strip_tags($_POST['twelve_checkbox'])) : ""; 
$twelve_percentage			= 	isset($_POST['twelve_percentage']) 		? trim(strip_tags($_POST['twelve_percentage'])) : ""; 
$twelve_amount				= 	isset($_POST['twelve_amount']) 			? trim(strip_tags($_POST['twelve_amount'])) : ""; 
$twelve_wht					= 	isset($_POST['twelve_wht']) 			? trim(strip_tags($_POST['twelve_wht'])) : ""; 
$twelve_recoup				= 	isset($_POST['twelve_recoup']) 			? trim(strip_tags($_POST['twelve_recoup'])) : ""; 
$twelve_retention			= 	isset($_POST['twelve_retention']) 		? trim(strip_tags($_POST['twelve_retention'])) : ""; 
$twelve_electricity			= 	isset($_POST['twelve_electricity']) 	? trim(strip_tags($_POST['twelve_electricity'])) : ""; 
$twelve_others				= 	isset($_POST['twelve_others']) 			? trim(strip_tags($_POST['twelve_others'])) : ""; 
$twelve_net					= 	isset($_POST['twelve_net']) 			? trim(strip_tags($_POST['twelve_net'])) : ""; 
$twelve_date				= 	isset($_POST['twelve_date']) 			? trim(strip_tags($_POST['twelve_date'])) : ""; 



$thirteen_checkbox			= 	isset($_POST['thirteen_checkbox']) 			? trim(strip_tags($_POST['thirteen_checkbox'])) : ""; 
$thirteen_percentage		= 	isset($_POST['thirteen_percentage']) 		? trim(strip_tags($_POST['thirteen_percentage'])) : ""; 
$thirteen_amount			= 	isset($_POST['thirteen_amount']) 			? trim(strip_tags($_POST['thirteen_amount'])) : ""; 
$thirteen_wht				= 	isset($_POST['thirteen_wht']) 				? trim(strip_tags($_POST['thirteen_wht'])) : ""; 
$thirteen_recoup			= 	isset($_POST['thirteen_recoup']) 			? trim(strip_tags($_POST['thirteen_recoup'])) : ""; 
$thirteen_retention			= 	isset($_POST['thirteen_retention']) 		? trim(strip_tags($_POST['thirteen_retention'])) : ""; 
$thirteen_electricity		= 	isset($_POST['thirteen_electricity']) 		? trim(strip_tags($_POST['thirteen_electricity'])) : ""; 
$thirteen_others			= 	isset($_POST['thirteen_others']) 			? trim(strip_tags($_POST['thirteen_others'])) : ""; 
$thirteen_net				= 	isset($_POST['thirteen_net']) 				? trim(strip_tags($_POST['thirteen_net'])) : ""; 
$thirteen_date				= 	isset($_POST['thirteen_date']) 				? trim(strip_tags($_POST['thirteen_date'])) : ""; 


$fourteen_checkbox			= 	isset($_POST['fourteen_checkbox']) 			? trim(strip_tags($_POST['fourteen_checkbox'])) : ""; 
$fourteen_percentage		= 	isset($_POST['fourteen_percentage']) 		? trim(strip_tags($_POST['fourteen_percentage'])) : ""; 
$fourteen_amount			= 	isset($_POST['fourteen_amount']) 			? trim(strip_tags($_POST['fourteen_amount'])) : ""; 
$fourteen_wht				= 	isset($_POST['fourteen_wht']) 				? trim(strip_tags($_POST['fourteen_wht'])) : ""; 
$fourteen_recoup			= 	isset($_POST['fourteen_recoup']) 			? trim(strip_tags($_POST['fourteen_recoup'])) : ""; 
$fourteen_retention			= 	isset($_POST['fourteen_retention']) 		? trim(strip_tags($_POST['fourteen_retention'])) : ""; 
$fourteen_electricity		= 	isset($_POST['fourteen_electricity']) 		? trim(strip_tags($_POST['fourteen_electricity'])) : ""; 
$fourteen_others			= 	isset($_POST['fourteen_others']) 			? trim(strip_tags($_POST['fourteen_others'])) : ""; 
$fourteen_net				= 	isset($_POST['fourteen_net']) 				? trim(strip_tags($_POST['fourteen_net'])) : ""; 
$fourteen_date				= 	isset($_POST['fourteen_date']) 				? trim(strip_tags($_POST['fourteen_date'])) : ""; 


$fifteen_checkbox			= 	isset($_POST['fifteen_checkbox']) 			? trim(strip_tags($_POST['fifteen_checkbox'])) : ""; 
$fifteen_percentage			= 	isset($_POST['fifteen_percentage']) 		? trim(strip_tags($_POST['fifteen_percentage'])) : ""; 
$fifteen_amount				= 	isset($_POST['fifteen_amount']) 			? trim(strip_tags($_POST['fifteen_amount'])) : ""; 
$fifteen_wht				= 	isset($_POST['fifteen_wht']) 				? trim(strip_tags($_POST['fifteen_wht'])) : ""; 
$fifteen_recoup				= 	isset($_POST['fifteen_recoup']) 			? trim(strip_tags($_POST['fifteen_recoup'])) : ""; 
$fifteen_retention			= 	isset($_POST['fifteen_retention']) 			? trim(strip_tags($_POST['fifteen_retention'])) : ""; 
$fifteen_electricity		= 	isset($_POST['fifteen_electricity']) 		? trim(strip_tags($_POST['fifteen_electricity'])) : ""; 
$fifteen_others				= 	isset($_POST['fifteen_others']) 			? trim(strip_tags($_POST['fifteen_others'])) : ""; 
$fifteen_net				= 	isset($_POST['fifteen_net']) 				? trim(strip_tags($_POST['fifteen_net'])) : ""; 
$fifteen_date				= 	isset($_POST['fifteen_date']) 				? trim(strip_tags($_POST['fifteen_date'])) : ""; 


$sixteen_checkbox			= 	isset($_POST['sixteen_checkbox']) 			? trim(strip_tags($_POST['sixteen_checkbox'])) : ""; 
$sixteen_percentage			= 	isset($_POST['sixteen_percentage']) 		? trim(strip_tags($_POST['sixteen_percentage'])) : ""; 
$sixteen_amount				= 	isset($_POST['sixteen_amount']) 			? trim(strip_tags($_POST['sixteen_amount'])) : ""; 
$sixteen_wht				= 	isset($_POST['sixteen_wht']) 				? trim(strip_tags($_POST['sixteen_wht'])) : ""; 
$sixteen_recoup				= 	isset($_POST['sixteen_recoup']) 			? trim(strip_tags($_POST['sixteen_recoup'])) : ""; 
$sixteen_retention			= 	isset($_POST['sixteen_retention']) 			? trim(strip_tags($_POST['sixteen_retention'])) : ""; 
$sixteen_electricity		= 	isset($_POST['sixteen_electricity']) 		? trim(strip_tags($_POST['sixteen_electricity'])) : ""; 
$sixteen_others				= 	isset($_POST['sixteen_others']) 			? trim(strip_tags($_POST['sixteen_others'])) : ""; 
$sixteen_net				= 	isset($_POST['sixteen_net']) 				? trim(strip_tags($_POST['sixteen_net'])) : ""; 
$sixteen_date				= 	isset($_POST['sixteen_date']) 				? trim(strip_tags($_POST['sixteen_date'])) : ""; 


$seventeen_checkbox			= 	isset($_POST['seventeen_checkbox']) 		? trim(strip_tags($_POST['seventeen_checkbox'])) : ""; 
$seventeen_percentage		= 	isset($_POST['seventeen_percentage']) 		? trim(strip_tags($_POST['seventeen_percentage'])) : ""; 
$seventeen_amount			= 	isset($_POST['seventeen_amount']) 			? trim(strip_tags($_POST['seventeen_amount'])) : ""; 
$seventeen_wht				= 	isset($_POST['seventeen_wht']) 				? trim(strip_tags($_POST['seventeen_wht'])) : ""; 
$seventeen_recoup			= 	isset($_POST['seventeen_recoup']) 			? trim(strip_tags($_POST['seventeen_recoup'])) : ""; 
$seventeen_retention		= 	isset($_POST['seventeen_retention']) 		? trim(strip_tags($_POST['seventeen_retention'])) : ""; 
$seventeen_electricity		= 	isset($_POST['seventeen_electricity']) 		? trim(strip_tags($_POST['seventeen_electricity'])) : ""; 
$seventeen_others			= 	isset($_POST['seventeen_others']) 			? trim(strip_tags($_POST['seventeen_others'])) : ""; 
$seventeen_net				= 	isset($_POST['seventeen_net']) 				? trim(strip_tags($_POST['seventeen_net'])) : ""; 
$seventeen_date				= 	isset($_POST['seventeen_date']) 			? trim(strip_tags($_POST['seventeen_date'])) : ""; 


$eighteen_checkbox			= 	isset($_POST['eighteen_checkbox']) 			? trim(strip_tags($_POST['eighteen_checkbox'])) : ""; 
$eighteen_percentage		= 	isset($_POST['eighteen_percentage']) 		? trim(strip_tags($_POST['eighteen_percentage'])) : ""; 
$eighteen_amount			= 	isset($_POST['eighteen_amount']) 			? trim(strip_tags($_POST['eighteen_amount'])) : ""; 
$eighteen_wht				= 	isset($_POST['eighteen_wht']) 				? trim(strip_tags($_POST['eighteen_wht'])) : ""; 
$eighteen_recoup			= 	isset($_POST['eighteen_recoup']) 			? trim(strip_tags($_POST['eighteen_recoup'])) : ""; 
$eighteen_retention			= 	isset($_POST['eighteen_retention']) 		? trim(strip_tags($_POST['eighteen_retention'])) : ""; 
$eighteen_electricity		= 	isset($_POST['eighteen_electricity']) 		? trim(strip_tags($_POST['eighteen_electricity'])) : ""; 
$eighteen_others			= 	isset($_POST['eighteen_others']) 			? trim(strip_tags($_POST['eighteen_others'])) : ""; 
$eighteen_net				= 	isset($_POST['eighteen_net']) 				? trim(strip_tags($_POST['eighteen_net'])) : ""; 
$eighteen_date				= 	isset($_POST['eighteen_date']) 				? trim(strip_tags($_POST['eighteen_date'])) : ""; 



$nineteen_checkbox			= 	isset($_POST['nineteen_checkbox']) 			? trim(strip_tags($_POST['nineteen_checkbox'])) : ""; 
$nineteen_percentage		= 	isset($_POST['nineteen_percentage']) 		? trim(strip_tags($_POST['nineteen_percentage'])) : ""; 
$nineteen_amount			= 	isset($_POST['nineteen_amount']) 			? trim(strip_tags($_POST['nineteen_amount'])) : ""; 
$nineteen_wht				= 	isset($_POST['nineteen_wht']) 				? trim(strip_tags($_POST['nineteen_wht'])) : ""; 
$nineteen_recoup			= 	isset($_POST['nineteen_recoup']) 			? trim(strip_tags($_POST['nineteen_recoup'])) : ""; 
$nineteen_retention			= 	isset($_POST['nineteen_retention']) 		? trim(strip_tags($_POST['nineteen_retention'])) : ""; 
$nineteen_electricity		= 	isset($_POST['nineteen_electricity']) 		? trim(strip_tags($_POST['nineteen_electricity'])) : ""; 
$nineteen_others			= 	isset($_POST['nineteen_others']) 			? trim(strip_tags($_POST['nineteen_others'])) : ""; 
$nineteen_net				= 	isset($_POST['nineteen_net']) 				? trim(strip_tags($_POST['nineteen_net'])) : ""; 
$nineteen_date				= 	isset($_POST['nineteen_date']) 				? trim(strip_tags($_POST['nineteen_date'])) : ""; 



$twenty_checkbox			= 	isset($_POST['twenty_checkbox']) 			? trim(strip_tags($_POST['twenty_checkbox'])) : ""; 
$twenty_percentage			= 	isset($_POST['twenty_percentage']) 			? trim(strip_tags($_POST['twenty_percentage'])) : ""; 
$twenty_amount				= 	isset($_POST['twenty_amount']) 				? trim(strip_tags($_POST['twenty_amount'])) : ""; 
$twenty_wht					= 	isset($_POST['twenty_wht']) 				? trim(strip_tags($_POST['twenty_wht'])) : ""; 
$twenty_recoup				= 	isset($_POST['twenty_recoup']) 				? trim(strip_tags($_POST['twenty_recoup'])) : ""; 
$twenty_retention			= 	isset($_POST['twenty_retention']) 			? trim(strip_tags($_POST['twenty_retention'])) : ""; 
$twenty_electricity			= 	isset($_POST['twenty_electricity']) 		? trim(strip_tags($_POST['twenty_electricity'])) : ""; 
$twenty_others				= 	isset($_POST['twenty_others']) 				? trim(strip_tags($_POST['twenty_others'])) : ""; 
$twenty_net					= 	isset($_POST['twenty_net']) 				? trim(strip_tags($_POST['twenty_net'])) : ""; 
$twenty_date				= 	isset($_POST['twenty_date']) 				? trim(strip_tags($_POST['twenty_date'])) : ""; 


$total_percentage		= 	isset($_POST['total_percentage']) 		? trim(strip_tags($_POST['total_percentage'])) : ""; 
$total_amount			= 	isset($_POST['total_amount']) 			? trim(strip_tags($_POST['total_amount'])) : ""; 
$total_wht				= 	isset($_POST['total_wht']) 				? trim(strip_tags($_POST['total_wht'])) : ""; 
$total_recoup			= 	isset($_POST['total_recoup']) 			? trim(strip_tags($_POST['total_recoup'])) : ""; 
$total_retention		= 	isset($_POST['total_retention']) 		? trim(strip_tags($_POST['total_retention'])) : ""; 
$total_electricity		= 	isset($_POST['total_electricity']) 		? trim(strip_tags($_POST['total_electricity'])) : ""; 
$total_water			= 	isset($_POST['total_water']) 			? trim(strip_tags($_POST['total_water'])) : ""; 
$total_others			= 	isset($_POST['total_others']) 			? trim(strip_tags($_POST['total_others'])) : ""; 
$total_net				= 	isset($_POST['total_net']) 				? trim(strip_tags($_POST['total_net'])) : ""; 
$balance_amount			= 	isset($_POST['balance_amount']) 		? trim(strip_tags($_POST['balance_amount'])) : ""; 
$balance_wht			= 	isset($_POST['balance_wht']) 			? trim(strip_tags($_POST['balance_wht'])) : ""; 
$balance_recoup			= 	isset($_POST['balance_recoup']) 		? trim(strip_tags($_POST['balance_recoup'])) : ""; 


$releases_status		= 	isset($_POST['releases_status']) 		? trim(strip_tags($_POST['releases_status'])) : ""; 
$releases_remarks		= 	isset($_POST['releases_remarks']) 		? trim(strip_tags($_POST['releases_remarks'])) : ""; 

$downpayment_check		= 	isset($_POST['downpayment_check']) 		? trim(strip_tags($_POST['downpayment_check'])) : ""; 
$first_check			= 	isset($_POST['first_check']) 		? trim(strip_tags($_POST['first_check'])) : ""; 
$second_check			= 	isset($_POST['second_check']) 		? trim(strip_tags($_POST['second_check'])) : ""; 
$third_check			= 	isset($_POST['third_check']) 		? trim(strip_tags($_POST['third_check'])) : ""; 
$fourth_check			= 	isset($_POST['fourth_check']) 		? trim(strip_tags($_POST['fourth_check'])) : ""; 
$fifth_check			= 	isset($_POST['fifth_check']) 		? trim(strip_tags($_POST['fifth_check'])) : ""; 
$sixth_check			= 	isset($_POST['sixth_check']) 		? trim(strip_tags($_POST['sixth_check'])) : ""; 
$seventh_check			= 	isset($_POST['seventh_check']) 		? trim(strip_tags($_POST['seventh_check'])) : ""; 
$eight_check			= 	isset($_POST['eight_check']) 		? trim(strip_tags($_POST['eight_check'])) : ""; 
$nine_check				= 	isset($_POST['nine_check']) 		? trim(strip_tags($_POST['nine_check'])) : ""; 
$ten_check				= 	isset($_POST['ten_check']) 			? trim(strip_tags($_POST['ten_check'])) : "";  
$eleven_check			= 	isset($_POST['eleven_check']) 		? trim(strip_tags($_POST['eleven_check'])) : "";  
$twelve_check			= 	isset($_POST['twelve_check']) 		? trim(strip_tags($_POST['twelve_check'])) : "";  
$thirteen_check			= 	isset($_POST['thirteen_check']) 	? trim(strip_tags($_POST['thirteen_check'])) : "";  
$fourteen_check			= 	isset($_POST['fourteen_check']) 	? trim(strip_tags($_POST['fourteen_check'])) : "";  
$fifteen_check			= 	isset($_POST['fifteen_check']) 		? trim(strip_tags($_POST['fifteen_check'])) : "";  
$sixteen_check			= 	isset($_POST['sixteen_check']) 		? trim(strip_tags($_POST['sixteen_check'])) : "";  
$seventeen_check		= 	isset($_POST['seventeen_check'])	? trim(strip_tags($_POST['seventeen_check'])) : "";  
$eighteen_check			= 	isset($_POST['eighteen_check'])		? trim(strip_tags($_POST['eighteen_check'])) : "";  
$nineteen_check			= 	isset($_POST['nineteen_check'])		? trim(strip_tags($_POST['nineteen_check'])) : "";  
$twenty_check			= 	isset($_POST['twenty_check'])		? trim(strip_tags($_POST['twenty_check'])) : "";  


$first_water			= 	isset($_POST['first_water']) 		? trim(strip_tags($_POST['first_water'])) : ""; 
$second_water			= 	isset($_POST['second_water']) 		? trim(strip_tags($_POST['second_water'])) : ""; 
$third_water			= 	isset($_POST['third_water']) 		? trim(strip_tags($_POST['third_water'])) : ""; 
$fourth_water			= 	isset($_POST['fourth_water']) 		? trim(strip_tags($_POST['fourth_water'])) : ""; 
$fifth_water			= 	isset($_POST['fifth_water']) 		? trim(strip_tags($_POST['fifth_water'])) : ""; 
$sixth_water			= 	isset($_POST['sixth_water']) 		? trim(strip_tags($_POST['sixth_water'])) : ""; 
$seventh_water			= 	isset($_POST['seventh_water']) 		? trim(strip_tags($_POST['seventh_water'])) : ""; 
$eight_water			= 	isset($_POST['eight_water']) 		? trim(strip_tags($_POST['eight_water'])) : ""; 
$nine_water				= 	isset($_POST['nine_water']) 		? trim(strip_tags($_POST['nine_water'])) : ""; 
$ten_water				= 	isset($_POST['ten_water']) 			? trim(strip_tags($_POST['ten_water'])) : "";      
$eleven_water			= 	isset($_POST['eleven_water']) 		? trim(strip_tags($_POST['eleven_water'])) : "";  
$twelve_water			= 	isset($_POST['twelve_water']) 		? trim(strip_tags($_POST['twelve_water'])) : "";  
$thirteen_water			= 	isset($_POST['thirteen_water']) 	? trim(strip_tags($_POST['thirteen_water'])) : "";  
$fourteen_water			= 	isset($_POST['fourteen_water']) 	? trim(strip_tags($_POST['fourteen_water'])) : "";  
$fifteen_water			= 	isset($_POST['fifteen_water']) 		? trim(strip_tags($_POST['fifteen_water'])) : "";  
$sixteen_water			= 	isset($_POST['sixteen_water']) 		? trim(strip_tags($_POST['sixteen_water'])) : "";  
$seventeen_water		= 	isset($_POST['seventeen_water'])	? trim(strip_tags($_POST['seventeen_water'])) : "";  
$eighteen_water			= 	isset($_POST['eighteen_water'])		? trim(strip_tags($_POST['eighteen_water'])) : "";  
$nineteen_water			= 	isset($_POST['nineteen_water'])		? trim(strip_tags($_POST['nineteen_water'])) : "";  
$twenty_water			= 	isset($_POST['twenty_water'])		? trim(strip_tags($_POST['twenty_water'])) : "";  


$ewt_type				= 	isset($_POST['ewt_type']) 			? $_POST['ewt_type'] : "";      
  
     
$currentUser 	= $_SESSION['danvilles_username'];
$timeStamp		= date('Y-m-d H:i:s');
//SAVING CHECKLIST DETAILS   
$mainArr	= array();
$output 	= "";
 
$mainArr['DatePOIssued'] 			= date('Y-m-d', strtotime($po_issued)); 
$mainArr['DateIssued'] 				= date('Y-m-d', strtotime($date_issued)); 

$mainArr['RetentionProcessed']		= date('Y-m-d', strtotime($retention_processed)); 

$mainArr['RetentionCheck']			= $retention_check; //12AUG24



$mainArr['ReleasesStatus']			= $releases_status;
$mainArr['ReleasesRemarks']			= $releases_remarks;
$mainArr['Contractor']				= $contractor;
$mainArr['Block']					= $block;
$mainArr['Lot']						= $lot;
$mainArr['Units']					= $number_units;
$mainArr['ContractPrice']			= str_replace(',','',$contract_price); 
$mainArr['WHT']						= str_replace(',','',$withholding_tax); 
$mainArr['EWTType']					= $ewt_type; 


$mainArr['NetContractPrice'] 		= str_replace(',','',$net_contract_price);

$details = array();
$details['downpayment_checkbox'] 	= $downpayment_checkbox;
$details['downpayment_recoup'] 		= str_replace(',','',$downpayment_recoup);
$details['downpayment_date'] 		= date('Y-m-d', strtotime($downpayment_date)); 


$details['first_checkbox'] 			= $first_checkbox;
$details['first_percentage'] 		= $first_percentage;
$details['first_amount'] 			= str_replace(',','',$first_amount);
$details['first_wht'] 				= str_replace(',','',$first_wht);
$details['first_recoup'] 			= str_replace(',','',$first_recoup);
$details['first_retention'] 		= str_replace(',','',$first_retention);
$details['first_electricity'] 		= str_replace(',','',$first_electricity);
$details['first_others'] 			= str_replace(',','',$first_others);
$details['first_net'] 				= str_replace(',','',$first_net);
$details['first_date'] 				= date('Y-m-d', strtotime($first_date));  

$details['second_checkbox'] 		= $second_checkbox;
$details['second_percentage'] 		= $second_percentage;
$details['second_amount'] 			= str_replace(',','',$second_amount);
$details['second_wht'] 				= str_replace(',','',$second_wht);
$details['second_recoup'] 			= str_replace(',','',$second_recoup);
$details['second_retention'] 		= str_replace(',','',$second_retention);
$details['second_electricity'] 		= str_replace(',','',$second_electricity);
$details['second_others'] 			= str_replace(',','',$second_others);
$details['second_net'] 				= str_replace(',','',$second_net);
$details['second_date'] 			= date('Y-m-d', strtotime($second_date));  

$details['third_checkbox'] 			= $third_checkbox;
$details['third_percentage'] 		= $third_percentage;
$details['third_amount'] 			= str_replace(',','',$third_amount);
$details['third_wht'] 				= str_replace(',','',$third_wht);
$details['third_recoup'] 			= str_replace(',','',$third_recoup);
$details['third_retention'] 		= str_replace(',','',$third_retention);
$details['third_electricity'] 		= str_replace(',','',$third_electricity);
$details['third_others'] 			= str_replace(',','',$third_others);
$details['third_net'] 				= str_replace(',','',$third_net);
$details['third_date'] 				= date('Y-m-d', strtotime($third_date));  

$details['fourth_checkbox'] 		= $fourth_checkbox;
$details['fourth_percentage'] 		= $fourth_percentage;
$details['fourth_amount'] 			= str_replace(',','',$fourth_amount);
$details['fourth_wht'] 				= str_replace(',','',$fourth_wht);
$details['fourth_recoup'] 			= str_replace(',','',$fourth_recoup);
$details['fourth_retention'] 		= str_replace(',','',$fourth_retention);
$details['fourth_electricity'] 		= str_replace(',','',$fourth_electricity);
$details['fourth_others'] 			= str_replace(',','',$fourth_others);
$details['fourth_net'] 				= str_replace(',','',$fourth_net);
$details['fourth_date'] 			= date('Y-m-d', strtotime($fourth_date));  

$details['fifth_checkbox'] 			= $fifth_checkbox;
$details['fifth_percentage'] 		= $fifth_percentage;
$details['fifth_amount'] 			= str_replace(',','',$fifth_amount);
$details['fifth_wht'] 				= str_replace(',','',$fifth_wht);
$details['fifth_recoup'] 			= str_replace(',','',$fifth_recoup);
$details['fifth_retention'] 		= str_replace(',','',$fifth_retention);
$details['fifth_electricity'] 		= str_replace(',','',$fifth_electricity);
$details['fifth_others'] 			= str_replace(',','',$fifth_others);
$details['fifth_net'] 				= str_replace(',','',$fifth_net);
$details['fifth_date'] 				= date('Y-m-d', strtotime($fifth_date));  

$details['sixth_checkbox'] 			= $sixth_checkbox;
$details['sixth_percentage'] 		= $sixth_percentage;
$details['sixth_amount'] 			= str_replace(',','',$sixth_amount);
$details['sixth_wht'] 				= str_replace(',','',$sixth_wht);
$details['sixth_recoup'] 			= str_replace(',','',$sixth_recoup);
$details['sixth_retention'] 		= str_replace(',','',$sixth_retention);
$details['sixth_electricity'] 		= str_replace(',','',$sixth_electricity);
$details['sixth_others'] 			= str_replace(',','',$sixth_others);
$details['sixth_net'] 				= str_replace(',','',$sixth_net);
$details['sixth_date'] 				= date('Y-m-d', strtotime($sixth_date));  

$details['seventh_checkbox'] 		= $seventh_checkbox;
$details['seventh_percentage'] 		= $seventh_percentage;
$details['seventh_amount'] 			= str_replace(',','',$seventh_amount);
$details['seventh_wht'] 			= str_replace(',','',$seventh_wht);
$details['seventh_recoup'] 			= str_replace(',','',$seventh_recoup);
$details['seventh_retention'] 		= str_replace(',','',$seventh_retention);
$details['seventh_electricity'] 	= str_replace(',','',$seventh_electricity);
$details['seventh_others'] 			= str_replace(',','',$seventh_others);
$details['seventh_net'] 			= str_replace(',','',$seventh_net);
$details['seventh_date'] 			= date('Y-m-d', strtotime($seventh_date));  

$details['eight_checkbox'] 			= $eight_checkbox;
$details['eight_percentage'] 		= $eight_percentage;
$details['eight_amount'] 			= str_replace(',','',$eight_amount);
$details['eight_wht'] 				= str_replace(',','',$eight_wht);
$details['eight_recoup'] 			= str_replace(',','',$eight_recoup);
$details['eight_retention'] 		= str_replace(',','',$eight_retention);
$details['eight_electricity'] 		= str_replace(',','',$eight_electricity);
$details['eight_others'] 			= str_replace(',','',$eight_others);
$details['eight_net'] 				= str_replace(',','',$eight_net);
$details['eight_date'] 				= date('Y-m-d', strtotime($eight_date));  

$details['nine_checkbox'] 			= $nine_checkbox;
$details['nine_percentage'] 		= $nine_percentage;
$details['nine_amount'] 			= str_replace(',','',$nine_amount);
$details['nine_wht'] 				= str_replace(',','',$nine_wht);
$details['nine_recoup'] 			= str_replace(',','',$nine_recoup);
$details['nine_retention'] 			= str_replace(',','',$nine_retention);
$details['nine_electricity'] 		= str_replace(',','',$nine_electricity);
$details['nine_others'] 			= str_replace(',','',$nine_others);
$details['nine_net'] 				= str_replace(',','',$nine_net);
$details['nine_date'] 				= date('Y-m-d', strtotime($nine_date));  

$details['ten_checkbox'] 			= $ten_checkbox;
$details['ten_percentage'] 			= $ten_percentage;
$details['ten_amount'] 				= str_replace(',','',$ten_amount);
$details['ten_wht'] 				= str_replace(',','',$ten_wht);
$details['ten_recoup'] 				= str_replace(',','',$ten_recoup);
$details['ten_retention'] 			= str_replace(',','',$ten_retention);
$details['ten_electricity'] 		= str_replace(',','',$ten_electricity);
$details['ten_others'] 				= str_replace(',','',$ten_others);
$details['ten_net'] 				= str_replace(',','',$ten_net);
$details['ten_date'] 				= date('Y-m-d', strtotime($ten_date));  

$details['eleven_checkbox'] 		= $eleven_checkbox;
$details['eleven_percentage'] 		= $eleven_percentage;
$details['eleven_amount'] 			= str_replace(',','',$eleven_amount);
$details['eleven_wht'] 				= str_replace(',','',$eleven_wht);
$details['eleven_recoup'] 			= str_replace(',','',$eleven_recoup);
$details['eleven_retention'] 		= str_replace(',','',$eleven_retention);
$details['eleven_electricity'] 		= str_replace(',','',$eleven_electricity);
$details['eleven_others'] 			= str_replace(',','',$eleven_others);
$details['eleven_net'] 				= str_replace(',','',$eleven_net);
$details['eleven_date'] 			= date('Y-m-d', strtotime($eleven_date));  

$details['twelve_checkbox'] 		= $twelve_checkbox;
$details['twelve_percentage'] 		= $twelve_percentage;
$details['twelve_amount'] 			= str_replace(',','',$twelve_amount);
$details['twelve_wht'] 				= str_replace(',','',$twelve_wht);
$details['twelve_recoup'] 			= str_replace(',','',$twelve_recoup);
$details['twelve_retention'] 		= str_replace(',','',$twelve_retention);
$details['twelve_electricity'] 		= str_replace(',','',$twelve_electricity);
$details['twelve_others'] 			= str_replace(',','',$twelve_others);
$details['twelve_net'] 				= str_replace(',','',$twelve_net);
$details['twelve_date'] 			= date('Y-m-d', strtotime($twelve_date));  

$details['thirteen_checkbox'] 			= $thirteen_checkbox;
$details['thirteen_percentage'] 		= $thirteen_percentage;
$details['thirteen_amount'] 			= str_replace(',','',$thirteen_amount);
$details['thirteen_wht'] 				= str_replace(',','',$thirteen_wht);
$details['thirteen_recoup'] 			= str_replace(',','',$thirteen_recoup);
$details['thirteen_retention'] 			= str_replace(',','',$thirteen_retention);
$details['thirteen_electricity'] 		= str_replace(',','',$thirteen_electricity);
$details['thirteen_others'] 			= str_replace(',','',$thirteen_others);
$details['thirteen_net'] 				= str_replace(',','',$thirteen_net);
$details['thirteen_date'] 				= date('Y-m-d', strtotime($thirteen_date));  

$details['fourteen_checkbox'] 			= $fourteen_checkbox;
$details['fourteen_percentage'] 		= $fourteen_percentage;
$details['fourteen_amount'] 			= str_replace(',','',$fourteen_amount);
$details['fourteen_wht'] 				= str_replace(',','',$fourteen_wht);
$details['fourteen_recoup'] 			= str_replace(',','',$fourteen_recoup);
$details['fourteen_retention'] 			= str_replace(',','',$fourteen_retention);
$details['fourteen_electricity'] 		= str_replace(',','',$fourteen_electricity);
$details['fourteen_others'] 			= str_replace(',','',$fourteen_others);
$details['fourteen_net'] 				= str_replace(',','',$fourteen_net);
$details['fourteen_date'] 				= date('Y-m-d', strtotime($fourteen_date));  


$details['fifteen_checkbox'] 			= $fifteen_checkbox;
$details['fifteen_percentage'] 			= $fifteen_percentage;
$details['fifteen_amount'] 				= str_replace(',','',$fifteen_amount);
$details['fifteen_wht'] 				= str_replace(',','',$fifteen_wht);
$details['fifteen_recoup'] 				= str_replace(',','',$fifteen_recoup);
$details['fifteen_retention'] 			= str_replace(',','',$fifteen_retention);
$details['fifteen_electricity'] 		= str_replace(',','',$fifteen_electricity);
$details['fifteen_others'] 				= str_replace(',','',$fifteen_others);
$details['fifteen_net'] 				= str_replace(',','',$fifteen_net);
$details['fifteen_date'] 				= date('Y-m-d', strtotime($fifteen_date));  

$details['sixteen_checkbox'] 			= $sixteen_checkbox;
$details['sixteen_percentage'] 			= $sixteen_percentage;
$details['sixteen_amount'] 				= str_replace(',','',$sixteen_amount);
$details['sixteen_wht'] 				= str_replace(',','',$sixteen_wht);
$details['sixteen_recoup'] 				= str_replace(',','',$sixteen_recoup);
$details['sixteen_retention'] 			= str_replace(',','',$sixteen_retention);
$details['sixteen_electricity'] 		= str_replace(',','',$sixteen_electricity);
$details['sixteen_others'] 				= str_replace(',','',$sixteen_others);
$details['sixteen_net'] 				= str_replace(',','',$sixteen_net);
$details['sixteen_date'] 				= date('Y-m-d', strtotime($sixteen_date));  

$details['seventeen_checkbox'] 			= $seventeen_checkbox;
$details['seventeen_percentage'] 		= $seventeen_percentage;
$details['seventeen_amount'] 			= str_replace(',','',$seventeen_amount);
$details['seventeen_wht'] 				= str_replace(',','',$seventeen_wht);
$details['seventeen_recoup'] 			= str_replace(',','',$seventeen_recoup);
$details['seventeen_retention'] 		= str_replace(',','',$seventeen_retention);
$details['seventeen_electricity'] 		= str_replace(',','',$seventeen_electricity);
$details['seventeen_others'] 			= str_replace(',','',$seventeen_others);
$details['seventeen_net'] 				= str_replace(',','',$seventeen_net);
$details['seventeen_date'] 				= date('Y-m-d', strtotime($seventeen_date));  

$details['eighteen_checkbox'] 			= $eighteen_checkbox;
$details['eighteen_percentage'] 		= $eighteen_percentage;
$details['eighteen_amount'] 			= str_replace(',','',$eighteen_amount);
$details['eighteen_wht'] 				= str_replace(',','',$eighteen_wht);
$details['eighteen_recoup'] 			= str_replace(',','',$eighteen_recoup);
$details['eighteen_retention'] 			= str_replace(',','',$eighteen_retention);
$details['eighteen_electricity'] 		= str_replace(',','',$eighteen_electricity);
$details['eighteen_others'] 			= str_replace(',','',$eighteen_others);
$details['eighteen_net'] 				= str_replace(',','',$eighteen_net);
$details['eighteen_date'] 				= date('Y-m-d', strtotime($eighteen_date));  

$details['nineteen_checkbox'] 			= $nineteen_checkbox;
$details['nineteen_percentage'] 		= $nineteen_percentage;
$details['nineteen_amount'] 			= str_replace(',','',$nineteen_amount);
$details['nineteen_wht'] 				= str_replace(',','',$nineteen_wht);
$details['nineteen_recoup'] 			= str_replace(',','',$nineteen_recoup);
$details['nineteen_retention'] 			= str_replace(',','',$nineteen_retention);
$details['nineteen_electricity'] 		= str_replace(',','',$nineteen_electricity);
$details['nineteen_others'] 			= str_replace(',','',$nineteen_others);
$details['nineteen_net'] 				= str_replace(',','',$nineteen_net);
$details['nineteen_date'] 				= date('Y-m-d', strtotime($nineteen_date));  

$details['twenty_checkbox'] 			= $twenty_checkbox;
$details['twenty_percentage'] 			= $twenty_percentage;
$details['twenty_amount'] 				= str_replace(',','',$twenty_amount);
$details['twenty_wht'] 					= str_replace(',','',$twenty_wht);
$details['twenty_recoup'] 				= str_replace(',','',$twenty_recoup);
$details['twenty_retention'] 			= str_replace(',','',$twenty_retention);
$details['twenty_electricity'] 			= str_replace(',','',$twenty_electricity);
$details['twenty_others'] 				= str_replace(',','',$twenty_others);
$details['twenty_net'] 					= str_replace(',','',$twenty_net);
$details['twenty_date'] 				= date('Y-m-d', strtotime($twenty_date));  





$details['total_percentage'] 		= $total_percentage; 
$details['total_amount'] 			= str_replace(',','',$total_amount);
$details['total_wht'] 				= str_replace(',','',$total_wht);
$details['total_recoup'] 			= str_replace(',','',$total_recoup);
$details['total_retention'] 		= str_replace(',','',$total_retention);
$details['total_electricity'] 		= str_replace(',','',$total_electricity);
$details['total_others'] 			= str_replace(',','',$total_others);
$details['total_net'] 				= str_replace(',','',$total_net);

$details['balance_amount'] 			= str_replace(',','',$balance_amount);
$details['balance_wht'] 			= str_replace(',','',$balance_wht);
$details['balance_recoup'] 			= str_replace(',','',$balance_recoup);

$details['downpayment_check'] 		= $downpayment_check; 
$details['first_check'] 			= $first_check; 
$details['second_check'] 			= $second_check; 
$details['third_check'] 			= $third_check; 
$details['fourth_check'] 			= $fourth_check; 
$details['fifth_check'] 			= $fifth_check; 
$details['sixth_check'] 			= $sixth_check; 
$details['seventh_check'] 			= $seventh_check; 
$details['eight_check'] 			= $eight_check; 
$details['nine_check'] 				= $nine_check; 
$details['ten_check'] 				= $ten_check; 
$details['eleven_check'] 			= $eleven_check;  
$details['twelve_check'] 			= $twelve_check;  
$details['thirteen_check'] 			= $thirteen_check;  
$details['fourteen_check'] 			= $fourteen_check;  
$details['fifteen_check'] 			= $fifteen_check;  
$details['sixteen_check'] 			= $sixteen_check;  
$details['seventeen_check'] 		= $seventeen_check;  
$details['eighteen_check'] 			= $eighteen_check;  
$details['nineteen_check'] 			= $nineteen_check;  
$details['twenty_check'] 			= $twenty_check;  


$details['first_water'] 			= str_replace(',','',$first_water);
$details['second_water'] 			= str_replace(',','',$second_water); 
$details['third_water'] 			= str_replace(',','',$third_water); 
$details['fourth_water'] 			= str_replace(',','',$fourth_water); 
$details['fifth_water'] 			= str_replace(',','',$fifth_water); 
$details['sixth_water'] 			= str_replace(',','',$sixth_water); 
$details['seventh_water'] 			= str_replace(',','',$seventh_water); 
$details['eight_water'] 			= str_replace(',','',$eight_water); 
$details['nine_water'] 				= str_replace(',','',$nine_water); 
$details['ten_water'] 				= str_replace(',','',$ten_water);

$details['eleven_water'] 				= str_replace(',','',$eleven_water);
$details['twelve_water'] 				= str_replace(',','',$twelve_water);
$details['thirteen_water'] 				= str_replace(',','',$thirteen_water);
$details['fourteen_water'] 				= str_replace(',','',$fourteen_water);
$details['fifteen_water'] 				= str_replace(',','',$fifteen_water);
$details['sixteen_water'] 				= str_replace(',','',$sixteen_water);
$details['seventeen_water'] 			= str_replace(',','',$seventeen_water);
$details['eighteen_water'] 				= str_replace(',','',$eighteen_water);
$details['nineteen_water'] 				= str_replace(',','',$nineteen_water);
$details['twenty_water'] 				= str_replace(',','',$twenty_water);



$details['total_water'] 			= str_replace(',','',$total_water); 

$mainArr['Details']   = serialize($details);
  
	$condArr  = array(); 
	$condArr2 = array(); 
	$mainArr2 = array();
 	  
	if($task=='create'){
		//insert
			$mainArr['Id']				= $mecon->getNextId("Id","releases_to_contractor");
			$mainArr['CreatedDate'] 	= $timeStamp;
			$mainArr['CreatedBy'] 		= $currentUser; 
			$output2 					= $mecon->insertSingleQuery($mainArr,"releases_to_contractor"); 
 			//SAVING TO RELEASES TO CONTRACTOR DETAILS
			$mainArr2[0]['release_contractor_id'] 		= $mainArr['Id']; 
			$mainArr2[0]['releases'] 					= 'downpayment';
			$mainArr2[0]['releases_checkbox'] 			= $details['downpayment_checkbox'];
			$mainArr2[0]['accomplishment_percentage'] 	= $details['downpayment_percentage'];
			$mainArr2[0]['accomplishment_amount'] 		= $details['downpayment_amount'];
			$mainArr2[0]['wht'] 						= $details['downpayment_wht'];
 			$mainArr2[0]['recoup'] 						= $details['downpayment_recoup'];
 			$mainArr2[0]['retention'] 					= $details['downpayment_retention'];
			$mainArr2[0]['electricity'] 				= $details['downpayment_electricity'];
			$mainArr2[0]['water'] 						= $details['downpayment_water'];
			$mainArr2[0]['others'] 						= $details['downpayment_others'];
			$mainArr2[0]['net'] 						= $details['downpayment_net'];
			$mainArr2[0]['date_processed'] 				= $details['downpayment_date'];
 			$mainArr2[0]['check_no'] 					= $details['downpayment_check'];
 			$mainArr2[0]['releases_no'] 				= 0;
    
			$mainArr2[1]['release_contractor_id'] 		= $mainArr['Id'];
			$mainArr2[1]['releases'] 					= 'first';
			$mainArr2[1]['releases_checkbox'] 			= $details['first_checkbox'];
			$mainArr2[1]['accomplishment_percentage'] 	= $details['first_percentage'];
			$mainArr2[1]['accomplishment_amount'] 		= $details['first_amount'];
			$mainArr2[1]['wht'] 						= $details['first_wht'];
 			$mainArr2[1]['recoup'] 						= $details['first_recoup'];
 			$mainArr2[1]['retention'] 					= $details['first_retention'];
			$mainArr2[1]['electricity'] 				= $details['first_electricity'];
			$mainArr2[1]['water'] 						= $details['first_water'];
			$mainArr2[1]['others'] 						= $details['first_others'];
			$mainArr2[1]['net'] 						= $details['first_net'];
			$mainArr2[1]['date_processed'] 				= $details['first_date'];
 			$mainArr2[1]['check_no'] 					= $details['first_check'];
 			$mainArr2[1]['releases_no'] 				= 1;

			$mainArr2[2]['release_contractor_id'] 		= $mainArr['Id'];
			$mainArr2[2]['releases'] 					= 'second';
			$mainArr2[2]['releases_checkbox'] 			= $details['second_checkbox'];
			$mainArr2[2]['accomplishment_percentage'] 	= $details['second_percentage'];
			$mainArr2[2]['accomplishment_amount'] 		= $details['second_amount'];
			$mainArr2[2]['wht'] 						= $details['second_wht'];
 			$mainArr2[2]['recoup'] 						= $details['second_recoup'];
 			$mainArr2[2]['retention'] 					= $details['second_retention'];
			$mainArr2[2]['electricity'] 				= $details['second_electricity'];
			$mainArr2[2]['water'] 						= $details['second_water'];
			$mainArr2[2]['others'] 						= $details['second_others'];
			$mainArr2[2]['net'] 						= $details['second_net'];
			$mainArr2[2]['date_processed'] 				= $details['second_date'];
 			$mainArr2[2]['check_no'] 					= $details['second_check'];
 			$mainArr2[2]['releases_no'] 				= 2;

			$mainArr2[3]['release_contractor_id'] 		= $mainArr['Id']; 
			$mainArr2[3]['releases'] 					= 'third'; 
			$mainArr2[3]['releases_checkbox'] 			= $details['third_checkbox'];
			$mainArr2[3]['accomplishment_percentage'] 	= $details['third_percentage'];
			$mainArr2[3]['accomplishment_amount'] 		= $details['third_amount'];
			$mainArr2[3]['wht'] 						= $details['third_wht'];
 			$mainArr2[3]['recoup'] 						= $details['third_recoup'];
 			$mainArr2[3]['retention'] 					= $details['third_retention'];
			$mainArr2[3]['electricity'] 				= $details['third_electricity'];
			$mainArr2[3]['water'] 						= $details['third_water'];
			$mainArr2[3]['others'] 						= $details['third_others'];
			$mainArr2[3]['net'] 						= $details['third_net'];
			$mainArr2[3]['date_processed'] 				= $details['third_date'];
 			$mainArr2[3]['check_no'] 					= $details['third_check'];
 			$mainArr2[3]['releases_no'] 				= 3;

			$mainArr2[4]['release_contractor_id'] 		= $mainArr['Id'];
			$mainArr2[4]['releases'] 					= 'fourth';
			$mainArr2[4]['releases_checkbox'] 			= $details['fourth_checkbox'];
			$mainArr2[4]['accomplishment_percentage'] 	= $details['fourth_percentage'];
			$mainArr2[4]['accomplishment_amount'] 		= $details['fourth_amount'];
			$mainArr2[4]['wht'] 						= $details['fourth_wht'];
 			$mainArr2[4]['recoup'] 						= $details['fourth_recoup'];
 			$mainArr2[4]['retention'] 					= $details['fourth_retention'];
			$mainArr2[4]['electricity'] 				= $details['fourth_electricity'];
			$mainArr2[4]['water'] 						= $details['fourth_water'];
			$mainArr2[4]['others'] 						= $details['fourth_others'];
			$mainArr2[4]['net'] 						= $details['fourth_net'];
			$mainArr2[4]['date_processed'] 				= $details['fourth_date'];
 			$mainArr2[4]['check_no'] 					= $details['fourth_check'];
 			$mainArr2[4]['releases_no'] 				= 4;

			$mainArr2[5]['release_contractor_id'] 		= $mainArr['Id']; 
			$mainArr2[5]['releases'] 					= 'fifth';
			$mainArr2[5]['releases_checkbox'] 			= $details['fifth_checkbox'];
			$mainArr2[5]['accomplishment_percentage'] 	= $details['fifth_percentage'];
			$mainArr2[5]['accomplishment_amount'] 		= $details['fifth_amount'];
			$mainArr2[5]['wht'] 						= $details['fifth_wht'];
 			$mainArr2[5]['recoup'] 						= $details['fifth_recoup'];
 			$mainArr2[5]['retention'] 					= $details['fifth_retention'];
			$mainArr2[5]['electricity'] 				= $details['fifth_electricity'];
			$mainArr2[5]['water'] 						= $details['fifth_water'];
			$mainArr2[5]['others'] 						= $details['fifth_others'];
			$mainArr2[5]['net'] 						= $details['fifth_net'];
			$mainArr2[5]['date_processed'] 				= $details['fifth_date'];
 			$mainArr2[5]['check_no'] 					= $details['fifth_check'];
 			$mainArr2[5]['releases_no'] 				= 5;

			$mainArr2[6]['release_contractor_id'] 		= $mainArr['Id'];
			$mainArr2[6]['releases'] 					= 'sixth';
			$mainArr2[6]['releases_checkbox'] 			= $details['sixth_checkbox'];
			$mainArr2[6]['accomplishment_percentage'] 	= $details['sixth_percentage'];
			$mainArr2[6]['accomplishment_amount'] 		= $details['sixth_amount'];
			$mainArr2[6]['wht'] 						= $details['sixth_wht'];
 			$mainArr2[6]['recoup'] 						= $details['sixth_recoup'];
 			$mainArr2[6]['retention'] 					= $details['sixth_retention'];
			$mainArr2[6]['electricity'] 				= $details['sixth_electricity'];
			$mainArr2[6]['water'] 						= $details['sixth_water'];
			$mainArr2[6]['others'] 						= $details['sixth_others'];
			$mainArr2[6]['net'] 						= $details['sixth_net'];
			$mainArr2[6]['date_processed'] 				= $details['sixth_date'];
 			$mainArr2[6]['check_no'] 					= $details['sixth_check'];
 			$mainArr2[6]['releases_no'] 				= 6;

			$mainArr2[7]['release_contractor_id'] 		= $mainArr['Id'];
			$mainArr2[7]['releases'] 					= 'seventh';
			$mainArr2[7]['releases_checkbox'] 			= $details['seventh_checkbox'];
			$mainArr2[7]['accomplishment_percentage'] 	= $details['seventh_percentage'];
			$mainArr2[7]['accomplishment_amount'] 		= $details['seventh_amount'];
			$mainArr2[7]['wht'] 						= $details['seventh_wht'];
 			$mainArr2[7]['recoup'] 						= $details['seventh_recoup'];
 			$mainArr2[7]['retention'] 					= $details['seventh_retention'];
			$mainArr2[7]['electricity'] 				= $details['seventh_electricity'];
			$mainArr2[7]['water'] 						= $details['seventh_water'];
			$mainArr2[7]['others'] 						= $details['seventh_others'];
			$mainArr2[7]['net'] 						= $details['seventh_net'];
			$mainArr2[7]['date_processed'] 				= $details['seventh_date'];
 			$mainArr2[7]['check_no'] 					= $details['seventh_check'];
 			$mainArr2[7]['releases_no'] 				= 7;

			$mainArr2[8]['release_contractor_id'] 		= $mainArr['Id'];
 			$mainArr2[8]['releases'] 					= 'eight';
 			$mainArr2[8]['releases_checkbox'] 			= $details['eight_checkbox'];
			$mainArr2[8]['accomplishment_percentage'] 	= $details['eight_percentage'];
			$mainArr2[8]['accomplishment_amount'] 		= $details['eight_amount'];
			$mainArr2[8]['wht'] 						= $details['eight_wht'];
 			$mainArr2[8]['recoup'] 						= $details['eight_recoup'];
 			$mainArr2[8]['retention'] 					= $details['eight_retention'];
			$mainArr2[8]['electricity'] 				= $details['eight_electricity'];
			$mainArr2[8]['water'] 						= $details['eight_water'];
			$mainArr2[8]['others'] 						= $details['eight_others'];
			$mainArr2[8]['net'] 						= $details['eight_net'];
			$mainArr2[8]['date_processed'] 				= $details['eight_date'];
 			$mainArr2[8]['check_no'] 					= $details['eight_check'];
 			$mainArr2[8]['releases_no'] 				= 8;

			$mainArr2[9]['release_contractor_id'] 		= $mainArr['Id'];
 			$mainArr2[9]['releases'] 					= 'nine';
 			$mainArr2[9]['releases_checkbox'] 			= $details['nine_checkbox'];
			$mainArr2[9]['accomplishment_percentage'] 	= $details['nine_percentage'];
			$mainArr2[9]['accomplishment_amount'] 		= $details['nine_amount'];
			$mainArr2[9]['wht'] 						= $details['nine_wht'];
 			$mainArr2[9]['recoup'] 						= $details['nine_recoup'];
 			$mainArr2[9]['retention'] 					= $details['nine_retention'];
			$mainArr2[9]['electricity'] 				= $details['nine_electricity'];
			$mainArr2[9]['water'] 						= $details['nine_water'];
			$mainArr2[9]['others'] 						= $details['nine_others'];
			$mainArr2[9]['net'] 						= $details['nine_net'];
			$mainArr2[9]['date_processed'] 				= $details['nine_date'];
 			$mainArr2[9]['check_no'] 					= $details['nine_check'];
 			$mainArr2[9]['releases_no'] 				= 9;

			$mainArr2[10]['release_contractor_id'] 		= $mainArr['Id'];
		 	$mainArr2[10]['releases'] 					= 'ten';
		  	$mainArr2[10]['releases_checkbox'] 			= $details['ten_checkbox'];
			$mainArr2[10]['accomplishment_percentage'] 	= $details['ten_percentage'];
			$mainArr2[10]['accomplishment_amount'] 		= $details['ten_amount'];
			$mainArr2[10]['wht'] 						= $details['ten_wht'];
 			$mainArr2[10]['recoup'] 					= $details['ten_recoup'];
 			$mainArr2[10]['retention'] 					= $details['ten_retention'];
			$mainArr2[10]['electricity'] 				= $details['ten_electricity'];
			$mainArr2[10]['water'] 						= $details['ten_water'];
			$mainArr2[10]['others'] 					= $details['ten_others'];
			$mainArr2[10]['net'] 						= $details['ten_net'];
			$mainArr2[10]['date_processed'] 			= $details['ten_date'];
 			$mainArr2[10]['check_no'] 					= $details['ten_check'];
 			$mainArr2[10]['releases_no'] 				= 10;

 			$mainArr2[11]['release_contractor_id'] 		= $mainArr['Id'];
		 	$mainArr2[11]['releases'] 					= 'eleven';
		  	$mainArr2[11]['releases_checkbox'] 			= $details['eleven_checkbox'];
			$mainArr2[11]['accomplishment_percentage'] 	= $details['eleven_percentage'];
			$mainArr2[11]['accomplishment_amount'] 		= $details['eleven_amount'];
			$mainArr2[11]['wht'] 						= $details['eleven_wht'];
 			$mainArr2[11]['recoup'] 					= $details['eleven_recoup'];
 			$mainArr2[11]['retention'] 					= $details['eleven_retention'];
			$mainArr2[11]['electricity'] 				= $details['eleven_electricity'];
			$mainArr2[11]['water'] 						= $details['eleven_water'];
			$mainArr2[11]['others'] 					= $details['eleven_others'];
			$mainArr2[11]['net'] 						= $details['eleven_net'];
			$mainArr2[11]['date_processed'] 			= $details['eleven_date'];
 			$mainArr2[11]['check_no'] 					= $details['eleven_check'];
 			$mainArr2[11]['releases_no'] 				= 11;

 			$mainArr2[12]['release_contractor_id'] 		= $mainArr['Id'];
		 	$mainArr2[12]['releases'] 					= 'twelve';
		  	$mainArr2[12]['releases_checkbox'] 			= $details['twelve_checkbox'];
			$mainArr2[12]['accomplishment_percentage'] 	= $details['twelve_percentage'];
			$mainArr2[12]['accomplishment_amount'] 		= $details['twelve_amount'];
			$mainArr2[12]['wht'] 						= $details['twelve_wht'];
 			$mainArr2[12]['recoup'] 					= $details['twelve_recoup'];
 			$mainArr2[12]['retention'] 					= $details['twelve_retention'];
			$mainArr2[12]['electricity'] 				= $details['twelve_electricity'];
			$mainArr2[12]['water'] 						= $details['twelve_water'];
			$mainArr2[12]['others'] 					= $details['twelve_others'];
			$mainArr2[12]['net'] 						= $details['twelve_net'];
			$mainArr2[12]['date_processed'] 			= $details['twelve_date'];
 			$mainArr2[12]['check_no'] 					= $details['twelve_check'];
 			$mainArr2[12]['releases_no'] 				= 12;

 			$mainArr2[13]['release_contractor_id'] 		= $mainArr['Id'];
		 	$mainArr2[13]['releases'] 					= 'thirteen';
		  	$mainArr2[13]['releases_checkbox'] 			= $details['thirteen_checkbox'];
			$mainArr2[13]['accomplishment_percentage'] 	= $details['thirteen_percentage'];
			$mainArr2[13]['accomplishment_amount'] 		= $details['thirteen_amount'];
			$mainArr2[13]['wht'] 						= $details['thirteen_wht'];
 			$mainArr2[13]['recoup'] 					= $details['thirteen_recoup'];
 			$mainArr2[13]['retention'] 					= $details['thirteen_retention'];
			$mainArr2[13]['electricity'] 				= $details['thirteen_electricity'];
			$mainArr2[13]['water'] 						= $details['thirteen_water'];
			$mainArr2[13]['others'] 					= $details['thirteen_others'];
			$mainArr2[13]['net'] 						= $details['thirteen_net'];
			$mainArr2[13]['date_processed'] 			= $details['thirteen_date'];
 			$mainArr2[13]['check_no'] 					= $details['thirteen_check'];
 			$mainArr2[13]['releases_no'] 				= 13;

 			$mainArr2[14]['release_contractor_id'] 		= $mainArr['Id'];
		 	$mainArr2[14]['releases'] 					= 'fourteen';
		  	$mainArr2[14]['releases_checkbox'] 			= $details['fourteen_checkbox'];
			$mainArr2[14]['accomplishment_percentage'] 	= $details['fourteen_percentage'];
			$mainArr2[14]['accomplishment_amount'] 		= $details['fourteen_amount'];
			$mainArr2[14]['wht'] 						= $details['fourteen_wht'];
 			$mainArr2[14]['recoup'] 					= $details['fourteen_recoup'];
 			$mainArr2[14]['retention'] 					= $details['fourteen_retention'];
			$mainArr2[14]['electricity'] 				= $details['fourteen_electricity'];
			$mainArr2[14]['water'] 						= $details['fourteen_water'];
			$mainArr2[14]['others'] 					= $details['fourteen_others'];
			$mainArr2[14]['net'] 						= $details['fourteen_net'];
			$mainArr2[14]['date_processed'] 			= $details['fourteen_date'];
 			$mainArr2[14]['check_no'] 					= $details['fourteen_check'];
 			$mainArr2[14]['releases_no'] 				= 14;

 			$mainArr2[15]['release_contractor_id'] 		= $mainArr['Id'];
		 	$mainArr2[15]['releases'] 					= 'fifteen';
		  	$mainArr2[15]['releases_checkbox'] 			= $details['fifteen_checkbox'];
			$mainArr2[15]['accomplishment_percentage'] 	= $details['fifteen_percentage'];
			$mainArr2[15]['accomplishment_amount'] 		= $details['fifteen_amount'];
			$mainArr2[15]['wht'] 						= $details['fifteen_wht'];
 			$mainArr2[15]['recoup'] 					= $details['fifteen_recoup'];
 			$mainArr2[15]['retention'] 					= $details['fifteen_retention'];
			$mainArr2[15]['electricity'] 				= $details['fifteen_electricity'];
			$mainArr2[15]['water'] 						= $details['fifteen_water'];
			$mainArr2[15]['others'] 					= $details['fifteen_others'];
			$mainArr2[15]['net'] 						= $details['fifteen_net'];
			$mainArr2[15]['date_processed'] 			= $details['fifteen_date'];
 			$mainArr2[15]['check_no'] 					= $details['fifteen_check'];
 			$mainArr2[15]['releases_no'] 				= 15;

 			$mainArr2[16]['release_contractor_id'] 		= $mainArr['Id'];
		 	$mainArr2[16]['releases'] 					= 'sixteen';
		  	$mainArr2[16]['releases_checkbox'] 			= $details['sixteen_checkbox'];
			$mainArr2[16]['accomplishment_percentage'] 	= $details['sixteen_percentage'];
			$mainArr2[16]['accomplishment_amount'] 		= $details['sixteen_amount'];
			$mainArr2[16]['wht'] 						= $details['sixteen_wht'];
 			$mainArr2[16]['recoup'] 					= $details['sixteen_recoup'];
 			$mainArr2[16]['retention'] 					= $details['sixteen_retention'];
			$mainArr2[16]['electricity'] 				= $details['sixteen_electricity'];
			$mainArr2[16]['water'] 						= $details['sixteen_water'];
			$mainArr2[16]['others'] 					= $details['sixteen_others'];
			$mainArr2[16]['net'] 						= $details['sixteen_net'];
			$mainArr2[16]['date_processed'] 			= $details['sixteen_date'];
 			$mainArr2[16]['check_no'] 					= $details['sixteen_check'];
 			$mainArr2[16]['releases_no'] 				= 16;

			$mainArr2[17]['release_contractor_id'] 		= $mainArr['Id'];
		 	$mainArr2[17]['releases'] 					= 'seventeen';
		  	$mainArr2[17]['releases_checkbox'] 			= $details['seventeen_checkbox'];
			$mainArr2[17]['accomplishment_percentage'] 	= $details['seventeen_percentage'];
			$mainArr2[17]['accomplishment_amount'] 		= $details['seventeen_amount'];
			$mainArr2[17]['wht'] 						= $details['seventeen_wht'];
 			$mainArr2[17]['recoup'] 					= $details['seventeen_recoup'];
 			$mainArr2[17]['retention'] 					= $details['seventeen_retention'];
			$mainArr2[17]['electricity'] 				= $details['seventeen_electricity'];
			$mainArr2[17]['water'] 						= $details['seventeen_water'];
			$mainArr2[17]['others'] 					= $details['seventeen_others'];
			$mainArr2[17]['net'] 						= $details['seventeen_net'];
			$mainArr2[17]['date_processed'] 			= $details['seventeen_date'];
 			$mainArr2[17]['check_no'] 					= $details['seventeen_check'];
 			$mainArr2[17]['releases_no'] 				= 17;

 			
 			$mainArr2[18]['release_contractor_id'] 		= $mainArr['Id'];
		 	$mainArr2[18]['releases'] 					= 'eighteen';
		  	$mainArr2[18]['releases_checkbox'] 			= $details['eighteen_checkbox'];
			$mainArr2[18]['accomplishment_percentage'] 	= $details['eighteen_percentage'];
			$mainArr2[18]['accomplishment_amount'] 		= $details['eighteen_amount'];
			$mainArr2[18]['wht'] 						= $details['eighteen_wht'];
 			$mainArr2[18]['recoup'] 					= $details['eighteen_recoup'];
 			$mainArr2[18]['retention'] 					= $details['eighteen_retention'];
			$mainArr2[18]['electricity'] 				= $details['eighteen_electricity'];
			$mainArr2[18]['water'] 						= $details['eighteen_water'];
			$mainArr2[18]['others'] 					= $details['eighteen_others'];
			$mainArr2[18]['net'] 						= $details['eighteen_net'];
			$mainArr2[18]['date_processed'] 			= $details['eighteen_date'];
 			$mainArr2[18]['check_no'] 					= $details['eighteen_check'];
 			$mainArr2[18]['releases_no'] 				= 18;

 			$mainArr2[19]['release_contractor_id'] 		= $mainArr['Id'];
		 	$mainArr2[19]['releases'] 					= 'nineteen';
		  	$mainArr2[19]['releases_checkbox'] 			= $details['nineteen_checkbox'];
			$mainArr2[19]['accomplishment_percentage'] 	= $details['nineteen_percentage'];
			$mainArr2[19]['accomplishment_amount'] 		= $details['nineteen_amount'];
			$mainArr2[19]['wht'] 						= $details['nineteen_wht'];
 			$mainArr2[19]['recoup'] 					= $details['nineteen_recoup'];
 			$mainArr2[19]['retention'] 					= $details['nineteen_retention'];
			$mainArr2[19]['electricity'] 				= $details['nineteen_electricity'];
			$mainArr2[19]['water'] 						= $details['nineteen_water'];
			$mainArr2[19]['others'] 					= $details['nineteen_others'];
			$mainArr2[19]['net'] 						= $details['nineteen_net'];
			$mainArr2[19]['date_processed'] 			= $details['nineteen_date'];
 			$mainArr2[19]['check_no'] 					= $details['nineteen_check'];
 			$mainArr2[19]['releases_no'] 				= 19;

 			$mainArr2[20]['release_contractor_id'] 		= $mainArr['Id'];
		 	$mainArr2[20]['releases'] 					= 'twenty';
		  	$mainArr2[20]['releases_checkbox'] 			= $details['twenty_checkbox'];
			$mainArr2[20]['accomplishment_percentage'] 	= $details['twenty_percentage'];
			$mainArr2[20]['accomplishment_amount'] 		= $details['twenty_amount'];
			$mainArr2[20]['wht'] 						= $details['twenty_wht'];
 			$mainArr2[20]['recoup'] 					= $details['twenty_recoup'];
 			$mainArr2[20]['retention'] 					= $details['twenty_retention'];
			$mainArr2[20]['electricity'] 				= $details['twenty_electricity'];
			$mainArr2[20]['water'] 						= $details['twenty_water'];
			$mainArr2[20]['others'] 					= $details['twenty_others'];
			$mainArr2[20]['net'] 						= $details['twenty_net'];
			$mainArr2[20]['date_processed'] 			= $details['twenty_date'];
 			$mainArr2[20]['check_no'] 					= $details['twenty_check'];
 			$mainArr2[20]['releases_no'] 				= 20;

 			 

			$output 					= $mecon->insertMultipleQuery($mainArr2,"releases_to_contractor_details"); 

 
	}else{
		//reservation exist update record
			$mainArr['UpdatedDate'] 	= $timeStamp;
			$mainArr['UpdatedBy'] 		= $currentUser;
			$condArr['Id']				= $mainid;
			$output2 					= $mecon->updateQuery($mainArr,"releases_to_contractor",$condArr);
			$mainArr['Id']				= $mainid;

			//SAVING TO RELEASES TO CONTRACTOR DETAILS
			$condDownArr['release_contractor_id']		= $mainid;
			$condDownArr['releases']					= 'downpayment';
			$downArr['release_contractor_id'] 			= $mainArr['Id']; 
			$downArr['releases'] 						= 'downpayment';
			$downArr['releases_checkbox'] 				= $details['downpayment_checkbox'];
			$downArr['accomplishment_percentage'] 		= $details['downpayment_percentage'];
			$downArr['accomplishment_amount'] 			= $details['downpayment_amount'];
			$downArr['wht'] 							= $details['downpayment_wht'];
 			$downArr['recoup'] 							= $details['downpayment_recoup'];
 			$downArr['retention'] 						= $details['downpayment_retention'];
			$downArr['electricity'] 					= $details['downpayment_electricity'];
			$downArr['water'] 							= $details['downpayment_water'];
			$downArr['others'] 							= $details['downpayment_others'];
			$downArr['net'] 							= $details['downpayment_net'];
			$downArr['date_processed'] 					= $details['downpayment_date'];
 			$downArr['check_no'] 						= $details['downpayment_check'];
 			$downArr['releases_no'] 					= 0;
 			$out0 = $mecon->updateQuery($downArr,"releases_to_contractor_details",$condDownArr);
 
			//FIRST  
    		$condOneArr['release_contractor_id']	= $mainid;
			$condOneArr['releases']					= 'first';
			$oneArr['release_contractor_id'] 		= $mainArr['Id'];
			$oneArr['releases'] 					= 'first';
			$oneArr['releases_checkbox'] 			= $details['first_checkbox'];
			$oneArr['accomplishment_percentage'] 	= $details['first_percentage'];
			$oneArr['accomplishment_amount'] 		= $details['first_amount'];
			$oneArr['wht'] 							= $details['first_wht'];
 			$oneArr['recoup'] 						= $details['first_recoup'];
 			$oneArr['retention'] 					= $details['first_retention'];
			$oneArr['electricity'] 					= $details['first_electricity'];
			$oneArr['water'] 						= $details['first_water'];
			$oneArr['others'] 						= $details['first_others'];
			$oneArr['net'] 							= $details['first_net'];
			$oneArr['date_processed'] 				= $details['first_date'];
 			$oneArr['check_no'] 					= $details['first_check'];
 			$oneArr['releases_no'] 					= 1;
 			$out1 = $mecon->updateQuery($oneArr,"releases_to_contractor_details",$condOneArr);

 			//SECOND  
    		$condTwoArr['release_contractor_id']	= $mainid;
			$condTwoArr['releases']					= 'second';
			$twoArr['release_contractor_id'] 		= $mainArr['Id'];
			$twoArr['releases'] 					= 'second';
			$twoArr['releases_checkbox'] 			= $details['second_checkbox'];
			$twoArr['accomplishment_percentage'] 	= $details['second_percentage'];
			$twoArr['accomplishment_amount'] 		= $details['second_amount'];
			$twoArr['wht'] 							= $details['second_wht'];
 			$twoArr['recoup'] 						= $details['second_recoup'];
 			$twoArr['retention'] 					= $details['second_retention'];
			$twoArr['electricity'] 					= $details['second_electricity'];
			$twoArr['water'] 						= $details['second_water'];
			$twoArr['others'] 						= $details['second_others'];
			$twoArr['net'] 							= $details['second_net'];
			$twoArr['date_processed'] 				= $details['second_date'];
 			$twoArr['check_no'] 					= $details['second_check'];
 			$twoArr['releases_no'] 					= 2;
 			$out2 = $mecon->updateQuery($twoArr,"releases_to_contractor_details",$condTwoArr);
 			
 			//THREE
 			$condThreeArr['release_contractor_id']	= $mainid;
			$condThreeArr['releases']				= 'third';
			$threeArr['release_contractor_id'] 		= $mainArr['Id']; 
			$threeArr['releases'] 					= 'third'; 
			$threeArr['releases_checkbox'] 			= $details['third_checkbox'];
			$threeArr['accomplishment_percentage'] 	= $details['third_percentage'];
			$threeArr['accomplishment_amount'] 		= $details['third_amount'];
			$threeArr['wht'] 						= $details['third_wht'];
 			$threeArr['recoup'] 					= $details['third_recoup'];
 			$threeArr['retention'] 					= $details['third_retention'];
			$threeArr['electricity'] 				= $details['third_electricity'];
			$threeArr['water'] 						= $details['third_water'];
			$threeArr['others'] 					= $details['third_others'];
			$threeArr['net'] 						= $details['third_net'];
			$threeArr['date_processed'] 			= $details['third_date'];
 			$threeArr['check_no'] 					= $details['third_check'];
 			$threeArr['releases_no'] 				= 3;
 			$out3 = $mecon->updateQuery($threeArr,"releases_to_contractor_details",$condThreeArr);

 			//FOUR
 			$condFourArr['release_contractor_id']	= $mainid;
			$condFourArr['releases']				= 'fourth';
			$fourArr['release_contractor_id'] 		= $mainArr['Id'];
			$fourArr['releases'] 					= 'fourth';
			$fourArr['releases_checkbox'] 			= $details['fourth_checkbox'];
			$fourArr['accomplishment_percentage'] 	= $details['fourth_percentage'];
			$fourArr['accomplishment_amount'] 		= $details['fourth_amount'];
			$fourArr['wht'] 						= $details['fourth_wht'];
 			$fourArr['recoup'] 						= $details['fourth_recoup'];
 			$fourArr['retention'] 					= $details['fourth_retention'];
			$fourArr['electricity'] 				= $details['fourth_electricity'];
			$fourArr['water'] 						= $details['fourth_water'];
			$fourArr['others'] 						= $details['fourth_others'];
			$fourArr['net'] 						= $details['fourth_net'];
			$fourArr['date_processed'] 				= $details['fourth_date'];
 			$fourArr['check_no'] 					= $details['fourth_check'];
 			$fourArr['releases_no'] 				= 4;
 			$out4 = $mecon->updateQuery($fourArr,"releases_to_contractor_details",$condFourArr);

 			//FIFTH
 			$condFifthArr['release_contractor_id']	= $mainid;
			$condFifthArr['releases']				= 'fifth';
			$fifthArr['release_contractor_id'] 		= $mainArr['Id']; 
			$fifthArr['releases'] 					= 'fifth';
			$fifthArr['releases_checkbox'] 			= $details['fifth_checkbox'];
			$fifthArr['accomplishment_percentage'] 	= $details['fifth_percentage'];
			$fifthArr['accomplishment_amount'] 		= $details['fifth_amount'];
			$fifthArr['wht'] 						= $details['fifth_wht'];
 			$fifthArr['recoup'] 					= $details['fifth_recoup'];
 			$fifthArr['retention'] 					= $details['fifth_retention'];
			$fifthArr['electricity'] 				= $details['fifth_electricity'];
			$fifthArr['water'] 						= $details['fifth_water'];
			$fifthArr['others'] 					= $details['fifth_others'];
			$fifthArr['net'] 						= $details['fifth_net'];
			$fifthArr['date_processed'] 			= $details['fifth_date'];
 			$fifthArr['check_no'] 					= $details['fifth_check'];
 			$fifthArr['releases_no'] 				= 5;
			$out5 = $mecon->updateQuery($fifthArr,"releases_to_contractor_details",$condFifthArr);

			//SIX
 			$condSixArr['release_contractor_id']	= $mainid;
			$condSixArr['releases']					= 'sixth';
			$sixArr['release_contractor_id'] 		= $mainArr['Id'];
			$sixArr['releases'] 					= 'sixth';
			$sixArr['releases_checkbox'] 			= $details['sixth_checkbox'];
			$sixArr['accomplishment_percentage'] 	= $details['sixth_percentage'];
			$sixArr['accomplishment_amount'] 		= $details['sixth_amount'];
			$sixArr['wht'] 							= $details['sixth_wht'];
 			$sixArr['recoup'] 						= $details['sixth_recoup'];
 			$sixArr['retention'] 					= $details['sixth_retention'];
			$sixArr['electricity'] 					= $details['sixth_electricity'];
			$sixArr['water'] 						= $details['sixth_water'];
			$sixArr['others'] 						= $details['sixth_others'];
			$sixArr['net'] 							= $details['sixth_net'];
			$sixArr['date_processed'] 				= $details['sixth_date'];
 			$sixArr['check_no'] 					= $details['sixth_check'];
 			$sixArr['releases_no'] 					= 6;
 			$out6 = $mecon->updateQuery($sixArr,"releases_to_contractor_details",$condSixArr);	


 			//SEVEN
 			$condSevenArr['release_contractor_id']	= $mainid;
			$condSevenArr['releases']				= 'seventh';
			$sevenArr['release_contractor_id'] 		= $mainArr['Id'];
			$sevenArr['releases'] 					= 'seventh';
			$sevenArr['releases_checkbox'] 			= $details['seventh_checkbox'];
			$sevenArr['accomplishment_percentage'] 	= $details['seventh_percentage'];
			$sevenArr['accomplishment_amount'] 		= $details['seventh_amount'];
			$sevenArr['wht'] 						= $details['seventh_wht'];
 			$sevenArr['recoup'] 					= $details['seventh_recoup'];
 			$sevenArr['retention'] 					= $details['seventh_retention'];
			$sevenArr['electricity'] 				= $details['seventh_electricity'];
			$sevenArr['water'] 						= $details['seventh_water'];
			$sevenArr['others'] 					= $details['seventh_others'];
			$sevenArr['net'] 						= $details['seventh_net'];
			$sevenArr['date_processed'] 			= $details['seventh_date'];
 			$sevenArr['check_no'] 					= $details['seventh_check'];
 			$sevenArr['releases_no'] 				= 7;
 			$out7 = $mecon->updateQuery($sevenArr,"releases_to_contractor_details",$condSevenArr);	


 			//EIGHT
 			$condEightArr['release_contractor_id']	= $mainid;
			$condEightArr['releases']				= 'eight';
			$eightArr['release_contractor_id'] 		= $mainArr['Id'];
 			$eightArr['releases'] 					= 'eight';
 			$eightArr['releases_checkbox'] 			= $details['eight_checkbox'];
			$eightArr['accomplishment_percentage'] 	= $details['eight_percentage'];
			$eightArr['accomplishment_amount'] 		= $details['eight_amount'];
			$eightArr['wht'] 						= $details['eight_wht'];
 			$eightArr['recoup'] 					= $details['eight_recoup'];
 			$eightArr['retention'] 					= $details['eight_retention'];
			$eightArr['electricity'] 				= $details['eight_electricity'];
			$eightArr['water'] 						= $details['eight_water'];
			$eightArr['others'] 					= $details['eight_others'];
			$eightArr['net'] 						= $details['eight_net'];
			$eightArr['date_processed'] 			= $details['eight_date'];
 			$eightArr['check_no'] 					= $details['eight_check'];
 			$eightArr['releases_no'] 				= 8;
 			$out8 = $mecon->updateQuery($eightArr,"releases_to_contractor_details",$condEightArr);	


 			//NINE
 			$condNineArr['release_contractor_id']	= $mainid;
			$condNineArr['releases']				= 'nine';
			$nineArr['release_contractor_id'] 		= $mainArr['Id'];
 			$nineArr['releases'] 					= 'nine';
 			$nineArr['releases_checkbox'] 			= $details['nine_checkbox'];
			$nineArr['accomplishment_percentage'] 	= $details['nine_percentage'];
			$nineArr['accomplishment_amount'] 		= $details['nine_amount'];
			$nineArr['wht'] 						= $details['nine_wht'];
 			$nineArr['recoup'] 						= $details['nine_recoup'];
 			$nineArr['retention'] 					= $details['nine_retention'];
			$nineArr['electricity'] 				= $details['nine_electricity'];
			$nineArr['water'] 						= $details['nine_water'];
			$nineArr['others'] 						= $details['nine_others'];
			$nineArr['net'] 						= $details['nine_net'];
			$nineArr['date_processed'] 				= $details['nine_date'];
 			$nineArr['check_no'] 					= $details['nine_check'];
 			$nineArr['releases_no'] 				= 9;
 			$out9 = $mecon->updateQuery($nineArr,"releases_to_contractor_details",$condNineArr);	

 			//TEN
 			$condTenArr['release_contractor_id']	= $mainid;
			$condTenArr['releases']					= 'ten';
			$tenArr['release_contractor_id'] 		= $mainArr['Id'];
		 	$tenArr['releases'] 					= 'ten';
		  	$tenArr['releases_checkbox'] 			= $details['ten_checkbox'];
			$tenArr['accomplishment_percentage'] 	= $details['ten_percentage'];
			$tenArr['accomplishment_amount'] 		= $details['ten_amount'];
			$tenArr['wht'] 							= $details['ten_wht'];
 			$tenArr['recoup'] 						= $details['ten_recoup'];
 			$tenArr['retention'] 					= $details['ten_retention'];
			$tenArr['electricity'] 					= $details['ten_electricity'];
			$tenArr['water'] 						= $details['ten_water'];
			$tenArr['others'] 						= $details['ten_others'];
			$tenArr['net'] 							= $details['ten_net'];
			$tenArr['date_processed'] 				= $details['ten_date'];
 			$tenArr['check_no'] 					= $details['ten_check'];
 			$tenArr['releases_no'] 					= 10;
 			$out10 = $mecon->updateQuery($tenArr,"releases_to_contractor_details",$condTenArr);	

 			//ELEVEn
 			$condelevenArr['release_contractor_id']		= $mainid;
			$condelevenArr['releases']					= 'eleven';
			$elevenArr['release_contractor_id'] 		= $mainArr['Id'];
		 	$elevenArr['releases'] 						= 'eleven';
		  	$elevenArr['releases_checkbox'] 			= $details['eleven_checkbox'];
			$elevenArr['accomplishment_percentage'] 	= $details['eleven_percentage'];
			$elevenArr['accomplishment_amount'] 		= $details['eleven_amount'];
			$elevenArr['wht'] 							= $details['eleven_wht'];
 			$elevenArr['recoup'] 						= $details['eleven_recoup'];
 			$elevenArr['retention'] 					= $details['eleven_retention'];
			$elevenArr['electricity'] 					= $details['eleven_electricity'];
			$elevenArr['water'] 						= $details['eleven_water'];
			$elevenArr['others'] 						= $details['eleven_others'];
			$elevenArr['net'] 							= $details['eleven_net'];
			$elevenArr['date_processed'] 				= $details['eleven_date'];
 			$elevenArr['check_no'] 						= $details['eleven_check'];
 			$elevenArr['releases_no'] 					= 11;
 			$out11 = $mecon->updateQuery($elevenArr,"releases_to_contractor_details",$condelevenArr);	

 			//twelve
 			$condtwelveArr['release_contractor_id']	= $mainid;
			$condtwelveArr['releases']				= 'twelve';
			$twelveArr['release_contractor_id'] 		= $mainArr['Id'];
 			$twelveArr['releases'] 					= 'twelve';
 			$twelveArr['releases_checkbox'] 			= $details['twelve_checkbox'];
			$twelveArr['accomplishment_percentage'] 	= $details['twelve_percentage'];
			$twelveArr['accomplishment_amount'] 		= $details['twelve_amount'];
			$twelveArr['wht'] 						= $details['twelve_wht'];
 			$twelveArr['recoup'] 						= $details['twelve_recoup'];
 			$twelveArr['retention'] 					= $details['twelve_retention'];
			$twelveArr['electricity'] 				= $details['twelve_electricity'];
			$twelveArr['water'] 						= $details['twelve_water'];
			$twelveArr['others'] 						= $details['twelve_others'];
			$twelveArr['net'] 						= $details['twelve_net'];
			$twelveArr['date_processed'] 				= $details['twelve_date'];
 			$twelveArr['check_no'] 					= $details['twelve_check'];
 			$twelveArr['releases_no'] 				= 12;
 			$out12 = $mecon->updateQuery($twelveArr,"releases_to_contractor_details",$condtwelveArr);	

 			//thirteen
 			$condthirteenArr['release_contractor_id']	= $mainid;
			$condthirteenArr['releases']				= 'thirteen';
			$thirteenArr['release_contractor_id'] 		= $mainArr['Id'];
 			$thirteenArr['releases'] 					= 'thirteen';
 			$thirteenArr['releases_checkbox'] 			= $details['thirteen_checkbox'];
			$thirteenArr['accomplishment_percentage'] 	= $details['thirteen_percentage'];
			$thirteenArr['accomplishment_amount'] 		= $details['thirteen_amount'];
			$thirteenArr['wht'] 						= $details['thirteen_wht'];
 			$thirteenArr['recoup'] 						= $details['thirteen_recoup'];
 			$thirteenArr['retention'] 					= $details['thirteen_retention'];
			$thirteenArr['electricity'] 				= $details['thirteen_electricity'];
			$thirteenArr['water'] 						= $details['thirteen_water'];
			$thirteenArr['others'] 						= $details['thirteen_others'];
			$thirteenArr['net'] 						= $details['thirteen_net'];
			$thirteenArr['date_processed'] 				= $details['thirteen_date'];
 			$thirteenArr['check_no'] 					= $details['thirteen_check'];
 			$thirteenArr['releases_no'] 				= 13;
 			$out13 = $mecon->updateQuery($thirteenArr,"releases_to_contractor_details",$condthirteenArr);	

 			//fourteen
 			$condfourteenArr['release_contractor_id']	= $mainid;
			$condfourteenArr['releases']				= 'fourteen';
			$fourteenArr['release_contractor_id'] 		= $mainArr['Id'];
 			$fourteenArr['releases'] 					= 'fourteen';
 			$fourteenArr['releases_checkbox'] 			= $details['fourteen_checkbox'];
			$fourteenArr['accomplishment_percentage'] 	= $details['fourteen_percentage'];
			$fourteenArr['accomplishment_amount'] 		= $details['fourteen_amount'];
			$fourteenArr['wht'] 						= $details['fourteen_wht'];
 			$fourteenArr['recoup'] 						= $details['fourteen_recoup'];
 			$fourteenArr['retention'] 					= $details['fourteen_retention'];
			$fourteenArr['electricity'] 				= $details['fourteen_electricity'];
			$fourteenArr['water'] 						= $details['fourteen_water'];
			$fourteenArr['others'] 						= $details['fourteen_others'];
			$fourteenArr['net'] 						= $details['fourteen_net'];
			$fourteenArr['date_processed'] 				= $details['fourteen_date'];
 			$fourteenArr['check_no'] 					= $details['fourteen_check'];
 			$fourteenArr['releases_no'] 				= 14;
 			$out14 = $mecon->updateQuery($fourteenArr,"releases_to_contractor_details",$condfourteenArr);	

 			//fifteen
 			$condfifteenArr['release_contractor_id']	= $mainid;
			$condfifteenArr['releases']					= 'fifteen';
			$fifteenArr['release_contractor_id'] 		= $mainArr['Id'];
 			$fifteenArr['releases'] 					= 'fifteen';
 			$fifteenArr['releases_checkbox'] 			= $details['fifteen_checkbox'];
			$fifteenArr['accomplishment_percentage'] 	= $details['fifteen_percentage'];
			$fifteenArr['accomplishment_amount'] 		= $details['fifteen_amount'];
			$fifteenArr['wht'] 							= $details['fifteen_wht'];
 			$fifteenArr['recoup'] 						= $details['fifteen_recoup'];
 			$fifteenArr['retention'] 					= $details['fifteen_retention'];
			$fifteenArr['electricity'] 					= $details['fifteen_electricity'];
			$fifteenArr['water'] 						= $details['fifteen_water'];
			$fifteenArr['others'] 						= $details['fifteen_others'];
			$fifteenArr['net'] 							= $details['fifteen_net'];
			$fifteenArr['date_processed'] 				= $details['fifteen_date'];
 			$fifteenArr['check_no'] 					= $details['fifteen_check'];
 			$fifteenArr['releases_no'] 					= 15;
 			$out15 = $mecon->updateQuery($fifteenArr,"releases_to_contractor_details",$condfifteenArr);	

 			//sixteen
 			$condsixteenArr['release_contractor_id']	= $mainid;
			$condsixteenArr['releases']				= 'sixteen';
			$sixteenArr['release_contractor_id'] 		= $mainArr['Id'];
 			$sixteenArr['releases'] 					= 'sixteen';
 			$sixteenArr['releases_checkbox'] 			= $details['sixteen_checkbox'];
			$sixteenArr['accomplishment_percentage'] 	= $details['sixteen_percentage'];
			$sixteenArr['accomplishment_amount'] 		= $details['sixteen_amount'];
			$sixteenArr['wht'] 						= $details['sixteen_wht'];
 			$sixteenArr['recoup'] 						= $details['sixteen_recoup'];
 			$sixteenArr['retention'] 					= $details['sixteen_retention'];
			$sixteenArr['electricity'] 				= $details['sixteen_electricity'];
			$sixteenArr['water'] 						= $details['sixteen_water'];
			$sixteenArr['others'] 						= $details['sixteen_others'];
			$sixteenArr['net'] 						= $details['sixteen_net'];
			$sixteenArr['date_processed'] 				= $details['sixteen_date'];
 			$sixteenArr['check_no'] 					= $details['sixteen_check'];
 			$sixteenArr['releases_no'] 				= 16;
 			$out16 = $mecon->updateQuery($sixteenArr,"releases_to_contractor_details",$condsixteenArr);	

 			//seventeen
 			$condseventeenArr['release_contractor_id']	= $mainid;
			$condseventeenArr['releases']				= 'seventeen';
			$seventeenArr['release_contractor_id'] 		= $mainArr['Id'];
 			$seventeenArr['releases'] 					= 'seventeen';
 			$seventeenArr['releases_checkbox'] 			= $details['seventeen_checkbox'];
			$seventeenArr['accomplishment_percentage'] 	= $details['seventeen_percentage'];
			$seventeenArr['accomplishment_amount'] 		= $details['seventeen_amount'];
			$seventeenArr['wht'] 						= $details['seventeen_wht'];
 			$seventeenArr['recoup'] 						= $details['seventeen_recoup'];
 			$seventeenArr['retention'] 					= $details['seventeen_retention'];
			$seventeenArr['electricity'] 				= $details['seventeen_electricity'];
			$seventeenArr['water'] 						= $details['seventeen_water'];
			$seventeenArr['others'] 						= $details['seventeen_others'];
			$seventeenArr['net'] 						= $details['seventeen_net'];
			$seventeenArr['date_processed'] 				= $details['seventeen_date'];
 			$seventeenArr['check_no'] 					= $details['seventeen_check'];
 			$seventeenArr['releases_no'] 				= 17;
 			$out17 = $mecon->updateQuery($seventeenArr,"releases_to_contractor_details",$condseventeenArr);	

 			//eighteen
 			$condeighteenArr['release_contractor_id']	= $mainid;
			$condeighteenArr['releases']				= 'eighteen';
			$eighteenArr['release_contractor_id'] 		= $mainArr['Id'];
 			$eighteenArr['releases'] 					= 'eighteen';
 			$eighteenArr['releases_checkbox'] 			= $details['eighteen_checkbox'];
			$eighteenArr['accomplishment_percentage'] 	= $details['eighteen_percentage'];
			$eighteenArr['accomplishment_amount'] 		= $details['eighteen_amount'];
			$eighteenArr['wht'] 						= $details['eighteen_wht'];
 			$eighteenArr['recoup'] 						= $details['eighteen_recoup'];
 			$eighteenArr['retention'] 					= $details['eighteen_retention'];
			$eighteenArr['electricity'] 				= $details['eighteen_electricity'];
			$eighteenArr['water'] 						= $details['eighteen_water'];
			$eighteenArr['others'] 						= $details['eighteen_others'];
			$eighteenArr['net'] 						= $details['eighteen_net'];
			$eighteenArr['date_processed'] 				= $details['eighteen_date'];
 			$eighteenArr['check_no'] 					= $details['eighteen_check'];
 			$eighteenArr['releases_no'] 				= 18;
 			$out18 = $mecon->updateQuery($eighteenArr,"releases_to_contractor_details",$condeighteenArr);	

 			//nineteen
 			$condnineteenArr['release_contractor_id']	= $mainid;
			$condnineteenArr['releases']				= 'nineteen';
			$nineteenArr['release_contractor_id'] 		= $mainArr['Id'];
 			$nineteenArr['releases'] 					= 'nineteen';
 			$nineteenArr['releases_checkbox'] 			= $details['nineteen_checkbox'];
			$nineteenArr['accomplishment_percentage'] 	= $details['nineteen_percentage'];
			$nineteenArr['accomplishment_amount'] 		= $details['nineteen_amount'];
			$nineteenArr['wht'] 						= $details['nineteen_wht'];
 			$nineteenArr['recoup'] 						= $details['nineteen_recoup'];
 			$nineteenArr['retention'] 					= $details['nineteen_retention'];
			$nineteenArr['electricity'] 				= $details['nineteen_electricity'];
			$nineteenArr['water'] 						= $details['nineteen_water'];
			$nineteenArr['others'] 						= $details['nineteen_others'];
			$nineteenArr['net'] 						= $details['nineteen_net'];
			$nineteenArr['date_processed'] 				= $details['nineteen_date'];
 			$nineteenArr['check_no'] 					= $details['nineteen_check'];
 			$nineteenArr['releases_no'] 				= 19;
 			$out19 = $mecon->updateQuery($nineteenArr,"releases_to_contractor_details",$condnineteenArr);	

 			//twenty
 			$condtwentyArr['release_contractor_id']		= $mainid;
			$condtwentyArr['releases']					= 'twenty';
			$twentyArr['release_contractor_id'] 		= $mainArr['Id'];
 			$twentyArr['releases'] 						= 'twenty';
 			$twentyArr['releases_checkbox'] 			= $details['twenty_checkbox'];
			$twentyArr['accomplishment_percentage'] 	= $details['twenty_percentage'];
			$twentyArr['accomplishment_amount'] 		= $details['twenty_amount'];
			$twentyArr['wht'] 							= $details['twenty_wht'];
 			$twentyArr['recoup'] 						= $details['twenty_recoup'];
 			$twentyArr['retention'] 					= $details['twenty_retention'];
			$twentyArr['electricity'] 					= $details['twenty_electricity'];
			$twentyArr['water'] 						= $details['twenty_water'];
			$twentyArr['others'] 						= $details['twenty_others'];
			$twentyArr['net'] 							= $details['twenty_net'];
			$twentyArr['date_processed'] 				= $details['twenty_date'];
 			$twentyArr['check_no'] 						= $details['twenty_check'];
 			$twentyArr['releases_no'] 					= 20;
 			$out20 = $mecon->updateQuery($twentyArr,"releases_to_contractor_details",$condtwentyArr);	




		 	if($out0==true && $out1==true && $out2==true && $out3==true && $out4==true && $out5==true && $out6==true && $out7==true && $out8==true && $out9==true && $out10==true && $out11==true && $out12==true && $out13==true && $out14==true && $out15==true && $out16==true && $out17==true && $out18==true && $out19==true && $out20==true){
		 		$output = true;
		 	}else{
		 		$output = false;
		 	}

	} 
	/***********************/
 
	//LOG TASK 
			$actArr['UserType']			= "accounting2";  
			$actArr['Remarks']			= "Updated Releases to Contractor : [$mainid] - $contractor";
			$actArr['TransId']			= $mainid; 
			$actArr['Action']			= "edit";
			$actArr['ActionType']		= "releases_to_contractor";
			$actArr['ActionContent']	= json_encode($mainArr);
			$actArr['ActionBy'] 		= $currentUser;	
			$actArr['ActionDate']		= $timeStamp; 
			$utility->encodeActivityLog($actArr);
//endif;

$resultArr 						= array();
$resultArr['output']	  		= $output;

echo json_encode($resultArr); 
exit();
ob_end_flush();