APP_EMV001.jsp 19.3 KB
Newer Older
Thitichaipun Wutthisak committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496
<%@page contentType="text/html; charset=UTF-8"%>
<%@page import="com.csc.library.databean.*,com.csc.library.session.*,com.csc.library.entry.*,com.csc.library.database.*,com.csc.library.system.*,com.csc.library.utilities.*,java.text.*"%>
<%@ include file="../CHECKPROFILE.jsp" %>
<jsp:useBean id="AS004_1" class="com.csc.library.system.Task" scope="page" />
<%AS004_1.setChannel(request, response);%>
<%EmvHelpEntry screen = (EmvHelpEntry) AS004_1.process("EmvHelpEntry","AS004_1");%>

<%	CheckNull ck = new CheckNull(); 


       
String employeeid=screen.getUProfile().get("employeeid");
String fullname=screen.getUProfile().get("fullname");
if(!ck.chkNullString(request.getParameter("__employeeid"),"").equals("")){
	employeeid= request.getParameter("__employeeid");
	DbInquiry emp_full = new InitialInquiry(screen.getUProfile()).getDbInquiry("MEMPLOYEE");
	emp_full.setColumn("employeeid,prefix,fname,lname");
	emp_full.setFilter("employeeid='"+employeeid+"'");

	emp_full.refresh();
	emp_full.next();
	fullname = emp_full.getString("fullname");
}
String sbu1,sbu2,sbu3;
sbu1=ck.chkNullString(request.getParameter("__bu1"),"");
sbu2=ck.chkNullString(request.getParameter("__bu2"),"");
sbu3=ck.chkNullString(request.getParameter("__bu3"),"");
String filter = "";
String 	namelist="" ;
String data_namelist="";
String 	groupName="" ;
String 	groupArr="" ;
if(!sbu1.equals(""))filter =" and bu1='"+sbu1+"'";

if(!sbu2.equals(""))filter =filter+" and bu2='"+sbu2+"'";

if(!sbu3.equals(""))filter =filter+" and bu3='"+sbu3+"'";

CscCalendar cDate = new CscCalendar();
DbInquiry taps0 = new InitialInquiry(screen.getUProfile()).getDbInquiry("TAPSTRAN0");
taps0.setColumn("apsid,apsstartdate,apsenddate");
String f1="apsenddate >= '"+cDate.getYYYYMMDD()+"'   AND";
	f1+=" apsstartdate <='"+cDate.getYYYYMMDD()+"'  ";
//taps0.setFilter(f1);

taps0.refresh();
String dateExp = "apsid=''";
while(taps0.next()){
	if(taps0.recNo()==1){
		dateExp = "(apsid='"+taps0.getString("apsid")+"'";
	}else{
		dateExp +=" OR apsid='"+taps0.getString("apsid")+"' ";
	}
}

if(!dateExp.equals("apsid=''")){dateExp+=")";}

screen.inq.setFilter(dateExp+" AND astid='AP10' AND apsassessor='"+employeeid+"'"+filter);
if(!ck.chkNullString(request.getParameter("__orderBy"),"").equals("")){
	screen.inq.setOrderBy(request.getParameter("__orderBy"));
}
((Simtapstran_kkb)screen.inq.getCurrentDbRecord()).approveConfirm();	
 String desc ="tdesc";
 if(!screen.getUProfile().get("lang").equals("tha"))desc="edesc";
 DataSet dsBu1 = new DataSet("Select Distinct APSASSESSOR,BU1 ,MBU1.TDESC AS TDESC, MBU1.EDESC AS EDESC from TAPSTRAN , MBU1 where  "+dateExp+" and TAPSTRAN.astid='AP10' and TAPSTRAN.bu1=MBU1.bu1id and  APSASSESSOR='"+employeeid+"'",(String)screen.getUProfile().get("dbname"),"Tapstran");
dsBu1.initConnection(screen.getUProfile());

 DataSet dsBu2 = new DataSet("Select Distinct APSASSESSOR,BU2,MBU2.TDESC AS TDESC, MBU2.EDESC AS EDESC from TAPSTRAN, MBU2 where  "+dateExp+" and TAPSTRAN.astid='AP10' and TAPSTRAN.bu2=MBU2.bu2id and  APSASSESSOR='"+employeeid+"'",(String)screen.getUProfile().get("dbname"),"Tapstran");
dsBu2.initConnection(screen.getUProfile());

//DataSet dsBu3 = new DataSet("Select Distinct APSASSESSOR,BU3,MBU3.TDESC AS TDESC, MBU3.EDESC AS EDESC from TAPSTRAN, MBU3 where TAPSTRAN.bu3=MBU3.bu3id and  APSASSESSOR='"+employeeid+"'",(String)screen.getUProfile().get("dbname"),"Tapstran");
//dsBu3.initConnection(screen.getUProfile());

%>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" ng-app="myHR">
	<head>

		<title>Employee View</title>

		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

	</head>
	<body>
		<div class="bg-com"></div>	
		<jsp:include page="EMV_HEADMENU.jsp" flush="true" />
		
		<script type="text/javascript">

			setLang("<%=screen.getUProfile().get("lang")%>");
			var swap = new swaplang();
            var titlename = swap.swap2String("SW002248");
			setPageTitle(titlename);
			
			function goHelp(helpName,inputName){
			var helpReturn;
			var temp_fixCon;
			if(inputName=="__bu1" )
				helpReturn="__bu1:bu1id,MBU1@TDESC";
			 else if(inputName=="__bu2" )
				helpReturn="__bu2:bu2id,MBU2@TDESC";	
			 else if(inputName=="__bu3" )
				helpReturn="__bu3:bu3id,MBU3@TDESC";	
			temp_fixCon = document.cscform.__fixCon.value;
			document.cscform.__fixCon.value="";
			linkHelp_Return(helpName,helpReturn);
			
			document.cscform.__fixCon.value=temp_fixCon;
			
			
			}
			function fixSearch(){
				with(document.cscform){
					__shown.value="1";
					submit();
				}
			}
			function goConfirm(){
				with(document.cscform){
					__status.value="A";
					__cmd.value="ack";		
					submit();
				
				}
			}
			function goConfirm1(){
				
				var groupArr = document.getElementById("groupArr");
				var arr = groupArr.value.split(",");
				var returnVal = true;
				
				for(i=0;i<arr.length;i++){

					var objSelected = document.getElementById(arr[i]);
					
					if((objSelected.options[objSelected.selectedIndex].value=="")||((objSelected.options[objSelected.selectedIndex].value==0))){
						alert("กรุณาเลือกลำดับให้ครบ");
						returnVal = false;
						break;
					}else{
						//alert(objSelected.options[objSelected.selectedIndex].value);
					}
				}
				if(returnVal){
					//alert("goConfirm()");
					goConfirm();
				}
			}
			function goCheck(emp_group,fieldName){
					with(document.cscform){
						var param="AS004_2C1.jsp?__emp_group="+emp_group+"&__fieldName="+fieldName+"&__bu1="+__bu1.value+"&__bu2="+__bu2.value;	
						win = window.open(param,"AS004_2C1","left=50,top=50,width=600,height=400,toolbar=no,status=yes,scrollbars=yes,resizable=yes");
						if(window.focus){win.focus();}
					}
			}
			function goASP700(apsid,apsassessor,apsassessy){
				with(document.cscform){	
					__orderBy.value = "";	//action="ASP700.jsp?apsid="+apsid+"&apsassessor="+apsassessor+"&apsassessy="+apsassessy+"&bpage="+__screen.value+"&ass_level=1&bu1="+__bu1.value+"&bu2="+__bu2.value+"&isread=0";	
				//	submit();
					var param="APP_EMV700.jsp?apsid="+apsid+"&apsassessor="+apsassessor+"&apsassessy="+apsassessy+"&bpage="+__screen.value+"&ass_level=1&bu1="+__bu1.value+"&bu2="+__bu2.value+"&isread=0";
					win =window.open(param,"APP_EMV700","left=50,top=50,width=1100,height=700,toolbar=no,status=yes,scrollbars=yes,resizable=yes");
						if(window.focus){win.focus();}
				}

			}
			function goReASP700(apsid,apsassessor,apsassessy){
				with(document.cscform){
					__orderBy.value = "";	//action="ASP700.jsp?apsid="+apsid+"&apsassessor="+apsassessor+"&apsassessy="+apsassessy+"&bpage="+__screen.value+"&ass_level=1&bu1="+__bu1.value+"&bu2="+__bu2.value+"&isread=1";	
				//	submit();
					var param="APP_EMV700.jsp?apsid="+apsid+"&apsassessor="+apsassessor+"&apsassessy="+apsassessy+"&bpage="+__screen.value+"&ass_level=1&bu1="+__bu1.value+"&bu2="+__bu2.value+"&isread=1";
					win =window.open(param,"APP_EMV700","left=50,top=50,width=1100,height=700,toolbar=no,status=yes,scrollbars=yes,resizable=yes");
						if(window.focus){win.focus();}
				}

			}

			function calAge(strDate){
				var currentYear = parseInt(new Date().getYear());
				var birthdateYear = parseInt(strDate.substring(6,10));
				var age = currentYear-birthdateYear;
				document.write(age);
			}

			function chkSelected(Obj){
				var arrSplit = Obj.name.split(":");
				var groupName = arrSplit[4];
				var elGroupName = document.getElementById(groupName);
				var arr = elGroupName.value.split(",");
				var elArr = new Array();
				var numArr = new Array();
				var num = 0;
				var valReturn = true;
				for(i=0;i<arr.length;i++){		
					elArr[i] = arr[i].replace("'","").replace("'","");
				}
				for(i=0;i<elArr.length;i++){
					var objSelected = document.getElementById(elArr[i]);
					
					if(Obj.name!=objSelected.name){
						if(Obj.value==objSelected.options[objSelected.selectedIndex].value&&Obj.value!=0){
							alert("เลขนี้ถูกเลือกแล้ว");
							Obj.selectedIndex=0;				
							break;
						}
					}
				}

			}
			function setOrder(field){
				//alert(field);
				with(document.cscform){
					__orderBy.value+=","+field;
					fixSearch();
				}
			}

		</script>
		
		<section>
			<div class="container csc-content">
				<form name="cscform" class="form-horizontal" method="post" action="?">
					<%=screen.InitialVariable()%>
					<input type="hidden"name="__screen"  value="AS004_1">
					<input type="hidden" name="__help" value="">
					<input type="hidden" name="__cmd"  value="">
					<input type="hidden" name="__language" value ="<%=screen.getUProfile().get("lang")%>"> 
					<input type="hidden" name="__fixCon" value="">
					<input type="hidden" name="__orderBy" value="emp_group">
					<input type="hidden" name="__tdesc" value="">
					<input type="hidden" name="__apsobjective" value="">
					<input type="hidden" name="__shown" value="<%=ck.chkNullString(request.getParameter("__shown"),"")%>">
					<input type="hidden" name="__updatefield" value="APSSTATUS">
					<input type="hidden" name="__returnfield" value="">
					<input type="hidden" name="__status" value="">
					<input type="hidden" name="__employeeid" value="<%=ck.chkNullString(request.getParameter("__employeeid"),"")%>">
					<input type="hidden" name="__update" value="">
					
					<div class="csc-block">
						<div class="center">
							<h2 class="csc-block-head" swlang code='SW002248'>Apprisal Information Lv1</h2> 
						</div>
						
						<div class="form-horizontal">
							<div class="row">
								<div class="form-group">
									<div class="col-md-1 col-sm-1 col-xs-1"></div>
									<div class="col-md-2 col-sm-2 col-xs-2">
										<label class="control-label label-right" swlang code='SW000020'>Assessor</label>
									</div>
									<div class="col-md-2 col-sm-2 col-xs-2">
										<label class="control-label"><%=fullname%></label>
									</div>
								</div>
							</div>
							<div class="row">
								<div class="form-group">
									<div class="col-md-1 col-sm-1 col-xs-1"></div>
									<div class="col-md-2 col-sm-2 col-xs-2">
										<label class="control-label label-right"><%=screen.getLabel("memployee","bu1")%></label>
									</div>
									<div class="col-md-2 col-sm-2 col-xs-2">
										<select class="form-control" name="__bu1" id="select">
											<option value=""></option>
											<%while(dsBu1.next()){%>
											<option value="<%=dsBu1.getString("bu1")%>" <%=(sbu1.equals(dsBu1.getString("bu1")))?"selected":""%>><%=dsBu1.getString(desc)%></option>
											<%}%>
										</select> 
									</div>
									<div class="col-md-2 col-sm-2 col-xs-2">
										<label class="control-label label-right"><%=screen.getLabel("memployee","bu2")%></label>
									</div>
									<div class="col-md-2 col-sm-2 col-xs-2">
										<select class="form-control" name="__bu2" id="select">
											<option value=""></option>
											<%while(dsBu2.next()){%>
											<option value="<%=dsBu2.getString("bu2")%>" <%=(sbu2.equals(dsBu2.getString("bu2")))?"selected":""%>><%=dsBu2.getString(desc)%></option>
											<%}%>
										</select>   
									</div>
								</div>
							</div>
							
							<div class="center">
								<a class="btn btn-primary" href="javascript:fixSearch();" swlang code='SW003537'>Search</a>
							</div>
						</div>
					</div>
					
					<div class="csc-block-white">
						<div class="table-responsive">
							<table class="table table-head table-hover table-bordered table-title-left table-content-center">
								<thead>
									<tr>
										<th class="table-title " colspan=9 swlang code='SW002248'>Apprisal Information Lv1</th>
									</tr>
								</thead>
									<% 
										int  recCount=0;
										if(ck.chkNullString(request.getParameter("__shown"),"").equals("1")){
											
											screen.inq.refresh();
											screen.inq.next();
											int running=0;
											double a_per,b_per,c_per,to_per;
											a_per=0.00;
											b_per=0.00;
											c_per=0.00;
											to_per=0.00;
											double a_per_t,b_per_t,c_per_t,to_per_t;
											a_per_t=0.00;
											b_per_t=0.00;
											c_per_t=0.00;
											to_per_t=0.00;						
											String old_group,cur_group;
											String workage="";
											boolean nextRec,end;
											recCount =screen.inq.recCount();
											DecimalFormat dc = new DecimalFormat();
											dc.applyPattern("#0.00");
											if(recCount>0){
												nextRec=true;
												end=true;
												int rowCount = 0;
												while(end){
													rowCount++;
												
									%>
								<tbody>
									<tr>
										<th swlang code='SW000019'>Status</th>
										<th swlang code='SW001055'>Sequencing</th>
										<th swlang code='SW000013'>Score</th>
										<th swlang code='SW000021'>Assessy</th>
										<th><%=screen.getLabel("memployee","bu1")%></th>
										<th><%=screen.getLabel("memployee","bu2")%></th>
										<th swlang code='SW000230'>Service Year</th>
										<th swlang code='SW000172'>Age</th>
										<th swlang code='SW012223'>Discipline</th>
									</tr>
									<tr>
										<td class="table-title" colspan=9 swlang code='SW000507'>Employee Group Code&nbsp;&nbsp;:&nbsp;<%=screen.getDataLabel("mgroup","tdesc")%></td>
									</tr>
									<%
										old_group = screen.inq.getString("emp_group");	
										cur_group = screen.inq.getString("emp_group");	
										nextRec=true;
										a_per=0;
										b_per=0;
										c_per=0;
										to_per=0;
										int countRow = 0;
										while(nextRec){
											countRow++;
											to_per++;
											to_per_t++;
											
											if(screen.inq.getString("apsgrade").indexOf("A")>=0){
												a_per++;
												a_per_t++;
											}else{
												if(screen.inq.getString("apsgrade").indexOf("B")>=0){
													b_per++;
													b_per_t++;
												}else{
													if(screen.inq.getString("apsgrade").indexOf("C")>=0){
														c_per++;
														c_per_t++;
													}
												}
											}
									%>
									<tr>
										<td>
											<center>
												<%if((screen.getDataLabel("apsstatus").equals(""))||(screen.getDataLabel("apsstatus").equals("0"))||(screen.getDataLabel("apsstatus").equals("R"))){%>
												<%=screen.inq.getCurrentDbRecord().getSystemCode("apsstatus")%>
												<%
													}else{
													if(screen.getDataLabel("apsstatus").equals("A")){
												%>
												<%=screen.inq.getCurrentDbRecord().getSystemCode("apsstatus")%>
												<%}else{%>
												<%=screen.inq.getCurrentDbRecord().getSystemCode("apsstatus")%>
												<%
													}
													}
												%>
											</center>
										</td>
										<td>
											<select class="form-control" id="__lineg:<%=screen.getDataLabel("mbu1","bu1id")+":"+screen.getDataLabel("mbu2","bu2id")+":"+screen.getDataLabel("mbu3","bu3id")+":"+screen.inq.getString("emp_group")+":"+screen.getDataLabel("runno") %>" name="__lineg:<%=screen.getDataLabel("mbu1","bu1id")+":"+screen.getDataLabel("mbu2","bu2id")+":"+screen.getDataLabel("mbu3","bu3id")+":"+screen.inq.getString("emp_group")+":"+screen.getDataLabel("runno") %>"  apsstatus='<%=screen.getDataLabel("apsstatus")%>' >	
												<option value=""></option>
											</select>
											<%
											
												namelist += ",'__lineg:"+screen.getDataLabel("mbu1","bu1id")+":"+screen.getDataLabel("mbu2","bu2id")+":"+screen.getDataLabel("mbu3","bu3id")+":"+screen.inq.getString("emp_group")+":"+screen.getDataLabel("runno")+"'";				
												data_namelist+=",'"+screen.getDataLabel("APSASSDESC")+"'";	
												groupArr+=",__lineg:"+screen.getDataLabel("mbu1","bu1id")+":"+screen.getDataLabel("mbu2","bu2id")+":"+screen.getDataLabel("mbu3","bu3id")+":"+screen.inq.getString("emp_group")+":"+screen.getDataLabel("runno");	

												groupName = screen.inq.getString("emp_group");
												
											%>
										</td>
										<td><center><%=screen.getDataLabel("apssumscore")%></center></td>
										<td>
											<%if(!screen.getDataLabel("APSSTATUS").equals("A")){%>
												<%="<A  href=\"javascript:goASP700('"+screen.getDataLabel("APSID")+"','"+screen.getDataLabel("APSASSESSOR")+"','"+screen.getDataLabel("APSASSESSY")+"');\">"+screen.getDataLabel("simemp","fullname")+"</A>" %>
											<%}else{%>
												<%="<A  href=\"javascript:goReASP700('"+screen.getDataLabel("APSID")+"','"+screen.getDataLabel("APSASSESSOR")+"','"+screen.getDataLabel("APSASSESSY")+"');\">"+screen.getDataLabel("simemp","fullname")+"</A>"%>
											<%}%>
										</td>
										<td><%=screen.getDataLabel("mbu2","tdesc")%></td>
										<td><%=screen.getDataLabel("mposition","tdesc")%></td>
										<%
											workage=screen.getDataLabel("simemp","empworkages");
											String[] y = workage.split(" ");	
										%>
										<td><%=y[0]+"/"+y[2] %></td>
										<td><script>calAge("<%=screen.getDataLabel("simemp","birthday")%>");</script></td>
										<td>
											<%if(screen.getDataLabel("other3").equals("Y")){%>
												<%=screen.getDataLabel("other3")%>
											<%}else{%>
												<%=screen.getDataLabel("other3")%>
											<%}%>
										</td>
									</tr>
									 <%
											if(!screen.inq.next()){
												end=false;
												nextRec = false;
											}
											cur_group= screen.inq.getString("emp_group");
											if(!cur_group.equals(old_group))nextRec = false; 
										
										} // end while 
									%>
									<tr>
										<td class="table-title result" colspan="9"><label swlang code='SW012235'>Total Assessy</label> :&nbsp;&nbsp;<%=dc.format(to_per).replaceAll(".00", "")%>&nbsp;<label swlang code='SW002049'>Person</label></td>
									</tr>
									<script>
										var arr = new Array(<%=namelist.substring(1)%>);
										var data_arr = new Array(<%=data_namelist.substring(1)%>);
										var arrSize = arr.length;
										
										for(i=0;i<arrSize;i++){						
											var 	selectObj = document.getElementById(arr[i]);
													selectObj.onchange = function(){chkSelected(this);	}									
											
												for (j = 1; j<= arrSize; j++) {
													var 	optionObj = document.createElement("option");
															optionObj.value = "apsassdesc:"+j+":apsstatus:A";
															optionObj.innerHTML = j;
															selectObj.appendChild(optionObj);
												}  //End For j
												if(data_arr[i]!=''){
												//	alert(data_arr[i]);
													selectObj.selectedIndex= +data_arr[i];
													if(selectObj.apsstatus=='A'){
														selectObj.disabled="disabled";
													}
												}
											document.getElementById(arr[i]).appendChild(selectObj);
										}//End For i
									</script>
									<input type="hidden" name="<%=groupName%>" id="<%=groupName%>" value="<%=namelist.substring(1)%>">
									<% namelist = "";%>
									<% data_namelist = "";%>
									<%			
										} // while
										}// if	
									%>
									<input type="hidden" name="groupArr" id="groupArr" value="<%=groupArr.substring(1)%>">
									<%	}// if%>  
								</tbody>
							</table>
						</div>
						
						<% if((ck.chkNullString(request.getParameter("__shown"),"").equals("1"))&&(recCount>0)){%>
						<div class="center">		
							<a class="btn btn-primary" href="javascript:goConfirm1();" swlang code='SW012098'>Submit</a>	 				
						</div> 
						<%}%>
						<%=screen.endJSP()%>
					</div>
				</form>
				
			</div>
			<a href="#top" id="top-button">
				<i class="fa fa-angle-up"></i>
				<div class="top-word">Back to top</div>
			</a>
		</section>
		<jsp:include page="FOOTER.jsp" flush="true" />
	</body>
</html>