APP_EMV011_02.jsp 14.5 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
<%@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.*, com.csc.library.utilities.CscCalendar"%>
<%@page import="com.csc.library.session.*"%>
<%@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"%>
<%@ include file="../CHECKPROFILE.jsp" %>
<jsp:useBean id="APP_EMV011_02" class="com.csc.library.system.Task" scope="page" />
<% 
	
	APP_EMV011_02.setChannel(request, response);
	EmvHelpEntry screen = (EmvHelpEntry) APP_EMV011_02.process("EmvHelpEntry","APP_EMV011_01");
	CheckNull chk = new CheckNull();
	int maxline = 10;
	String filter = "";
	String apsassessy = "";
	String bu1 = "";
	String bu2 = "";
	String year ="";
	String emp_position = "";
	
	String filter_bu1 = "";
	String filter_bu2 = "";
	String filter_apsassessy = "";
	String filter_emp_position = "";

	filter_bu1 = " apsassessor = '"+screen.getUProfile().get("employeeid")+"' and astid = 'AP10'";
	filter_bu2 = " apsassessor = '"+screen.getUProfile().get("employeeid")+"' and astid = 'AP10'";
	filter_apsassessy = " apsassessor = '"+screen.getUProfile().get("employeeid")+"' and astid = 'AP10'";
	filter_emp_position = " apsassessor = '"+screen.getUProfile().get("employeeid")+"' and astid = 'AP10'";
	filter = " apsassessor = '"+screen.getUProfile().get("employeeid")+"' and astid = 'AP10'";

	String param_ = chk.chkNullString(request.getParameter("__param"));
	if(param_.equals("approve")){
		filter = " (apsassessor = '"+screen.getUProfile().get("employeeid")+"'  or apsapprove1 = '"+screen.getUProfile().get("employeeid")+"' or apsapprove2 = '"+screen.getUProfile().get("employeeid")+"') and astid = 'AP10' ";
		filter_bu1 = " (apsassessor = '"+screen.getUProfile().get("employeeid")+"'  or apsapprove1 = '"+screen.getUProfile().get("employeeid")+"' or apsapprove2 = '"+screen.getUProfile().get("employeeid")+"') and astid = 'AP10' ";
		filter_bu2 = " (apsassessor = '"+screen.getUProfile().get("employeeid")+"'  or apsapprove1 = '"+screen.getUProfile().get("employeeid")+"' or apsapprove2 = '"+screen.getUProfile().get("employeeid")+"') and astid = 'AP10' ";
		filter_apsassessy = " (apsassessor = '"+screen.getUProfile().get("employeeid")+"'  or apsapprove1 = '"+screen.getUProfile().get("employeeid")+"' or apsapprove2 = '"+screen.getUProfile().get("employeeid")+"') and astid = 'AP10' ";

		filter_emp_position =" (apsassessor = '"+screen.getUProfile().get("employeeid")+"'  or apsapprove1 = '"+screen.getUProfile().get("employeeid")+"' or apsapprove2 = '"+screen.getUProfile().get("employeeid")+"') and astid = 'AP10' ";
	}

	apsassessy = chk.chkNullString(request.getParameter("apsassessy")); 
    bu1 = chk.chkNullString(request.getParameter("bu1"));
    bu2 = chk.chkNullString(request.getParameter("bu2"));
	year  = chk.chkNullString(request.getParameter("__year"));
	emp_position = chk.chkNullString(request.getParameter("emp_position"));
	//out.println("apsassessy " + apsassessy + " bu1 " + bu1 + " bu2 " + bu2);
	if(!apsassessy.equals("")){
			filter += " and apsassessy = '"+apsassessy+"' ";
	}

	if(!bu1.equals("")){
				filter += " and bu1 = '"+bu1+"' ";
	}


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

	if(!year.equals("")){
				filter += " and apsid = '"+year+"' ";
	}	

	if(!emp_position.equals("")){
			filter += " and emp_position = '"+emp_position+"' ";
	}

	screen.setMaxLine(maxline);
	//out.println("filter  : " + filter);
	screen.getInquiry().setFilter(filter);
	screen.process();
	CscCalendar  c_year = new CscCalendar();
	
	//out.println(screen.getInquiry().getCurrentDbRecord().getChildTable());
	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("SW012381");
			setPageTitle(titlename);

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

			function goSearch(){
					with(document.cscform){	
						submit();
					}
			}

		</script>
		
		<section>
			<div class="container csc-content">
				<form name="cscform" class="form-horizontal" method="post" action="APP_EMV011_02.jsp">
					<input type="hidden" name="__screen"  value="APP_EMV011_02">
					<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="">
					<input type="hidden" name="isall" value="">
					<input type="hidden" name="__goPage" value="">
					<input type="hidden" name="__employeeid" value="">
					<input type="hidden" name="__param" value="<%=param_%>">
				
					<div class="csc-block">
						<div class="center">
							<h2 class="csc-block-head" swlang code='SW012381'>Subordinate Appraisal (KPI)</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>
									<%
										String tdesc = (screen.getUProfile().get("lang").equals("tha"))?"tdesc":"edesc";
										DataSet condition = new DataSet();
										condition.setDbName((String)screen.getUProfile().get("dbname")); 
										
										
										condition.setTableName("hapstran0");
										
										condition.setSql("select apsid,tdesc,edesc from hapstran0 where astid = 'AP10'");
										condition.initConnection(screen.getUProfile());

									%>
									<div class="col-md-2 col-sm-2 col-xs-2">
										<label class="control-label label-right" swlang code='SW012262'>Year of Apprasial</label>
									</div>

									<div class="col-md-2 col-sm-2 col-xs-2">
										<select class="form-control" name="__year">
											<option value="" selected swlang code='SW008544'>All</option>
											<%
												while(condition.next()){
											%>
											<option value="<%=condition.getString("apsid")%>" <% if(year.equals(condition.getString("apsid"))){ out.print(" selected "); } %> ><%=condition.getString(tdesc)%></option>			
											<%}%>
										</select>
									</div>
									<%	
										condition.setTableName("mbu1");
										condition.setSql(" select distinct bu1id as id, mbu1.tdesc as tdesc, mbu1.edesc as edesc from memployee inner join mbu1 on bu1id = bu1 "+
											" where employeeid in ("+" select apsassessy"+" from hapstran"+" where "+filter_bu1+")");
										condition.initConnection(screen.getUProfile());
									%>
									<%
									   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="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-2">
										<select class="form-control" name="bu1">
											<option value="" selected swlang code='SW008544'>All</option>
											<%
												while(condition.next()){
											%>
											<option value="<%=condition.getString("id")%>" <% if(bu1.equals(condition.getString("id"))){ out.print(" selected "); } %> ><%=condition.getString(tdesc)%></option>			
											<%}%>
										</select>
									</div>
								</div>
							</div>  <!-- End row -->
							
							<div class="row">
								<div class="form-group">
									<div class="col-md-1 col-sm-1 col-xs-1"></div>
									<%
										condition.setTableName("mposition");
										condition.setSql(
											" select distinct emp_position id, mposition.tdesc, mposition.edesc from memployee inner join mposition on positionid = emp_position "+
											" where emp_position in ("+" select emp_position"+" from hapstran"+" where "+filter_emp_position+")");
										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-2">
										<select class="form-control" name="emp_position">
											<option value="" selected swlang code='SW008544'>All</option>
											<%
												while(condition.next()){
											%>
											<option value="<%=condition.getString("id")%>" <% if(emp_position.equals(condition.getString("id"))){ out.print(" 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 hapstran"+" where "+filter_bu2+")");
										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-2">
										<select class="form-control" name="bu2">
											<option value="" selected swlang code='SW008544'>All</option>
											<%
												while(condition.next()){
											%>
												<option value="<%=condition.getString("id")%>" <% if(bu2.equals(condition.getString("id"))){ out.print(" selected "); } %>><%=condition.getString(tdesc)%></option>			
											<%}%>
										</select>
									</div>
								</div>
							</div> <!-- End row -->
							
							<div class="row">
								<div class="form-group">
									<div class="col-md-1 col-sm-1 col-xs-1"></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 hapstran"+" where  "+filter_apsassessy+" )");
										condition.initConnection(screen.getUProfile());
									%>
									<div class="col-md-2 col-sm-2 col-xs-2">
										<label class="control-label label-right" swlang code='SW000307'>Employee</label>
									</div>

									<div class="col-md-2 col-sm-2 col-xs-2">
										<select class="form-control" name="apsassessy">
											<option value="" selected swlang code='SW008544'>All</option>
											<%
												while(condition.next()){
											%>
											<option value="<%=condition.getString("id")%>" <% if(apsassessy.equals(condition.getString("id"))){ out.print(" selected "); } %>><%="["+condition.getString("id")+"] "+condition.getString(tdesc)%></option>
											<%
												}
												condition.closeConnection();
											%>		
										</select>
									</div>
								</div>
							</div> <!-- End row -->
						</div> <!-- End form-horizontal -->
						
						<div class="center">
							<a class="btn btn-primary" href="javascript:goSearch();" swlang code='SW003537'>Search</a>
						</div>
						
					</div> <!-- End csc-block -->
					
					
					<span class="detail-table">
						<span swlang code='SW001771'>Found Data</span> :&nbsp;&nbsp;<%= screen.getInquiry().recCount() %>&nbsp;
						<span swlang code='SW001780'>records</span> 
					</span>
					<span class="detail-table label-right">
						<span swlang code='SW001120'>Page</span> : <%=screen.getPageTagNew()%> 
					</span>
					
					
					<table class="table table-head table-hover table-bordered table-title-left">
						<thead>
							<tr>
								<th class="table-title" colspan=8>
									<%if(param_.equals("approve")){%>
									<label swlang code='SW012264'>Record Annual Assessment KPI</label>
									<%}else {%>
									<label swlang code='SW012263'>History of Assess subordinates</label>
									<%}%>
								</th>
							</tr>
							<tr>
								<th swlang code='SW000193'>Seq</th>
								<th swlang code='SW000013'>Score</th>
								<th swlang code='SW000021'>Assessy</th>
								<th><%=mbu.getField("bu1").getDescription()%></th>
								<th><%=mbu.getField("bu2").getDescription()%></th>
								<th swlang code='SW000057'>Position</th>
								<th swlang code='SW000230'>Service Year</th>
								<th swlang code='SW000172'>Age</th>
							</tr>
						</thead>
						<tbody>
							<%
								String goPage = chk.chkNullString(request.getParameter("__goPage"),"+0");
								String page_ = goPage.substring(goPage.indexOf("+")+1,goPage.length());
								int numberPage = Integer.parseInt(page_);
								//out.println("numberPage "  + numberPage);
								int inc=1;
								int inc_cout = 1;
								if(numberPage > 1){
									inc_cout = maxline * (numberPage-1);
									inc += inc_cout;
								}
								while(screen.nextRec()){
							%>
							<tr>
								<td><center><%=inc%></center></td>
								<td><%=screen.getString("APSASSSOURCE")%></div></td>
								<td><%=screen.getString("SIMEMP","fullname")%></td>
								<td><%=screen.getString("mbu1","tdesc")%></td>
								<td><%=screen.getString("mbu2","tdesc")%></td>
								<td><%=screen.getString("mposition","tdesc")%></td>
								<% String[] y = screen.getDataLabel("simemp","empworkages").split(" "); %>
								<td><%=y[0] %>&nbsp;<label swlang code='SW000717'>Year</label></td>
								<td><%=screen.getString("SIMEMP","empages")%></td>
							</tr>
							<%
									inc++;
							}%>
						</tbody>
					</table>
				</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>