function save_releases_to_contractor(){ 
	var mods 					=	$('#main_page').val();
	var types 					=	$('#main_type').val(); 
	var action 					=	$('#main_action').val();
	var mainid					=	$('#main_id').val(); 
	var releases_to_contractor	=	$('#releases_to_contractor_form').serialize(); 
  
	var dataString				=	releases_to_contractor+"&action="+encodeURIComponent(action)+"&mainid="+encodeURIComponent(mainid)+"&types="+encodeURIComponent(types);  
	$.post('./ajax/releases_to_contractor.php', dataString, function(msg){
		var obj	= $.parseJSON(msg);
 
 
			if(obj.output==true){
				bootbox.alert("Successfully Saved ..."); 
				window.setTimeout(function() { window.location.href = 'index.php?pg='+mods+'&type='+types; }, 1000);
			}else{
				bootbox.alert("Failed in saving.");
			} 
	}); 
  
}

function computeContract(){ 
	$('#net_contract_price').val(0.00);
	$('#withholding_tax').val(0);
	var contract_price = $('#contract_price').val().replace(/,/g, "");
	var withholding_tax = parseFloat((contract_price/1.12)*0.02);

	var cwithholding_tax = Comma(parseFloat(withholding_tax).toFixed(2));

	$('#withholding_tax').val(cwithholding_tax);
	var net_contract_price = parseFloat(contract_price) - parseFloat(withholding_tax);
	 
	var cnet_contract_price = Comma(parseFloat(net_contract_price).toFixed(2));
	$('#net_contract_price').val(cnet_contract_price);


	var ccontract_price = parseFloat(contract_price);
	$('#contract_price').val(ccontract_price);

	$('#withholding_tax').attr('readonly',true);
	$('#net_contract_price').attr('readonly',true);


}


reloadContractor();
function reloadContractor(contractor=''){ 
	var dataString = '';
	$.post('./ajax/singleselectcontractor.php', dataString, function(msg){ 
								var obj	=	$.parseJSON(msg);  
								var html	=	'';
								html += '<select class="select2 form-control" id="contractor" name="contractor">';
									html += '<option value="">- Select One -</option>';
								for(var a=0; a<obj.data.length; a++){
									if(contractor==obj.data[a].contractor){
											var selected = 'selected';
									}else{
										var selected = '';
									}
									html += '<option value="'+obj.data[a].contractor+'" '+selected+'>'+obj.data[a].contractor+'</option>';
								}
								html += '</select>'; 
								$('#div_contractor').html(html); 
		});						
}
 
var action 					=	$('#main_action').val();
if(action=='edit' || action=='view'){ 
	load_releases_to_contractor();
}
 
function load_releases_to_contractor(){
				var mods 			=	$('#main_page').val();
				var types 			=	$('#main_type').val(); 
				var action 			=	$('#main_action').val();
				var mainid			=	$('#main_id').val();
				var dataString		=	"action="+encodeURIComponent(action)+"&mainid="+encodeURIComponent(mainid); 
						$.post('./ajax/load_releases_to_contractor.php', dataString, function(msg){ 
								var obj	= $.parseJSON(msg);

								
								var date_po_issued			=	obj.data[0].date_po_issued;
 								var date_issued				=	obj.data[0].date_issued;  
 								var retention_processed		=	obj.data[0].retention_processed;

 								var retention_check			=	obj.data[0].retention_check; //12AUG24
								

						 		var block					=	obj.data[0].block;
								var lot						=	obj.data[0].lot; 
						 		var units					=	obj.data[0].units; 
						 		var contractor				=	obj.data[0].fullname;
						 		var releases_status			=	obj.data[0].releases_status;
						 		var releases_remarks		=	obj.data[0].releases_remarks;

								var contract_price			=	parseFloat(obj.data[0].contract_price);
								var wht						=	parseFloat(obj.data[0].wht); 
								var net_contract_price		=	parseFloat(obj.data[0].net_contract_price); 

								var downpayment_checkbox	=	obj.data[0].downpayment_checkbox;  
								var downpayment_recoup		=	(obj.data[0].downpayment_recoup!="") ? parseFloat(obj.data[0].downpayment_recoup) : 0.00; //11AUG24
								var downpayment_date		=	obj.data[0].downpayment_date; 
								var downpayment_check		=	obj.data[0].downpayment_check; 
								
								var first_checkbox			=	obj.data[0].first_checkbox; 
								var first_percentage		=	obj.data[0].first_percentage; 
								var first_amount			=	parseFloat(obj.data[0].first_amount);
								var first_wht				=	parseFloat(obj.data[0].first_wht);
								var first_recoup			=	parseFloat(obj.data[0].first_recoup);
								var first_retention			=	parseFloat(obj.data[0].first_retention);
								var first_electricity		=	parseFloat(obj.data[0].first_electricity);
								var first_others			=	parseFloat(obj.data[0].first_others);
								var first_net				=	parseFloat(obj.data[0].first_net);
								var first_date				=	obj.data[0].first_date;  
 
								var second_checkbox			=	obj.data[0].second_checkbox; 
								var second_percentage		=	obj.data[0].second_percentage; 
								var second_amount			=	parseFloat(obj.data[0].second_amount);
								var second_wht				=	parseFloat(obj.data[0].second_wht);
								var second_recoup			=	parseFloat(obj.data[0].second_recoup);
								var second_retention		=	parseFloat(obj.data[0].second_retention);
								var second_electricity		=	parseFloat(obj.data[0].second_electricity);
								var second_others			=	parseFloat(obj.data[0].second_others);
								var second_net				=	parseFloat(obj.data[0].second_net);
								var second_date				=	obj.data[0].second_date;  
								
								var third_checkbox			=	obj.data[0].third_checkbox; 
								var third_percentage		=	obj.data[0].third_percentage; 
								var third_amount			=	parseFloat(obj.data[0].third_amount);
								var third_wht				=	parseFloat(obj.data[0].third_wht);
								var third_recoup			=	parseFloat(obj.data[0].third_recoup);
								var third_retention			=	parseFloat(obj.data[0].third_retention);
								var third_electricity		=	parseFloat(obj.data[0].third_electricity);
								var third_others			=	parseFloat(obj.data[0].third_others);
								var third_net				=	parseFloat(obj.data[0].third_net);
								var third_date				=	obj.data[0].third_date; 
								
								var fourth_checkbox			=	obj.data[0].fourth_checkbox; 
								var fourth_percentage		=	obj.data[0].fourth_percentage; 
								var fourth_amount			=	parseFloat(obj.data[0].fourth_amount);
								var fourth_wht				=	parseFloat(obj.data[0].fourth_wht);
								var fourth_recoup			=	parseFloat(obj.data[0].fourth_recoup);
								var fourth_retention		=	parseFloat(obj.data[0].fourth_retention);
								var fourth_electricity		=	parseFloat(obj.data[0].fourth_electricity);
								var fourth_others			=	parseFloat(obj.data[0].fourth_others);
								var fourth_net				=	parseFloat(obj.data[0].fourth_net);
								var fourth_date				=	obj.data[0].fourth_date; 

								var fifth_checkbox			=	obj.data[0].fifth_checkbox; 
								var fifth_percentage		=	obj.data[0].fifth_percentage; 
								var fifth_amount			=	parseFloat(obj.data[0].fifth_amount);
								var fifth_wht				=	parseFloat(obj.data[0].fifth_wht);
								var fifth_recoup			=	parseFloat(obj.data[0].fifth_recoup);
								var fifth_retention			=	parseFloat(obj.data[0].fifth_retention);
								var fifth_electricity		=	parseFloat(obj.data[0].fifth_electricity);
								var fifth_others			=	parseFloat(obj.data[0].fifth_others);
								var fifth_net				=	parseFloat(obj.data[0].fifth_net);
								var fifth_date				=	obj.data[0].fifth_date; 

								var sixth_checkbox			=	obj.data[0].sixth_checkbox; 
								var sixth_percentage		=	obj.data[0].sixth_percentage; 
								var sixth_amount			=	parseFloat(obj.data[0].sixth_amount);
								var sixth_wht				=	parseFloat(obj.data[0].sixth_wht);
								var sixth_recoup			=	parseFloat(obj.data[0].sixth_recoup);
								var sixth_retention			=	parseFloat(obj.data[0].sixth_retention);
								var sixth_electricity		=	parseFloat(obj.data[0].sixth_electricity);
								var sixth_others			=	parseFloat(obj.data[0].sixth_others);
								var sixth_net				=	parseFloat(obj.data[0].sixth_net);
								var sixth_date				=	obj.data[0].sixth_date; 

								var seventh_checkbox		=	obj.data[0].seventh_checkbox; 
								var seventh_percentage		=	obj.data[0].seventh_percentage; 
								var seventh_amount			=	parseFloat(obj.data[0].seventh_amount);
								var seventh_wht				=	parseFloat(obj.data[0].seventh_wht);
								var seventh_recoup			=	parseFloat(obj.data[0].seventh_recoup);
								var seventh_retention		=	parseFloat(obj.data[0].seventh_retention);
								var seventh_electricity		=	parseFloat(obj.data[0].seventh_electricity);
								var seventh_others			=	parseFloat(obj.data[0].seventh_others);
								var seventh_net				=	parseFloat(obj.data[0].seventh_net);
								var seventh_date			=	obj.data[0].seventh_date; 

								var eight_checkbox			=	obj.data[0].eight_checkbox; 
								var eight_percentage		=	obj.data[0].eight_percentage; 
								var eight_amount			=	parseFloat(obj.data[0].eight_amount);
								var eight_wht				=	parseFloat(obj.data[0].eight_wht);
								var eight_recoup			=	parseFloat(obj.data[0].eight_recoup);
								var eight_retention			=	parseFloat(obj.data[0].eight_retention);
								var eight_electricity		=	parseFloat(obj.data[0].eight_electricity);
								var eight_others			=	parseFloat(obj.data[0].eight_others);
								var eight_net				=	parseFloat(obj.data[0].eight_net);
								var eight_date				=	obj.data[0].eight_date; 

								var nine_checkbox			=	obj.data[0].nine_checkbox; 
								var nine_percentage			=	obj.data[0].nine_percentage; 
								var nine_amount				=	parseFloat(obj.data[0].nine_amount);
								var nine_wht				=	parseFloat(obj.data[0].nine_wht);
								var nine_recoup				=	parseFloat(obj.data[0].nine_recoup);
								var nine_retention			=	parseFloat(obj.data[0].nine_retention);
								var nine_electricity		=	parseFloat(obj.data[0].nine_electricity);
								var nine_others				=	parseFloat(obj.data[0].nine_others);
								var nine_net				=	parseFloat(obj.data[0].nine_net);
								var nine_date				=	obj.data[0].nine_date; 

								var ten_checkbox			=	obj.data[0].ten_checkbox; 
								var ten_percentage			=	obj.data[0].ten_percentage; 
								var ten_amount				=	parseFloat(obj.data[0].ten_amount);
								var ten_wht					=	parseFloat(obj.data[0].ten_wht);
								var ten_recoup				=	parseFloat(obj.data[0].ten_recoup);
								var ten_retention			=	parseFloat(obj.data[0].ten_retention);
								var ten_electricity			=	parseFloat(obj.data[0].ten_electricity);
								var ten_others				=	parseFloat(obj.data[0].ten_others);
								var ten_net					=	parseFloat(obj.data[0].ten_net);
								var ten_date				=	obj.data[0].ten_date; 

								var eleven_checkbox			=	obj.data[0].eleven_checkbox; 
								var eleven_percentage		=	obj.data[0].eleven_percentage; 
								var eleven_amount			=	parseFloat(obj.data[0].eleven_amount);
								var eleven_wht				=	parseFloat(obj.data[0].eleven_wht);
								var eleven_recoup			=	parseFloat(obj.data[0].eleven_recoup);
								var eleven_retention		=	parseFloat(obj.data[0].eleven_retention);
								var eleven_electricity		=	parseFloat(obj.data[0].eleven_electricity);
								var eleven_others			=	parseFloat(obj.data[0].eleven_others);
								var eleven_net				=	parseFloat(obj.data[0].eleven_net);
								var eleven_date				=	obj.data[0].eleven_date; 

								var twelve_checkbox			=	obj.data[0].twelve_checkbox; 
								var twelve_percentage		=	obj.data[0].twelve_percentage; 
								var twelve_amount			=	parseFloat(obj.data[0].twelve_amount);
								var twelve_wht				=	parseFloat(obj.data[0].twelve_wht);
								var twelve_recoup			=	parseFloat(obj.data[0].twelve_recoup);
								var twelve_retention		=	parseFloat(obj.data[0].twelve_retention);
								var twelve_electricity		=	parseFloat(obj.data[0].twelve_electricity);
								var twelve_others			=	parseFloat(obj.data[0].twelve_others);
								var twelve_net				=	parseFloat(obj.data[0].twelve_net);
								var twelve_date				=	obj.data[0].twelve_date; 

								var thirteen_checkbox		=	obj.data[0].thirteen_checkbox; 
								var thirteen_percentage		=	obj.data[0].thirteen_percentage; 
								var thirteen_amount			=	parseFloat(obj.data[0].thirteen_amount);
								var thirteen_wht			=	parseFloat(obj.data[0].thirteen_wht);
								var thirteen_recoup			=	parseFloat(obj.data[0].thirteen_recoup);
								var thirteen_retention		=	parseFloat(obj.data[0].thirteen_retention);
								var thirteen_electricity	=	parseFloat(obj.data[0].thirteen_electricity);
								var thirteen_others			=	parseFloat(obj.data[0].thirteen_others);
								var thirteen_net			=	parseFloat(obj.data[0].thirteen_net);
								var thirteen_date			=	obj.data[0].thirteen_date; 	

								var fourteen_checkbox			=	obj.data[0].fourteen_checkbox; 
								var fourteen_percentage			=	obj.data[0].fourteen_percentage; 
								var fourteen_amount				=	parseFloat(obj.data[0].fourteen_amount);
								var fourteen_wht				=	parseFloat(obj.data[0].fourteen_wht);
								var fourteen_recoup				=	parseFloat(obj.data[0].fourteen_recoup);
								var fourteen_retention			=	parseFloat(obj.data[0].fourteen_retention);
								var fourteen_electricity		=	parseFloat(obj.data[0].fourteen_electricity);
								var fourteen_others				=	parseFloat(obj.data[0].fourteen_others);
								var fourteen_net				=	parseFloat(obj.data[0].fourteen_net);
								var fourteen_date				=	obj.data[0].fourteen_date; 

								var fifteen_checkbox			=	obj.data[0].fifteen_checkbox; 
								var fifteen_percentage			=	obj.data[0].fifteen_percentage; 
								var fifteen_amount				=	parseFloat(obj.data[0].fifteen_amount);
								var fifteen_wht					=	parseFloat(obj.data[0].fifteen_wht);
								var fifteen_recoup				=	parseFloat(obj.data[0].fifteen_recoup);
								var fifteen_retention			=	parseFloat(obj.data[0].fifteen_retention);
								var fifteen_electricity			=	parseFloat(obj.data[0].fifteen_electricity);
								var fifteen_others				=	parseFloat(obj.data[0].fifteen_others);
								var fifteen_net					=	parseFloat(obj.data[0].fifteen_net);
								var fifteen_date				=	obj.data[0].fifteen_date; 

								var sixteen_checkbox			=	obj.data[0].sixteen_checkbox; 
								var sixteen_percentage			=	obj.data[0].sixteen_percentage; 
								var sixteen_amount				=	parseFloat(obj.data[0].sixteen_amount);
								var sixteen_wht					=	parseFloat(obj.data[0].sixteen_wht);
								var sixteen_recoup				=	parseFloat(obj.data[0].sixteen_recoup);
								var sixteen_retention			=	parseFloat(obj.data[0].sixteen_retention);
								var sixteen_electricity			=	parseFloat(obj.data[0].sixteen_electricity);
								var sixteen_others				=	parseFloat(obj.data[0].sixteen_others);
								var sixteen_net					=	parseFloat(obj.data[0].sixteen_net);
								var sixteen_date				=	obj.data[0].sixteen_date; 

								var seventeen_checkbox				=	obj.data[0].seventeen_checkbox; 
								var seventeen_percentage			=	obj.data[0].seventeen_percentage; 
								var seventeen_amount				=	parseFloat(obj.data[0].seventeen_amount);
								var seventeen_wht					=	parseFloat(obj.data[0].seventeen_wht);
								var seventeen_recoup				=	parseFloat(obj.data[0].seventeen_recoup);
								var seventeen_retention				=	parseFloat(obj.data[0].seventeen_retention);
								var seventeen_electricity			=	parseFloat(obj.data[0].seventeen_electricity);
								var seventeen_others				=	parseFloat(obj.data[0].seventeen_others);
								var seventeen_net					=	parseFloat(obj.data[0].seventeen_net);
								var seventeen_date					=	obj.data[0].seventeen_date; 

								var eighteen_checkbox				=	obj.data[0].eighteen_checkbox; 
								var eighteen_percentage				=	obj.data[0].eighteen_percentage; 
								var eighteen_amount					=	parseFloat(obj.data[0].eighteen_amount);
								var eighteen_wht					=	parseFloat(obj.data[0].eighteen_wht);
								var eighteen_recoup					=	parseFloat(obj.data[0].eighteen_recoup);
								var eighteen_retention				=	parseFloat(obj.data[0].eighteen_retention);
								var eighteen_electricity			=	parseFloat(obj.data[0].eighteen_electricity);
								var eighteen_others					=	parseFloat(obj.data[0].eighteen_others);
								var eighteen_net					=	parseFloat(obj.data[0].eighteen_net);
								var eighteen_date					=	obj.data[0].eighteen_date; 

								var nineteen_checkbox				=	obj.data[0].nineteen_checkbox; 
								var nineteen_percentage				=	obj.data[0].nineteen_percentage; 
								var nineteen_amount					=	parseFloat(obj.data[0].nineteen_amount);
								var nineteen_wht					=	parseFloat(obj.data[0].nineteen_wht);
								var nineteen_recoup					=	parseFloat(obj.data[0].nineteen_recoup);
								var nineteen_retention				=	parseFloat(obj.data[0].nineteen_retention);
								var nineteen_electricity			=	parseFloat(obj.data[0].nineteen_electricity);
								var nineteen_others					=	parseFloat(obj.data[0].nineteen_others);
								var nineteen_net					=	parseFloat(obj.data[0].nineteen_net);
								var nineteen_date					=	obj.data[0].nineteen_date; 

								var twenty_checkbox				=	obj.data[0].twenty_checkbox; 
								var twenty_percentage			=	obj.data[0].twenty_percentage; 
								var twenty_amount				=	parseFloat(obj.data[0].twenty_amount);
								var twenty_wht					=	parseFloat(obj.data[0].twenty_wht);
								var twenty_recoup				=	parseFloat(obj.data[0].twenty_recoup);
								var twenty_retention			=	parseFloat(obj.data[0].twenty_retention);
								var twenty_electricity			=	parseFloat(obj.data[0].twenty_electricity);
								var twenty_others				=	parseFloat(obj.data[0].twenty_others);
								var twenty_net					=	parseFloat(obj.data[0].twenty_net);
								var twenty_date					=	obj.data[0].twenty_date; 


								var total_percentage		=	obj.data[0].total_percentage; 
								var total_amount			=	parseFloat(obj.data[0].total_amount);
								var total_wht				=	parseFloat(obj.data[0].total_wht);
								var total_recoup			=	parseFloat(obj.data[0].total_recoup);
								var total_retention			=	parseFloat(obj.data[0].total_retention);
								var total_electricity		=	parseFloat(obj.data[0].total_electricity);
								var total_water				=	parseFloat(obj.data[0].total_water);
								var total_others			=	parseFloat(obj.data[0].total_others);
								var total_net				=	parseFloat(obj.data[0].total_net);
  
								var balance_amount			=	parseFloat(obj.data[0].balance_amount);
								var balance_wht				=	parseFloat(obj.data[0].balance_wht);
								var balance_recoup			=	parseFloat(obj.data[0].balance_recoup);

								var ewt_type				=	obj.data[0].ewt_type;
							 
								if(ewt_type=='one_time'){
									$('#ewt_one_time').attr('checked',true);
								}else if(ewt_type=='each_billing'){
									$('#ewt_each_billing').attr('checked',true);
								}

  
  								$('#downpayment_check').val(downpayment_check); 

  								var first_water				=	parseFloat(obj.data[0].first_water);
 								var first_check				=	obj.data[0].first_check; 
 								first_water 				=  Comma(first_water.toFixed(2)); 
								$('#first_water').val(first_water);
  								$('#first_check').val(first_check);

								var second_water			=	parseFloat(obj.data[0].second_water);
 								var second_check			=	obj.data[0].second_check; 
 								second_water 				=  Comma(second_water.toFixed(2)); 
								$('#second_water').val(second_water);
  								$('#second_check').val(second_check);

  								var third_water				=	parseFloat(obj.data[0].third_water);
 								var third_check				=	obj.data[0].third_check; 
 								third_water 				=  Comma(third_water.toFixed(2)); 
								$('#third_water').val(third_water);
  								$('#third_check').val(third_check);
								
								var fourth_water			=	parseFloat(obj.data[0].fourth_water);
 								var fourth_check			=	obj.data[0].fourth_check; 
 								fourth_water 				=  Comma(fourth_water.toFixed(2)); 
								$('#fourth_water').val(fourth_water);
  								$('#fourth_check').val(fourth_check);

								var fifth_water				=	parseFloat(obj.data[0].fifth_water);
 								var fifth_check				=	obj.data[0].fifth_check; 
 								fifth_water 				=  Comma(fifth_water.toFixed(2)); 
								$('#fifth_water').val(fifth_water);
  								$('#fifth_check').val(fifth_check);

								var sixth_water				=	parseFloat(obj.data[0].sixth_water);
 								var sixth_check				=	obj.data[0].sixth_check; 
 								sixth_water 				=  Comma(sixth_water.toFixed(2)); 
								$('#sixth_water').val(sixth_water);
  								$('#sixth_check').val(sixth_check);

  								var seventh_water			=	parseFloat(obj.data[0].seventh_water);
 								var seventh_check			=	obj.data[0].seventh_check; 
 								seventh_water 				=  Comma(seventh_water.toFixed(2)); 
								$('#seventh_water').val(seventh_water);
  								$('#seventh_check').val(seventh_check);

								var eight_water				=	parseFloat(obj.data[0].eight_water);
 								var eight_check				=	obj.data[0].eight_check; 
 								eight_water 				=  Comma(eight_water.toFixed(2)); 
								$('#eight_water').val(eight_water);
  								$('#eight_check').val(eight_check);

								var nine_water				=	parseFloat(obj.data[0].nine_water);
 								var nine_check				=	obj.data[0].nine_check; 
 								nine_water 					=  Comma(nine_water.toFixed(2)); 
								$('#nine_water').val(nine_water);
  								$('#nine_check').val(nine_check);

								var ten_water				=	parseFloat(obj.data[0].ten_water);
 								var ten_check				=	obj.data[0].ten_check; 
 								ten_water 					=  Comma(ten_water.toFixed(2)); 
								$('#ten_water').val(ten_water);
  								$('#ten_check').val(ten_check);


  								var eleven_water				=	parseFloat(obj.data[0].eleven_water);
 								var eleven_check				=	obj.data[0].eleven_check; 
 								eleven_water 					=  Comma(eleven_water.toFixed(2)); 
								$('#eleven_water').val(eleven_water);
  								$('#eleven_check').val(eleven_check);

  								var twelve_water				=	parseFloat(obj.data[0].twelve_water);
 								var twelve_check				=	obj.data[0].twelve_check; 
 								twelve_water 					=  Comma(twelve_water.toFixed(2)); 
								$('#twelve_water').val(twelve_water);
  								$('#twelve_check').val(twelve_check);

  								var thirteen_water				=	parseFloat(obj.data[0].thirteen_water);
 								var thirteen_check				=	obj.data[0].thirteen_check; 
 								thirteen_water 					=  Comma(thirteen_water.toFixed(2)); 
								$('#thirteen_water').val(thirteen_water);
  								$('#thirteen_check').val(thirteen_check);

  								var fourteen_water				=	parseFloat(obj.data[0].fourteen_water);
 								var fourteen_check				=	obj.data[0].fourteen_check; 
 								fourteen_water 					=  Comma(fourteen_water.toFixed(2)); 
								$('#fourteen_water').val(fourteen_water);
  								$('#fourteen_check').val(fourteen_check);

  								var fifteen_water				=	parseFloat(obj.data[0].fifteen_water);
 								var fifteen_check				=	obj.data[0].fifteen_check; 
 								fifteen_water 					=  Comma(fifteen_water.toFixed(2)); 
								$('#fifteen_water').val(fifteen_water);
  								$('#fifteen_check').val(fifteen_check);


  								var sixteen_water				=	parseFloat(obj.data[0].sixteen_water);
 								var sixteen_check				=	obj.data[0].sixteen_check; 
 								sixteen_water 					=  Comma(sixteen_water.toFixed(2)); 
								$('#sixteen_water').val(sixteen_water);
  								$('#sixteen_check').val(sixteen_check);

  								var seventeen_water				=	parseFloat(obj.data[0].seventeen_water);
 								var seventeen_check				=	obj.data[0].seventeen_check; 
 								seventeen_water 					=  Comma(seventeen_water.toFixed(2)); 
								$('#seventeen_water').val(seventeen_water);
  								$('#seventeen_check').val(seventeen_check);

  								var eighteen_water				=	parseFloat(obj.data[0].eighteen_water);
 								var eighteen_check				=	obj.data[0].eighteen_check; 
 								eighteen_water 					=  Comma(eighteen_water.toFixed(2)); 
								$('#eighteen_water').val(eighteen_water);
  								$('#eighteen_check').val(eighteen_check);

  								var nineteen_water				=	parseFloat(obj.data[0].nineteen_water);
 								var nineteen_check				=	obj.data[0].nineteen_check; 
 								nineteen_water 					=  Comma(nineteen_water.toFixed(2)); 
								$('#nineteen_water').val(nineteen_water);
  								$('#nineteen_check').val(nineteen_check);

  								var twenty_water				=	parseFloat(obj.data[0].twenty_water);
 								var twenty_check				=	obj.data[0].twenty_check; 
 								twenty_water 					=  Comma(twenty_water.toFixed(2)); 
								$('#twenty_water').val(twenty_water);
  								$('#twenty_check').val(twenty_check);




  								$('#releases_status').val(releases_status);
  								$('#releases_remarks').val(releases_remarks);

								$('#contractor').val(contractor);
								$('#po_issued').val(date_po_issued); 
								$('#date_issued').val(date_issued);

								$('#retention_processed').val(retention_processed);


								$('#retention_check').val(retention_check); //12AUG24


						 


								$('#block').val(block);
								$('#lot').val(lot);
								$('#number_units').val(units);
								contract_price 			=  Comma(contract_price.toFixed(2)); 
								$('#contract_price').val(contract_price);
								wht 					=  Comma(wht.toFixed(2)); 
								$('#withholding_tax').val(wht);
								net_contract_price 		=  Comma(net_contract_price.toFixed(2)); 
								$('#net_contract_price').val(net_contract_price);

								if(downpayment_checkbox=='on'){
									$('#downpayment_checkbox').attr('checked',true);
								}

								downpayment_recoup 		=  Comma(downpayment_recoup.toFixed(2)); 
								$('#downpayment_recoup').val(downpayment_recoup); 
								$('#downpayment_date').val(downpayment_date); 


								if(first_checkbox=='on'){
									$('#first_checkbox').attr('checked',true);
								} 
								$('#first_percentage').val(first_percentage); 
								first_amount 		=  Comma(first_amount.toFixed(2)); 
								$('#first_amount').val(first_amount); 
								first_wht 			=  Comma(first_wht.toFixed(2)); 
								$('#first_wht').val(first_wht); 
								first_recoup 		=  Comma(first_recoup.toFixed(2)); 
								$('#first_recoup').val(first_recoup); 
								first_retention 	=  Comma(first_retention.toFixed(2)); 
								$('#first_retention').val(first_retention); 
								first_electricity 	=  Comma(first_electricity.toFixed(2)); 
								$('#first_electricity').val(first_electricity); 
								first_others 		=  Comma(first_others.toFixed(2)); 
								$('#first_others').val(first_others); 
								first_net 			=  Comma(first_net.toFixed(2)); 
								$('#first_net').val(first_net); 
								$('#first_date').val(first_date); 


								if(second_checkbox=='on'){
									$('#second_checkbox').attr('checked',true);
								} 
								$('#second_percentage').val(second_percentage); 
								second_amount 		=  Comma(second_amount.toFixed(2)); 
								$('#second_amount').val(second_amount); 
								second_wht 			=  Comma(second_wht.toFixed(2)); 
								$('#second_wht').val(second_wht); 
								second_recoup 		=  Comma(second_recoup.toFixed(2)); 
								$('#second_recoup').val(second_recoup); 
								second_retention 	=  Comma(second_retention.toFixed(2)); 
								$('#second_retention').val(second_retention); 
								second_electricity 	=  Comma(second_electricity.toFixed(2)); 
								$('#second_electricity').val(second_electricity); 
								second_others 		=  Comma(second_others.toFixed(2)); 
								$('#second_others').val(second_others); 
								second_net 			=  Comma(second_net.toFixed(2)); 
								$('#second_net').val(second_net); 
								$('#second_date').val(second_date); 
 
								if(third_checkbox=='on'){
									$('#third_checkbox').attr('checked',true);
								} 
								$('#third_percentage').val(third_percentage); 
								third_amount 		=  Comma(third_amount.toFixed(2)); 
								$('#third_amount').val(third_amount); 
								third_wht 			=  Comma(third_wht.toFixed(2)); 
								$('#third_wht').val(third_wht); 
								third_recoup 		=  Comma(third_recoup.toFixed(2)); 
								$('#third_recoup').val(third_recoup); 
								third_retention 	=  Comma(third_retention.toFixed(2)); 
								$('#third_retention').val(third_retention); 
								third_electricity 	=  Comma(third_electricity.toFixed(2)); 
								$('#third_electricity').val(third_electricity); 
								third_others 		=  Comma(third_others.toFixed(2)); 
								$('#third_others').val(third_others); 
								third_net 			=  Comma(third_net.toFixed(2)); 
								$('#third_net').val(third_net); 
								$('#third_date').val(third_date); 

								if(fourth_checkbox=='on'){
									$('#fourth_checkbox').attr('checked',true);
								} 
								$('#fourth_percentage').val(fourth_percentage); 
								fourth_amount 		=  Comma(fourth_amount.toFixed(2)); 
								$('#fourth_amount').val(fourth_amount); 
								fourth_wht 			=  Comma(fourth_wht.toFixed(2)); 
								$('#fourth_wht').val(fourth_wht); 
								fourth_recoup 		=  Comma(fourth_recoup.toFixed(2)); 
								$('#fourth_recoup').val(fourth_recoup); 
								fourth_retention 	=  Comma(fourth_retention.toFixed(2)); 
								$('#fourth_retention').val(fourth_retention); 
								fourth_electricity 	=  Comma(fourth_electricity.toFixed(2)); 
								$('#fourth_electricity').val(fourth_electricity); 
								fourth_others 		=  Comma(fourth_others.toFixed(2)); 
								$('#fourth_others').val(fourth_others); 
								fourth_net 			=  Comma(fourth_net.toFixed(2)); 
								$('#fourth_net').val(fourth_net); 
								$('#fourth_date').val(fourth_date); 
 
								if(fifth_checkbox=='on'){
									$('#fifth_checkbox').attr('checked',true);
								} 
								$('#fifth_percentage').val(fifth_percentage); 
								fifth_amount 		=  Comma(fifth_amount.toFixed(2)); 
								$('#fifth_amount').val(fifth_amount); 
								fifth_wht 			=  Comma(fifth_wht.toFixed(2)); 
								$('#fifth_wht').val(fifth_wht); 
								fifth_recoup 		=  Comma(fifth_recoup.toFixed(2)); 
								$('#fifth_recoup').val(fifth_recoup); 
								fifth_retention 	=  Comma(fifth_retention.toFixed(2)); 
								$('#fifth_retention').val(fifth_retention); 
								fifth_electricity 	=  Comma(fifth_electricity.toFixed(2)); 
								$('#fifth_electricity').val(fifth_electricity); 
								fifth_others 		=  Comma(fifth_others.toFixed(2)); 
								$('#fifth_others').val(fifth_others); 
								fifth_net 			=  Comma(fifth_net.toFixed(2)); 
								$('#fifth_net').val(fifth_net); 
								$('#fifth_date').val(fifth_date); 

								if(sixth_checkbox=='on'){
									$('#sixth_checkbox').attr('checked',true);
								} 
								$('#sixth_percentage').val(sixth_percentage); 
								sixth_amount 		=  Comma(sixth_amount.toFixed(2)); 
								$('#sixth_amount').val(sixth_amount); 
								sixth_wht 			=  Comma(sixth_wht.toFixed(2)); 
								$('#sixth_wht').val(sixth_wht); 
								sixth_recoup 		=  Comma(sixth_recoup.toFixed(2)); 
								$('#sixth_recoup').val(sixth_recoup); 
								sixth_retention 	=  Comma(sixth_retention.toFixed(2)); 
								$('#sixth_retention').val(sixth_retention); 
								sixth_electricity 	=  Comma(sixth_electricity.toFixed(2)); 
								$('#sixth_electricity').val(sixth_electricity); 
								sixth_others 		=  Comma(sixth_others.toFixed(2)); 
								$('#sixth_others').val(sixth_others); 
								sixth_net 			=  Comma(sixth_net.toFixed(2)); 
								$('#sixth_net').val(sixth_net); 
								$('#sixth_date').val(sixth_date); 

								if(seventh_checkbox=='on'){
									$('#seventh_checkbox').attr('checked',true);
								} 
								$('#seventh_percentage').val(seventh_percentage); 
								seventh_amount 		=  Comma(seventh_amount.toFixed(2)); 
								$('#seventh_amount').val(seventh_amount); 
								seventh_wht 		=  Comma(seventh_wht.toFixed(2)); 
								$('#seventh_wht').val(seventh_wht); 
								seventh_recoup 		=  Comma(seventh_recoup.toFixed(2)); 
								$('#seventh_recoup').val(seventh_recoup); 
								seventh_retention 	=  Comma(seventh_retention.toFixed(2)); 
								$('#seventh_retention').val(seventh_retention); 
								seventh_electricity =  Comma(seventh_electricity.toFixed(2)); 
								$('#seventh_electricity').val(seventh_electricity); 
								seventh_others 		=  Comma(seventh_others.toFixed(2)); 
								$('#seventh_others').val(seventh_others); 
								seventh_net 		=  Comma(seventh_net.toFixed(2)); 
								$('#seventh_net').val(seventh_net); 
								$('#seventh_date').val(seventh_date); 

								if(eight_checkbox=='on'){
									$('#eight_checkbox').attr('checked',true);
								} 
								$('#eight_percentage').val(eight_percentage); 
								eight_amount 		=  Comma(eight_amount.toFixed(2)); 
								$('#eight_amount').val(eight_amount); 
								eight_wht 			=  Comma(eight_wht.toFixed(2)); 
								$('#eight_wht').val(eight_wht); 
								eight_recoup 		=  Comma(eight_recoup.toFixed(2)); 
								$('#eight_recoup').val(eight_recoup); 
								eight_retention 	=  Comma(eight_retention.toFixed(2)); 
								$('#eight_retention').val(eight_retention); 
								eight_electricity 	=  Comma(eight_electricity.toFixed(2)); 
								$('#eight_electricity').val(eight_electricity); 
								eight_others 		=  Comma(eight_others.toFixed(2)); 
								$('#eight_others').val(eight_others); 
								eight_net 			=  Comma(eight_net.toFixed(2)); 
								$('#eight_net').val(eight_net); 
								$('#eight_date').val(eight_date); 

								if(nine_checkbox=='on'){
									$('#nine_checkbox').attr('checked',true);
								} 
								$('#nine_percentage').val(nine_percentage); 
								nine_amount 		=  Comma(nine_amount.toFixed(2)); 
								$('#nine_amount').val(nine_amount); 
								nine_wht 			=  Comma(nine_wht.toFixed(2)); 
								$('#nine_wht').val(nine_wht); 
								nine_recoup 		=  Comma(nine_recoup.toFixed(2)); 
								$('#nine_recoup').val(nine_recoup); 
								nine_retention 		=  Comma(nine_retention.toFixed(2)); 
								$('#nine_retention').val(nine_retention); 
								nine_electricity 	=  Comma(nine_electricity.toFixed(2)); 
								$('#nine_electricity').val(nine_electricity); 
								nine_others 		=  Comma(nine_others.toFixed(2)); 
								$('#nine_others').val(nine_others); 
								nine_net 			=  Comma(nine_net.toFixed(2)); 
								$('#nine_net').val(nine_net); 
								$('#nine_date').val(nine_date); 

								if(ten_checkbox=='on'){
									$('#ten_checkbox').attr('checked',true);
								} 
								$('#ten_percentage').val(ten_percentage); 
								ten_amount 			=  Comma(ten_amount.toFixed(2)); 
								$('#ten_amount').val(ten_amount); 
								ten_wht 			=  Comma(ten_wht.toFixed(2)); 
								$('#ten_wht').val(ten_wht); 
								ten_recoup 			=  Comma(ten_recoup.toFixed(2)); 
								$('#ten_recoup').val(ten_recoup); 
								ten_retention 		=  Comma(ten_retention.toFixed(2)); 
								$('#ten_retention').val(ten_retention); 
								ten_electricity 	=  Comma(ten_electricity.toFixed(2)); 
								$('#ten_electricity').val(ten_electricity); 
								ten_others 			=  Comma(ten_others.toFixed(2)); 
								$('#ten_others').val(ten_others); 
								ten_net 			=  Comma(ten_net.toFixed(2)); 
								$('#ten_net').val(ten_net); 
								$('#ten_date').val(ten_date);



								if(eleven_checkbox=='on'){
									$('#eleven_checkbox').attr('checked',true);
								} 
								$('#eleven_percentage').val(eleven_percentage); 
								eleven_amount 		=  Comma(eleven_amount.toFixed(2)); 
								$('#eleven_amount').val(eleven_amount); 
								eleven_wht 			=  Comma(eleven_wht.toFixed(2)); 
								$('#eleven_wht').val(eleven_wht); 
								eleven_recoup 		=  Comma(eleven_recoup.toFixed(2)); 
								$('#eleven_recoup').val(eleven_recoup);  
								 
								eleven_retention 		=  Comma(eleven_retention.toFixed(2)); 
								$('#eleven_retention').val(eleven_retention); 


								eleven_electricity 	=  Comma(eleven_electricity.toFixed(2)); 
								$('#eleven_electricity').val(eleven_electricity); 
								eleven_others 		=  Comma(eleven_others.toFixed(2)); 
								$('#eleven_others').val(eleven_others); 
								eleven_net 			=  Comma(eleven_net.toFixed(2)); 
								$('#eleven_net').val(eleven_net); 
								$('#eleven_date').val(eleven_date); 


								if(twelve_checkbox=='on'){
									$('#twelve_checkbox').attr('checked',true);
								} 
								$('#twelve_percentage').val(twelve_percentage); 
								twelve_amount 		=  Comma(twelve_amount.toFixed(2)); 
								$('#twelve_amount').val(twelve_amount); 
								twelve_wht 			=  Comma(twelve_wht.toFixed(2)); 
								$('#twelve_wht').val(twelve_wht); 
								twelve_recoup 		=  Comma(parseFloat(twelve_recoup).toFixed(2)); 
								$('#twelve_recoup').val(twelve_recoup); 
								twelve_retention 		=  Comma(parseFloat(twelve_retention).toFixed(2)); 
								$('#twelve_retention').val(twelve_retention); 
								twelve_electricity 	=  Comma(twelve_electricity.toFixed(2)); 
								$('#twelve_electricity').val(twelve_electricity); 
								twelve_others 		=  Comma(twelve_others.toFixed(2)); 
								$('#twelve_others').val(twelve_others); 
								twelve_net 			=  Comma(twelve_net.toFixed(2)); 
								$('#twelve_net').val(twelve_net); 
								$('#twelve_date').val(twelve_date); 



								if(thirteen_checkbox=='on'){
									$('#thirteen_checkbox').attr('checked',true);
								} 
								$('#thirteen_percentage').val(thirteen_percentage); 
								thirteen_amount 		=  Comma(thirteen_amount.toFixed(2)); 
								$('#thirteen_amount').val(thirteen_amount); 
								thirteen_wht 			=  Comma(thirteen_wht.toFixed(2)); 
								$('#thirteen_wht').val(thirteen_wht); 
								thirteen_recoup 		=  Comma(thirteen_recoup.toFixed(2)); 
								$('#thirteen_recoup').val(thirteen_recoup); 
								 
								
								thirteen_retention 		=  Comma(parseFloat(thirteen_retention).toFixed(2)); 
								$('#thirteen_retention').val(thirteen_retention); 

								thirteen_electricity 	=  Comma(thirteen_electricity.toFixed(2)); 
								$('#thirteen_electricity').val(thirteen_electricity); 
								thirteen_others 		=  Comma(thirteen_others.toFixed(2)); 
								$('#thirteen_others').val(thirteen_others); 
								thirteen_net 			=  Comma(thirteen_net.toFixed(2)); 
								$('#thirteen_net').val(thirteen_net); 
								$('#thirteen_date').val(thirteen_date); 


								if(fourteen_checkbox=='on'){
									$('#fourteen_checkbox').attr('checked',true);
								} 
								$('#fourteen_percentage').val(fourteen_percentage); 
								fourteen_amount 		=  Comma(fourteen_amount.toFixed(2)); 
								$('#fourteen_amount').val(fourteen_amount); 
								fourteen_wht 			=  Comma(fourteen_wht.toFixed(2)); 
								$('#fourteen_wht').val(fourteen_wht); 
								fourteen_recoup 		=  Comma(fourteen_recoup.toFixed(2)); 
								$('#fourteen_recoup').val(fourteen_recoup); 

								fourteen_retention 		=  Comma(parseFloat(fourteen_retention).toFixed(2));  
								$('#fourteen_retention').val(fourteen_retention); 
								fourteen_electricity 	=  Comma(fourteen_electricity.toFixed(2)); 
								$('#fourteen_electricity').val(fourteen_electricity); 
								fourteen_others 		=  Comma(fourteen_others.toFixed(2)); 
								$('#fourteen_others').val(fourteen_others); 
								fourteen_net 			=  Comma(fourteen_net.toFixed(2)); 
								$('#fourteen_net').val(fourteen_net); 
								$('#fourteen_date').val(fourteen_date); 


								if(fifteen_checkbox=='on'){
									$('#fifteen_checkbox').attr('checked',true);
								} 
								$('#fifteen_percentage').val(fifteen_percentage); 
								fifteen_amount 		=  Comma(fifteen_amount.toFixed(2)); 
								$('#fifteen_amount').val(fifteen_amount); 
								fifteen_wht 			=  Comma(fifteen_wht.toFixed(2)); 
								$('#fifteen_wht').val(fifteen_wht); 
								fifteen_recoup 		=  Comma(fifteen_recoup.toFixed(2)); 
								$('#fifteen_recoup').val(fifteen_recoup); 
								 

								fifteen_retention 		=  Comma(parseFloat(fifteen_retention).toFixed(2));  
								$('#fifteen_retention').val(fifteen_retention); 
								
								fifteen_electricity 	=  Comma(fifteen_electricity.toFixed(2)); 
								$('#fifteen_electricity').val(fifteen_electricity); 
								fifteen_others 		=  Comma(fifteen_others.toFixed(2)); 
								$('#fifteen_others').val(fifteen_others); 
								fifteen_net 			=  Comma(fifteen_net.toFixed(2)); 
								$('#fifteen_net').val(fifteen_net); 
								$('#fifteen_date').val(fifteen_date); 


								if(sixteen_checkbox=='on'){
									$('#sixteen_checkbox').attr('checked',true);
								} 
								$('#sixteen_percentage').val(sixteen_percentage); 
								sixteen_amount 		=  Comma(sixteen_amount.toFixed(2)); 
								$('#sixteen_amount').val(sixteen_amount); 
								sixteen_wht 			=  Comma(sixteen_wht.toFixed(2)); 
								$('#sixteen_wht').val(sixteen_wht); 
								sixteen_recoup 		=  Comma(sixteen_recoup.toFixed(2)); 
								$('#sixteen_recoup').val(sixteen_recoup); 

								sixteen_retention 		=  Comma(parseFloat(sixteen_retention).toFixed(2));   
								$('#sixteen_retention').val(sixteen_retention); 
								sixteen_electricity 	=  Comma(sixteen_electricity.toFixed(2)); 
								$('#sixteen_electricity').val(sixteen_electricity); 
								sixteen_others 		=  Comma(sixteen_others.toFixed(2)); 
								$('#sixteen_others').val(sixteen_others); 
								sixteen_net 			=  Comma(sixteen_net.toFixed(2)); 
								$('#sixteen_net').val(sixteen_net); 
								$('#sixteen_date').val(sixteen_date); 

								if(seventeen_checkbox=='on'){
									$('#seventeen_checkbox').attr('checked',true);
								} 
								$('#seventeen_percentage').val(seventeen_percentage); 
								seventeen_amount 		=  Comma(seventeen_amount.toFixed(2)); 
								$('#seventeen_amount').val(seventeen_amount); 
								seventeen_wht 			=  Comma(seventeen_wht.toFixed(2)); 
								$('#seventeen_wht').val(seventeen_wht); 
								seventeen_recoup 		=  Comma(seventeen_recoup.toFixed(2)); 
								$('#seventeen_recoup').val(seventeen_recoup); 

								seventeen_retention 		=  Comma(parseFloat(seventeen_retention).toFixed(2));    

								$('#seventeen_retention').val(seventeen_retention); 
								seventeen_electricity 	=  Comma(seventeen_electricity.toFixed(2)); 
								$('#seventeen_electricity').val(seventeen_electricity); 
								seventeen_others 		=  Comma(seventeen_others.toFixed(2)); 
								$('#seventeen_others').val(seventeen_others); 
								seventeen_net 			=  Comma(seventeen_net.toFixed(2)); 
								$('#seventeen_net').val(seventeen_net); 
								$('#seventeen_date').val(seventeen_date); 

								if(eighteen_checkbox=='on'){
									$('#eighteen_checkbox').attr('checked',true);
								} 
								$('#eighteen_percentage').val(eighteen_percentage); 
								eighteen_amount 		=  Comma(eighteen_amount.toFixed(2)); 
								$('#eighteen_amount').val(eighteen_amount); 
								eighteen_wht 			=  Comma(eighteen_wht.toFixed(2)); 
								$('#eighteen_wht').val(eighteen_wht); 
								eighteen_recoup 		=  Comma(eighteen_recoup.toFixed(2)); 
								$('#eighteen_recoup').val(eighteen_recoup); 


								eighteen_retention 		=  Comma(parseFloat(eighteen_retention).toFixed(2));    
								$('#eighteen_retention').val(eighteen_retention); 
								
								eighteen_electricity 	=  Comma(eighteen_electricity.toFixed(2)); 
								$('#eighteen_electricity').val(eighteen_electricity); 
								eighteen_others 		=  Comma(eighteen_others.toFixed(2)); 
								$('#eighteen_others').val(eighteen_others); 
								eighteen_net 			=  Comma(eighteen_net.toFixed(2)); 
								$('#eighteen_net').val(eighteen_net); 
								$('#eighteen_date').val(eighteen_date); 

								if(nineteen_checkbox=='on'){
									$('#nineteen_checkbox').attr('checked',true);
								} 
								$('#nineteen_percentage').val(nineteen_percentage); 
								nineteen_amount 		=  Comma(nineteen_amount.toFixed(2)); 
								$('#nineteen_amount').val(nineteen_amount); 
								nineteen_wht 			=  Comma(nineteen_wht.toFixed(2)); 
								$('#nineteen_wht').val(nineteen_wht); 
								nineteen_recoup 		=  Comma(nineteen_recoup.toFixed(2)); 
								$('#nineteen_recoup').val(nineteen_recoup); 

								nineteen_retention 		=  Comma(parseFloat(nineteen_retention).toFixed(2));      
								$('#nineteen_retention').val(nineteen_retention); 

								nineteen_electricity 	=  Comma(nineteen_electricity.toFixed(2)); 
								$('#nineteen_electricity').val(nineteen_electricity); 
								nineteen_others 		=  Comma(nineteen_others.toFixed(2)); 
								$('#nineteen_others').val(nineteen_others); 
								nineteen_net 			=  Comma(nineteen_net.toFixed(2)); 
								$('#nineteen_net').val(nineteen_net); 
								$('#nineteen_date').val(nineteen_date); 

								if(twenty_checkbox=='on'){
									$('#twenty_checkbox').attr('checked',true);
								} 
								$('#twenty_percentage').val(twenty_percentage); 
								twenty_amount 		=  Comma(twenty_amount.toFixed(2)); 
								$('#twenty_amount').val(twenty_amount); 
								twenty_wht 			=  Comma(twenty_wht.toFixed(2)); 
								$('#twenty_wht').val(twenty_wht); 
								twenty_recoup 		=  Comma(twenty_recoup.toFixed(2)); 
								$('#twenty_recoup').val(twenty_recoup); 

								twenty_retention 		=  Comma(parseFloat(twenty_retention).toFixed(2));       
								$('#twenty_retention').val(twenty_retention); 

								twenty_electricity 	=  Comma(twenty_electricity.toFixed(2)); 
								$('#twenty_electricity').val(twenty_electricity); 
								twenty_others 		=  Comma(twenty_others.toFixed(2)); 
								$('#twenty_others').val(twenty_others); 
								twenty_net 			=  Comma(twenty_net.toFixed(2)); 
								$('#twenty_net').val(twenty_net); 
								$('#twenty_date').val(twenty_date); 



								$('#total_percentage').val(total_percentage); 
								total_amount 			=  Comma(total_amount.toFixed(2)); 
								$('#total_amount').val(total_amount); 
								total_wht 			=  Comma(total_wht.toFixed(2)); 
								$('#total_wht').val(total_wht); 
								total_recoup 			=  Comma(total_recoup.toFixed(2)); 
								$('#total_recoup').val(total_recoup); 
								total_retention 		=  Comma(total_retention.toFixed(2)); 
								$('#total_retention').val(total_retention); 
								total_electricity 	=  Comma(total_electricity.toFixed(2)); 
								$('#total_electricity').val(total_electricity); 

								total_water 	=  Comma(total_water.toFixed(2)); 
								$('#total_water').val(total_water); 

								total_others 			=  Comma(total_others.toFixed(2)); 
								$('#total_others').val(total_others); 
								total_net 			=  Comma(total_net.toFixed(2)); 
								$('#total_net').val(total_net);  
 
 								balance_amount 			=  Comma(balance_amount.toFixed(2)); 
								$('#balance_amount').val(balance_amount);  
 
 								balance_wht 			=  Comma(balance_wht.toFixed(2)); 
								$('#balance_wht').val(balance_wht);  
 
 								balance_recoup 			=  Comma(balance_recoup.toFixed(2)); 

 								if(balance_recoup=='NaN'){
									balance_recoup = 0.00;
								}

								$('#balance_recoup').val(balance_recoup);  
   

						});
}

     

function releaseStatus(){
	var total_amount	= parseFloat($('#total_amount').val().replace(/,/g, ""));
	var contract_price	= parseFloat($('#contract_price').val().replace(/,/g, ""));

	if(total_amount == contract_price){
		$('#releases_status').val("Fully Paid");
	}else if(total_amount > contract_price){
		$('#releases_status').val("Overpaid");
	}else if(total_amount < contract_price){
		$('#releases_status').val("with Balance");
	} 
}
 

 
function amount_computation(){
	var first_percentage	= $('#first_percentage').val().replace(/,/g, "");
	var second_percentage	= $('#second_percentage').val().replace(/,/g, "");
	var third_percentage	= $('#third_percentage').val().replace(/,/g, "");
	var fourth_percentage	= $('#fourth_percentage').val().replace(/,/g, "");
	var fifth_percentage	= $('#fifth_percentage').val().replace(/,/g, "");
	var sixth_percentage	= $('#sixth_percentage').val().replace(/,/g, "");
	var seventh_percentage	= $('#seventh_percentage').val().replace(/,/g, "");
	var eight_percentage	= $('#eight_percentage').val().replace(/,/g, "");
	var nine_percentage		= $('#nine_percentage').val().replace(/,/g, "");
	var ten_percentage		= $('#ten_percentage').val().replace(/,/g, "");

	var eleven_percentage		= $('#eleven_percentage').val().replace(/,/g, "");
	var twelve_percentage		= $('#twelve_percentage').val().replace(/,/g, "");
	var thirteen_percentage		= $('#thirteen_percentage').val().replace(/,/g, "");
	var fourteen_percentage		= $('#fourteen_percentage').val().replace(/,/g, "");
	var fifteen_percentage		= $('#fifteen_percentage').val().replace(/,/g, "");
	var sixteen_percentage		= $('#sixteen_percentage').val().replace(/,/g, "");
	var seventeen_percentage	= $('#seventeen_percentage').val().replace(/,/g, "");
	var eighteen_percentage		= $('#eighteen_percentage').val().replace(/,/g, "");
	var nineteen_percentage		= $('#nineteen_percentage').val().replace(/,/g, "");
	var twenty_percentage		= $('#twenty_percentage').val().replace(/,/g, "");

	var wht 				= $('#withholding_tax').val().replace(/,/g, "");
	var contract_price		= $('#contract_price').val().replace(/,/g, "");
	var downpayment_recoup	= $('#downpayment_recoup').val().replace(/,/g, "");

 
	//check if one time or each billing
	   var radioValue = $("input[name='ewt_type']:checked").val();
            if(radioValue){ 

                if(radioValue=="one_time"){
                	$('.release_ewt').val(parseFloat(0.00).toFixed(2));
 
                }else{


                	//computation of EWT 
					var first_wht 			= wht * (first_percentage/100);
					first_wht 				= Comma(parseFloat(first_wht).toFixed(2));
					$('#first_wht').val(first_wht);

					var second_wht 			= wht * (second_percentage/100);
					second_wht 				= Comma(parseFloat(second_wht).toFixed(2));
					$('#second_wht').val(second_wht); 

					var third_wht 			= wht * (third_percentage/100);
					third_wht 				= Comma(parseFloat(third_wht).toFixed(2));
					$('#third_wht').val(third_wht); 

					var fourth_wht 			= wht * (fourth_percentage/100);
					fourth_wht 				= Comma(parseFloat(fourth_wht).toFixed(2));
					$('#fourth_wht').val(fourth_wht); 

					var fifth_wht 			= wht * (fifth_percentage/100);
					fifth_wht 				= Comma(parseFloat(fifth_wht).toFixed(2));
					$('#fifth_wht').val(fifth_wht); 

					var sixth_wht 			= wht * (sixth_percentage/100);
					sixth_wht 				= Comma(parseFloat(sixth_wht).toFixed(2));
					$('#sixth_wht').val(sixth_wht); 

					var seventh_wht 			= wht * (seventh_percentage/100);
					seventh_wht 				= Comma(parseFloat(seventh_wht).toFixed(2));
					$('#seventh_wht').val(seventh_wht); 

					var eight_wht 			= wht * (eight_percentage/100);
					eight_wht 				= Comma(parseFloat(eight_wht).toFixed(2));
					$('#eight_wht').val(eight_wht); 

					var nine_wht 			= wht * (nine_percentage/100);
					nine_wht 				= Comma(parseFloat(nine_wht).toFixed(2));
					$('#nine_wht').val(nine_wht); 
								
					var ten_wht 			= wht * (ten_percentage/100);
					ten_wht 				= Comma(parseFloat(ten_wht).toFixed(2));
					$('#ten_wht').val(ten_wht); 


					var eleven_wht 			= wht * (eleven_percentage/100);
					eleven_wht 				= Comma(parseFloat(eleven_wht).toFixed(2));
					$('#eleven_wht').val(eleven_wht); 

					var twelve_wht 			= wht * (twelve_percentage/100);
					twelve_wht 				= Comma(parseFloat(twelve_wht).toFixed(2));
					$('#twelve_wht').val(twelve_wht); 

					var thirteen_wht 			= wht * (thirteen_percentage/100);
					thirteen_wht 				= Comma(parseFloat(thirteen_wht).toFixed(2));
					$('#thirteen_wht').val(thirteen_wht); 

					var fourteen_wht 			= wht * (fourteen_percentage/100);
					fourteen_wht 				= Comma(parseFloat(fourteen_wht).toFixed(2));
					$('#fourteen_wht').val(fourteen_wht); 

					var fifteen_wht 			= wht * (fifteen_percentage/100);
					fifteen_wht 				= Comma(parseFloat(fifteen_wht).toFixed(2));
					$('#fifteen_wht').val(fifteen_wht); 

					var sixteen_wht 			= wht * (sixteen_percentage/100);
					sixteen_wht 				= Comma(parseFloat(sixteen_wht).toFixed(2));
					$('#sixteen_wht').val(sixteen_wht); 

					var seventeen_wht 			= wht * (seventeen_percentage/100);
					seventeen_wht 				= Comma(parseFloat(seventeen_wht).toFixed(2));
					$('#seventeen_wht').val(seventeen_wht); 

					var eighteen_wht 			= wht * (eighteen_percentage/100);
					eighteen_wht 				= Comma(parseFloat(eighteen_wht).toFixed(2));
					$('#eighteen_wht').val(eighteen_wht); 

					var nineteen_wht 			= wht * (nineteen_percentage/100);
					nineteen_wht 				= Comma(parseFloat(nineteen_wht).toFixed(2));
					$('#nineteen_wht').val(nineteen_wht); 

					var twenty_wht 			= wht * (twenty_percentage/100);
					twenty_wht 				= Comma(parseFloat(twenty_wht).toFixed(2));
					$('#twenty_wht').val(twenty_wht); 
				 
					/**************/

                }
            }


	var first_amount 			= contract_price * (first_percentage/100);
	first_amount 				= Comma(parseFloat(first_amount).toFixed(2));
	$('#first_amount').val(first_amount); 

	var first_recoup 			= downpayment_recoup * (first_percentage/100);
	first_recoup 				= Comma(parseFloat(first_recoup).toFixed(2));
	$('#first_recoup').val(first_recoup); 


	var second_amount 			= contract_price * (second_percentage/100);
	second_amount 				= Comma(parseFloat(second_amount).toFixed(2));
	$('#second_amount').val(second_amount); 

	var second_recoup 			= downpayment_recoup * (second_percentage/100);
	second_recoup 				= Comma(parseFloat(second_recoup).toFixed(2));
	$('#second_recoup').val(second_recoup);


	var third_amount 			= contract_price * (third_percentage/100);
	third_amount 				= Comma(parseFloat(third_amount).toFixed(2));
	$('#third_amount').val(third_amount); 

	var third_recoup 			= downpayment_recoup * (third_percentage/100);
	third_recoup 				= Comma(parseFloat(third_recoup).toFixed(2));
	$('#third_recoup').val(third_recoup); 



	var fourth_amount 			= contract_price * (fourth_percentage/100);
	fourth_amount 				= Comma(parseFloat(fourth_amount).toFixed(2));
	$('#fourth_amount').val(fourth_amount); 

	var fourth_recoup 			= downpayment_recoup * (fourth_percentage/100);
	fourth_recoup 				= Comma(parseFloat(fourth_recoup).toFixed(2));
	$('#fourth_recoup').val(fourth_recoup); 


	
	var fifth_amount 			= contract_price * (fifth_percentage/100);
	fifth_amount 				= Comma(parseFloat(fifth_amount).toFixed(2));
	$('#fifth_amount').val(fifth_amount); 

	var fifth_recoup 			= downpayment_recoup * (fifth_percentage/100);
	fifth_recoup 				= Comma(parseFloat(fifth_recoup).toFixed(2));
	$('#fifth_recoup').val(fifth_recoup); 


	
	var sixth_amount 			= contract_price * (sixth_percentage/100);
	sixth_amount 				= Comma(parseFloat(sixth_amount).toFixed(2));
	$('#sixth_amount').val(sixth_amount); 

	var sixth_recoup 			= downpayment_recoup * (sixth_percentage/100);
	sixth_recoup 				= Comma(parseFloat(sixth_recoup).toFixed(2));
	$('#sixth_recoup').val(sixth_recoup); 


	
	var seventh_amount 			= contract_price * (seventh_percentage/100);
	seventh_amount 				= Comma(parseFloat(seventh_amount).toFixed(2));
	$('#seventh_amount').val(seventh_amount); 

	var seventh_recoup 			= downpayment_recoup * (seventh_percentage/100);
	seventh_recoup 				= Comma(parseFloat(seventh_recoup).toFixed(2));
	$('#seventh_recoup').val(seventh_recoup); 

	
	var eight_amount 			= contract_price * (eight_percentage/100);
	eight_amount 				= Comma(parseFloat(eight_amount).toFixed(2));
	$('#eight_amount').val(eight_amount); 

	var eight_recoup 			= downpayment_recoup * (eight_percentage/100);
	eight_recoup 				= Comma(parseFloat(eight_recoup).toFixed(2));
	$('#eight_recoup').val(eight_recoup); 


	
	var nine_amount 			= contract_price * (nine_percentage/100);
	nine_amount 				= Comma(parseFloat(nine_amount).toFixed(2));
	$('#nine_amount').val(nine_amount); 
	
	var nine_recoup 			= downpayment_recoup * (nine_percentage/100);
	nine_recoup 				= Comma(parseFloat(nine_recoup).toFixed(2));
	$('#nine_recoup').val(nine_recoup); 


	var ten_amount 			= contract_price * (ten_percentage/100);
	ten_amount 				= Comma(parseFloat(ten_amount).toFixed(2));
	$('#ten_amount').val(ten_amount); 

	var ten_recoup 				= downpayment_recoup * (ten_percentage/100);
	ten_recoup 					= Comma(parseFloat(ten_recoup).toFixed(2));
	$('#ten_recoup').val(ten_recoup);  



	var eleven_amount 			= contract_price * (eleven_percentage/100);
	eleven_amount 				= Comma(parseFloat(eleven_amount).toFixed(2));
	$('#eleven_amount').val(eleven_amount); 
	
	var eleven_recoup 			= downpayment_recoup * (eleven_percentage/100);
	eleven_recoup 				= Comma(parseFloat(eleven_recoup).toFixed(2));
	$('#eleven_recoup').val(eleven_recoup); 



	var twelve_amount 			= contract_price * (twelve_percentage/100);
	twelve_amount 				= Comma(parseFloat(twelve_amount).toFixed(2));
	$('#twelve_amount').val(twelve_amount); 
	
	var twelve_recoup 			= downpayment_recoup * (twelve_percentage/100);
	twelve_recoup 				= Comma(parseFloat(twelve_recoup).toFixed(2));
	$('#twelve_recoup').val(twelve_recoup); 


	var thirteen_amount 			= contract_price * (thirteen_percentage/100);
	thirteen_amount 				= Comma(parseFloat(thirteen_amount).toFixed(2));
	$('#thirteen_amount').val(thirteen_amount); 
	
	var thirteen_recoup 			= downpayment_recoup * (thirteen_percentage/100);
	thirteen_recoup 				= Comma(parseFloat(thirteen_recoup).toFixed(2));
	$('#thirteen_recoup').val(thirteen_recoup); 


	var fourteen_amount 			= contract_price * (fourteen_percentage/100);
	fourteen_amount 				= Comma(parseFloat(fourteen_amount).toFixed(2));
	$('#fourteen_amount').val(fourteen_amount); 
	
	var fourteen_recoup 			= downpayment_recoup * (fourteen_percentage/100);
	fourteen_recoup 				= Comma(parseFloat(fourteen_recoup).toFixed(2));
	$('#fourteen_recoup').val(fourteen_recoup); 


	var fifteen_amount 			= contract_price * (fifteen_percentage/100);
	fifteen_amount 				= Comma(parseFloat(fifteen_amount).toFixed(2));
	$('#fifteen_amount').val(fifteen_amount); 
	
	var fifteen_recoup 			= downpayment_recoup * (fifteen_percentage/100);
	fifteen_recoup 				= Comma(parseFloat(fifteen_recoup).toFixed(2));
	$('#fifteen_recoup').val(fifteen_recoup); 


	var sixteen_amount 			= contract_price * (sixteen_percentage/100);
	sixteen_amount 				= Comma(parseFloat(sixteen_amount).toFixed(2));
	$('#sixteen_amount').val(sixteen_amount); 
	
	var sixteen_recoup 			= downpayment_recoup * (sixteen_percentage/100);
	sixteen_recoup 				= Comma(parseFloat(sixteen_recoup).toFixed(2));
	$('#sixteen_recoup').val(sixteen_recoup); 


	var seventeen_amount 			= contract_price * (seventeen_percentage/100);
	seventeen_amount 				= Comma(parseFloat(seventeen_amount).toFixed(2));
	$('#seventeen_amount').val(seventeen_amount); 
	
	var seventeen_recoup 			= downpayment_recoup * (seventeen_percentage/100);
	seventeen_recoup 				= Comma(parseFloat(seventeen_recoup).toFixed(2));
	$('#seventeen_recoup').val(seventeen_recoup); 



	var eighteen_amount 			= contract_price * (eighteen_percentage/100);
	eighteen_amount 				= Comma(parseFloat(eighteen_amount).toFixed(2));
	$('#eighteen_amount').val(eighteen_amount); 
	
	var eighteen_recoup 			= downpayment_recoup * (eighteen_percentage/100);
	eighteen_recoup 				= Comma(parseFloat(eighteen_recoup).toFixed(2));
	$('#eighteen_recoup').val(eighteen_recoup); 


	var nineteen_amount 			= contract_price * (nineteen_percentage/100);
	nineteen_amount 				= Comma(parseFloat(nineteen_amount).toFixed(2));
	$('#nineteen_amount').val(nineteen_amount); 
	
	var nineteen_recoup 			= downpayment_recoup * (nineteen_percentage/100);
	nineteen_recoup 				= Comma(parseFloat(nineteen_recoup).toFixed(2));
	$('#nineteen_recoup').val(nineteen_recoup); 


	var twenty_amount 			= contract_price * (twenty_percentage/100);
	twenty_amount 				= Comma(parseFloat(twenty_amount).toFixed(2));
	$('#twenty_amount').val(twenty_amount); 
	
	var twenty_recoup 			= downpayment_recoup * (twenty_percentage/100);
	twenty_recoup 				= Comma(parseFloat(twenty_recoup).toFixed(2));
	$('#twenty_recoup').val(twenty_recoup); 
	/*************/
	 

	compute_net();
}

function compute_recoup(){
	
	var downpayment_recoup	= $('#downpayment_recoup').val().replace(/,/g, ""); 

	var first_percentage	= $('#first_percentage').val().replace(/,/g, "");
	var first_recoup 		= downpayment_recoup * (first_percentage/100);
	first_recoup 			= Comma(parseFloat(first_recoup).toFixed(2));
	$('#first_recoup').val(first_recoup); 

	var second_percentage	= $('#second_percentage').val().replace(/,/g, "");
	var second_recoup 		= downpayment_recoup * (second_percentage/100);
	second_recoup 			= Comma(parseFloat(second_recoup).toFixed(2));
	$('#second_recoup').val(second_recoup); 

	var third_percentage	= $('#third_percentage').val().replace(/,/g, "");
	var third_recoup 		= downpayment_recoup * (third_percentage/100);
	third_recoup 			= Comma(parseFloat(third_recoup).toFixed(2));
	$('#third_recoup').val(third_recoup); 

	var fourth_percentage	= $('#fourth_percentage').val().replace(/,/g, "");
	var fourth_recoup 		= downpayment_recoup * (fourth_percentage/100);
	fourth_recoup 			= Comma(parseFloat(fourth_recoup).toFixed(2));
	$('#fourth_recoup').val(fourth_recoup); 

	var fifth_percentage	= $('#fifth_percentage').val().replace(/,/g, "");
	var fifth_recoup 		= downpayment_recoup * (fifth_percentage/100);
	fifth_recoup 			= Comma(parseFloat(fifth_recoup).toFixed(2));
	$('#fifth_recoup').val(fifth_recoup); 
 
	var sixth_percentage	= $('#sixth_percentage').val().replace(/,/g, "");
	var sixth_recoup 		= downpayment_recoup * (sixth_percentage/100);
	sixth_recoup 			= Comma(parseFloat(sixth_recoup).toFixed(2));
	$('#sixth_recoup').val(sixth_recoup); 

	var seventh_percentage	= $('#seventh_percentage').val().replace(/,/g, "");
	var seventh_recoup 		= downpayment_recoup * (seventh_percentage/100);
	seventh_recoup 			= Comma(parseFloat(seventh_recoup).toFixed(2));
	$('#seventh_recoup').val(seventh_recoup); 

	var eight_percentage	= $('#eight_percentage').val().replace(/,/g, "");
	var eight_recoup 		= downpayment_recoup * (eight_percentage/100);
	eight_recoup 			= Comma(parseFloat(eight_recoup).toFixed(2));
	$('#eight_recoup').val(eight_recoup); 

	var nine_percentage	= $('#nine_percentage').val().replace(/,/g, "");
	var nine_recoup 		= downpayment_recoup * (nine_percentage/100);
	nine_recoup 			= Comma(parseFloat(nine_recoup).toFixed(2));
	$('#nine_recoup').val(nine_recoup); 

	var ten_percentage	= $('#ten_percentage').val().replace(/,/g, "");
	var ten_recoup 		= downpayment_recoup * (ten_percentage/100);
	ten_recoup 			= Comma(parseFloat(ten_recoup).toFixed(2));
	$('#ten_recoup').val(ten_recoup);  

	var eleven_percentage	= $('#eleven_percentage').val().replace(/,/g, "");
	var eleven_recoup 		= downpayment_recoup * (eleven_percentage/100);
	eleven_recoup 			= Comma(parseFloat(eleven_recoup).toFixed(2));
	$('#eleven_recoup').val(eleven_recoup); 

	var twelve_percentage	= $('#twelve_percentage').val().replace(/,/g, "");
	var twelve_recoup 		= downpayment_recoup * (twelve_percentage/100);
	twelve_recoup 			= Comma(parseFloat(twelve_recoup).toFixed(2));
	$('#twelve_recoup').val(twelve_recoup);

	var thirteen_percentage	= $('#thirteen_percentage').val().replace(/,/g, "");
	var thirteen_recoup 		= downpayment_recoup * (thirteen_percentage/100);
	thirteen_recoup 			= Comma(parseFloat(thirteen_recoup).toFixed(2));
	$('#thirteen_recoup').val(thirteen_recoup); 

	var fourteen_percentage	= $('#fourteen_percentage').val().replace(/,/g, "");
	var fourteen_recoup 		= downpayment_recoup * (fourteen_percentage/100);
	fourteen_recoup 			= Comma(parseFloat(fourteen_recoup).toFixed(2));
	$('#fourteen_recoup').val(fourteen_recoup); 

	var fifteen_percentage	= $('#fifteen_percentage').val().replace(/,/g, "");
	var fifteen_recoup 		= downpayment_recoup * (fifteen_percentage/100);
	fifteen_recoup 			= Comma(parseFloat(fifteen_recoup).toFixed(2));
	$('#fifteen_recoup').val(fifteen_recoup); 

	var sixteen_percentage	= $('#sixteen_percentage').val().replace(/,/g, "");
	var sixteen_recoup 		= downpayment_recoup * (sixteen_percentage/100);
	sixteen_recoup 			= Comma(parseFloat(sixteen_recoup).toFixed(2));
	$('#sixteen_recoup').val(sixteen_recoup); 

	var seventeen_percentage	= $('#seventeen_percentage').val().replace(/,/g, "");
	var seventeen_recoup 		= downpayment_recoup * (seventeen_percentage/100);
	seventeen_recoup 			= Comma(parseFloat(seventeen_recoup).toFixed(2));
	$('#seventeen_recoup').val(seventeen_recoup);

	var eighteen_percentage	= $('#eighteen_percentage').val().replace(/,/g, "");
	var eighteen_recoup 		= downpayment_recoup * (eighteen_percentage/100);
	eighteen_recoup 			= Comma(parseFloat(eighteen_recoup).toFixed(2));
	$('#eighteen_recoup').val(eighteen_recoup); 

	var nineteen_percentage	= $('#nineteen_percentage').val().replace(/,/g, "");
	var nineteen_recoup 		= downpayment_recoup * (nineteen_percentage/100);
	nineteen_recoup 			= Comma(parseFloat(nineteen_recoup).toFixed(2));
	$('#nineteen_recoup').val(nineteen_recoup); 

	var twenty_percentage	= $('#twenty_percentage').val().replace(/,/g, "");
	var twenty_recoup 		= downpayment_recoup * (twenty_percentage/100);
	twenty_recoup 			= Comma(parseFloat(twenty_recoup).toFixed(2));
	$('#twenty_recoup').val(twenty_recoup); 

	compute_net();
}

function compute_net(){
	var first_amount		= $('#first_amount').val().replace(/,/g, "");
	var first_wht			= $('#first_wht').val().replace(/,/g, "");
	var first_recoup		= $('#first_recoup').val().replace(/,/g, "");
	var first_retention		= $('#first_retention').val().replace(/,/g, "");
	var first_electricity	= $('#first_electricity').val().replace(/,/g, "");
	var first_water			= $('#first_water').val().replace(/,/g, "");
	var first_others		= $('#first_others').val().replace(/,/g, "");
	var first_net			= parseFloat(first_amount) - (parseFloat(first_wht) + parseFloat(first_recoup) + parseFloat(first_retention) + parseFloat(first_electricity) + parseFloat(first_water) + parseFloat(first_others));
	
	if(first_net!='NaN'){
		first_net = Comma(parseFloat(first_net).toFixed(2));	
		if(first_net!='0.00' && first_net!='NaN'){  
			$('#first_checkbox').prop("checked",true); 
		}
	}else{
		first_net = 0;
	}

	$('#first_net').val(first_net);

	var second_amount		= $('#second_amount').val().replace(/,/g, "");
	var second_wht			= $('#second_wht').val().replace(/,/g, "");
	var second_recoup		= $('#second_recoup').val().replace(/,/g, "");
	var second_retention	= $('#second_retention').val().replace(/,/g, "");
	var second_electricity	= $('#second_electricity').val().replace(/,/g, "");
	var second_water		= $('#second_water').val().replace(/,/g, "");
	var second_others		= $('#second_others').val().replace(/,/g, "");
	var second_net			= parseFloat(second_amount) - (parseFloat(second_wht) + parseFloat(second_recoup) + parseFloat(second_retention) + parseFloat(second_electricity) + parseFloat(second_water) + parseFloat(second_others));
	 
	if(second_net!='NaN'){
		second_net = Comma(parseFloat(second_net).toFixed(2));	
		
		if(second_net!='0.00' && second_net!='NaN'){ 
			$('#second_checkbox').prop("checked",true); 
		}
	}else{
		second_net = 0;
	}

	$('#second_net').val(second_net);


	var third_amount		= $('#third_amount').val().replace(/,/g, "");
	var third_wht			= $('#third_wht').val().replace(/,/g, "");
	var third_recoup		= $('#third_recoup').val().replace(/,/g, "");
	var third_retention	= $('#third_retention').val().replace(/,/g, "");
	var third_electricity	= $('#third_electricity').val().replace(/,/g, "");
	var third_water	= $('#third_water').val().replace(/,/g, "");
	var third_others		= $('#third_others').val().replace(/,/g, "");
	var third_net			= parseFloat(third_amount) - (parseFloat(third_wht) + parseFloat(third_recoup) + parseFloat(third_retention) + parseFloat(third_electricity) + parseFloat(third_water) + parseFloat(third_others));
	 
	if(third_net!='NaN'){
		third_net = Comma(parseFloat(third_net).toFixed(2));	
		if(third_net!='0.00' && third_net!='NaN'){ 
			$('#third_checkbox').prop("checked",true); 
		}
	}else{
		third_net = 0;
	}

	$('#third_net').val(third_net);

	
	var fourth_amount		= $('#fourth_amount').val().replace(/,/g, "");
	var fourth_wht			= $('#fourth_wht').val().replace(/,/g, "");
	var fourth_recoup		= $('#fourth_recoup').val().replace(/,/g, "");
	var fourth_retention	= $('#fourth_retention').val().replace(/,/g, "");
	var fourth_electricity	= $('#fourth_electricity').val().replace(/,/g, "");
	var fourth_water		= $('#fourth_water').val().replace(/,/g, "");
	var fourth_others		= $('#fourth_others').val().replace(/,/g, "");
	var fourth_net			= parseFloat(fourth_amount) - (parseFloat(fourth_wht) + parseFloat(fourth_recoup) + parseFloat(fourth_retention) + parseFloat(fourth_electricity) + parseFloat(fourth_water) + parseFloat(fourth_others));
	 
	if(fourth_net!='NaN'){
		fourth_net = Comma(parseFloat(fourth_net).toFixed(2));	
		if(fourth_net!='0.00' && fourth_net!='NaN'){ 
			$('#fourth_checkbox').prop("checked",true); 
		}
	}else{
		fourth_net = 0;
	}

	$('#fourth_net').val(fourth_net);


	var fifth_amount		= $('#fifth_amount').val().replace(/,/g, "");
	var fifth_wht			= $('#fifth_wht').val().replace(/,/g, "");
	var fifth_recoup		= $('#fifth_recoup').val().replace(/,/g, "");
	var fifth_retention		= $('#fifth_retention').val().replace(/,/g, "");
	var fifth_electricity	= $('#fifth_electricity').val().replace(/,/g, "");
	var fifth_water			= $('#fifth_water').val().replace(/,/g, "");
	var fifth_others		= $('#fifth_others').val().replace(/,/g, "");
	var fifth_net			= parseFloat(fifth_amount) - (parseFloat(fifth_wht) + parseFloat(fifth_recoup) + parseFloat(fifth_retention) + parseFloat(fifth_electricity) + parseFloat(fifth_water) + parseFloat(fifth_others));
	 
	if(fifth_net!='NaN'){
		fifth_net = Comma(parseFloat(fifth_net).toFixed(2));	
		if(fifth_net!='0.00' && fifth_net!='NaN'){ 
			$('#fifth_checkbox').prop("checked",true); 
		}
	}else{
		fifth_net = 0;
	}

	$('#fifth_net').val(fifth_net);


	var sixth_amount		= $('#sixth_amount').val().replace(/,/g, "");
	var sixth_wht			= $('#sixth_wht').val().replace(/,/g, "");
	var sixth_recoup		= $('#sixth_recoup').val().replace(/,/g, "");
	var sixth_retention		= $('#sixth_retention').val().replace(/,/g, "");
	var sixth_electricity	= $('#sixth_electricity').val().replace(/,/g, "");
	var sixth_water			= $('#sixth_water').val().replace(/,/g, "");
	var sixth_others		= $('#sixth_others').val().replace(/,/g, "");
	var sixth_net			= parseFloat(sixth_amount) - (parseFloat(sixth_wht) + parseFloat(sixth_recoup) + parseFloat(sixth_retention) + parseFloat(sixth_electricity) + parseFloat(sixth_water) + parseFloat(sixth_others));
	  
	if(sixth_net!='NaN'){
		sixth_net = Comma(parseFloat(sixth_net).toFixed(2));	
		if(sixth_net!='0.00' && sixth_net!='NaN'){
			$('#sixth_checkbox').prop("checked",true); 
		}
	}else{
		sixth_net = 0;
	}

	$('#sixth_net').val(sixth_net);


	var seventh_amount		= $('#seventh_amount').val().replace(/,/g, "");
	var seventh_wht			= $('#seventh_wht').val().replace(/,/g, "");
	var seventh_recoup		= $('#seventh_recoup').val().replace(/,/g, "");
	var seventh_retention	= $('#seventh_retention').val().replace(/,/g, "");
	var seventh_electricity	= $('#seventh_electricity').val().replace(/,/g, "");
	var seventh_water		= $('#seventh_water').val().replace(/,/g, "");
	var seventh_others		= $('#seventh_others').val().replace(/,/g, "");
	var seventh_net			= parseFloat(seventh_amount) - (parseFloat(seventh_wht) + parseFloat(seventh_recoup) + parseFloat(seventh_retention) + parseFloat(seventh_electricity) + parseFloat(seventh_water) + parseFloat(seventh_others));
	 
	if(seventh_net!='NaN'){
		seventh_net = Comma(parseFloat(seventh_net).toFixed(2));	
		if(seventh_net!='0.00' && seventh_net!='NaN'){
			$('#seventh_checkbox').prop("checked",true); 
		}
	}else{
		seventh_net = 0;
	}

	$('#seventh_net').val(seventh_net);

	var eight_amount		= $('#eight_amount').val().replace(/,/g, "");
	var eight_wht			= $('#eight_wht').val().replace(/,/g, "");
	var eight_recoup		= $('#eight_recoup').val().replace(/,/g, "");
	var eight_retention		= $('#eight_retention').val().replace(/,/g, "");
	var eight_electricity	= $('#eight_electricity').val().replace(/,/g, "");
	var eight_water			= $('#eight_water').val().replace(/,/g, "");
	var eight_others		= $('#eight_others').val().replace(/,/g, "");
	var eight_net			= parseFloat(eight_amount) - (parseFloat(eight_wht) + parseFloat(eight_recoup) + parseFloat(eight_retention) + parseFloat(eight_electricity) + parseFloat(eight_water) + parseFloat(eight_others));
	 
	if(eight_net!='NaN'){
		eight_net = Comma(parseFloat(eight_net).toFixed(2));	
		if(eight_net!='0.00' && eight_net!='NaN'){
			$('#eight_checkbox').prop("checked",true); 
		}
	}else{
		eight_net = 0;
	}

	$('#eight_net').val(eight_net);


	var nine_amount			= $('#nine_amount').val().replace(/,/g, "");
	var nine_wht			= $('#nine_wht').val().replace(/,/g, "");
	var nine_recoup			= $('#nine_recoup').val().replace(/,/g, "");
	var nine_retention		= $('#nine_retention').val().replace(/,/g, "");
	var nine_electricity	= $('#nine_electricity').val().replace(/,/g, "");
	var nine_water			= $('#nine_water').val().replace(/,/g, "");
	var nine_others			= $('#nine_others').val().replace(/,/g, "");
	var nine_net			= parseFloat(nine_amount) - (parseFloat(nine_wht) + parseFloat(nine_recoup) + parseFloat(nine_retention) + parseFloat(nine_electricity) + parseFloat(nine_water) + parseFloat(nine_others));
	 
	if(nine_net!='NaN'){
		nine_net = Comma(parseFloat(nine_net).toFixed(2));	
		if(nine_net!='0.00' && nine_net!='NaN'){
			$('#nine_checkbox').prop("checked",true); 
		}
	}else{
		nine_net = 0;
	}

	$('#nine_net').val(nine_net);

	var ten_amount		= $('#ten_amount').val().replace(/,/g, "");
	var ten_wht			= $('#ten_wht').val().replace(/,/g, "");
	var ten_recoup		= $('#ten_recoup').val().replace(/,/g, "");
	var ten_retention	= $('#ten_retention').val().replace(/,/g, "");
	var ten_electricity	= $('#ten_electricity').val().replace(/,/g, "");
	var ten_water		= $('#ten_water').val().replace(/,/g, "");
	var ten_others		= $('#ten_others').val().replace(/,/g, "");
	var ten_net			= parseFloat(ten_amount) - (parseFloat(ten_wht) + parseFloat(ten_recoup) + parseFloat(ten_retention) + parseFloat(ten_electricity) + parseFloat(ten_water) + parseFloat(ten_others));
	 
	if(ten_net!='NaN'){
		ten_net = Comma(parseFloat(ten_net).toFixed(2));	
		if(ten_net!='0.00' && ten_net!='NaN'){
			$('#ten_checkbox').prop("checked",true); 
		}
	}else{
		ten_net = 0;
	}

	$('#ten_net').val(ten_net);


	var eleven_amount			= $('#eleven_amount').val().replace(/,/g, "");
	var eleven_wht				= $('#eleven_wht').val().replace(/,/g, "");
	var eleven_recoup			= $('#eleven_recoup').val().replace(/,/g, "");
	var eleven_retention		= $('#eleven_retention').val().replace(/,/g, "");
	var eleven_electricity		= $('#eleven_electricity').val().replace(/,/g, "");
	var eleven_water			= $('#eleven_water').val().replace(/,/g, "");
	var eleven_others			= $('#eleven_others').val().replace(/,/g, "");
	var eleven_net				= parseFloat(eleven_amount) - (parseFloat(eleven_wht) + parseFloat(eleven_recoup) + parseFloat(eleven_retention) + parseFloat(eleven_electricity) + parseFloat(eleven_water) + parseFloat(eleven_others));
	 
	if(eleven_net!='NaN'){
		eleven_net = Comma(parseFloat(eleven_net).toFixed(2));	
		if(eleven_net!='0.00' && eleven_net!='NaN'){
			$('#eleven_checkbox').prop("checked",true); 
		}
	}else{
		eleven_net = 0;
	}

	$('#eleven_net').val(eleven_net);


	var twelve_amount			= $('#twelve_amount').val().replace(/,/g, "");
	var twelve_wht			= $('#twelve_wht').val().replace(/,/g, "");
	var twelve_recoup			= $('#twelve_recoup').val().replace(/,/g, "");
	var twelve_retention		= $('#twelve_retention').val().replace(/,/g, "");
	var twelve_electricity	= $('#twelve_electricity').val().replace(/,/g, "");
	var twelve_water			= $('#twelve_water').val().replace(/,/g, "");
	var twelve_others			= $('#twelve_others').val().replace(/,/g, "");
	var twelve_net			= parseFloat(twelve_amount) - (parseFloat(twelve_wht) + parseFloat(twelve_recoup) + parseFloat(twelve_retention) + parseFloat(twelve_electricity) + parseFloat(twelve_water) + parseFloat(twelve_others));
	 
	if(twelve_net!='NaN'){
		twelve_net = Comma(parseFloat(twelve_net).toFixed(2));	
		if(twelve_net!='0.00' && twelve_net!='NaN'){
			$('#twelve_checkbox').prop("checked",true); 
		}
	}else{
		twelve_net = 0;
	}

	$('#twelve_net').val(twelve_net);

	var thirteen_amount			= $('#thirteen_amount').val().replace(/,/g, "");
	var thirteen_wht			= $('#thirteen_wht').val().replace(/,/g, "");
	var thirteen_recoup			= $('#thirteen_recoup').val().replace(/,/g, "");
	var thirteen_retention		= $('#thirteen_retention').val().replace(/,/g, "");
	var thirteen_electricity	= $('#thirteen_electricity').val().replace(/,/g, "");
	var thirteen_water			= $('#thirteen_water').val().replace(/,/g, "");
	var thirteen_others			= $('#thirteen_others').val().replace(/,/g, "");
	var thirteen_net			= parseFloat(thirteen_amount) - (parseFloat(thirteen_wht) + parseFloat(thirteen_recoup) + parseFloat(thirteen_retention) + parseFloat(thirteen_electricity) + parseFloat(thirteen_water) + parseFloat(thirteen_others));
	 
	if(thirteen_net!='NaN'){
		thirteen_net = Comma(parseFloat(thirteen_net).toFixed(2));	
		if(thirteen_net!='0.00' && thirteen_net!='NaN'){
			$('#thirteen_checkbox').prop("checked",true); 
		}
	}else{
		thirteen_net = 0;
	}

	$('#thirteen_net').val(thirteen_net);


	var fourteen_amount			= $('#fourteen_amount').val().replace(/,/g, "");
	var fourteen_wht			= $('#fourteen_wht').val().replace(/,/g, "");
	var fourteen_recoup			= $('#fourteen_recoup').val().replace(/,/g, "");
	var fourteen_retention		= $('#fourteen_retention').val().replace(/,/g, "");
	var fourteen_electricity	= $('#fourteen_electricity').val().replace(/,/g, "");
	var fourteen_water			= $('#fourteen_water').val().replace(/,/g, "");
	var fourteen_others			= $('#fourteen_others').val().replace(/,/g, "");
	var fourteen_net			= parseFloat(fourteen_amount) - (parseFloat(fourteen_wht) + parseFloat(fourteen_recoup) + parseFloat(fourteen_retention) + parseFloat(fourteen_electricity) + parseFloat(fourteen_water) + parseFloat(fourteen_others));
	 
	if(fourteen_net!='NaN'){
		fourteen_net = Comma(parseFloat(fourteen_net).toFixed(2));	
		if(fourteen_net!='0.00' && fourteen_net!='NaN'){
			$('#fourteen_checkbox').prop("checked",true); 
		}
	}else{
		fourteen_net = 0;
	}

	$('#fourteen_net').val(fourteen_net);


	var fifteen_amount			= $('#fifteen_amount').val().replace(/,/g, "");
	var fifteen_wht			= $('#fifteen_wht').val().replace(/,/g, "");
	var fifteen_recoup			= $('#fifteen_recoup').val().replace(/,/g, "");
	var fifteen_retention		= $('#fifteen_retention').val().replace(/,/g, "");
	var fifteen_electricity	= $('#fifteen_electricity').val().replace(/,/g, "");
	var fifteen_water			= $('#fifteen_water').val().replace(/,/g, "");
	var fifteen_others			= $('#fifteen_others').val().replace(/,/g, "");
	var fifteen_net			= parseFloat(fifteen_amount) - (parseFloat(fifteen_wht) + parseFloat(fifteen_recoup) + parseFloat(fifteen_retention) + parseFloat(fifteen_electricity) + parseFloat(fifteen_water) + parseFloat(fifteen_others));
	 
	if(fifteen_net!='NaN'){
		fifteen_net = Comma(parseFloat(fifteen_net).toFixed(2));	
		if(fifteen_net!='0.00' && fifteen_net!='NaN'){
			$('#fifteen_checkbox').prop("checked",true); 
		}
	}else{
		fifteen_net = 0;
	}

	$('#fifteen_net').val(fifteen_net);


	var sixteen_amount			= $('#sixteen_amount').val().replace(/,/g, "");
	var sixteen_wht			= $('#sixteen_wht').val().replace(/,/g, "");
	var sixteen_recoup			= $('#sixteen_recoup').val().replace(/,/g, "");
	var sixteen_retention		= $('#sixteen_retention').val().replace(/,/g, "");
	var sixteen_electricity	= $('#sixteen_electricity').val().replace(/,/g, "");
	var sixteen_water			= $('#sixteen_water').val().replace(/,/g, "");
	var sixteen_others			= $('#sixteen_others').val().replace(/,/g, "");
	var sixteen_net			= parseFloat(sixteen_amount) - (parseFloat(sixteen_wht) + parseFloat(sixteen_recoup) + parseFloat(sixteen_retention) + parseFloat(sixteen_electricity) + parseFloat(sixteen_water) + parseFloat(sixteen_others));
	 
	if(sixteen_net!='NaN'){
		sixteen_net = Comma(parseFloat(sixteen_net).toFixed(2));	
		if(sixteen_net!='0.00' && sixteen_net!='NaN'){
			$('#sixteen_checkbox').prop("checked",true); 
		}
	}else{
		sixteen_net = 0;
	}

	$('#sixteen_net').val(sixteen_net);

	var seventeen_amount			= $('#seventeen_amount').val().replace(/,/g, "");
	var seventeen_wht			= $('#seventeen_wht').val().replace(/,/g, "");
	var seventeen_recoup			= $('#seventeen_recoup').val().replace(/,/g, "");
	var seventeen_retention		= $('#seventeen_retention').val().replace(/,/g, "");
	var seventeen_electricity	= $('#seventeen_electricity').val().replace(/,/g, "");
	var seventeen_water			= $('#seventeen_water').val().replace(/,/g, "");
	var seventeen_others			= $('#seventeen_others').val().replace(/,/g, "");
	var seventeen_net			= parseFloat(seventeen_amount) - (parseFloat(seventeen_wht) + parseFloat(seventeen_recoup) + parseFloat(seventeen_retention) + parseFloat(seventeen_electricity) + parseFloat(seventeen_water) + parseFloat(seventeen_others));
	 
	if(seventeen_net!='NaN'){
		seventeen_net = Comma(parseFloat(seventeen_net).toFixed(2));	
		if(seventeen_net!='0.00' && seventeen_net!='NaN'){
			$('#seventeen_checkbox').prop("checked",true); 
		}
	}else{
		seventeen_net = 0;
	}

	$('#seventeen_net').val(seventeen_net);


	var eighteen_amount			= $('#eighteen_amount').val().replace(/,/g, "");
	var eighteen_wht			= $('#eighteen_wht').val().replace(/,/g, "");
	var eighteen_recoup			= $('#eighteen_recoup').val().replace(/,/g, "");
	var eighteen_retention		= $('#eighteen_retention').val().replace(/,/g, "");
	var eighteen_electricity	= $('#eighteen_electricity').val().replace(/,/g, "");
	var eighteen_water			= $('#eighteen_water').val().replace(/,/g, "");
	var eighteen_others			= $('#eighteen_others').val().replace(/,/g, "");
	var eighteen_net			= parseFloat(eighteen_amount) - (parseFloat(eighteen_wht) + parseFloat(eighteen_recoup) + parseFloat(eighteen_retention) + parseFloat(eighteen_electricity) + parseFloat(eighteen_water) + parseFloat(eighteen_others));
	 
	if(eighteen_net!='NaN'){
		eighteen_net = Comma(parseFloat(eighteen_net).toFixed(2));	
		if(eighteen_net!='0.00' && eighteen_net!='NaN'){
			$('#eighteen_checkbox').prop("checked",true); 
		}
	}else{
		eighteen_net = 0;
	}

	$('#eighteen_net').val(eighteen_net);

	var nineteen_amount			= $('#nineteen_amount').val().replace(/,/g, "");
	var nineteen_wht			= $('#nineteen_wht').val().replace(/,/g, "");
	var nineteen_recoup			= $('#nineteen_recoup').val().replace(/,/g, "");
	var nineteen_retention		= $('#nineteen_retention').val().replace(/,/g, "");
	var nineteen_electricity	= $('#nineteen_electricity').val().replace(/,/g, "");
	var nineteen_water			= $('#nineteen_water').val().replace(/,/g, "");
	var nineteen_others			= $('#nineteen_others').val().replace(/,/g, "");
	var nineteen_net			= parseFloat(nineteen_amount) - (parseFloat(nineteen_wht) + parseFloat(nineteen_recoup) + parseFloat(nineteen_retention) + parseFloat(nineteen_electricity) + parseFloat(nineteen_water) + parseFloat(nineteen_others));
	 
	if(nineteen_net!='NaN'){
		nineteen_net = Comma(parseFloat(nineteen_net).toFixed(2));	
		if(nineteen_net!='0.00' && nineteen_net!='NaN'){
			$('#nineteen_checkbox').prop("checked",true); 
		}
	}else{
		nineteen_net = 0;
	}

	$('#nineteen_net').val(nineteen_net);


	var twenty_amount			= $('#twenty_amount').val().replace(/,/g, "");
	var twenty_wht			= $('#twenty_wht').val().replace(/,/g, "");
	var twenty_recoup			= $('#twenty_recoup').val().replace(/,/g, "");
	var twenty_retention		= $('#twenty_retention').val().replace(/,/g, "");
	var twenty_electricity	= $('#twenty_electricity').val().replace(/,/g, "");
	var twenty_water			= $('#twenty_water').val().replace(/,/g, "");
	var twenty_others			= $('#twenty_others').val().replace(/,/g, "");
	var twenty_net			= parseFloat(twenty_amount) - (parseFloat(twenty_wht) + parseFloat(twenty_recoup) + parseFloat(twenty_retention) + parseFloat(twenty_electricity) + parseFloat(twenty_water) + parseFloat(twenty_others));
	 
	if(twenty_net!='NaN'){
		twenty_net = Comma(parseFloat(twenty_net).toFixed(2));	
		if(twenty_net!='0.00' && twenty_net!='NaN'){
			$('#twenty_checkbox').prop("checked",true); 
		}
	}else{
		twenty_net = 0;
	}

	$('#twenty_net').val(twenty_net);

	compute_total();
}




function compute_total(){
	 
	var first_percentage	= $('#first_percentage').val().replace(/,/g, "");
	var second_percentage	= $('#second_percentage').val().replace(/,/g, "");
	var third_percentage	= $('#third_percentage').val().replace(/,/g, "");
	var fourth_percentage	= $('#fourth_percentage').val().replace(/,/g, "");
	var fifth_percentage	= $('#fifth_percentage').val().replace(/,/g, "");
	var sixth_percentage	= $('#sixth_percentage').val().replace(/,/g, "");
	var seventh_percentage	= $('#seventh_percentage').val().replace(/,/g, "");
	var eight_percentage	= $('#eight_percentage').val().replace(/,/g, "");
	var nine_percentage		= $('#nine_percentage').val().replace(/,/g, "");
	var ten_percentage		= $('#ten_percentage').val().replace(/,/g, "");
 	var eleven_percentage	= $('#eleven_percentage').val().replace(/,/g, "");
	var twelve_percentage	= $('#twelve_percentage').val().replace(/,/g, "");
	var thirteen_percentage	= $('#thirteen_percentage').val().replace(/,/g, "");
	var fourteen_percentage	= $('#fourteen_percentage').val().replace(/,/g, "");
	var fifteen_percentage	= $('#fifteen_percentage').val().replace(/,/g, "");
	var sixteen_percentage	= $('#sixteen_percentage').val().replace(/,/g, "");
	var seventeen_percentage	= $('#seventeen_percentage').val().replace(/,/g, "");
	var eighteen_percentage		= $('#eighteen_percentage').val().replace(/,/g, "");
	var nineteen_percentage		= $('#nineteen_percentage').val().replace(/,/g, "");
	var twenty_percentage		= $('#twenty_percentage').val().replace(/,/g, "");
 
	if(first_percentage==''){ first_percentage = 0; }
	if(second_percentage==''){ second_percentage = 0; }
	if(third_percentage==''){ third_percentage = 0; }
	if(fourth_percentage==''){ fourth_percentage = 0; }
	if(fifth_percentage==''){ fifth_percentage = 0; }
	if(sixth_percentage==''){ sixth_percentage = 0; }
	if(seventh_percentage==''){ seventh_percentage = 0; }
	if(eight_percentage==''){ eight_percentage = 0; }
	if(nine_percentage==''){ nine_percentage = 0; }
	if(ten_percentage==''){ ten_percentage = 0; }

	if(eleven_percentage==''){ eleven_percentage = 0; }
	if(twelve_percentage==''){ twelve_percentage = 0; }
	if(thirteen_percentage==''){ thirteen_percentage = 0; }
	if(fourteen_percentage==''){ fourteen_percentage = 0; }
	if(fifteen_percentage==''){ fifteen_percentage = 0; }
	if(sixteen_percentage==''){ sixteen_percentage = 0; }
	if(seventeen_percentage==''){ seventeen_percentage = 0; }
	if(eighteen_percentage==''){ eighteen_percentage = 0; }
	if(nineteen_percentage==''){ nineteen_percentage = 0; }
	if(twenty_percentage==''){ twenty_percentage = 0; }



	var total_percentage 	= parseFloat(first_percentage) + parseFloat(second_percentage) + parseFloat(third_percentage) + parseFloat(fourth_percentage) + parseFloat(fifth_percentage) + parseFloat(sixth_percentage) + parseFloat(seventh_percentage) + parseFloat(eight_percentage) + parseFloat(nine_percentage) + parseFloat(ten_percentage) + parseFloat(eleven_percentage) + parseFloat(twelve_percentage) + parseFloat(thirteen_percentage) + parseFloat(fourteen_percentage) + parseFloat(fifteen_percentage) + parseFloat(sixteen_percentage) + parseFloat(seventeen_percentage) + parseFloat(eighteen_percentage) + parseFloat(nineteen_percentage) + parseFloat(twenty_percentage);

	total_percentage 		= Comma(parseFloat(total_percentage).toFixed(2));
	$('#total_percentage').val(total_percentage);

	var contract_price		= parseFloat($('#contract_price').val().replace(/,/g, ""));
	var withholding_tax		= $('#withholding_tax').val().replace(/,/g, "");
	var downpayment_recoup	= $('#downpayment_recoup').val().replace(/,/g, "");
 	
	var first_amount	= $('#first_amount').val().replace(/,/g, "");
	var second_amount	= $('#second_amount').val().replace(/,/g, "");
	var third_amount	= $('#third_amount').val().replace(/,/g, "");
	var fourth_amount	= $('#fourth_amount').val().replace(/,/g, "");
	var fifth_amount	= $('#fifth_amount').val().replace(/,/g, "");
	var sixth_amount	= $('#sixth_amount').val().replace(/,/g, "");
	var seventh_amount	= $('#seventh_amount').val().replace(/,/g, "");
	var eight_amount	= $('#eight_amount').val().replace(/,/g, "");
	var nine_amount		= $('#nine_amount').val().replace(/,/g, "");
	var ten_amount		= $('#ten_amount').val().replace(/,/g, "");

	var eleven_amount	= $('#eleven_amount').val().replace(/,/g, "");
	var twelve_amount	= $('#twelve_amount').val().replace(/,/g, "");
	var thirteen_amount	= $('#thirteen_amount').val().replace(/,/g, "");
	var fourteen_amount	= $('#fourteen_amount').val().replace(/,/g, "");
	var fifteen_amount	= $('#fifteen_amount').val().replace(/,/g, "");
	var sixteen_amount	= $('#sixteen_amount').val().replace(/,/g, "");
	var seventeen_amount	= $('#seventeen_amount').val().replace(/,/g, "");
	var eighteen_amount		= $('#eighteen_amount').val().replace(/,/g, "");
	var nineteen_amount		= $('#nineteen_amount').val().replace(/,/g, "");
	var twenty_amount		= $('#twenty_amount').val().replace(/,/g, "");




	 
	var total_amount 	= (parseFloat(first_amount) + parseFloat(second_amount) + parseFloat(third_amount) + parseFloat(fourth_amount) + parseFloat(fifth_amount) + parseFloat(sixth_amount) + parseFloat(seventh_amount) + parseFloat(eight_amount) + parseFloat(nine_amount) + parseFloat(ten_amount) + parseFloat(eleven_amount) + parseFloat(twelve_amount) + parseFloat(thirteen_amount) + parseFloat(fourteen_amount) + parseFloat(fifteen_amount) + parseFloat(sixteen_amount) +  parseFloat(seventeen_amount) + parseFloat(eighteen_amount) + parseFloat(nineteen_amount) + parseFloat(twenty_amount));
	

	total_amount 		= Comma(parseFloat(total_amount).toFixed(2));
	$('#total_amount').val(total_amount);

	var balance_amount 	= parseFloat(contract_price) - (parseFloat(first_amount) + parseFloat(second_amount) + parseFloat(third_amount) + parseFloat(fourth_amount) + parseFloat(fifth_amount) + parseFloat(sixth_amount) + parseFloat(seventh_amount) + parseFloat(eight_amount) + parseFloat(nine_amount) + parseFloat(ten_amount) + parseFloat(eleven_amount) + parseFloat(twelve_amount) + parseFloat(thirteen_amount) + parseFloat(fourteen_amount) + parseFloat(fifteen_amount) + parseFloat(sixteen_amount) +  parseFloat(seventeen_amount) + parseFloat(eighteen_amount) + parseFloat(nineteen_amount) + parseFloat(twenty_amount));
	

	balance_amount 		= Comma(parseFloat(balance_amount).toFixed(2));
	$('#balance_amount').val(balance_amount);

	var first_wht	= $('#first_wht').val().replace(/,/g, "");
	var second_wht	= $('#second_wht').val().replace(/,/g, "");
	var third_wht	= $('#third_wht').val().replace(/,/g, "");
	var fourth_wht	= $('#fourth_wht').val().replace(/,/g, "");
	var fifth_wht	= $('#fifth_wht').val().replace(/,/g, "");
	var sixth_wht	= $('#sixth_wht').val().replace(/,/g, "");
	var seventh_wht	= $('#seventh_wht').val().replace(/,/g, "");
	var eight_wht	= $('#eight_wht').val().replace(/,/g, "");
	var nine_wht		= $('#nine_wht').val().replace(/,/g, "");
	var ten_wht		= $('#ten_wht').val().replace(/,/g, "");

	var eleven_wht	= $('#eleven_wht').val().replace(/,/g, "");
	var twelve_wht	= $('#twelve_wht').val().replace(/,/g, "");
	var thirteen_wht	= $('#thirteen_wht').val().replace(/,/g, "");
	var fourteen_wht	= $('#fourteen_wht').val().replace(/,/g, "");
	var fifteen_wht	= $('#fifteen_wht').val().replace(/,/g, "");
	var sixteen_wht	= $('#sixteen_wht').val().replace(/,/g, "");
	var seventeen_wht	= $('#seventeen_wht').val().replace(/,/g, "");
	var eighteen_wht	= $('#eighteen_wht').val().replace(/,/g, "");
	var nineteen_wht		= $('#nineteen_wht').val().replace(/,/g, "");
	var twenty_wht		= $('#twenty_wht').val().replace(/,/g, "");
	 

	 
	var total_wht 	= (parseFloat(first_wht) + parseFloat(second_wht) + parseFloat(third_wht) + parseFloat(fourth_wht) + parseFloat(fifth_wht) + parseFloat(sixth_wht) + parseFloat(seventh_wht) + parseFloat(eight_wht) + parseFloat(nine_wht) + parseFloat(ten_wht) + parseFloat(eleven_wht) + parseFloat(twelve_wht) + parseFloat(thirteen_wht) + parseFloat(fourteen_wht) + parseFloat(fifteen_wht) + parseFloat(sixteen_wht) + parseFloat(seventeen_wht) + parseFloat(eighteen_wht) + parseFloat(nineteen_wht) + parseFloat(twenty_wht));
	var total_wht2 	= (parseFloat(first_wht) + parseFloat(second_wht) + parseFloat(third_wht) + parseFloat(fourth_wht) + parseFloat(fifth_wht) + parseFloat(sixth_wht) + parseFloat(seventh_wht) + parseFloat(eight_wht) + parseFloat(nine_wht) + parseFloat(ten_wht) + parseFloat(eleven_wht) + parseFloat(twelve_wht) + parseFloat(thirteen_wht) + parseFloat(fourteen_wht) + parseFloat(fifteen_wht) + parseFloat(sixteen_wht) + parseFloat(seventeen_wht) + parseFloat(eighteen_wht) + parseFloat(nineteen_wht) + parseFloat(twenty_wht));
	//12JUL25
	total_wht 		= Comma(parseFloat(total_wht).toFixed(2));

	total_wht2 		= parseFloat(total_wht2).toFixed(2); //12JUL25

	$('#total_wht').val(total_wht);
 
	//var balance_wht 	= parseFloat(withholding_tax) - (parseFloat(first_wht) + parseFloat(second_wht) + parseFloat(third_wht) + parseFloat(fourth_wht) + parseFloat(fifth_wht) + parseFloat(sixth_wht) + parseFloat(seventh_wht) + parseFloat(eight_wht) + parseFloat(nine_wht) + parseFloat(ten_wht) + parseFloat(withholding_tax) - parseFloat(eleven_wht) + parseFloat(twelve_wht) + parseFloat(thirteen_wht) + parseFloat(fourteen_wht) + parseFloat(fifteen_wht) + parseFloat(sixteen_wht) + parseFloat(seventeen_wht) + parseFloat(eighteen_wht) + parseFloat(nineteen_wht) + parseFloat(twenty_wht));
	 
	 var balance_wht = parseFloat(withholding_tax) - parseFloat(total_wht2); //12JUL25
 

	balance_wht 		= Comma(parseFloat(balance_wht).toFixed(2));
	$('#balance_wht').val(balance_wht);
 
	var first_recoup	= $('#first_recoup').val().replace(/,/g, "");
	var second_recoup	= $('#second_recoup').val().replace(/,/g, "");
	var third_recoup	= $('#third_recoup').val().replace(/,/g, "");
	var fourth_recoup	= $('#fourth_recoup').val().replace(/,/g, "");
	var fifth_recoup	= $('#fifth_recoup').val().replace(/,/g, "");
	var sixth_recoup	= $('#sixth_recoup').val().replace(/,/g, "");
	var seventh_recoup	= $('#seventh_recoup').val().replace(/,/g, "");
	var eight_recoup	= $('#eight_recoup').val().replace(/,/g, "");
	var nine_recoup		= $('#nine_recoup').val().replace(/,/g, "");
	var ten_recoup		= $('#ten_recoup').val().replace(/,/g, "");


	var eleven_recoup	= $('#eleven_recoup').val().replace(/,/g, "");
	var twelve_recoup	= $('#twelve_recoup').val().replace(/,/g, "");
	var thirteen_recoup	= $('#thirteen_recoup').val().replace(/,/g, "");
	var fourteen_recoup	= $('#fourteen_recoup').val().replace(/,/g, "");
	var fifteen_recoup	= $('#fifteen_recoup').val().replace(/,/g, "");
	var sixteen_recoup	= $('#sixteen_recoup').val().replace(/,/g, "");
	var seventeen_recoup	= $('#seventeen_recoup').val().replace(/,/g, "");
	var eighteen_recoup	= $('#eighteen_recoup').val().replace(/,/g, "");
	var nineteen_recoup		= $('#nineteen_recoup').val().replace(/,/g, "");
	var twenty_recoup		= $('#twenty_recoup').val().replace(/,/g, "");

	 
	var total_recoup 	= (parseFloat(first_recoup) + parseFloat(second_recoup) + parseFloat(third_recoup) + parseFloat(fourth_recoup) + parseFloat(fifth_recoup) + parseFloat(sixth_recoup) + parseFloat(seventh_recoup) + parseFloat(eight_recoup) + parseFloat(nine_recoup) + parseFloat(ten_recoup) + parseFloat(eleven_recoup) + parseFloat(twelve_recoup) + parseFloat(thirteen_recoup) + parseFloat(fourteen_recoup) + parseFloat(fifteen_recoup) + parseFloat(sixteen_recoup) + parseFloat(seventeen_recoup) + parseFloat(eighteen_recoup) + parseFloat(nineteen_recoup) + parseFloat(twenty_recoup));
	

	total_recoup 		= Comma(parseFloat(total_recoup).toFixed(2));
	$('#total_recoup').val(total_recoup);

 	var balance_recoup 	= parseFloat(downpayment_recoup) - (parseFloat(first_recoup) + parseFloat(second_recoup) + parseFloat(third_recoup) + parseFloat(fourth_recoup) + parseFloat(fifth_recoup) + parseFloat(sixth_recoup) + parseFloat(seventh_recoup) + parseFloat(eight_recoup) + parseFloat(nine_recoup) + parseFloat(ten_recoup) + parseFloat(eleven_recoup) + parseFloat(twelve_recoup) + parseFloat(thirteen_recoup) + parseFloat(fourteen_recoup) + parseFloat(fifteen_recoup) + parseFloat(sixteen_recoup) + parseFloat(seventeen_recoup) + parseFloat(eighteen_recoup) + parseFloat(nineteen_recoup) + parseFloat(twenty_recoup));
	

	balance_recoup 		= Comma(parseFloat(balance_recoup).toFixed(2));
	
	if(balance_recoup=='NaN'){
		balance_recoup = 0.00;
	}

	$('#balance_recoup').val(balance_recoup);


	var first_retention	= $('#first_retention').val().replace(/,/g, "");
	var second_retention	= $('#second_retention').val().replace(/,/g, "");
	var third_retention	= $('#third_retention').val().replace(/,/g, "");
	var fourth_retention	= $('#fourth_retention').val().replace(/,/g, "");
	var fifth_retention	= $('#fifth_retention').val().replace(/,/g, "");
	var sixth_retention	= $('#sixth_retention').val().replace(/,/g, "");
	var seventh_retention	= $('#seventh_retention').val().replace(/,/g, "");
	var eight_retention	= $('#eight_retention').val().replace(/,/g, "");
	var nine_retention		= $('#nine_retention').val().replace(/,/g, "");
	var ten_retention		= $('#ten_retention').val().replace(/,/g, "");

	var eleven_retention	= $('#eleven_retention').val().replace(/,/g, "");
	var twelve_retention	= $('#twelve_retention').val().replace(/,/g, "");
	var thirteen_retention	= $('#thirteen_retention').val().replace(/,/g, "");
	var fourteen_retention	= $('#fourteen_retention').val().replace(/,/g, "");
	var fifteen_retention	= $('#fifteen_retention').val().replace(/,/g, "");
	var sixteen_retention	= $('#sixteen_retention').val().replace(/,/g, "");
	var seventeen_retention	= $('#seventeen_retention').val().replace(/,/g, "");
	var eighteen_retention	= $('#eighteen_retention').val().replace(/,/g, "");
	var nineteen_retention		= $('#nineteen_retention').val().replace(/,/g, "");
	var twenty_retention		= $('#twenty_retention').val().replace(/,/g, "");
	 
	var total_retention 	= (parseFloat(first_retention) + parseFloat(second_retention) + parseFloat(third_retention) + parseFloat(fourth_retention) + parseFloat(fifth_retention) + parseFloat(sixth_retention) + parseFloat(seventh_retention) + parseFloat(eight_retention) + parseFloat(nine_retention) + parseFloat(ten_retention) + parseFloat(eleven_retention) + parseFloat(twelve_retention) + parseFloat(thirteen_retention) + parseFloat(fourteen_retention) + parseFloat(fifteen_retention) + parseFloat(sixteen_retention) + parseFloat(seventeen_retention) + parseFloat(eighteen_retention) + parseFloat(nineteen_retention) + parseFloat(twenty_retention));
	

	total_retention 		= Comma(parseFloat(total_retention).toFixed(2));
	$('#total_retention').val(total_retention);



	var first_electricity	= $('#first_electricity').val().replace(/,/g, "");
	var second_electricity	= $('#second_electricity').val().replace(/,/g, "");
	var third_electricity	= $('#third_electricity').val().replace(/,/g, "");
	var fourth_electricity	= $('#fourth_electricity').val().replace(/,/g, "");
	var fifth_electricity	= $('#fifth_electricity').val().replace(/,/g, "");
	var sixth_electricity	= $('#sixth_electricity').val().replace(/,/g, "");
	var seventh_electricity	= $('#seventh_electricity').val().replace(/,/g, "");
	var eight_electricity	= $('#eight_electricity').val().replace(/,/g, "");
	var nine_electricity		= $('#nine_electricity').val().replace(/,/g, "");
	var ten_electricity		= $('#ten_electricity').val().replace(/,/g, "");

	var eleven_electricity	= $('#eleven_electricity').val().replace(/,/g, "");
	var twelve_electricity	= $('#twelve_electricity').val().replace(/,/g, "");
	var thirteen_electricity	= $('#thirteen_electricity').val().replace(/,/g, "");
	var fourteen_electricity	= $('#fourteen_electricity').val().replace(/,/g, "");
	var fifteen_electricity	= $('#fifteen_electricity').val().replace(/,/g, "");
	var sixteen_electricity	= $('#sixteen_electricity').val().replace(/,/g, "");
	var seventeen_electricity	= $('#seventeen_electricity').val().replace(/,/g, "");
	var eighteen_electricity	= $('#eighteen_electricity').val().replace(/,/g, "");
	var nineteen_electricity		= $('#nineteen_electricity').val().replace(/,/g, "");
	var twenty_electricity		= $('#twenty_electricity').val().replace(/,/g, "");
	 
	var total_electricity 	= (parseFloat(first_electricity) + parseFloat(second_electricity) + parseFloat(third_electricity) + parseFloat(fourth_electricity) + parseFloat(fifth_electricity) + parseFloat(sixth_electricity) + parseFloat(seventh_electricity) + parseFloat(eight_electricity) + parseFloat(nine_electricity) + parseFloat(ten_electricity) + parseFloat(eleven_electricity) + parseFloat(twelve_electricity) + parseFloat(thirteen_electricity) + parseFloat(fourteen_electricity) + parseFloat(fifteen_electricity) + parseFloat(sixteen_electricity) + parseFloat(seventeen_electricity) + parseFloat(eighteen_electricity) + parseFloat(nineteen_electricity) + parseFloat(twenty_electricity));
	

	total_electricity 		= Comma(parseFloat(total_electricity).toFixed(2));
	$('#total_electricity').val(total_electricity);


	var first_water	= $('#first_water').val().replace(/,/g, "");
	var second_water	= $('#second_water').val().replace(/,/g, "");
	var third_water	= $('#third_water').val().replace(/,/g, "");
	var fourth_water	= $('#fourth_water').val().replace(/,/g, "");
	var fifth_water	= $('#fifth_water').val().replace(/,/g, "");
	var sixth_water	= $('#sixth_water').val().replace(/,/g, "");
	var seventh_water	= $('#seventh_water').val().replace(/,/g, "");
	var eight_water	= $('#eight_water').val().replace(/,/g, "");
	var nine_water		= $('#nine_water').val().replace(/,/g, "");
	var ten_water		= $('#ten_water').val().replace(/,/g, "");

	var eleven_water	= $('#eleven_water').val().replace(/,/g, "");
	var twelve_water	= $('#twelve_water').val().replace(/,/g, "");
	var thirteen_water	= $('#thirteen_water').val().replace(/,/g, "");
	var fourteen_water	= $('#fourteen_water').val().replace(/,/g, "");
	var fifteen_water	= $('#fifteen_water').val().replace(/,/g, "");
	var sixteen_water	= $('#sixteen_water').val().replace(/,/g, "");
	var seventeen_water	= $('#seventeen_water').val().replace(/,/g, "");
	var eighteen_water	= $('#eighteen_water').val().replace(/,/g, "");
	var nineteen_water		= $('#nineteen_water').val().replace(/,/g, "");
	var twenty_water		= $('#twenty_water').val().replace(/,/g, "");
	 
	var total_water 	= (parseFloat(first_water) + parseFloat(second_water) + parseFloat(third_water) + parseFloat(fourth_water) + parseFloat(fifth_water) + parseFloat(sixth_water) + parseFloat(seventh_water) + parseFloat(eight_water) + parseFloat(nine_water) + parseFloat(ten_water) + parseFloat(eleven_water) + parseFloat(twelve_water) + parseFloat(thirteen_water) + parseFloat(fourteen_water) + parseFloat(fifteen_water) + parseFloat(sixteen_water) + parseFloat(seventeen_water) + parseFloat(eighteen_water) + parseFloat(nineteen_water) + parseFloat(twenty_water));
	

	total_water 		= Comma(parseFloat(total_water).toFixed(2));
	$('#total_water').val(total_water);

	var first_others	= $('#first_others').val().replace(/,/g, "");
	var second_others	= $('#second_others').val().replace(/,/g, "");
	var third_others	= $('#third_others').val().replace(/,/g, "");
	var fourth_others	= $('#fourth_others').val().replace(/,/g, "");
	var fifth_others	= $('#fifth_others').val().replace(/,/g, "");
	var sixth_others	= $('#sixth_others').val().replace(/,/g, "");
	var seventh_others	= $('#seventh_others').val().replace(/,/g, "");
	var eight_others	= $('#eight_others').val().replace(/,/g, "");
	var nine_others		= $('#nine_others').val().replace(/,/g, "");
	var ten_others		= $('#ten_others').val().replace(/,/g, "");

	var eleven_others	= $('#eleven_others').val().replace(/,/g, "");
	var twelve_others	= $('#twelve_others').val().replace(/,/g, "");
	var thirteen_others	= $('#thirteen_others').val().replace(/,/g, "");
	var fourteen_others	= $('#fourteen_others').val().replace(/,/g, "");
	var fifteen_others	= $('#fifteen_others').val().replace(/,/g, "");
	var sixteen_others	= $('#sixteen_others').val().replace(/,/g, "");
	var seventeen_others	= $('#seventeen_others').val().replace(/,/g, "");
	var eighteen_others	= $('#eighteen_others').val().replace(/,/g, "");
	var nineteen_others		= $('#nineteen_others').val().replace(/,/g, "");
	var twenty_others		= $('#twenty_others').val().replace(/,/g, "");

	 
	var total_others 	= (parseFloat(first_others) + parseFloat(second_others) + parseFloat(third_others) + parseFloat(fourth_others) + parseFloat(fifth_others) + parseFloat(sixth_others) + parseFloat(seventh_others) + parseFloat(eight_others) + parseFloat(nine_others) + parseFloat(ten_others) + parseFloat(eleven_others) + parseFloat(twelve_others) + parseFloat(thirteen_others) + parseFloat(fourteen_others) + parseFloat(fifteen_others) + parseFloat(sixteen_others) + parseFloat(seventeen_others) + parseFloat(eighteen_others) + parseFloat(nineteen_others) + parseFloat(twenty_others));
	

	total_others 		= Comma(parseFloat(total_others).toFixed(2));
	$('#total_others').val(total_others);


	var first_net	= $('#first_net').val().replace(/,/g, "");
	var second_net	= $('#second_net').val().replace(/,/g, "");
	var third_net	= $('#third_net').val().replace(/,/g, "");
	var fourth_net	= $('#fourth_net').val().replace(/,/g, "");
	var fifth_net	= $('#fifth_net').val().replace(/,/g, "");
	var sixth_net	= $('#sixth_net').val().replace(/,/g, "");
	var seventh_net	= $('#seventh_net').val().replace(/,/g, "");
	var eight_net	= $('#eight_net').val().replace(/,/g, "");
	var nine_net		= $('#nine_net').val().replace(/,/g, "");
	var ten_net		= $('#ten_net').val().replace(/,/g, "");
	var eleven_net	= $('#eleven_net').val().replace(/,/g, "");
	var twelve_net	= $('#twelve_net').val().replace(/,/g, "");
	var thirteen_net	= $('#thirteen_net').val().replace(/,/g, "");
	var fourteen_net	= $('#fourteen_net').val().replace(/,/g, "");
	var fifteen_net	= $('#fifteen_net').val().replace(/,/g, "");
	var sixteen_net	= $('#sixteen_net').val().replace(/,/g, "");
	var seventeen_net	= $('#seventeen_net').val().replace(/,/g, "");
	var eighteen_net	= $('#eighteen_net').val().replace(/,/g, "");
	var nineteen_net		= $('#nineteen_net').val().replace(/,/g, "");
	var twenty_net		= $('#twenty_net').val().replace(/,/g, "");
	 
	var total_net 	= (parseFloat(first_net) + parseFloat(second_net) + parseFloat(third_net) + parseFloat(fourth_net) + parseFloat(fifth_net) + parseFloat(sixth_net) + parseFloat(seventh_net) + parseFloat(eight_net) + parseFloat(nine_net) + parseFloat(ten_net) + parseFloat(eleven_net) + parseFloat(twelve_net) + parseFloat(thirteen_net) + parseFloat(fourteen_net) + parseFloat(fifteen_net) + parseFloat(sixteen_net) + parseFloat(seventeen_net) + parseFloat(eighteen_net) + parseFloat(nineteen_net) + parseFloat(twenty_net));
	


	total_net 		= Comma(parseFloat(total_net).toFixed(2));
	$('#total_net').val(total_net);

	releaseStatus();

}	