<%@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.report.*;"%>
<jsp:useBean id="WEL314" class="com.csc.library.system.Task" scope="page" />
<%
	WEL314.setChannel(request, response);
	HelpEntry screen = (HelpEntry) WEL314.process("HelpEntry","WEL314");
	CheckNull chk=new CheckNull();
	ThaiUtilities thail = new ThaiUtilities();
	String condition=thail.ASCII2Unicode(chk.chkNullString(request.getParameter("__fixCon")));  
	String conditionemp=thail.ASCII2Unicode(chk.chkNullString(request.getParameter("__fixConEmp")));  
	String emp1=thail.ASCII2Unicode(chk.chkNullString(request.getParameter("__employeeid1")));  
	String emp2=thail.ASCII2Unicode(chk.chkNullString(request.getParameter("__employeeid2")));  
	String bu11=thail.ASCII2Unicode(chk.chkNullString(request.getParameter("__bu11")));  
	String bu12=thail.ASCII2Unicode(chk.chkNullString(request.getParameter("__bu12")));  
	String bu21=thail.ASCII2Unicode(chk.chkNullString(request.getParameter("__bu21")));  
	String bu22=thail.ASCII2Unicode(chk.chkNullString(request.getParameter("__bu22")));  
	String bu31=thail.ASCII2Unicode(chk.chkNullString(request.getParameter("__bu31")));  
	String bu32=thail.ASCII2Unicode(chk.chkNullString(request.getParameter("__bu32")));  
	String position1=thail.ASCII2Unicode(chk.chkNullString(request.getParameter("__position1")));  
	String position2=thail.ASCII2Unicode(chk.chkNullString(request.getParameter("__position2")));  
	String years1=thail.ASCII2Unicode(chk.chkNullString(request.getParameter("__years1"),String.valueOf(new CscCalendar().getYear())));  
	String years2=thail.ASCII2Unicode(chk.chkNullString(request.getParameter("__years2"),String.valueOf(new CscCalendar().getYear())));  
	CscCalendar cs=new CscCalendar();
	DbRecord emp=(DbRecord)screen.getInquiry().getChild("memployee");
	emp.setFilter(conditionemp);
	screen.getInquiry().setRequireFoundTable("memployee");
	screen.process();
%>
<html>
<head>
<title></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>
<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 language="JavaScript" type="text/JavaScript">
<!--
function GoSearch()
{
			var filteremp="";
			var filterheal="";
			with(document.cscform)
			{	
						filterheal=checkCondition("",__employeeid1,__employeeid2,"employeeid");
						filterheal+=checkCondition(filterheal,__years1,__years2,"years");
						filteremp=checkCondition("",__bu11,__bu12,"bu1");
						filteremp+=checkCondition(filteremp,__bu21,__bu22,"bu2");
						filteremp+=checkCondition(filteremp,__bu31,__bu32,"bu3");
						filteremp+=checkCondition(filteremp,__position1,__position2,"emp_position");
						__fixConEmp.value=filteremp;
						__fixCon.value=filterheal;
						search();
			}
}

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

function checkCondition(filcon,objname1,objname2,targetname){
	with(document.cscform){
			if(objname1.value.length>0&&objname2.value.length>0){
			 			filcon+=checkFilter(filcon);
						filcon+= "("+targetname+" between '"+objname1.value+"' and '"+objname2.value+"')";
			}else if(objname1.value.length>0){
			 			filcon+=checkFilter(filcon);
						filcon+= targetname+"='"+objname1.value+"'";
			}
			return filcon;
	}
}

function GoSave() {}
function GoDelete(){ }
function GoUpdate(){}


function goHelp(helpName,inputName){
	var helpReturn;
	var fixcon=document.cscform.__fixCon.value;
	document.cscform.__fixCon.value="";
		 if(inputName=="__employeeid1" )
		 	helpReturn="__employeeid1:EMPLOYEEID,MEMPLOYEE@EMPLOYEEID";
		else 		if(inputName=="__employeeid2" )
		 	helpReturn="__employeeid2:EMPLOYEEID,MEMPLOYEE@EMPLOYEEID";
		else if(inputName=="__bu11" )
		 	helpReturn="__bu11:bu1id";
		else if(inputName=="__bu12" )
		 	helpReturn="__bu12:bu1id";
		else if(inputName=="__bu21" )
		 	helpReturn="__bu21:bu2id";
		else if(inputName=="__bu22" )
		 	helpReturn="__bu22:bu2id";
		else if(inputName=="__bu31" )
		 	helpReturn="__bu31:bu3id";
		else if(inputName=="__bu32" )
		 	helpReturn="__bu32:bu3id";
		else if(inputName=="__position1" )
		 	helpReturn="__position1:positionid";
		else if(inputName=="__position2" )
		 	helpReturn="__position2:positionid";				
	     linkHelp_Return(helpName,helpReturn);
		 document.cscform.__fixCon.value=fixcon;
}

function GoClean()
{
			with(document.cscform)
			{	
				__employeeid1.value="";
				__employeeid2.value="";
				__welid1.value="";
				__welid2.value="";
				__startdate.value=""; 
					__enddate.value="";
			}
}


function GoPage(years1,employeeid,group){
		with(document.cscform){
				__fixCon.value="years='"+years1+"'and employeeid='"+employeeid+"' and healthygid='"+group+"' ";
				__cmd.value="search";
				action="WEL315.jsp";
				submit();
		}
}
//-->
</script>

<style type="text/css">
<!--
.style1 {font-size: 12px}
-->
</style>
</head>
<body >
<div id="toolTipLayer" style="position:absolute; visibility: hidden"></div>
<script language="javascript">initToolTips();</script>
<form name="cscform" method="post" action="WEL314.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="__goPage" 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="__calendar">
   <input type="hidden" name="__screen" value="WEL314">
   <input type="hidden" name="__webid">
    <input type="hidden" name="__readposter">
  <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 name="__fixConEmp" type="hidden" value="<%=conditionemp%>">
	<input type="hidden" name="__orderBy" value="<%=request.getParameter("__orderBy")%>">
  	<input type="hidden" name="__companyid"  value="<%=screen.getUProfile().get("companyid")%>">
	<input name="__complainid" type="hidden" value="">

    <script language="JavaScript" src="../JS/HOTKEY.js"></script>
          <script language="javascript">
	 var titlename=swap2String('History of healthy');
	 //document.write(Icons("WEL314,"+titlename));
	 </script>

	<br> <div align="center">
 <table cellpadding="0" cellspacing="0" class="largest">
      <tr >
        <td colspan="2" class="header" >WEL314, <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="638" border="0" align="center" cellpadding="0" cellspacing="1" class="inframe">
                <tr>
                  <td colspan="2" class="blankspace"> </td>
                </tr>
                <tr>
                  <td width="207" class="columnlabel"><script language="javascript">swapLang('Employeeid');</script>&nbsp;</td>
                  <td width="1003">
                    <input name="__employeeid1" type="text" size="15" value="<%=emp1%>">
                    <a href="javascript:goHelp('MEMPLOYEEHELP','__employeeid1');" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image3','','../IMAGES/BUTTON/SWAP/SEARCH_SWAP20.gif',1)"><img src="../IMAGES/BUTTON/MAIN/SEARCH20.gif" alt="Search" name="Image3" width="20"  border="0" align="absmiddle"></a> -
                    <input name="__employeeid2" type="text" size="15" value="<%=emp2%>">
                    <a href="javascript:goHelp('MEMPLOYEEHELP','__employeeid2');" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image31','','../IMAGES/BUTTON/SWAP/SEARCH_SWAP20.gif',1)"><img src="../IMAGES/BUTTON/MAIN/SEARCH20.gif" alt="Search" name="Image31" width="20"  border="0" align="absmiddle" id="Image31"></a></td>
                </tr>
                <tr>
                  <td class="columnlabel"><%=screen.getLabel("memployee","bu1")%>&nbsp;</td>
                  <td><input name="__bu11" type="text" size="15" value="<%=bu11%>">
                    <a href="javascript:goHelp('MBU1HELP','__bu11');" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('999','','../IMAGES/BUTTON/SWAP/SEARCH_SWAP20.gif',1)"><img src="../IMAGES/BUTTON/MAIN/SEARCH20.gif" alt="Search" name="Image3" width="20"  border="0" align="absmiddle"></a> -
                    <input name="__bu12" type="text" size="15" value="<%=bu11%>">
                    <a href="javascript:goHelp('MBU1HELP','__bu12');" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image311','','../IMAGES/BUTTON/SWAP/SEARCH_SWAP20.gif',1)"><img src="../IMAGES/BUTTON/MAIN/SEARCH20.gif" alt="Search" name="Image311" width="20"  border="0" align="absmiddle" id="Image311"></a></td>
                </tr>
                <tr>
                  <td class="columnlabel"><%=screen.getLabel("memployee","bu2")%>&nbsp;</td>
                  <td><input name="__bu21" type="text" size="15" value="<%=bu21%>">
                    <a href="javascript:goHelp('MBU2HELP','__bu21');" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('999','','../IMAGES/BUTTON/SWAP/SEARCH_SWAP20.gif',1)"><img src="../IMAGES/BUTTON/MAIN/SEARCH20.gif" alt="Search" name="Image3" width="20"  border="0" align="absmiddle"></a> -
                    <input name="__bu22" type="text" size="15" value="<%=bu22%>">
                    <a href="javascript:goHelp('MBU2HELP','__bu22');" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image312','','../IMAGES/BUTTON/SWAP/SEARCH_SWAP20.gif',1)"><img src="../IMAGES/BUTTON/MAIN/SEARCH20.gif" alt="Search" name="Image312" width="20"  border="0" align="absmiddle" id="Image312"></a></td>
                </tr>
                <tr>
                  <td class="columnlabel"><%=screen.getLabel("memployee","bu3")%>&nbsp;</td>
                  <td><input name="__bu31" type="text" size="15" value="<%=bu31%>">
                    <a href="javascript:goHelp('MBU3HELP','__bu31');" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('999','','../IMAGES/BUTTON/SWAP/SEARCH_SWAP20.gif',1)"><img src="../IMAGES/BUTTON/MAIN/SEARCH20.gif" alt="Search" name="Image3" width="20"  border="0" align="absmiddle"></a> -
                    <input name="__bu32" type="text" size="15" value="<%=bu32%>">
                    <a href="javascript:goHelp('MBU3HELP','__bu32');" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image313','','../IMAGES/BUTTON/SWAP/SEARCH_SWAP20.gif',1)"><img src="../IMAGES/BUTTON/MAIN/SEARCH20.gif" alt="Search" name="Image313" width="20"  border="0" align="absmiddle" id="Image313"></a></td>
                </tr>
                <tr>
                  <td class="columnlabel"><%=screen.getLabel("memployee","emp_position")%>&nbsp;</td>
                  <td><input name="__position1" type="text" size="15" value="<%=position1%>">
                    <a href="javascript:goHelp('MPOSITIONHELP','__position1');" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('999','','../IMAGES/BUTTON/SWAP/SEARCH_SWAP20.gif',1)"><img src="../IMAGES/BUTTON/MAIN/SEARCH20.gif" alt="Search" name="Image3" width="20"  border="0" align="absmiddle"></a> -
                    <input name="__position2" type="text" size="15" value="<%=position2%>">
                    <a href="javascript:goHelp('MPOSITIONHELP','__position2');" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image314','','../IMAGES/BUTTON/SWAP/SEARCH_SWAP20.gif',1)"><img src="../IMAGES/BUTTON/MAIN/SEARCH20.gif" alt="Search" name="Image314" width="20"  border="0" align="absmiddle" id="Image314"></a>					
				  </td>
                </tr>
                <tr>
                  <td class="columnlabel"><%=screen.getLabel("years")%>&nbsp;</td>
                  <td>
					<select name="__years1">
					<%for(int i=(cs.getYear()-3);i<(cs.getYear()+5);i++){%>
								<option value="<%=i%>"  <%if(years1.equals(String.valueOf(i))){ out.println("selected");}%>><%=i%></option>
					<%}%>
					</select>	-
										<select name="__years2">
					<%for(int i=(cs.getYear()-3);i<(cs.getYear()+5);i++){%>
								<option value="<%=i%>"  <%if(years2.equals(String.valueOf(i))){ out.println("selected");}%>><%=i%></option>
					<%}%>
					</select>					  
				  </td>
                </tr>
                <tr>
                  <td class="columnlabel_baseline">&nbsp;</td>
                  <td>
                    <button type="button" class="btn btn-primary width100" swlang code="SW013168" onClick="GoSearch();">SEARCH</button></td>
                </tr>
                <tr>
                  <td colspan="2" class="columnlabel_baseline2"></td>
                </tr>
              </table>WEL006
              <br>
                  <div align="right" class="style1"><%=screen.getPageTag()%></div>
<table width="638" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#808080" class="inframe tablewithborder">
					  <tr class="title1">
						<td width="11%" nowrap class="row3"><div align="center"><%=screen.getLabel("years")%></div></td>
						<td width="8%" nowrap class="row3"><div align="center"><%=screen.getLabel("healthdate")%></div></td>
						<td width="51%" nowrap class="row3"><div align="center"><%=screen.getLabel("healthygid")%></div></td>
						<td width="11%" nowrap class="row3"><div align="center"><%=screen.getLabel("employeeid")%></div></td>
						<td width="19%" nowrap class="row3"><div align="center"><script language="javascript">swapLang('Name-Surname');</script></div></td>
					  </tr>
          <%
		   while (screen.nextRec()) {
			if(screen.checkLinePage()){
	%>
          <tr>
				<td  ><%=screen.getString("years")%></td>
				<td ><%=screen.getString("healthdate")%></td>
				<td ><a href="JavaScript:GoPage('<%=screen.getString("years")%>','<%=screen.getString("employeeid")%>','<%=screen.getString("healthygid")%>')"><%=screen.getString("healthygid")%></a>&nbsp;<%=screen.getString("mhealthygroup","tdesc")%></td>
				<td><%=screen.getString("employeeid")%></td>
				<td ><%=screen.getString("memployee","fullname")%></td>		  
          </tr>
          <% 
					 }
					 if(screen.outLinePage()){ break; }	 
	 }
	 %>
		  <tr>
            <td colspan="12" class="blankspace"></td>
          </tr>
          <tr>
            <td colspan="12" class="bottom"></td>
          </tr>
        </table></td>
      </tr>
    </table>

</form>
</body>
</html>