<%@page contentType="text/html; charset=UTF-8"%>
<%@page import="com.csc.library.entry.HelpEntry,com.csc.library.system.*,com.csc.library.utilities.*,com.csc.library.session.*,com.csc.library.components.*,com.csc.library.report.*,java.util.*;"%>
<jsp:useBean id="PRU031" class="com.csc.library.system.Task" scope="page" />
<jsp:useBean id="PayrollReconcile" class="com.csc.library.databean.Tpayrollreconcile_save" scope="page" />
<%
	PRU031.setChannel(request, response);
	HelpEntry screen = (HelpEntry) PRU031.process("HelpEntry","PAYROLLRECONCILE");
        
	CheckNull chk=new CheckNull();
	ThaiUtilities thail = new ThaiUtilities();

	CscCalendar cc = new CscCalendar();
	String getPresentDay = cc.getDDMMYYYY();
	String presentMonth = getPresentDay.split("-")[1];
	String presentYear = getPresentDay.split("-")[2];

	String condition=thail.ASCII2Unicode(chk.chkNullString(request.getParameter("__fixCon")));
    String cmd = chk.chkNullString(request.getParameter("__cmd"),"");
		
	String getEndDateSP = chk.chkNullString(request.getParameter("__getEndDateSP"),"");
	String getEndDateRP = chk.chkNullString(request.getParameter("__getEndDateRP"),"");

	//-------------------Set Parameter----------------------
	HashMap<String,String> SourcePeriod = new HashMap<String,String>();
	HashMap<String,String> ReconcilePeriod = new HashMap<String,String>();
	HashMap<String,String> Difference = new HashMap<String,String>();
	HashMap<String,String> NewPayment = new HashMap<String,String>();
	HashMap<String,String> StopPayment = new HashMap<String,String>();
		
	//Get Parameter for Save 
	String sp_period = chk.chkNullString(request.getParameter("__sp_period"),"");
	String sp_month = chk.chkNullString(request.getParameter("__sp_month"),"");
    String sp_year = chk.chkNullString(request.getParameter("__sp_year"),"");
    String rp_period = chk.chkNullString(request.getParameter("__rp_period"),"");
    String rp_month = chk.chkNullString(request.getParameter("__rp_month"),"");
    String rp_year = chk.chkNullString(request.getParameter("__rp_year"),"");
    String salatype = chk.chkNullString(request.getParameter("__salatype"),"");
    String reconcileTdesc = chk.chkNullString(request.getParameter("__tdesc"),"");
    String reconcileEdesc = chk.chkNullString(request.getParameter("__edesc"),"");
    String reconcileID = chk.chkNullString(request.getParameter("__reconcileid"),"");
	String sp_head_total = chk.chkNullString(request.getParameter("__sp_head_total"),"");	//Source Period
	String sp_netpay_total = chk.chkNullString(request.getParameter("__sp_netpay_total"),"");	//Source Period
	String np_head_total = chk.chkNullString(request.getParameter("__np_head_total"),"");	//New Payment
	String np_netpay_total = chk.chkNullString(request.getParameter("__np_netpay_total"),"");	//New Payment
	String diff_head_total = chk.chkNullString(request.getParameter("__diff_head_total"),"");	//Difference
	String diff_netpay_total = chk.chkNullString(request.getParameter("__diff_netpay_total"),"");	//Difference
	String stop_head_total = chk.chkNullString(request.getParameter("__stop_head_total"),"");	//Stop Payment
	String stop_netpay_total = chk.chkNullString(request.getParameter("__stop_netpay_total"),"");//Stop Payment
	String rp_head_total = chk.chkNullString(request.getParameter("__rp_head_total"),"");	//Reconcile Period
	String rp_netpay_total = chk.chkNullString(request.getParameter("__rp_netpay_total"),"");//Reconcile Period

	//Get Parameter for Showing
	String saladesc_sp = chk.chkNullString(request.getParameter("__saladesc_sp"),"");
	String saladesc_rp = chk.chkNullString(request.getParameter("__saladesc_rp"),"");
	
	

	String helloBean = "";
	HashMap<String,String> getFormulaType = new HashMap<String,String>();
	ArrayList<String> getEmpID = new ArrayList<String>();

	/*
	if("".equals(getEndDateSP)){
		//Do nothing
	}else{
		getEndDateSP2 = getEndDateSP.split("-");
	}

	if("".equals(getEndDateRP)){
		//Do nothing
	}else{
		getEndDateRP2 = getEndDateRP.split("-");
	}
	/*
	String getYearMonthSP = sp_year+"-"+sp_month+"-"+getEndDateSP2[0];
	String getYearMonthRP = rp_year+"-"+rp_month+"-"+getEndDateRP2[0];
	
	if(cmd.equalsIgnoreCase("process")) {
        System.out.println("*********************** Process ***********************");
		//-------------------Set Value--------------------------
		PayrollReconcile.setUProfile(screen.getUProfile());
		//PayrollReconcile.setFormulaType();
		PayrollReconcile.setAllEmployeeSourcePeriod(getYearMonthSP,salatype);
		PayrollReconcile.setAllEmployeeReconcilePeriod(getYearMonthRP,salatype);
		
		
		//-------------------Process----------------------------
		SourcePeriod = PayrollReconcile.CalPeriod(getYearMonthSP,salatype,0);
		ReconcilePeriod = PayrollReconcile.CalPeriod(getYearMonthRP,salatype,1);
		
		NewPayment = PayrollReconcile.getNewPayment(getYearMonthSP,getYearMonthRP,salatype);
		StopPayment = PayrollReconcile.getStopPayment(getYearMonthSP,getYearMonthRP,salatype);

		Difference = PayrollReconcile.getDifference2(getYearMonthSP,getYearMonthRP,salatype);
		//-------------------Result-------------------------------
		//for using in this page
	
		sp_head_total = SourcePeriod.get("Head");
		sp_netpay_total = SourcePeriod.get("NetPay");
		np_head_total = NewPayment.get("Head");
		np_netpay_total = NewPayment.get("NetPay");
		diff_head_total = Difference.get("Head");
		diff_netpay_total = Difference.get("NetPay");
		stop_head_total = StopPayment.get("Head");
		stop_netpay_total = StopPayment.get("NetPay");
		rp_head_total = ReconcilePeriod.get("Head");
		rp_netpay_total = ReconcilePeriod.get("NetPay");
	}*/

      
    //--------------------- Set MultiSave Bean ---------------------------------
    String tableName = "Tpayrollreconciliation0";
    String[] tableField = new String[]{reconcileID,reconcileTdesc,reconcileEdesc,salatype,sp_period,sp_month,sp_year,rp_period,rp_month,rp_year,sp_head_total,sp_netpay_total,np_head_total,np_netpay_total,diff_head_total,diff_netpay_total,stop_head_total,stop_netpay_total,rp_head_total,rp_netpay_total,getEndDateSP,getEndDateRP};
       
    if (cmd.equalsIgnoreCase("save")) {
            System.out.println("*********************** save condition ***********************");
            PayrollReconcile.setUProfile(screen.getUProfile());
			//PayrollReconcile.setFormulaType();
			PayrollReconcile.setTableName(tableName);
			PayrollReconcile.setField(tableField);
			//PayrollReconcile.setAllEmployeeSourcePeriod(getEndDateSP,salatype);
			//PayrollReconcile.setAllEmployeeReconcilePeriod(getEndDateRP,salatype);
			PayrollReconcile.getTotalEmptoSave(getEndDateSP,getEndDateRP,salatype);
			PayrollReconcile.process();
            cmd = "savecomplete";
    }

    if (cmd.equalsIgnoreCase("delete")) {
            System.out.println("*********************** delete condition ***********************");
			PayrollReconcile.setUProfile(screen.getUProfile());
			//setFormulaType();
			PayrollReconcile.setTableName(tableName);
			PayrollReconcile.setField(tableField);
            PayrollReconcile.deleteRecord2();
            cmd = "deletecomplete";
    }
		
%>
<html ng-app="myHR">
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" >
<link href="../CSS/Bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css">
<link href="../CSS/TISCO.css" rel="stylesheet" type="text/css">
<script  language="JavaScript" src="../JS/SCREEN.js"></script>
<script type='text/javascript' src="../JS/ICONSMENU.js"></script>
<script language='javascript' src="../JS/HOTKEY.js"></script>
<script language='javascript'>setLang('<%=screen.getUProfile().get("lang")%>');</script>
<script type='text/javascript' src='../JS/jquery-1.11.1.min.js'></script>
<script src="../JS/jquery-1.11.2.js" type="text/javascript"></script>
<script src="../JS/jquery-ui-1.11.4.js" type="text/javascript"></script>
<script type='text/javascript' src='../JS/bootstrap.js'></script>

<script type='text/javascript' src='/hr/dwr/interface/CalculateReconcile.js'></script>
<script type='text/javascript' src='/hr/dwr/engine.js'></script>
<script type='text/javascript' src='/hr/dwr/util.js'></script>

<script src="../JS/angular-1.3.15/angular.js"></script>
<script type='text/JavaScript' SRC='../JS/ANGULAR/SWAPLANG.js'></script>
<SCRIPT TYPE='text/JavaScript' SRC='../TA/JS/TA_SCREEN.js'></SCRIPT>
<link href="../CSS/jquery-ui-csc.css" rel="stylesheet" type="text/css"/>
<style>
#myModal .modal-dialog  {
	width:1200px;
	height:500px;
	}
</style>
<script language="JavaScript" type="text/JavaScript">
var sw = new swaplang2();
var strCMD = "<%=cmd%>";
var lang = "<%=screen.getUProfile().get("lang")%>";
switch (strCMD) {
    case "savecomplete":
        if(lang === 'tha'){
            alert('บันทึกเรียบร้อย');
        } else {
            alert('Save Data Successful');
        }
        break;
    case "deletecomplete":
        if(lang === 'tha'){
            alert('ลบเรียบร้อย');
        } else {
            alert('Delete Data Successful');
        }
		
		 
		
        break;
}

//------------------- Global Variable -----------------------//

function GoSearch(){
    with(document.cscform){
        /*
		var filterheal="";
        
		var modulecodition = setAndGetCheckedValueModule();
        filterheal=checkCondition(filterheal,__siteid,"siteid");
        filterheal=checkCondition(filterheal,__searchthai,"thai");
        filterheal=checkCondition(filterheal,__searcheng,"eng");
        filterheal=checkCondition(filterheal,__searchcodeid,"codeid");
        if(modulecodition != ""){
            filterheal=checkFilter(filterheal);
            filterheal+="module in("+modulecodition.substring(0,modulecodition.length-1)+")";
        }
        __fixCon.value=filterheal;
        console.log(__fixCon.value);
        search();
		*/

    }
}

function checkFilter(fil){
    if(fil.length>0)
        fil+=" and ";
    return fil;
}


function checkCondition(filcon,objname,targetname){
    with(document.cscform){
        /*
		if(objname.value.length>0 && targetname === "siteid"){
            filcon=checkFilter(filcon);
            filcon+= targetname+"='"+objname.value+"'";
        } else if (objname.value.length>0){
            filcon=checkFilter(filcon);
            var find = '"';
            var repOriginalValue = new RegExp(find, 'g');
            var value = objname.value;
            value = value.replace(repOriginalValue,'\\\"');
            filcon+= targetname+" LIKE '%"+value+"%'";
        }
        return filcon;
		*/
    }
}

function GoDelete(){
	 with(document.cscform){
		var getReconcileID = __reconcileid.value;
		if(getReconcileID != ""){
			__cmd.value = "delete";
			submit();
		}else{
			 if(lang === 'tha'){
				 alert('กรุณาเลือกรหัสเปรียบเทียบก่อน');
			 } else {
				alert("Please select reconcileID first.");
			 }
		}
	 }
}
function GoUpdate(){}

/*----------------------------------------------
--------- goHelp() Condition Pattarn -----------
helpReturn=inputName+":mproductid,MPRODUCT@TDESC,MPRODUCT@EDESC,MPRODUCT@PRICE"; //pattern 1 for showing data only
helpReturn="__mproductid:mproductid,__tdesc:tdesc,__productprice:price"; //pattern 2 for showing and saveing data

----------------------------------------------*/
function goHelp(helpName,inputName){
    with(document.cscform){
	var helpReturn;
	var fixcon=__fixCon.value;
	__fixCon.value="";
	if(inputName=="__sp_period" ){
		if(__salatype.value === ""){
			 if(lang === 'tha'){
				 alert('กรุณาเลือกประเภทงวดเงินเดือน');
			 } else {
				alert("Please select salary type first.");
			 }
		}else{
		var getSalaType = __salatype.value;
		__sp_period.value = "";
		__fixCon.value="CODEID='"+getSalaType+"'";
	    helpReturn="__sp_period:line_no,__getEndDateSP:pay_date";
		//linkHelp_Return(helpName,helpReturn);
		linkHelp_Return_CallFunction(helpName,helpReturn,"splitDateSP");
        __fixCon.value=fixcon;
		}
    }else if (inputName=="__rp_period") {
		if(__salatype.value === ""){
			 if(lang === 'tha'){
				 alert('กรุณาเลือกประเภทงวดเงินเดือน');
			 } else {
				alert("Please select salary type first.");
			 }
		}else{
		var getSalaType = __salatype.value;
		__rp_period.value = "";
		__fixCon.value="CODEID ='"+getSalaType+"'";
	    helpReturn="__rp_period:line_no,__getEndDateRP:pay_date";	
		//linkHelp_Return(helpName,helpReturn);
		linkHelp_Return_CallFunction(helpName,helpReturn,"splitDateRP");
        __fixCon.value=fixcon;
		}
    }else if (inputName=="__salatype") {
		if(lang === 'tha'){
			__fixCon.value = "";
			__salatype.value ="";
			helpReturn="__salatype:codeid,__saladesc_sp:tdesc,__saladesc_rp:tdesc";			
			linkHelp_Return_CallFunction(helpName,helpReturn,"clearValue");
			__fixCon.value=fixcon;
		} else {
			__fixCon.value = "";
			__salatype.value ="";
			helpReturn="__salatype:codeid,__saladesc_sp:edesc,__saladesc_rp:edesc";			
			linkHelp_Return_CallFunction(helpName,helpReturn,"clearValue");
			__fixCon.value=fixcon;
		}
		
    }else if (inputName=="__reconcileid") {
		__fixCon.value="";
		__reconcileid.value ="";
	    helpReturn="__reconcileid:reconcileid,__tdesc:tdesc,__edesc:edesc,__salatype:salatype,__sp_period:sp_period,__sp_month:sp_month,__sp_year:sp_year,__rp_period:rp_period,__rp_month:rp_month,__rp_year:rp_year,__sp_head_total:sp_head_total,__sp_netpay_total:sp_netpay_total,__rp_head_total:rp_head_total,__rp_netpay_total:rp_netpay_total,__np_head_total:np_head_total,__np_netpay_total:np_netpay_total,__stop_head_total:stop_head_total,__stop_netpay_total:stop_netpay_total,__diff_head_total:diff_head_total,__diff_netpay_total:diff_netpay_total";	
		linkHelp_Return(helpName,helpReturn);
        __fixCon.value=fixcon;
    }
	}
}

function GoClean(){
	with(document.cscform){
		__saladesc_sp.value = "";
		__saladesc_rp.value = "";
        __reconcileid.value="";
        __tdesc.value="";
        __edesc.value="";
        __salatype.value="";
        __cmd.value="";
		clearValue();  
    }
}


function goPage(page){
	with(document.cscform){
		__goPage.value=page;
		submit();
	}
}

function GoSave() {
    with(document.cscform){
	if(__sp_head_total.value == '0' || __sp_netpay_total.value == '0.00' || __rp_head_total.value == '0' || __rp_netpay_total.value == '0.00'){
		if(lang === 'tha'){
			alert('กรุณากด ปุ่ม Process ก่อน Save');
		} else {
			alert("Please click 'Process' first.");
		}
	}else{
		__cmd.value = "save";
        submit();
	}    
    }
}

function splitDateSP(){
	with(document.cscform){
		var getDateSP = __getEndDateSP.value;
		var splitSP = getDateSP.split("-");
		var SPYearValue = splitSP[2]+"-"+splitSP[1]+"-"+splitSP[0];
		var presentMonth = "<%=presentMonth%>";
		var presentYear = "<%=presentYear%>";
		var parsePresentMonth = parseInt(presentMonth);
		var parsePresentYear = parseInt(presentYear);
		var parseSPMonth = parseInt(splitSP[1]);
		var parseSPYear = parseInt(splitSP[2]);
		if(__rp_period.value != "" && __rp_month.value != "" && __rp_year.value != ""){
			//Do something
			var parseRPMonth = parseInt(__rp_month.value);
			var parseRPYear = parseInt(__rp_year.value);
			if(parseRPMonth >= parseSPMonth && parseRPYear>=parseSPYear){
				if(lang === 'tha'){
					alert('ไม่สามารถเลือก period ที่มีเดือนน้อยกว่าหรือเท่ากับ Reconcile Period ได้');
				} else {
					alert("Can't select period that less than or equal Reconcile Period's month.");
				}
				__sp_period.value = "";
				__sp_month.value = "";
				__sp_year.value = "";
			}else if(parseSPMonth <= parsePresentMonth && parseSPYear <= parsePresentYear){
				__sp_month.value = splitSP[1];
				__sp_year.value = splitSP[2];
			}else{
				if(lang === 'tha'){
					alert('ไม่สามารถเลือก period ที่มีเดือนมากกว่าเดือนปัจจุบันได้');
				} else {
					alert("Can't select period that more than present day.");
				}
				__sp_period.value = "";
				__sp_month.value = "";
				__sp_year.value = "";
			}
		}else{
			if(__sp_period.value === '01'){ //Can't select First Period for Reconcile
				if(lang === 'tha'){
					alert('ไม่สามารถเลือก period ที่ 1 ได้');
				} else {
					alert("Can't select first period.");
				}
				__sp_period.value = "";
				__sp_month.value = "";
				__sp_year.value = "";
			}else if(parseSPMonth <= parsePresentMonth && parseSPYear <= parsePresentYear){
				__sp_month.value = splitSP[1];
				__sp_year.value = splitSP[2];
			}else{
				if(lang === 'tha'){
					alert('ไม่สามารถเลือก period ที่มีเดือนมากกว่าเดือนปัจจุบันได้');
				} else {
					alert("Can't select period that more than present day.");
				}
				__sp_period.value = "";
				__sp_month.value = "";
				__sp_year.value = "";
			}
		}
		__getEndDateSP.value = SPYearValue;
    }
}

function splitDateRP(){
	with(document.cscform){
		var getDateRP = __getEndDateRP.value;
		var splitRP = getDateRP.split("-");
		var RPYearValue = splitRP[2]+"-"+splitRP[1]+"-"+splitRP[0];
		var presentMonth = "<%=presentMonth%>";
		var presentYear = "<%=presentYear%>";
		var parsePresentMonth = parseInt(presentMonth);
		var parsePresentYear = parseInt(presentYear);
		var parseRPMonth = parseInt(splitRP[1]);
		var parseRPYear = parseInt(splitRP[2]);
		if(__sp_period.value != "" && __sp_month.value != "" && __sp_year.value != ""){
			//Do something
			var parseSPMonth = parseInt(__sp_month.value);
			var parseSPYear = parseInt(__sp_year.value);
			if(parseRPMonth >= parseSPMonth && parseSPYear <= parseRPYear){
				if(lang === 'tha'){
					alert('ไม่สามารถเลือก period ที่มีเดือนน้อยกว่าหรือเท่ากับ Source Period ได้');
				} else {
					alert("Can't select period that more than or equal Source Period's month.");
				}
				__rp_period.value = "";
				__rp_month.value = "";
				__rp_year.value = "";
			}else{
				__rp_month.value = splitRP[1];
				__rp_year.value = splitRP[2];
			}
		}else{
			if(parseRPMonth >= parsePresentMonth && parseRPYear >= parsePresentYear){
				if(lang === 'tha'){
					alert('ไม่สามารถเลือก period ที่มีเดือนมากกว่าหรือเท่ากับเดือนปัจจุบันได้');
				} else {
					alert("Can't select period that more than or equal present day.");
				}
				__rp_period.value = "";
				__rp_month.value = "";
				__rp_year.value = "";
				
			}else{
				__rp_month.value = splitRP[1];
				__rp_year.value = splitRP[2];
			}
		}
		__getEndDateRP.value = RPYearValue;
    }
}

function clearValue(){
	with(document.cscform){
		__sp_period.value = "";
		__sp_month.value = "";
		__sp_year.value = "";
		__rp_period.value = "";
		__rp_month.value = "";
		__rp_year.value = "";
		__sp_head_total.value = '0';
		__sp_netpay_total.value = '0.00';
		__rp_head_total.value = '0';
		__rp_netpay_total.value = '0.00';
		__np_head_total.value = '0';
		__np_netpay_total.value = '0.00';
		__stop_head_total.value = '0';
		__stop_netpay_total.value = '0.00';
		__diff_head_total.value = '0';
		__diff_netpay_total.value = '0.00';
    }
}

function processCalculate(){	
	with(document.cscform){
		if(__sp_period.value == '' || __rp_period.value == ''){
			if(lang === 'tha'){
				alert('กรุณาเลือก period ก่อน');
			} else {
				alert("Please Choose 'period' first.");
			}
			}else{
				var getSPDate = __getEndDateSP.value;
				var getRPDate = __getEndDateRP.value;

				if(getSPDate == ''){
					getSPDate = __sp_year.value +"-"+__sp_month.value;
				}
				if(getRPDate == ''){
					getRPDate = __rp_year.value +"-"+__rp_month.value;
				}
				
				var getSalatype = __salatype.value;
				waitingDialog.show('Processing');
				CalculateReconcile.calculation(getSPDate,getRPDate,getSalatype,AfterCalculate);
			}    
		}
}

function AfterCalculate(data){
with(document.cscform){
	waitingDialog.hide();
    var result = data;
	//Do something --> Yeah
	//alert("Hello DWR")
	//alert(result);
	__sp_head_total.value = result.split("-")[0];
	__sp_netpay_total.value = result.split("-")[1];
	__rp_head_total.value = result.split("-")[8];
	__rp_netpay_total.value = result.split("-")[9];
	__np_head_total.value = result.split("-")[2];
	__np_netpay_total.value = result.split("-")[3];
	__stop_head_total.value = result.split("-")[6];
	__stop_netpay_total.value = result.split("-")[7];
	__diff_head_total.value = result.split("-")[4];
	__diff_netpay_total.value = result.split("-")[5];

	__cmd.value = "process";
	submit();
}
}


function ClearViaDel(){
	with(document.cscform){
	var getSomething = "<%=cmd%>";
	if(getSomething == 'deletecomplete'){
		GoClean();
	}
	}
}

</script>
</head>
<body onload="ClearViaDel()">
<div id="toolTipLayer" style="position:absolute; visibility: hidden"></div>
<script language="javascript">initToolTips();</script>
<form name="cscform" method="post" action="PRU031.jsp">


<!----------BEGIN CSC INITIAL ZONE ------------------------>

<%=screen.InitialVariable()%>

<!----------END CSC INITIAL ZONE -------------------------->
	<input type="hidden" name="__cmd" value="">
	<input type="hidden" name="__help" value="">
	<input  type="hidden" name="__notNull" value="<%//=screen.getRequire()%>">
	<input type="hidden" name="__helpReturn" value="">
	<input type="hidden" name="__helpName" value="">
	<input type="hidden" name="__pageCall" value="">
	<input type="hidden" name="__referPage" value="">
	<input  type="hidden" name="__language" value="<%=screen.getUProfile().get("lang")%>">
	<input type="hidden" name="__lockPage" value="">
    <input type="hidden" name="__goPage" value="">
    <input type="hidden" name="__calendar">
    <input type="hidden" name="__screen" value="PAYROLL RECONCILIATION">
    <script language="javascript">getInputFormatDate();</script>
	<input type="hidden" name="__employeeid" value="">
	<input type="hidden" name="__docno" value="">
	<input type="hidden" name="__formulaid" value="">
	<input name="__fixCon" type="hidden" value="<%=condition%>">
	<input type="hidden" name="__orderBy" value="<%=request.getParameter("__orderBy")%>">
  	<input type="hidden" name="__companyid"  value="<%=screen.getUProfile().get("companyid")%>">
	<input name="__getcheckvalue" type="hidden" value="<%=request.getParameter("__getcheckvalue")%>">
	<input name="__getEndDateSP" type="hidden" value="<%=getEndDateSP%>">
	<input name="__getEndDateRP" type="hidden" value="<%=getEndDateRP%>">
	<script language="JavaScript" src="../JS/HOTKEY.js"></script>
    <script language="javascript">
            var titlename=swap2String('Payroll Reconciliation');
            document.write(Icons("PAYROLL RECONCILIATION,"+titlename));
    </script>
	<br>
	<div align="center">
            <table cellpadding="0" cellspacing="0" class="largest">
                <tr>
                    <td colspan="2" class="header" >Payroll Reconciliation, <script language="javascript">swapLang(titlename);</script>&nbsp;</td>
                </tr>
                <tr>
                    <td>
                        <table class="maxsize" border="0" align="center" cellpadding="0" cellspacing="1">
                            <tr>
                                <td colspan="12" class="blankspace">
                                   <table width="800" border="0" align="center" cellpadding="0" cellspacing="1" class="inframe">
                                        <tr>
                                            <td colspan="2" class="blankspace"></td>
                                        </tr>
                                        <tr> 
                                            <td class="columnlabel" width="45%"><%=screen.getLabel("reconcileid")%>&nbsp;</td>                      
                                            <td class="columnobject1" width="55%"><%=screen.getInput("reconcileid")%></td>
                                        </tr>
										<tr> 
                                            <td class="columnlabel" width="45%"><%=screen.getLabel("tdesc")%>&nbsp;</td>                      
                                            <td class="columnobject1"><%=screen.getInput("tdesc")%></td>
                                        </tr>
										<tr> 
                                            <td class="columnlabel" width="45%"><%=screen.getLabel("edesc")%>&nbsp;</td>                      
                                            <td class="columnobject1"><%=screen.getInput("edesc")%></td>
                                        </tr>
										<tr> 
                                            <td class="columnlabel" width="45%"><%=screen.getLabel("salatype")%>&nbsp;</td>                      
                                            <td class="columnobject1"><%=screen.getInput("salatype")%></td>
                                        </tr>
                                        <tr>
                                            <td colspan="2" class="blankspace"></td>
                                        </tr>
										<tr>
										<table width="800" border="0" align="center" cellpadding="0" cellspacing="1" class="columnobject1">
										<tr class="title1">
                                            <td width="30%" nowrap  align="center">
											</td>
                                            <td width="15%" nowrap  align="center"><h1><swaplang code='SW000907'></swaplang></h1></td>
                                            <td width="15%" nowrap  align="center"><h1><swaplang code='SW000800'></swaplang></h1></td>
                                            <td width="15%" nowrap  align="center"><h1><swaplang code='SW000717'></swaplang></h1></td>
                                            <td width="25%" nowrap  align="center"><h1><swaplang code='SW000012'></swaplang></h1></td>
										</tr>
										<tr>
											<td width="30%" nowrap  align="left">Source Period
											</td>
                                            <td width="15%" nowrap  align="center"><%=screen.getInput("sp_period")%></td>
                                            <td width="15%" nowrap  align="center"><%=screen.getInput("sp_month")%></td>
                                            <td width="15%" nowrap  align="center"><%=screen.getInput("sp_year")%></td>
                                            <td width="35%" nowrap  align="center"><input type="Text" name="__saladesc_sp" size="35" value="<%=saladesc_sp%>" readonly></td>
										</tr>
										<tr>
											<td width="30%" nowrap  align="left">Reconcile Period
											</td>
                                            <td width="15%" nowrap  align="center"><%=screen.getInput("rp_period")%></td>
											<td width="15%" nowrap  align="center"><%=screen.getInput("rp_month")%></td>
                                            <td width="15%" nowrap  align="center"><%=screen.getInput("rp_year")%></td>
                                            <td width="35%" nowrap  align="center"><input type="Text" name="__saladesc_rp" size="35" value="<%=saladesc_rp%>" readonly></td> 
										</tr>
										</table>
									</tr>
                                    </table>
                                    <br>
                                </td>
                            </tr>
                            <tr>
                                <td colspan="2" class="blankspace">	</td>
                            </tr>
							<tr>
							<td>
							<table width="300" border="0" align="center" cellpadding="0" cellspacing="1" class="columnobject1">
										<tr class="title1">
                                            <td width="30%" nowrap  align="center">
											</td>
                                            <td width="35%" nowrap  align="center"><h1>Head</h1></td>
                                            <td width="35%" nowrap  align="center"><h1>Amount</h1></td>
                                           
										</tr>
										<%if(!cmd.equalsIgnoreCase("process")){%>
										<tr>
											<td width="30%" nowrap  align="left">Source Period
											</td>
                                            <td width="35%" nowrap  align="center"><%=screen.getInput("SP_HEAD_TOTAL")%></td>
                                            <td width="35%" nowrap  align="center"><%=screen.getInput("SP_NETPAY_TOTAL")%></td>
										</tr>
										<tr>
											<td width="30%" nowrap  align="left">New Payment
											</td>
                                            <td width="35%" nowrap  align="center"><%=screen.getInput("NP_HEAD_TOTAL")%></td>
                                            <td width="35%" nowrap  align="center"><%=screen.getInput("NP_NETPAY_TOTAL")%></td>
										</tr>
										<tr>
											<td width="30%" nowrap  align="left">Difference
											</td>
                                            <td width="35%" nowrap  align="center"><%=screen.getInput("DIFF_HEAD_TOTAL")%></td>
                                            <td width="35%" nowrap  align="center"><%=screen.getInput("DIFF_NETPAY_TOTAL")%></td>
										</tr>
										<tr>
											<td width="30%" nowrap  align="left">Stop Payment
											</td>
                                            <td width="35%" nowrap  align="center"><%=screen.getInput("STOP_HEAD_TOTAL")%></td>
                                            <td width="35%" nowrap  align="center"><%=screen.getInput("STOP_NETPAY_TOTAL")%></td>
										</tr>
										<tr>
											<td width="30%" nowrap  align="left">Reconcile Period
											</td>
                                            <td width="35%" nowrap  align="center"><%=screen.getInput("RP_HEAD_TOTAL")%></td>
                                            <td width="35%" nowrap  align="center"><%=screen.getInput("RP_NETPAY_TOTAL")%></td>
										</tr>
										<%}else{%><!-- After Process -->
											<tr>
											<td width="30%" nowrap  align="left">Source Period
											</td>
                                            <td width="35%" nowrap  align="center"><input type="text" name="__sp_head_total" size="20" maxlength="20" value="<%=sp_head_total%>" readonly="" class="numeric" onkeypress="chkInteger(event);" onkeyup="sysIsEdit();" onblur="checkNumInt(this,0,900000000);" onfocus="callDelComma(this);" alt="Source Period Head Total" onmousemver="toolTip('Source Period Head Total')" onmouseout="toolTip()"></td>
                                            <td width="35%" nowrap  align="center"><input type="text" name="__sp_netpay_total" size="20" maxlength="20" value="<%=sp_netpay_total%>" readonly="" class="numeric" onkeypress="checkWordNumber(this.value,event);" onkeyup="sysIsEdit();checkComma(this,2);" onblur="checkNumFloat(this,0,900000000);" onfocus="callDelComma(this);" alt="Source Period Netpay Total" onmousemver="toolTip('Source Period Netpay Total')" onmouseout="toolTip()"></td>
										</tr>
										<tr>
											<td width="30%" nowrap  align="left">New Payment
											</td>
                                            <td width="35%" nowrap  align="center"><input type="text" name="__np_head_total" size="20" maxlength="20" value="<%=np_head_total%>" readonly="" class="numeric" onkeypress="chkInteger(event);" onkeyup="sysIsEdit();" onblur="checkNumInt(this,0,900000000);" onfocus="callDelComma(this);" alt="New Payment Head Total" onmousemver="toolTip('New Payment Head Total')" onmouseout="toolTip()"></td>
                                            <td width="35%" nowrap  align="center"><input type="text" name="__np_netpay_total" size="20" maxlength="20" value="<%=np_netpay_total%>" readonly="" class="numeric" onkeypress="checkWordNumber(this.value,event);" onkeyup="sysIsEdit();checkComma(this,2);" onblur="checkNumFloat(this,0,900000000);" onfocus="callDelComma(this);" alt="New Payment Netpay Total" onmousemver="toolTip('New Payment Netpay Total')" onmouseout="toolTip()"></td>
										</tr>
										<tr>
											<td width="30%" nowrap  align="left">Difference
											</td>
                                            <td width="35%" nowrap  align="center"><input type="text" name="__diff_head_total" size="20" maxlength="20" value="<%=diff_head_total%>" readonly="" class="numeric" onkeypress="chkInteger(event);" onkeyup="sysIsEdit();" onblur="checkNumInt(this,0,900000000);" onfocus="callDelComma(this);" alt="Difference Head Total" onmousemver="toolTip('Difference Head Total')" onmouseout="toolTip()"></td>
                                            <td width="35%" nowrap  align="center"><input type="text" name="__diff_netpay_total" size="20" maxlength="20" value="<%=diff_netpay_total%>" readonly="" class="numeric" onkeypress="checkWordNumber(this.value,event);" onkeyup="sysIsEdit();checkComma(this,2);" onblur="checkNumFloat(this,0,900000000);" onfocus="callDelComma(this);" alt="Difference Netpay Total" onmousemver="toolTip('Difference Netpay Total')" onmouseout="toolTip()"></td>
										</tr>
										<tr>
											<td width="30%" nowrap  align="left">Stop Payment
											</td>
                                            <td width="35%" nowrap  align="center"><input type="text" name="__stop_head_total" size="20" maxlength="20" value="<%=stop_head_total%>" readonly="" class="numeric" onkeypress="chkInteger(event);" onkeyup="sysIsEdit();" onblur="checkNumInt(this,0,900000000);" onfocus="callDelComma(this);" alt="Stop Payment Head Total" onmousemver="toolTip('Stop Payment Head Total')" onmouseout="toolTip()"></td>
                                            <td width="35%" nowrap  align="center"><input type="text" name="__stop_netpay_total" size="20" maxlength="20" value="<%=stop_netpay_total%>" readonly="" class="numeric" onkeypress="checkWordNumber(this.value,event);" onkeyup="sysIsEdit();checkComma(this,2);" onblur="checkNumFloat(this,0,900000000);" onfocus="callDelComma(this);" alt="Stop Payment Netpay Total" onmousemver="toolTip('Stop Payment Netpay Total')" onmouseout="toolTip()"></td>
										</tr>
										<tr>
											<td width="30%" nowrap  align="left">Reconcile Period
											</td>
                                            <td width="35%" nowrap  align="center"><input type="text" name="__rp_head_total" size="20" maxlength="20" value="<%=rp_head_total%>" readonly="" class="numeric" onkeypress="chkInteger(event);" onkeyup="sysIsEdit();" onblur="checkNumInt(this,0,900000000);" onfocus="callDelComma(this);" alt="Reconcile Period Head Total" onmousemver="toolTip('Reconcile Period Head Total')" onmouseout="toolTip()"></td>
                                            <td width="35%" nowrap  align="center"><input type="text" name="__rp_netpay_total" size="20" maxlength="20" value="<%=rp_netpay_total%>" readonly="" class="numeric" onkeypress="checkWordNumber(this.value,event);" onkeyup="sysIsEdit();checkComma(this,2);" onblur="checkNumFloat(this,0,900000000);" onfocus="callDelComma(this);" alt="Reconcile Period Netpay Total" onmousemver="toolTip('Reconcile Period Netpay Total')" onmouseout="toolTip()"></td>
										</tr>
										<%}%>
										</table>
										</td>
							</tr>
							<tr>
                                <td colspan="2" class="blankspace"></td>
                            </tr>
                            <tr>
                                <td colspan="2" align="center">
                                    <a href="javascript:processCalculate();"><img src="../IMAGES/BUTTON/CALCULATE.gif"  border="0"></a>&nbsp;&nbsp;
                                </td>
                            </tr>
                            <tr>
                                <td colspan="2" class="blankspace"></td>
                            </tr>
                            <tr>
                                <td colspan="2" class="bottom"></td>
                            </tr>
                        </table>
                    </td>
                </tr>
            </table>
        </div>
</form>
</body>
<script>
	var waitingDialog = waitingDialog || (function ($) {
		'use strict';

		// Creating modal dialog's DOM
		var $dialog = $(
			'<div class="modal fade" data-backdrop="static" data-keyboard="false" tabindex="-1" role="dialog" aria-hidden="true" style="padding-top:15%; overflow-y:visible;">' +
			'<div class="modal-dialog modal-m">' +
			'<div class="modal-content">' +
				'<div class="modal-header"><h3 style="margin:0;"></h3></div>' +
				'<div class="modal-body">' +
					'<div class="progress progress-striped active" style="margin-bottom:0;"><div class="progress-bar" style="width: 100%"></div></div>' +
				'</div>' +
			'</div></div></div>');

		return {
			show: function (message, options) {
				// Assigning defaults
				if (typeof options === 'undefined') {
					options = {};
				}
				if (typeof message === 'undefined') {
					message = 'Loading';
				}
				var settings = $.extend({
					dialogSize: 'm',
					progressType: '',
					onHide: null // This callback runs after the dialog was hidden
				}, options);

				// Configuring dialog
				$dialog.find('.modal-dialog').attr('class', 'modal-dialog').addClass('modal-' + settings.dialogSize);
				$dialog.find('.progress-bar').attr('class', 'progress-bar');
				if (settings.progressType) {
					$dialog.find('.progress-bar').addClass('progress-bar-' + settings.progressType);
				}
				$dialog.find('h3').text(message);
				// Adding callbacks
				if (typeof settings.onHide === 'function') {
					$dialog.off('hidden.bs.modal').on('hidden.bs.modal', function (e) {
						settings.onHide.call($dialog);
					});
				}
				$dialog.modal();
			},
			hide: function () {
				$dialog.modal('hide');
			}
		};

	})(jQuery);
</script>
</html>