APP_EMV005_1.jsp 17.6 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
<%@page contentType="text/html; charset=UTF-8"%>
<%@page import="com.csc.library.entry.UIManager, com.csc.library.utilities.CheckNull"%>
<%@page import="com.csc.library.entry.HelpEntry, com.csc.library.utilities.CscCalendar"%>
<%@page import="com.csc.library.session.DbInquiry, com.csc.library.session.InitialInquiry"%>
<%@page import="com.csc.library.database.DataSet, com.csc.library.components.ListBox, com.csc.library.report.ReportUDF"%>
<%@page import="com.csc.library.database.StaticProperties, com.csc.library.database.CscConnection,com.csc.library.database.*,com.csc.library.session.*"%>
<%@ include file="../CHECKPROFILE.jsp" %>

<jsp:useBean id="APP_EMV005_1" class="com.csc.library.system.Task" scope="page" />
<% 
	
	APP_EMV005_1.setChannel(request, response);
	HelpEntry screen = (HelpEntry) APP_EMV005_1.process("HelpEntry","APP_EMV005_1");
	CheckNull ck = new CheckNull(); 
	String employeeid = ck.chkNullString(request.getParameter("__employeeid"), screen.getUProfile().get("employeeid"));
	
	CscCalendar cDate = new CscCalendar();
	DbInquiry taps0 = new InitialInquiry(screen.getUProfile()).getDbInquiry("TAPSTRAN0");
	taps0.setColumn("apsid,apsperiodstart,apsperiodend");

	String f1="apsenddate >= '"+cDate.getYYYYMMDD()+"' and apsstartdate <= '"+cDate.getYYYYMMDD()+"'  and astid = 'AP10'";
	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+=")";}


	String desc ="tdesc";
	if(!screen.getUProfile().get("lang").equals("tha"))desc="edesc";

	String issearch = ck.chkNullString(request.getParameter("issearch"));
	String isall = ck.chkNullString(request.getParameter("isall"));
	String emp_position =  ck.chkNullString(request.getParameter("emp_position"));
	String bu1 =  ck.chkNullString(request.getParameter("bu1"));
	String bu2 =  ck.chkNullString(request.getParameter("bu2"));
	String empid =  ck.chkNullString(request.getParameter("employeeid"));
	String status =  ck.chkNullString(request.getParameter("status"),"all");
	String level =  ck.chkNullString(request.getParameter("level"));
	String filter = "";

	if(issearch.equals("1") && !isall.equals("1")){
		if(!emp_position.equals("")){	
			filter += "and emp_position = '"+emp_position+"' ";
		}
		if(!bu1.equals("")){	
			filter += "and bu1 = '"+bu1+"' ";
		}
		if(!bu2.equals("")){	
			filter += "and bu2 = '"+bu2+"' ";
		}
		if(!empid.equals("")){	
			filter += "and empid = '"+empid+"' ";
		}
		if(!filter.equals("")){
			filter = " and apsassessy in (select employeeid from memployee where companyid = '"+screen.getUProfile().get("companyid")+"' "+filter+")";
		}
	}

	String dbtype =  ((CscConnection) StaticProperties.myConnection.getConnection(screen.getUProfile().get("dbname"), screen.getUProfile())).getVendor();
%>
<!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("SW012367");
			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){
					issearch.value="1";
					isall.value="0";
					submit();
				}
			}
			function search(){
				with(document.cscform){
					issearch.value="1";
					isall.value="1";
					submit();
				}
			}
			function goASP(apsid,apsassessor,apsassessy,stat,lv){
				with(document.cscform){
					var isread = (stat=='A')?"1":"0";
					var page = (lv=='0')?"APP_EMV707":"APP_EMV707";
					var param=page+".jsp?apsid="+apsid+"&apsassessor="+apsassessor+"&apsassessy="+apsassessy+"&bpage="+__screen.value+"&ass_level="+lv+"&bu1=&bu2=&isread="+isread;	
					window.open(param,"Assess_Pages","left=150,top=150,width=1100,height=700,toolbar=no,status=yes,scrollbars=yes,resizable=yes");
				}
			}
			function calAge(strDate){
				var currentYear = parseInt(new Date().getYear());
				var birthdateYear = parseInt(strDate.substring(6,10));
				var age = currentYear-birthdateYear;
				document.write(age);
			}	

		</script>
		
		<section>
			<div class="container csc-content">
				<form name="cscform" class="form-horizontal" method="post" action="APP_EMV005_1.jsp">
					<input type="hidden" name="__screen"  value="APP_EMV005_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="issearch" value="<%=issearch%>">
					<input type="hidden" name="isall" value="<%=isall%>">
					<input type="hidden" name="__employeeid" value="<%=employeeid%>">
				
					<div class="csc-block">
						<div class="center">
							<h2 class="csc-block-head" swlang code='SW012367'>Subordinate Appraisal</h2>
						</div>
						<%
							DbInquiry memployee = new InitialInquiry(screen.getUProfile()).getDbInquiry("memployee");
							memployee.setColumn("employeeid,companyid,bu1,bu2,bu3,bu4,bu5");
							memployee.refresh();

							DbRecord mbu = memployee.getCurrentDbRecord();
						%>
					
						<div class="form-horizontal">
							<div class="row">
								<div class="form-group">
									<div class="col-md-1 col-sm-1 col-xs-1"></div>
									<% 
										String tdesc = (screen.getUProfile().get("lang").equals("tha"))?"tdesc":"edesc";
										DataSet condition = new DataSet();
										condition.setDbName((String)screen.getUProfile().get("dbname"));
										condition.setTableName("mposition");
										condition.setSql( " select distinct positionid id, mposition.tdesc, mposition.edesc from memployee inner join mposition on positionid = emp_position "+
											" where employeeid in ("+" select apsassessy"+" from tapstran"+
											" where  apsapprove1 = '"+employeeid+"' or apsapprove2 = '"+employeeid+"' "+
											" or apsapprove3 = '"+employeeid+"' or apsapprove4 = '"+employeeid+"' or apsapprove5 = '"+employeeid+"')"
										);

										condition.initConnection(screen.getUProfile());
									%>
									<div class="col-md-2 col-sm-2 col-xs-2">
										<label class="control-label label-right" swlang code='SW000057'>Position</label>
									</div>
									<div class="col-md-2 col-sm-2 col-xs-3">
										<select class="form-control" name="emp_position">
											<option value="" selected swlang code='SW008544'>All</option>
											<%
												while(condition.next()){
											%>
											<option value="<%=condition.getString("id")%>" <%=(emp_position.equals(condition.getString("id")))?"selected":""%>><%=condition.getString(tdesc)%></option>
											<%
												}
											%>	
										</select>
									</div>
									<%
										condition.setTableName("memployee");
										condition.setSql(	" select distinct employeeid id, fname"+((dbtype.equalsIgnoreCase("ORACLE")||dbtype.equalsIgnoreCase("PGSQL"))?"|| ' ' ||":"+' '+")+"lname tdesc, fname"+((dbtype.equalsIgnoreCase("ORACLE")||dbtype.equalsIgnoreCase("PGSQL"))?"|| ' ' ||":"+' '+")+"lname edesc from memployee "+
											" where employeeid in ("+" select apsassessy"+" from tapstran"+
											" where  apsapprove1 = '"+employeeid+"' or apsapprove2 = '"+employeeid+"' "+
											" or apsapprove3 = '"+employeeid+"' or apsapprove4 = '"+employeeid+"' or apsapprove5 = '"+employeeid+"')"
										);

										condition.initConnection(screen.getUProfile());
									%>
									<div class="col-md-2 col-sm-2 col-xs-2">
										<label class="control-label label-right" swlang code='SW000602'>Employee</label>
									</div>
									<div class="col-md-2 col-sm-2 col-xs-3">
										<select class="form-control" name="employeeid">
											<option value="" selected swlang code='SW008544'>All</option>
											<%
												while(condition.next()){
											%>
											<option value="<%=condition.getString("id")%>" <%=(empid.equals(condition.getString("id")))?"selected":""%>><%="["+condition.getString("id")+"] "+condition.getString(tdesc)%></option>
											<%
												}
												condition.closeConnection();
											%>		
										</select>
									</div>
								</div>
							</div>
							
							<div class="row">
								<div class="form-group">
									<div class="col-md-1 col-sm-1 col-xs-1"></div>
									<%
										condition.setTableName("mbu1");
										condition.setSql(
																
																" select distinct bu1id id, mbu1.tdesc, mbu1.edesc from memployee inner join mbu1 on bu1id = bu1 "+
																" where employeeid in ("+
																		" select apsassessy"+
																		" from tapstran"+
																		" where  apsapprove1 = '"+employeeid+"' or apsapprove2 = '"+employeeid+"' "+
																		" or apsapprove3 = '"+employeeid+"' or apsapprove4 = '"+employeeid+"' or apsapprove5 = '"+employeeid+"')"
																);

										condition.initConnection(screen.getUProfile());
									%>
									<div class="col-md-2 col-sm-2 col-xs-2">
										<label class="control-label label-right"><%=mbu.getField("bu1").getDescription()%></label>
									</div>
									<div class="col-md-2 col-sm-2 col-xs-3">
										<select class="form-control" name="bu1">
											<option value="" selected swlang code='SW008544'>All</option>
											<%
												while(condition.next()){
											%>
											<option value="<%=condition.getString("id")%>" <%=(bu1.equals(condition.getString("id")))?"selected":""%>><%=condition.getString(tdesc)%></option>
											<%
												}
											%>	
										</select>
									</div>
									<%
										condition.setTableName("mbu2");
										condition.setSql(
																
																" select distinct bu2id id, mbu2.tdesc, mbu2.edesc from memployee inner join mbu2 on bu2id = bu2 "+
																" where employeeid in ("+
																		" select apsassessy"+
																		" from tapstran"+
																		" where  apsapprove1 = '"+employeeid+"' or apsapprove2 = '"+employeeid+"' "+
																		" or apsapprove3 = '"+employeeid+"' or apsapprove4 = '"+employeeid+"' or apsapprove5 = '"+employeeid+"')"
																);

										condition.initConnection(screen.getUProfile());
									%>
									<div class="col-md-2 col-sm-2 col-xs-2">
										<label class="control-label label-right"><%=mbu.getField("bu2").getDescription()%></label>
									</div>
									<div class="col-md-2 col-sm-2 col-xs-3">
										<select class="form-control" name="bu2">
											<option value="" selected swlang code='SW008544'>All</option>
											<%
												while(condition.next()){
											%>
											<option value="<%=condition.getString("id")%>" <%=(bu2.equals(condition.getString("id")))?"selected":""%>><%=condition.getString(tdesc)%></option>
											<%
												}
											%>
										</select>
									</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" swlang code='SW001145'>Assess LV</label>
									</div>
									<div class="col-md-2 col-sm-2 col-xs-3">
										<select class="form-control" name="level">
											<option value="" selected swlang code='SW008544'>All</option>
											<option value="1" <%=(level.equals("1"))?"selected":""%>><span swlang code='SW001145'>Assess LV</span> 1</option>
											<option value="2" <%=(level.equals("2"))?"selected":""%>><span swlang code='SW001145'>Assess LV</span> 2</option>
											<option value="3" <%=(level.equals("3"))?"selected":""%>><span swlang code='SW001145'>Assess LV</span> 3</option>
											<option value="4" <%=(level.equals("4"))?"selected":""%>><span swlang code='SW001145'>Assess LV</span> 4</option>
											<option value="5" <%=(level.equals("5"))?"selected":""%>><span swlang code='SW001145'>Assess LV</span> 5</option>
										</select>
									</div>
									<%
										String sys_status[] = new ReportUDF().getSystemCode("APPSTATUS",screen.getUProfile().get("lang"));
									%>
									<div class="col-md-2 col-sm-2 col-xs-2">
										<label class="control-label label-right" swlang code='SW000019'>Status</label>
									</div>
									<div class="col-md-2 col-sm-2 col-xs-3">
										<select class="form-control" name="status">
											<option value="all" <%=(status.equals("all"))?"selected":""%> swlang code='SW008544'>All</option>
											<%
												String sysstatus[] = new ReportUDF().getSystemCode("APPSTATUS",screen.getUProfile().get("lang"));
												for(int i=0;i<sysstatus.length;i++){
											%>
											<option value="<%=sysstatus[i].split(",")[0]%>"  <%=(status.equals(sysstatus[i].split(",")[0]))?" selected":""%>><%=sysstatus[i].split(",")[1]%></option>
											<%		
												}
											%>
										</select>
									</div>
								</div>
							</div>
							<div class="center">
								<a class="btn btn-primary" href="javascript:fixSearch();" swlang code='SW003537'>Search</a>
								<a class="btn btn-primary" href="javascript:search();" swlang code='SW002000'>Show All</a>
							</div>
						</div>
					</div>
				
					<div class="table-responsive">	
						<table class="table table-head table-hover table-bordered table-title-left">
							<thead>
								<tr>
									<th class="table-title" colspan=6 swlang code='SW000530'>Apprisal Information</th> 
								</tr>
							</thead>
							<tbody>
								<tr>
									<th swlang code='SW000019'>Status</th>
									<th swlang code='SW001984'>Fullname</th>
									<th swlang code='SW000057'>Position</th>
									<th><%=mbu.getField("bu1").getDescription()%></th>
									<th><%=mbu.getField("bu2").getDescription()%></th>
									<th swlang code='SW000230'>Service Year</th>
								</tr>
								<%
									String field[] = {"apsapprove1","apsapprove2","apsapprove3","apsapprove4","apsapprove5"};
									String field_status[] = {"apsappstatus1","apsappstatus2","apsappstatus3","apsappstatus4","apsappstatus5"};
									String field_desc[] = {"Level_1","Level_2","Level_3","Level_4","Level_5"};
									int running = 0;
									loop_lv : for(int i=0; issearch.equals("1") && i<field.length; i++, running = 0){
											if(!isall.equals("1")){
											if(!level.equals("") && (Integer.parseInt(level)-1) != i){
												continue loop_lv;
											}
											if(!status.equals("") && !status.equals("all")){
												filter += " and "+field_status[i]+" = '"+status+"'";
											}
										}
										screen.inq.setFilter(dateExp+" and ("+field[i]+"='"+employeeid+"') "+filter);
										screen.inq.refresh();
										boolean hasdata = false;
										while(screen.nextRec()){
											hasdata = true;
											if(screen.inq.recNo()==1){
								%>
								<tr>
									<td colspan=6><span swlang code='SW001145'>Assess LV</span> <%=i+1%></td>
								</tr>
								<%
									}
								%>
							
								<tr>
									<td>
										<center>
											<%
												if((screen.getDataLabel(field_status[i]).equals(""))||(screen.getDataLabel(field_status[i]).equals("Q"))||(screen.getDataLabel(field_status[i]).equals("R"))){
											%>			
											<span class="week"><%=screen.inq.getCurrentDbRecord().getSystemCode(field_status[i])%></span>
											<%
												}else{
												if(screen.getDataLabel(field_status[i]).equals("A")){
											%>
											<span class="holiday"><%=screen.inq.getCurrentDbRecord().getSystemCode(field_status[i])%></span>
											<%
												}else{
											%>
												<%=screen.inq.getCurrentDbRecord().getSystemCode(field_status[i])%>
											<%
													}
												}
											%>
										</center>
									</td>
									<td>
										<%
											String cstat = ((i==0)?"apsstatus":field_status[i-1]);
											if(screen.getDataLabel(cstat).equals("A")){
										%>
										<a href="javascript:goASP('<%=screen.getDataLabel("APSID")%>','<%=screen.getDataLabel("APSASSESSOR")%>','<%=screen.getDataLabel("APSASSESSY")%>','<%=screen.getDataLabel(field_status[i])%>','<%=(i+1)%>');"><%=screen.getDataLabel("simemp","fullname")%></a>
										<%
											}else{
										%>
											<%=screen.getDataLabel("simemp","fullname")%>
										<%
											}
										%>
									</td>
									<td><%=screen.getDataLabel("mposition","tdesc")%></td>
									<td><%=screen.getDataLabel("mbu1","tdesc")%></td>
									<td><%=screen.getDataLabel("mbu2","tdesc")%></td>
									<%
										String[] y = screen.getDataLabel("simemp","empworkages").split(" ");	
									%>
									<td class="trash"><%=y[0] %>&nbsp;<span swlang code='SW000717'>Year</span></td>
								</tr>
								<%
									}
									if(hasdata){
								%>
							</tbody>
							<%
									}
								}
							%>		
						</table>
					</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>