<%@page contentType="text/html; charset=UTF-8"%>
<%@page import="com.csc.library.entry.HelpEntry,com.csc.library.system.*,com.csc.library.utilities.*"%>
<%@ page import="com.csc.library.entry.*,com.csc.library.database.*,com.csc.library.session.*,com.csc.library.report.ReportUDF"  %>
<%request.setCharacterEncoding("UTF-8");%>
<jsp:useBean id="AS300_KKB" class="com.csc.library.system.Task" scope="page"/>
<%
	AS300_KKB.setChannel(request,response);
	UIManager screen = (UIManager) AS300_KKB.process("SingleEntry","AS300_KKB");
	screen.referLangOn();
	CheckNull chk = new CheckNull();
	ReportUDF sc = new ReportUDF();
%>
<html  ng-app="myHR">
	<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 src="../JS/angular-1.3.15/angular.js" type="text/javascript"></script>
		<script src="../JS/ANGULAR/SCREEN_ANGULAR.js" type="text/javascript"></script>
		<script src="../JS/jquery-2.1.3.min.js"></script>

		<!--DWR INCLUDE-->
		<script type='text/javascript' src='/hr/dwr/interface/SearchDWR.js'></script>
		<script type='text/javascript' src='/hr/dwr/engine.js'></script>
		<script type='text/javascript' src='/hr/dwr/util.js'></script>
		<!--DWR INCLUDE-->

		<script language="javascript">

			function GoSave() {  confirmSave();  }
			function GoDelete(){ edelete(); }
			function GoSearch(){ search(); }
			function GoUpdate(){ update();  }
			function checkCF(){ checkConfirm(); }

			function MM_preloadImages() {
				//v3.0
				var d=document;
				if(d.images){
					if(!d.MM_p) d.MM_p=new Array();
					var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
					if (a[i].indexOf("#")!=0){
						d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];
					}
				}
			}

			function showHelp(page){
				window.open(page,"Help","left=150,top=150,width=700,height=500,toolbar=no,status=no,scrollbars=no");
			}

			function goHelp(helpName,inputName){
				with(document.cscform){
					var helpReturn;
					var temp;
					temp = __fixCon.value;

					if(inputName=="__employeeid" ){
						__postReturn.value="1";
						__fixCon.value="status not in ('X','Y','U')";
						helpReturn=inputName+":employeeid,"+
						"memployee@fullname,"+
						"mgroup@edesc,"+
						"mbu1@edesc,"+
						"mbu2@edesc,"+
						"mbu3@edesc,"+
						"mposition@edesc,"+
						"memployee@startdate,"+
						"memployee@empworkages,"+
						"memployee@empages,"+
						"sim1memployee@fullname,"+
						"mjobcode@edesc,"+
						"mpersonallevel@plid,"+
						"mpersonallevel@edesc";
					}
					else if(inputName=="__assessor1" ){
						__fixCon.value="status not in ('X','Y','U')";
						helpReturn=inputName+":employeeid,"+
						"fullname$1:fullname,"+
						"mbu2$1:mbu2.edesc,"+
						"mposition$1:mposition.edesc";
					}
					else if(inputName=="__assessor2" ){
						__fixCon.value="status not in ('X','Y','U')";
						helpReturn=inputName+":employeeid,"+
						"fullname$2:fullname,"+
						"mbu2$2:mbu2.edesc,"+
						"mposition$2:mposition.edesc";
					}
					else if(inputName=="__assessor3" ){
						__fixCon.value="status not in ('X','Y','U')";
						helpReturn=inputName+":employeeid,"+
						"fullname$3:fullname,"+
						"mbu2$3:mbu2.edesc,"+
						"mposition$3:mposition.edesc";
					} else if(inputName=="__assessor4" ){
						__fixCon.value="status not in ('X','Y','U')";
						helpReturn=inputName+":employeeid,"+
						"fullname$4:fullname,"+
						"mbu2$4:mbu2.edesc,"+
						"mposition$4:mposition.edesc";
					} else if(inputName=="__assessor5" ){
						__fixCon.value="status not in ('X','Y','U')";
						helpReturn=inputName+":employeeid,"+
						"fullname$5:fullname,"+
						"mbu2$5:mbu2.edesc,"+
						"mposition$5:mposition.edesc";
					} else if(inputName=="__astype") {
						helpReturn=inputName+":astid,typename:tdesc";
					}else if(inputName=="__astype1") {
						helpReturn=inputName+":astid";
					} else if(inputName=="__astype2") {
						helpReturn=inputName+":astid";
					} else if(inputName=="__astype3") {
						helpReturn=inputName+":astid";
					}
					linkHelp_Return(helpName,helpReturn);
					__fixCon.value=temp;
				}
			}

			function postReturn(){
				with(document.cscform){
					if(__postReturn.value!=""){
						__postReturn.value="";
						SearchDWR.searchDBXMLAll(new Array("MEMPL_ASSESSORHELP","mempl_assessor.employeeid","MEMPL_ASSESSOR:employeeid='"+__employeeid.value+"' and astype='"+__astype.value+"' ","","langon",""),
							function(data){
								if(data.length>0){
									search();
								}else{
									clearAssessor();
								}
							}
						);
					}
				}
			}

			function clearAssessor(){
				with(document.cscform){
					clearData('1');
					clearData('2');
					clearData('3');
					clearData('4');
					clearData('5');
				}
			}

			function searchBossEmp(objname,row){
				with(document.cscform){
					objname = chkobj(objname);
					SearchDWR.searchDBXMLAll(new Array("MEMPLOYEEHELP_APS","memployee.bossid,sim1memployee.fullname,v1mbu2.tdesc,v2mposition.tdesc",
						"MEMPLOYEE:employeeid='"+eval(objname).value+"'","","langon",""),
						function(data1){
							if(data1.length > 0){
								dwr.util.setValue('__assessor'+row,data1[0][0]);
								dwr.util.setValue('fullname$'+row,data1[0][1]);
								dwr.util.setValue('mbu2$'+row,data1[0][2]);
								dwr.util.setValue('mposition$'+row,data1[0][3]);
							}//end if
						}// end function
					);
				}
			}

			function chkobj(objname){
				if(objname == "0"){
					return "__employeeid"
				}else if(objname == "1"){
					return "__assessor1"
				}else if(objname == "2"){
					return "__assessor2"
				}else if(objname == "3"){
					return "__assessor3"
				}else if(objname == "4"){
					return "__assessor4"
				}
			}

			function clearData(row){
				with(document.cscform){
					dwr.util.setValue('__assessor'+row,"");
					dwr.util.setValue('fullname$'+row,"");
					dwr.util.setValue('mbu2$'+row,"");
					dwr.util.setValue('mposition$'+row,"");
				}
			}


		</script>

	</head>
	<body leftmargin="0" topmargin="0" onLoad="MM_preloadImages('../IMAGES/BUTTON/SWAP/SEARCH_SWAP20.gif')">
		<div id="toolTipLayer" style="position:absolute; visibility: hidden"></div>
		<script language="javascript">initToolTips();</script>
		<form name="cscform" method="post">
			<!----------BEGIN CSC INITIAL ZONE ------------------------>
			<%=screen.InitialVariable()%>
			<!----------END CSC INITIAL ZONE -------------------------->
			<input type="hidden" name="__screen" value="AS300_KKB">
			<input type="hidden" name="__help" value="">
			<input type="hidden" name="__sysisedit" value="">
			<input type="hidden" name="__cmd" value="">
			<input type="hidden" name="__fixCon" value="">
			<input type="hidden" name="__language" value="<%=screen.getUProfile().get("lang")%>">
			<input type="hidden" name="__notNull"	value="<%=screen.getRequire()%>">
			<input type="hidden" name="__companyid"	value="<%=screen.getUProfile().get("companyid")%>">
			<input type="hidden" name="__postReturn"	value="">
			<script language="JavaScript">document.write(Icons());</script>
			<br>
			<div align="center">
				<!-- ตารางกำหนดผู้ประเมิน -->
				<table  cellpadding="0"  cellspacing="0" class="large">
					<tr >
						<td  class="header">AS300_KKB,<label swlang code="SW001146">Define Assessor Process</label>&nbsp;</td>
					</tr>
					<tr >
						<td class="blankspace">&nbsp;</td>
					</tr>
					<tr >
						<td align="center">
							<table cellpadding="0" cellspacing="0">
								<tr>
									<td align="right" nowrap><%=screen.getLabel("astype")%></td>
									<td colspan="4"><%=screen.getInput("astype")%></td>
								</tr>
								<tr>
									<td align="right" nowrap><%=screen.getLabel("employeeid")%></td>
									<td colspan="3"><%=screen.getInput("employeeid").replaceAll("MEMPL_ASSESSORHELP","MEMPLOYEEHELP").replaceAll("linkHelp","goHelp")%>&nbsp;<input type='text' name='memployee@fullname' size='30' maxlength='100' value='<%=screen.getDataLabel("memployee","fullname")%>' readonly></td>
								</tr>
								<tr>
									<td align="right" nowrap><div swlang code="SW001058">Employee Group Code</div></td>
									<td>&nbsp;<input type='text' name='mgroup@edesc' size='30' maxlength='100' value='<%=screen.getDataLabel("mgroup","edesc")%>'  readonly></td>
									<td align="right" nowrap><script language='javascript'>swapLang('BU1');</script></td>
									<td>&nbsp;<input type='text' name='mbu1@edesc' size='30' maxlength='100' value="<%=screen.getDataLabel("mbu1","edesc")%>" readonly></td>
								</tr>
								<tr>
									<td align="right" nowrap><script language='javascript'>swapLang('BU2');</script></td>
									<td>&nbsp;<input type='text' name='mbu2@edesc' size='30' maxlength='100' value="<%=screen.getDataLabel("mbu2","edesc")%>" readonly></td>
									<td align="right" nowrap><script language='javascript'>swapLang('BU3');</script></td>
									<td>&nbsp;<input type='text' name='mbu3@edesc' size='30' maxlength='100' value="<%=screen.getDataLabel("mbu3","edesc")%>" readonly></td>
								</tr>
								<tr>
									<td align="right" nowrap><div swlang code="SW000057">Position</div></td>
									<td>&nbsp;<input type='text' name='mposition@edesc' size='30' maxlength='100' value="<%=screen.getDataLabel("mposition","edesc")%>" readonly></td>
									<td align="right" nowrap><div swlang code="SW011749">Start Date</div></td>
									<td>&nbsp;<input TYPE='text' name='memployee@startdate' size='30' maxlength='100' value="<%=screen.getDataLabel("memployee","startdate")%>" readonly></td>
								</tr>
								<tr>
									<td align="right" nowrap><div swlang code="SW000399">Year Of Service</div></td>
									<td>&nbsp;<input type='text' Name='memployee@empworkages' size='30' maxlength='100' value="<%=screen.getDataLabel("memployee","empworkages")%>" readonly></td>
									<td align="right" nowrap><div swlang code="SW000172">Age</div></td>
									<td>&nbsp;<input type='text' name='memployee@empages' size='30' maxlength='100' value="<%=screen.getDataLabel("memployee","empages")%>" readonly></td>
								</tr>
								<tr>
									<td align="right" nowrap><div swlang code="SW000185">Supervisor</div></td>
									<td>&nbsp;<input type='text' name='sim1memployee@fullname' size='30' maxlength='100' value="<%=screen.getDataLabel("sim1memployee","fullname")%>" readonly></td>
									<td align="right" nowrap>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<div swlang code="SW000057">Position</div></td>
									<td>&nbsp;<input type='text' name='mjobcode@edesc' size='30' maxlength='100' value="<%=screen.getDataLabel("mjobcode","edesc")%>" readonly></td>
								</tr>
								<tr>
									<td class="blankspace">&nbsp;</td>
								</tr>
							</table>
						</td>
					</tr>
					<tr>
						<td class="blankspace">&nbsp;</td>
					</tr>
					<%
					DbRecord memployee = new InitialRecord(screen.getUProfile()).getDbRecord("memployee");
					String[] systemcode = sc.getSystemCode("ASSESSOR_CONDITION",screen.getUProfile().get("lang"));
					%>
					<tr>
						<td>
							<table align="center" cellpadding="1" bgcolor="#666666" cellspacing="1" class="largest tablewithborder" colspan="5" border="0">
								<tr>
									<td class="title1" align="center" swlang code="SW000735">Order</td>
									<td class="title1" align="center" swlang code="SW000006">Condition</td>
									<td class="title1" align="center" swlang code="SW000602">Employeeid</td>
									<td class="title1" align="center" swlang code="SW007745">Name Surname</td>
									<td class="title1" align="center"><%=memployee.getField("bu2").getDescription()%></td>
									<td class="title1" align="center" swlang code="SW000057">Position</td>
								</tr>
								<tr>
									<td align="center"><%=screen.getLabel("ASSESSOR_LEVEL1")%></td>
									<td align="center">
										<select id="con_asslv1">
											<%
												for (String scdesc : systemcode) {
													String[] parts = scdesc.split(",");
											%>
											<option value="<%=parts[0]%>"><%=parts[1]%></option>
											<%
												}
											%>
										</select>
									</td>
									<td align="center">
										<%screen.setProperties("assessor1","help","MEMPLOYEEHELP_APS");%><%=screen.getInput("assessor1").replaceAll("linkHelp","goHelp")%>
										<a href="javascript:clearData('1');" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('__assessor1_del','','../IMAGES/BUTTON/SWAP/DEL_SWAP20.gif',1)"><img src="../IMAGES/BUTTON/MAIN/DEL20.gif" alt="SEARCH" name="__assessor1_del" width="20" height="20" border="0" align="absmiddle"></a>
										<button type="button" class="btn btn-primary width100" swlang code="SW013176" onClick="searchBossEmp(con_asslv1.value,'1');">GENDATA</button>
									</td>
									<td align="center"><input type='text' name='fullname$1' size='30' maxlength='100' value="<%=screen.getDataLabel("v1memployee","fullname")%>" readonly></td>
									<td align="center"><input type='text' name='mbu2$1' size='30' maxlength='100' value="<%=screen.getDataLabel("v1memployee","bu2name")%>" readonly></td>
									<td align="center"><input type='text' name='mposition$1' size='30' maxlength='100' value="<%=screen.getDataLabel("v1memployee","positionname")%>" readonly></td>
								</tr>
								<tr>
									<td align="center"><%=screen.getLabel("ASSESSOR_LEVEL2")%></td>
									<td align="center">
										<select id="con_asslv2">
											<%
												for (String scdesc1 : systemcode) {
													String[] parts1 = scdesc1.split(",");
											%>
											<option value="<%=parts1[0]%>" <%=parts1[0].equals("1")?"selected":""%>><%=parts1[1]%></option>
											<%
												}
											%>
										</select>
									</td>
									<td align="center">
										<%screen.setProperties("assessor2","help","MEMPLOYEEHELP_APS");%><%=screen.getInput("assessor2").replaceAll("linkHelp","goHelp")%><a href="javascript:clearData('2');" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('__assessor2_del','','../IMAGES/BUTTON/SWAP/DEL_SWAP20.gif',1)"><img src="../IMAGES/BUTTON/MAIN/DEL20.gif" alt="SEARCH" name="__assessor2_del" width="20" height="20" border="0" align="absmiddle"></a>
										<button type="button" class="btn btn-primary width100" swlang code="SW013176" onClick="searchBossEmp(con_asslv2.value,'2');">GENDATA</button>
									</td>
									<td align="center"><input type='text' name='fullname$2' size='30' maxlength='100' value="<%=screen.getDataLabel("v2memployee","fullname")%>" readonly></td>
									<td align="center"><input type='text' name='mbu2$2' size='30' maxlength='100' value="<%=screen.getDataLabel("v2memployee","bu2name")%>" readonly></td>
									<td align="center"><input type='text' name='mposition$2' size='30' maxlength='100' value="<%=screen.getDataLabel("v2memployee","positionname")%>" readonly></td>
								</tr>
								<tr>
									<td align="center"><%=screen.getLabel("ASSESSOR_LEVEL3")%></td>
									<td align="center">
										<select id="con_asslv3">
											<%
												for (String scdesc2 : systemcode) {
													String[] parts2 = scdesc2.split(",");
											%>
											<option value="<%=parts2[0]%>" <%=parts2[0].equals("2")?"selected":""%>><%=parts2[1]%></option>
											<%
												}
											%>
										</select>
									</td>
									<td align="center">
										<%screen.setProperties("assessor3","help","MEMPLOYEEHELP_APS");%><%=screen.getInput("assessor3").replaceAll("linkHelp","goHelp")%><a href="javascript:clearData('3');" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('__assessor3_del','','../IMAGES/BUTTON/SWAP/DEL_SWAP20.gif',1)"><img src="../IMAGES/BUTTON/MAIN/DEL20.gif" alt="SEARCH" name="__assessor3_del" width="20" height="20" border="0" align="absmiddle"></a>
										<button type="button" class="btn btn-primary width100" swlang code="SW013176" onClick="searchBossEmp(con_asslv3.value,'3');">GENDATA</button>
									</td>
									<td align="center"><input type='text' name='fullname$3' size='30' maxlength='100' value="<%=screen.getDataLabel("v3memployee","fullname")%>" readonly></td>
									<td align="center"><input type='text' name='mbu2$3' size='30' maxlength='100' value="<%=screen.getDataLabel("v3memployee","bu2name")%>" readonly></td>
									<td align="center"><input type='text' name='mposition$3' size='30' maxlength='100' value="<%=screen.getDataLabel("v3memployee","positionname")%>" readonly></td>
								</tr>
								<tr>
									<td align="center"><%=screen.getLabel("ASSESSOR_LEVEL4")%></td>
									<td align="center">
										<select id="con_asslv4">
											<%
												for (String scdesc3 : systemcode) {
													String[] parts3 = scdesc3.split(",");
											%>
											<option value="<%=parts3[0]%>" <%=parts3[0].equals("3")?"selected":""%>><%=parts3[1]%></option>
											<%
												}
											%>
										</select>
									</td>
									<td align="center">
										<%screen.setProperties("assessor4","help","MEMPLOYEEHELP_APS");%><%=screen.getInput("assessor4").replaceAll("linkHelp","goHelp")%><a href="javascript:clearData('4');" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('__assessor4_del','','../IMAGES/BUTTON/SWAP/DEL_SWAP20.gif',1)"><img src="../IMAGES/BUTTON/MAIN/DEL20.gif" alt="SEARCH" name="__assessor4_del" width="20" height="20" border="0" align="absmiddle"></a>
										<button type="button" class="btn btn-primary width100" swlang code="SW013176" onClick="searchBossEmp(con_asslv4.value,'4');">GENDATA</button>
									</td>
									<td align="center"><input type='text' name='fullname$4' size='30' maxlength='100' value="<%=screen.getDataLabel("v4memployee","fullname")%>" readonly></td>
									<td align="center"><input type='text' name='mbu2$4' size='30' maxlength='100' value="<%=screen.getDataLabel("v4memployee","bu2name")%>" readonly></td>
									<td align="center"><input type='text' name='mposition$4' size='30' maxlength='100' value="<%=screen.getDataLabel("v4memployee","positionname")%>" readonly></td>
								</tr>
								<tr>
									<td align="center"><%=screen.getLabel("ASSESSOR_LEVEL5")%></td>
									<td align="center">
										<select id="con_asslv5">
											<%
												for (String scdesc4 : systemcode) {
													String[] parts4 = scdesc4.split(",");
											%>
											<option value="<%=parts4[0]%>" <%=parts4[0].equals("4")?"selected":""%>><%=parts4[1]%></option>
											<%
												}
											%>
										</select>
									</td>
									<td align="center">
										<%screen.setProperties("assessor5","help","MEMPLOYEEHELP_APS");%><%=screen.getInput("assessor5").replaceAll("linkHelp","goHelp")%><a href="javascript:clearData('5');" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('__assessor5_del','','../IMAGES/BUTTON/SWAP/DEL_SWAP20.gif',1)"><img src="../IMAGES/BUTTON/MAIN/DEL20.gif" alt="SEARCH" name="__assessor5_del" width="20" height="20" border="0" align="absmiddle"></a>
										<button type="button" class="btn btn-primary width100" swlang code="SW013176" onClick="searchBossEmp(con_asslv5.value,'5');">GENDATA</button>
									</td>
									<td align="center"><input type='text' name='fullname$5' size='30' maxlength='100' value="<%=screen.getDataLabel("simmemp","fullname")%>" readonly></td>
									<td align="center"><input type='text' name='mbu2$5' size='30' maxlength='100' value="<%=screen.getDataLabel("simmemp","bu2name")%>" readonly></td>
									<td align="center"><input type='text' name='mposition$5' size='30' maxlength='100' value="<%=screen.getDataLabel("simmemp","positionname")%>" readonly></td>
								</tr>
							</table>
						</td>
					</tr>
					<tr >
						<td class="blankspace">&nbsp;</td>
					</tr>
					<tr >
						<td  class="bottom"></td>
					</tr>
				</table>
			</div>
			<!----------BEGIN CSC ENDING ZONE ------------------------>
			<%=screen.endJSP()%>
			<!----------END CSC ENDING ZONE -------------------------->
		</form>
		<%screen.referLangOff();%>
	</body>
</html>
