<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%@page contentType="text/html; charset=UTF-8"%>
<%@ page import="com.csc.library.entry.*,com.csc.library.system.*,com.csc.library.utilities.*,com.csc.library.session.*,com.csc.library.components.*,com.csc.library.report.*,java.util.*,java.text.DecimalFormat,java.math.BigDecimal,com.csc.library.database.DataSet;"%>
<jsp:useBean id="PRU203_HISTORY" scope="page" class="com.csc.library.system.Task" />
<jsp:useBean id="EMPLOYEE" class="com.csc.library.system.Task" scope="page" />
<% 
    PRU203_HISTORY.setChannel(request ,response);
    HelpEntry emp_help = (HelpEntry) PRU203_HISTORY.process("HelpEntry", "MEMPLOYEEHELP");
	CheckNull chk = new CheckNull();
	CscCalendar cs = new CscCalendar();
	
	//initial value
	String emp1 = chk.chkNullString(request.getParameter("__emp1"));
	String emp2 = chk.chkNullString(request.getParameter("__emp2"));
	String bu1 = chk.chkNullString(request.getParameter("__bu1"));
	String bu2 = chk.chkNullString(request.getParameter("__bu2"));
	String bu3 = chk.chkNullString(request.getParameter("__bu3"));
	String bu4 = chk.chkNullString(request.getParameter("__bu4"));
	String bu5 = chk.chkNullString(request.getParameter("__bu5"));
	String salatype = chk.chkNullString(request.getParameter("__salatype"));
	String saladesc = chk.chkNullString(request.getParameter("__saladesc"));
	String group = chk.chkNullString(request.getParameter("__group"));
	String groupdesc = chk.chkNullString(request.getParameter("__groupdesc"));
	String cmd = chk.chkNullString(request.getParameter("__cmd"));
	String listGenRecord = chk.chkNullString(request.getParameter("__listGenRecord"));
	//String thisdate = cs.getYYYYMMDD();
	String language = emp_help.getUProfile().get("lang");
	String fixCon = chk.chkNullString(request.getParameter("__fixCon"),"");
	String fixCon2 = chk.chkNullString(request.getParameter("__fixCon2"),"");
	String groupby = chk.chkNullString(request.getParameter("__groupby"),"employeeid");
	//String status_search = chk.chkNullString(request.getParameter("__status_search"));

        if(!fixCon.equals("")){ fixCon = " where " + fixCon; }

        String filter = "employeeid in (select employeeid from his_salaryinc"+fixCon+")";

        if(!fixCon2.equals("")){ filter = chkStr(filter) + fixCon2; }

        emp_help.getInquiry().setFilter(filter);
        emp_help.getInquiry().setOrderBy(groupby);
        emp_help.getInquiry().refresh();

%>

<%!

private String chkStr(String str){
    if(!str.equals("")){
        str += " and ";
    }
    return str;
}

%>
<html ng-app="myHR">
<head>
<title>ReportOption</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link href="../CSS/TISCO.css" rel="stylesheet" type="text/css">
<link href="../CSS/bootstrap.css" rel="stylesheet"  type="text/css">
<link href="../CSS/bootstrap_csc_backend.css" rel="stylesheet"  type="text/css">
<script type="text/javascript" src="../JS/jquery-2.1.3.min.js"></script>
<script type='text/javascript' src="../JS/bootstrap.js"></script>
<link href="../CSS/Bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css">
<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 src="../JS/SCREEN.js"></script>
<script src="../JS/angular-1.3.15/angular.js" type="text/javascript"></script>
<script src="../JS/ANGULAR/SCREEN_ANGULAR.js" type="text/javascript"></script>
<SCRIPT TYPE='text/JavaScript' SRC='../TA/JS/TA_SCREEN.js'></SCRIPT>

<script language='javascript'>setLang('<%=emp_help.getUProfile().get("lang")%>');</script>

<script src="../JS/VIEWCALENDAR.js"></script>
<script src='../JS/ICONSMENU.js'></script>
<script src='../JS/HOTKEY.js'></script>
<script src="../JS/DATEINPUT.js"></script>
<script src="../JS/CscBase.js"></script>
<script src="../JS/CscCalendar.js"></script>

<script>getTitleName();</script>
<script type="text/JavaScript">

function goHelp(helpName,inputName){
	var helpReturn;
	var fixcon;
	//var thisdate = "<%//=thisdate%>";
	if(inputName.indexOf("__emp") > -1){
		helpReturn = inputName+":employeeid"
		//fixcon = "employeeid in(select employeeid from ttemp_salaryinc)";
		linkHelp_Return(helpName,helpReturn,fixcon);
	} else { 
            if(inputName=="__bu1" ){
                    helpReturn="__bu1:bu1id,__bu1_desc:tdesc|desc";	
            }else if(inputName=="__bu2" ){
                    helpReturn="__bu2:bu2id,__bu2_desc:tdesc|desc";
            }else if(inputName=="__bu3" ){
                    helpReturn="__bu3:bu3id,__bu3_desc:tdesc|desc";
            }else if(inputName=="__bu4" ){
                    helpReturn="__bu4:bu4id,__bu4_desc:tdesc|desc";
            }else if(inputName=="__bu5" ){
                    helpReturn="__bu5:bu5id,__bu5_desc:tdesc|desc";
            }else if(inputName=="__salatype" ){
                    helpReturn="__salatype:codeid,__saladesc:tdesc|desc";
            }else if(inputName=="__group" ){
                    helpReturn="__group:groupid,__groupdesc:tdesc|desc";
            }else if(inputName.indexOf("group$") > -1){
                    helpReturn= inputName+":groupid";
            }
            linkHelp_Return(helpName,helpReturn);
	}
}

function GoSearch(){
	with(document.cscform){	
		var filterheal="";
		var filterheal2="";
			filterheal2=checkCondition2(filterheal2,__emp1,__emp2,"employeeid")
            filterheal2=checkCondition(filterheal2,__bu1,"bu1");
            filterheal2=checkCondition(filterheal2,__bu2,"bu2");
            filterheal2=checkCondition(filterheal2,__bu3,"bu3");
            filterheal2=checkCondition(filterheal2,__bu4,"bu4");
			filterheal2=checkCondition(filterheal2,__bu5,"bu5");
			filterheal2=checkCondition(filterheal2,__salatype,"salatype");
			filterheal=checkCondition(filterheal,__group,"groupid");
			//filterheal=checkCondition(filterheal,__status_search,"status_search");
            __fixCon.value=filterheal;
            __fixCon2.value=filterheal2;
            console.log("filterheal == > "+filterheal);
            console.log("filterheal2 == > "+filterheal2);
		search();
		}
}

function checkCondition(filcon,objname,targetname){
    with(document.cscform){
		if(objname.value.length>0){
            filcon=checkFilter(filcon);
            filcon+= targetname+"='"+objname.value+"'";
		}
        return filcon;
    }
}

function checkCondition2(filcon,objname1,objname2,targetname){ // For EmployeeID (Between)
    with(document.cscform){
		var emp1 = objname1.value;
		var emp2 = objname2.value;
		if(emp1 === "" && emp2===""){
			return filcon;   
		}else if(emp1 === ""){
			emp1 = emp2;
		}else if(emp2 === ""){
			emp2 = emp1;
		}

		filcon = checkFilter(filcon);
		filcon += "(" + targetname + " between '"+emp1+"' and '"+emp2+"')";
        return filcon;
    }
}

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

</script>
<style>
    .forborder { 
        height: 21px !important; 
    }
    .padd {
        padding: 0px 8px 0px 8px;
    }
</style>
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<form name="cscform" method="post" action ="PRU203_HISTORY.jsp">
 

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

<%=emp_help.InitialVariable()%>

<input type="hidden" name="__cmd" value="<%=request.getParameter("__cmd")%>"> 
<input type="hidden" name="__screen" value="PRU203_HISTORY"> 
<input type="hidden" name="__help" value=""> 
<input type="hidden" name="__calendar" value="">
<script language="javascript">getInputFormatDate();</script>
<input type="hidden" name="__companyid" value="<%=emp_help.getUProfile().get("companyid")%>"> 
<input type="hidden" name="__referPage" value="">
<input type="hidden" name="__fixCon" value="">
<input type="hidden" name="__fixCon2" value="">
<input type="hidden" name="__language" value="<%=emp_help.getUProfile().get("lang")%>">


<!----------END CSC INITIAL ZONE -------------------------->

<div align="center">

    <table height="" align="center" cellpadding="0" cellspacing="0"  border="1" style="width: 1000px"  >
    <tr bgcolor="#3366CC">
        <td  height="20" class="header" colspan="2">PRU203_HISTORY,  <span swlang code="SW011938">Yearly Salary Increase History</span>&nbsp;</td>
    </tr>
    <tr>
        <td class="blankspace" colspan="2"></td>
    </tr>
    <tr>
        <td align="right"><b swlang code="SW000350">Employee ID</b>&nbsp;</td>
        <td>
            <input type="text" name="__emp1" size="15" value="<%=emp1%>">
            <a href="javascript:goHelp('MEMPLOYEEHELP','__emp1')" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image2','','../IMAGES/BUTTON/SWAP/SEARCH_SWAP20.gif',1)"><img src="../IMAGES/BUTTON/MAIN/SEARCH20.gif" alt="Help" name="Image2"  border="0" align="absmiddle"></a> &nbsp;&nbsp;-&nbsp;&nbsp;
            <input type="text" name="__emp2" size="15" value="<%=emp2%>">
            <a href="javascript:goHelp('MEMPLOYEEHELP','__emp2')" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image3','','../IMAGES/BUTTON/SWAP/SEARCH_SWAP20.gif',1)"><img src="../IMAGES/BUTTON/MAIN/SEARCH20.gif" alt="Help" name="Image3"  border="0" align="absmiddle"></a></span> 
        </td>
    </tr>
    <tr>
        <td align="right"><span swlang code="SW010728">Division</span>&nbsp;</td>
        <td>
            <input type="text" name="__bu1" size="15" value="<%=bu1%>">
            <a href="javascript:goHelp('MBU1HELP','__bu1')" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('imgBu1','','../IMAGES/BUTTON/SWAP/SEARCH_SWAP20.gif',1)"><img src="../IMAGES/BUTTON/MAIN/SEARCH20.gif" alt="Help" name="imgBu1"  border="0" align="absmiddle"></a>
            <input name="__bu1_desc" type="text" value="<%=chk.chkNullString(request.getParameter("__bu1_desc"))%>" size="35" readonly="">
        </td>
    </tr>
    <tr>
        <td align="right"><span swlang code="SW002031">Department</span>&nbsp;</td>
        <td>
            <input type="text" name="__bu2" size="15" value="<%=bu2%>">
            <a href="javascript:goHelp('MBU2HELP','__bu2')" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('imgBu2','','../IMAGES/BUTTON/SWAP/SEARCH_SWAP20.gif',1)"><img src="../IMAGES/BUTTON/MAIN/SEARCH20.gif" alt="Help" name="imgBu2"  border="0" align="absmiddle"></a> 
            <input name="__bu2_desc" type="text" value="<%=chk.chkNullString(request.getParameter("__bu2_desc"))%>" size="35" readonly="">
        </td>
    </tr>
    <tr>
        <td align="right"><span swlang code="SW000052">Section</span>&nbsp;</td>
        <td>
            <input type="text" name="__bu3" size="15" value="<%=bu3%>">
            <a href="javascript:goHelp('MBU3HELP','__bu3')" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('imgBu3','','../IMAGES/BUTTON/SWAP/SEARCH_SWAP20.gif',1)"><img src="../IMAGES/BUTTON/MAIN/SEARCH20.gif" alt="Help" name="imgBu3"  border="0" align="absmiddle"></a>
            <input name="__bu3_desc" type="text" value="<%=chk.chkNullString(request.getParameter("__bu3_desc"))%>" size="35" readonly="">
        </td>
    </tr>
    <tr>
        <td align="right"><span swlang code="SW011728">Sub Section #1</span>&nbsp;</td>
        <td>
            <input type="text" name="__bu4" size="15" value="<%=bu4%>">
            <a href="javascript:goHelp('MBU4HELP','__bu4')" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('imgBu4','','../IMAGES/BUTTON/SWAP/SEARCH_SWAP20.gif',1)"><img src="../IMAGES/BUTTON/MAIN/SEARCH20.gif" alt="Help" name="imgBu4"  border="0" align="absmiddle"></a>
            <input name="__bu4_desc" type="text" value="<%=chk.chkNullString(request.getParameter("__bu4_desc"))%>" size="35" readonly="">
        </td>
    </tr>
    <tr>
        <td align="right"><span swlang code="SW011729">Sub Section #2</span>&nbsp;</td>
        <td>
            <input type="text" name="__bu5" size="15" value="<%=bu5%>">
            <a href="javascript:goHelp('MBU5HELP','__bu5')" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('imgBu5','','../IMAGES/BUTTON/SWAP/SEARCH_SWAP20.gif',1)"><img src="../IMAGES/BUTTON/MAIN/SEARCH20.gif" alt="Help" name="imgBu5"  border="0" align="absmiddle"></a>
            <input name="__bu5_desc" type="text" value="<%=chk.chkNullString(request.getParameter("__bu5_desc"))%>" size="35" readonly="">
        </td>
    </tr>
    <tr> 
        <td align="right"><span swlang code="SW000865">Salary Type</span>&nbsp;</td>
        <td><!-- Salary Type -->
            <input type="Text" name="__salatype" size="5" maxlength="5" value="<%=salatype%>" onkeypress="chkSpecialStr(event);" onkeyup="sysIsEdit();" onblur="trimValue(this);" onfocus="this.select();" alt="Salary Type" onmousemver="toolTip('Salary Type')" onmouseout="toolTip()">&nbsp;
            <a href="javascript:goHelp('MSALATYPE0HELP','__salatype');" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('__salatype_image','','../IMAGES/BUTTON/SWAP/SEARCH_SWAP20.gif',1)"><img src="../IMAGES/BUTTON/MAIN/SEARCH20.gif" alt="SEARCH" name="__salatype_image" border="0" align="absmiddle"></a>
            <input type="Text" name="__saladesc" size="35" value="<%=saladesc%>" readonly>
        </td>
    </tr>
    <tr> 
        <td align="right"><!-- <swaplang code=''></swaplang> --><!-- <%=language.equals("eng")?"Group":"เกรดการปรับเงินเดือนประจำปี"%> -->
		<span swlang code="SW000471">Group</span>&nbsp;</td>  
        <td><!-- Salary Type -->
            <input type="Text" name="__group" size="5" maxlength="5" value="<%=group%>" onkeypress="chkSpecialStr(event);" onkeyup="sysIsEdit();" onblur="trimValue(this);" onfocus="this.select();" alt="Salary Type" onmousemver="toolTip('Salary Type')" onmouseout="toolTip()">&nbsp;
            <a href="javascript:goHelp('MYEARLY_GROUPHELP','__group');" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('__group_image','','../IMAGES/BUTTON/SWAP/SEARCH_SWAP20.gif',1)"><img src="../IMAGES/BUTTON/MAIN/SEARCH20.gif" alt="SEARCH" name="__group_image" border="0" align="absmiddle"></a>
            <input type="Text" name="__groupdesc" size="35" value="<%=groupdesc%>" readonly>
        </td>
    </tr>
    <tr>
        <td align="right"><span swlang code="SW000004">Order By</span>&nbsp;</td>
        <td>
            <select name="__groupby" id="__groupby">
                <!--option value=""></option-->
                <option value="employeeid" <%=(groupby.equals("employeeid"))?"selected":""%>><%=language.equals("tha")?"รหัสพนักงาน":"Employee ID"%></option>
                <option value="bu1" <%=(groupby.equals("bu1"))?"selected":""%>><%=language.equals("tha")?"หน่วยงานระดับที่ 1":"Business Unit 1"%></option>
                <option value="bu2"  <%=(groupby.equals("bu2"))?"selected":""%>><%=language.equals("tha")?"หน่วยงานระดับที่ 2":"Business Unit 2"%></option>
                <option value="bu3"  <%=(groupby.equals("bu3"))?"selected":""%>><%=language.equals("tha")?"หน่วยงานระดับที่ 3":"Business Unit 3"%></option>
                <option value="bu4"  <%=(groupby.equals("bu4"))?"selected":""%>><%=language.equals("tha")?"หน่วยงานระดับที่ 4":"Business Unit 4"%></option>
                <option value="bu5"  <%=(groupby.equals("bu5"))?"selected":""%>><%=language.equals("tha")?"หน่วยงานระดับที่ 5":"Business Unit 5"%></option>
                <option value="salatype"  <%=(groupby.equals("salatype"))?"selected":""%>><%=language.equals("tha")?"ประเภทการจ่ายเงิน":"Salary Type"%></option>
            </select>
        </td>
    </tr>
    <!-- tr>
        <td align="right"><span swlang code="SW000019">Status</span>&nbsp;</td>
        <td>
            <select name="__status_search">
                <option value="" <%//=(status_search.equals(""))?"selected":""%>><%//=language.equals("eng")?"All":"ทั้งหมด"%></option>
                <option value="1" <%//=(status_search.equals("1"))?"selected":""%>><%//=language.equals("eng")?"Transfer":"ยืนยัน"%></option>
                <option value="0"  <%//=(status_search.equals("0"))?"selected":""%>><%//=language.equals("eng")?"Not Transfer":"ยังไม่ยืนยัน"%></option>
            </select>
        </td>
    </tr -->
    <tr>
        <td class="blankspace" colspan="2"></td>
    </tr>

        <tr>
            <td  class="buttonline" colspan="7"><div align="center">
                <button type="button" class="btn btn-primary width100" swlang code="SW003537" onClick="GoSearch();">Search</button>
            </div>
            </td>
        </tr>
    <tr>
        <td class="blankspace" colspan="2"></td>
    </tr>
    <tr>
        <td colspan="2">
            <table align="center" cellpadding="0" cellspacing="0" style="width: 950px" class="tablewithborder">
                <tr align="center">
                    <td class="row3"><b swlang code="SW001393">No.</b></td>
                    <td class="row3"><b swlang code="SW000307">Employee</b></td>
                    <td class="row3"><b swlang code="SW000717">Year</b></td>
                    <td class="row3"><b swlang code="SW000800">Month</b></td>
                    <td class="row3"><b swlang code="SW005039">Effective Date</b></td>
                    <td class="row3"><b swlang code="SW000069">Grade</b></td>
                    <td class="row3"><b swlang code="SW000013">Score</b></td>
                    <td class="row3"><b swlang code="SW000471">Group</b></td>
                    <td class="row3"><b swlang code="SW011714">Amount Increase</b></td>
                    <td class="row3"><b swlang code="SW000707">Percent</b></td>
                    <td class="row3"><b swlang code="SW011715">Current Basepay</b></td>
                    <td class="row3"><b swlang code="SW011716">New Basepay</b></td>
                </tr>
                <%
                    while(emp_help.nextRec()){
                        DbInquiry inq = new InitialInquiry(emp_help.getUProfile()).getDbInquiry("Memployee");
                        inq.setColumn("*");
                        inq.setFilter("employeeid = '"+emp_help.getString("EMPLOYEEID")+"'");
                        inq.refresh();
                        inq.next();

                        DbInquiry inqhis = new InitialInquiry(emp_help.getUProfile()).getDbInquiry("his_salaryinc");
                        inqhis.setColumn("*");
                        inqhis.setFilter("employeeid = '"+emp_help.getString("EMPLOYEEID")+"'");
                        inqhis.refresh();
                        inqhis.next();
                %>
                <tr>
                    <td align="center" class="forborder"><%=inqhis.getString("EMPLOYEEID")%></td>
                    <td align="left" class="forborder padd"><%=inq.getString("Fullname")%></td>
                    <td align="center" class="forborder"><%=inqhis.getString("YEAR")%></td>
                    <td align="center" class="forborder"><%=inqhis.getString("MONTH")%></td>
                    <td align="center" class="forborder"><%=inqhis.getString("EFFECTIVE_DATE")%></td>
                    <td align="center" class="forborder"><%=inqhis.getString("GRADE")%></td>
                    <td align="center" class="forborder"><%=inqhis.getString("SCORE")%></td>
                    <td align="center" class="forborder"><%=inqhis.getString("GROUPID")%></td>
                    <td align="right" class="forborder padd"><%=inqhis.getString("AMOUNT_INCREASE")%></td>
                    <td align="center" class="forborder"><%=inqhis.getString("PERCENT")%></td>
                    <td align="right" class="forborder padd"><%=inqhis.getString("CURRENT_BASEPAY")%></td>
                    <td align="right" class="forborder padd"><%=inqhis.getString("NEW_BASEPAY")%></td>
                </tr>
                <%
                    }
                %>
            </table>
        </td>
    </tr>
    <tr>
        <td colspan="2" class="blankspace"></td>
    </tr>
    <tr bordercolor="0069B3"> 
        <td colspan="2" class="bottom"></td>
    </tr>
  </table>
  </div>
  
</form>
</body>
</html>
��