<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%@ page contentType="text/html; charset=UTF-8"%>
<%@ page import="com.csc.library.entry.*,com.csc.library.system.*,com.csc.library.session.*,com.csc.library.utilities.*,java.text.DecimalFormat"%>
<%@ page import="java.util.*,java.io.*,java.sql.*"%>
<%@ page import="java.text.SimpleDateFormat" %>
<%@ page import="java.util.Locale" %>
<%@ page import="java.util.Date" %>
<%
	CheckNull chk = new CheckNull();
	CscCalendar c = new CscCalendar();
	UProfile up = null;

	if (session !=null){
		up = (UProfile)session.getAttribute("userprofile");
	}

  DecimalFormat dmfm1 = new DecimalFormat("#,##0.00");

	String cmd = chk.chkNullString(request.getParameter("__cmd"));
	String bu1id =chk.chkNullString(request.getParameter("__bu1"));
	String bu2id =chk.chkNullString(request.getParameter("__bu2"));
	String bu3id =chk.chkNullString(request.getParameter("__bu3"));
	String bu4id =chk.chkNullString(request.getParameter("__bu4"));
	String bu5id =chk.chkNullString(request.getParameter("__bu5"));
	String apsassessy =chk.chkNullString(request.getParameter("__employeeid"));
	String apsid =chk.chkNullString(request.getParameter("__apsid"));
	String isprocess =chk.chkNullString(request.getParameter("__isprocess"));
	String apsyear =chk.chkNullString(request.getParameter("__apsyear"));
	String filter = "1=1";

	if( !apsid.equals("") ){
		filter += " and apsid = '"+ apsid+ "'";
	}
	if( !bu1id.equals("") ){
		filter += " and bu1 = '"+ bu1id+ "'";
	}
	if( !bu2id.equals("") ){
		filter += " and bu2 = '"+ bu2id+ "'";
	}
	if( !bu3id.equals("") ){
		filter += " and bu3 = '"+ bu3id+ "'";
	}
	if( !bu4id.equals("") ){
		filter += " and bu4 = '"+ bu4id+ "'";
	}
	if( !bu5id.equals("") ){
		filter += " and bu5 = '"+ bu5id+ "'";
	}
	if( !apsassessy.equals("") ){
		filter += " and apsassessy = '"+ apsassessy+ "'";
	}
	filter +="and apsyear = '"+apsyear+"'";

	DbRecord dbrec = new InitialRecord(up).getDbRecord("memployee");
	dbrec.setColumn("*");

%>

<html ng-app="myHR">
	<head>
		<title></title>
		<meta http-equiv="Content-Type" content="text/html; charset=TIS-620">
		<link href="../CSS/TISCO.css" rel="stylesheet" type="text/css">
		<script language="JavaScript" src="../JS/SCREEN.js"></script>
		<SCRIPT TYPE='text/JavaScript' SRC='../JS/DATEINPUT.js'></SCRIPT>
		<SCRIPT TYPE='text/JavaScript' SRC='../JS/VIEWCALENDAR.js'></SCRIPT>
		<script type="text/javascript" src="../JS/jquery-2.1.3.min.js"></script>
		<script type="text/javascript" src="../JS/angular-1.3.15/angular.js"></script>
		<script type="text/javascript" src="../JS/ANGULAR/SCREEN_ANGULAR.js"></script>
		<script language="javascript">setLang('<%=up.get("lang")%>');</script>
		<script language="JavaScript" type="text/JavaScript">
			function goHelp(helpName,inputName){
				var helpReturn;
				if(inputName=="__branch" ){
					helpReturn="__branch:branchid,__branch_desc:tdesc";
				}else if(inputName=="__bu1" ){
					helpReturn="__bu1:bu1id,__bu1_desc:tdesc";
				}else if(inputName=="__bu2" ){
					helpReturn="__bu2:bu2id,__bu2_desc:tdesc";
				}else if(inputName=="__bu3" ){
					helpReturn="__bu3:bu3id,__bu3_desc:tdesc";
				}else if(inputName=="__bu4" ){
					helpReturn="__bu4:bu4id,__bu4_desc:tdesc";
				}else if(inputName=="__bu5" ){
					helpReturn="__bu5:bu5id,__bu5_desc:tdesc";
				}else if(inputName=="__employeeid" ){
					helpReturn="__employeeid:employeeid,__employeeid_desc:fullname";
				}else if(inputName=="__shift" ){
					helpReturn="__shift:time0id,__shift_desc:tdesc";
				}else if(inputName=="__salatype" ){
					helpReturn="__salatype:codeid,__salatype_desc:tdesc";
				}else if(inputName=="__emp_type" ){
					helpReturn="__emp_type:codeid,__emp_type_desc:tdesc";
				}else if(inputName=="__apsid"){
					helpReturn="__apsid:apsid,__apsid_desc:tdesc";
				}

				linkHelp_Return(helpName, helpReturn);
			}

			function back(unit){
				with(window.opener.document.cscform){
					locateId.value =unit;
				}
				window.close();
			}

			function GoExport(){
				with(document.cscform){
					// alert(__filter.value);
					var param = "APSR010_EXP.jsp?__filter="+__filter.value;
					window.open(param);
				}
			}

			function GoProcess(){
				with( document.cscform){
          __cmd.value = "search"
          __isprocess.value = "1"
          submit();
				}
			}

			// Script for list *********************************

			function goHelp2(helpName,inputName,listName){
				var fixCon = "";
				var helpReturn;
				var key;
				var tdesc="tdesc",edesc="edesc";

				if (inputName=="aps" ) {
					helpReturn="aps";
					key="apsid";
				}else if (inputName=="pl" ) {
					helpReturn="pl";
					key="plid";
				}

				with(document.cscform){
					var param="PRU086.jsp?__helpName="+helpName+"&__helpReturn="+helpReturn
					+"&__pageCall="+__screen.value+"&__fixCon="+fixCon+"&__checkVerify=off"
					+"&__listName="+listName+"&__key="+key+"&__tdesc="+tdesc+"&__edesc="+edesc+"&__astype="+__astypvalue;
					window.open(param,"Help","left=50,top=70,width=920,height=680,toolbar=no,status=yes,scrollbars=yes,resizable=yes");
				}
			}

			function findKey(objOption,myList){
				//alert("in findKey:>"+objOption+":"+myList);
				for ( var j = 0 ; j < objOption.length; j++ ) {
					for(var i=0;i < myList.length;i++){
						if(objOption[j].value == myList.options[i].value){
							alert(myList.options[i].value+" "+MyCode[83]);
							return true;
						}//if
					}//for
				}	//for
				return false;
			}

			function listDblClick(objmyList){
				for(i=objmyList.length;i > 0;i--){
					if(objmyList.options[i-1].selected==true){
						bCon=confirm(MyCode[84]+" "+objmyList.options[i-1].text+" ?");
						if (bCon==true){
							objmyList.options[i-1]  = null;
						}
					}
				}
			}

			function addOption(objOption, objList=false) {
				addToOption(objOption,objList) ;
			}

			function addToOption(objOption,destList) {
				//alert(objOption+":"+destList);
			  	var lengthAll = parseInt(objOption.length)+parseInt(destList.options.length);
				newDestList = new Array(lengthAll);
				var clen=0;
				for(len=0; len<destList.options.length; len++) {
					if (destList.options[len] != null) {
						newDestList[ len ] = new Option( destList.options[ len ].text, destList.options[ len ].value, destList.options[ len ].defaultSelected, destList.options[ len ].selected );
						clen++;
					}
				}
				for ( var j = 0 ; j < objOption.length; j++ ) {
					if ( objOption[ j ] != null ) {
						newDestList[ clen ] = objOption[ j ];
						clen++;
					}
				}
				//newDestList.sort( compareOptionValues );
				for( var i = destList.options.length - 1; i >= 0; i-- )  {
					if ( destList.options[i] != null  ) {
						destList.options[i]  = null;
					}
				}
				for ( var j = 0; j < newDestList.length; j++ )  {
					if ( newDestList[ j ] != null ) {
						destList.options[ j ] =new Option(newDestList[ j ].text,newDestList[ j ].value);
					}
				}
			} // End of addToOption

		</script>
	</head>
	<%
		String helpReturn="";
		if(request.getParameter("__helpReturn")!=null){
		  helpReturn=request.getParameter("__helpReturn");
		}
		String fieldSearch="";
		if(request.getParameter("__fieldSearch")!=null){
		  fieldSearch=request.getParameter("__fieldSearch");
		}
	%>
	<body leftmargin="0" topmargin="0">
		<form name="cscform" method="post" action="APSR010.jsp">
			<!----------BEGIN CSC INITIAL ZONE ------------------------>
			<%//=screen.InitialVariable()%>
			<!----------END CSC INITIAL ZONE -------------------------->
			<input type="hidden" name="__cmd" value="">
			<input type="hidden" name="__screen" value="APSR010">
			<input type="hidden" name="__help" value="">
			<input type="hidden" name="__goPage" value="">
			<input type="hidden" name="__language" value="<%=up.get("lang")%>">
			<input type="hidden" name="__orderBy" value="<%=request.getParameter("__orderBy")%>">
			<input type="hidden" name="__helpReturn" value="<%=helpReturn%>">
			<input type="hidden" name="__fieldSearch" value="<%=fieldSearch%>">
			<input type="hidden" name="__helpName" value="<%=request.getParameter("__helpName")%>">
			<input type="hidden" name="__pageCall" value="<%=request.getParameter("__screen")%>">
			<input type="hidden" name="__fixCon" value="<%=request.getParameter("__fixCon")%>">
			<input type="hidden" name="__astype" value="AP10">
			<input type="hidden" name="__export" value="">
			<input type="hidden" name="__isprocess" value="0">
			<input type="hidden" name="__filter" value="<%=filter%>">
			<script language="javascript">getInputFormatDate()</script>

			<br>
			<div align="center">
				<table class="large" cellpadding="0"  cellspacing="1"  >
					<tr>
						<td  colspan=2 class="header">APSR010,รายงานสรุปการประเมินประจำปี</td>
					</tr>
					<tr>
						<td colspan=2>
							<table border="0" cellpadding="0" cellspacing="1"   align="center" class="largest">
								<tr>
									<td colspan=2 class="blankspace"></td>
								</tr>

								<!--
								<tr>
									<td width="30%" align="right" swlang code="SW000038">เลขที่เอกสาร</td>
									<td>
											<select name="apsidList" size="20" multiple class="large" style="width:425; height:60" onDblClick="listDblClick(this.form.apsidList);"></select>
											<A style="vertical-align: top;" href="javascript: goHelp2('TAPSTRAN0HELP','aps','apsidList');"  onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('__apsid','','../IMAGES/BUTTON/SWAP/SEARCH_SWAP20.gif',1)"><img style="vertical-align: top;" src="../IMAGES/BUTTON/MAIN/SEARCH20.gif" alt="SEARCH" name="__apsid" width="20" height="20" border="0" align="absmiddle"  ></a>
									</td>
								</tr>
								<tr>
									<td width="30%" align="right"><script language="javascript">swapLang("Pl")</script>&nbsp;</td>
									<td>
											<select name="plList" size="20" multiple class="large" style="width:425; height:60" onDblClick="listDblClick(this.form.plList);"></select>
											<A style="vertical-align: top;" href="javascript: goHelp2('MPERSONALLEVELHELP','pl','plList');"  onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('__plid','','../IMAGES/BUTTON/SWAP/SEARCH_SWAP20.gif',1)"><img style="vertical-align: top;" src="../IMAGES/BUTTON/MAIN/SEARCH20.gif" alt="SEARCH" name="__plid" width="20" height="20" border="0" align="absmiddle"  ></a>
									</td>
								</tr>
								-->

								<tr>
									<td width="30%" align="right" swlang code="SW012262">Year of Appraisal</td>
									<td width="70%">
										<input type="number" name="__apsyear" value="<%=chk.chkNullString(request.getParameter("__apsyear"),String.valueOf(c.getYear())) %>">
									</td>
								</tr>
								<tr>
									<td width="30%" align="right" swlang code="SW000038">เลขที่เอกสาร</td>
									<td width="70%">
										<input type="text" name="__apsid" size="20" value="<%=chk.chkNullString(request.getParameter("__apsid"))%>" onkeypress="chkSpecialKey(event);" onkeyup="sysIsEdit();" onblur="trimValue(this);" onfocus="this.select();" >&nbsp;
										<a href="javascript:goHelp('TAPSTRAN0HELP','__apsid');" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('__apsid_image','','../IMAGES/BUTTON/SWAP/SEARCH_SWAP20.gif',1)">
										<img src="../IMAGES/BUTTON/MAIN/SEARCH20.gif" alt="SEARCH" name="__apsid_image" width="20" height="20" border="0" align="absmiddle"></a>&nbsp;&nbsp;<input type="text" size="30" name="__apsid_desc" value="<%=chk.chkNullString(request.getParameter("__apsid_desc"))%>" readonly class="diabled">
									</td>
								</tr>

								<tr>
									<td width="30%" align="right"><script language="javascript">swapLang("Employeeid")</script>&nbsp;</td>
									<td width="70%">
										<input type="text" name="__employeeid" size="20" value="<%=chk.chkNullString(request.getParameter("__employeeid"))%>" onkeypress="chkSpecialKey(event);" onkeyup="sysIsEdit();" onblur="trimValue(this);" onfocus="this.select();" >&nbsp;
										<a href="javascript:goHelp('MEMPLOYEEHELP','__employeeid');" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('__employeeid_image','','../IMAGES/BUTTON/SWAP/SEARCH_SWAP20.gif',1)">
										<img src="../IMAGES/BUTTON/MAIN/SEARCH20.gif" alt="SEARCH" name="__employeeid_image" width="20" height="20" border="0" align="absmiddle"></a>&nbsp;&nbsp;<input type="text" size="30" name="__employeeid_desc" value="<%=chk.chkNullString(request.getParameter("__employeeid_desc"))%>" readonly class="diabled">
									</td>
								</tr>
								<tr>
									<td width="30%" align="right"><%=dbrec.getField("bu1").getDescription()%>&nbsp;</td>
									<td width="70%">
										<input type="text" name="__bu1" size="20" maxlength="5" value="<%=chk.chkNullString(request.getParameter("__bu1"))%>" onkeypress="chkSpecialKey(event);" onkeyup="sysIsEdit();" onblur="trimValue(this);" onfocus="this.select();" alt="หน่วยงานระดับ">&nbsp;
										<a href="javascript:goHelp('MBU1HELP','__bu1');" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('__bu1_image','','../IMAGES/BUTTON/SWAP/SEARCH_SWAP20.gif',1)">
										<img src="../IMAGES/BUTTON/MAIN/SEARCH20.gif" alt="SEARCH" name="__bu1_image" width="20" height="20" border="0" align="absmiddle"></a>&nbsp;&nbsp;<input type="text" size="30" name="__bu1_desc" value="<%=chk.chkNullString(request.getParameter("__bu1_desc"))%>" readonly class="diabled">
									</td>
								</tr>
								<tr>
									<td width="30%"  align="right"><%=dbrec.getField("bu2").getDescription()%>&nbsp;</td>
										<td width="70%">
										<input type="text" name="__bu2" size="20" maxlength="5" value="<%=chk.chkNullString(request.getParameter("__bu2"))%>" onkeypress="chkSpecialKey(event);" onkeyup="sysIsEdit();" onblur="trimValue(this);" onfocus="this.select();" alt="หน่วยงานระดับ">&nbsp;
										<a href="javascript:goHelp('MBU2HELP','__bu2');" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('__bu2_image','','../IMAGES/BUTTON/SWAP/SEARCH_SWAP20.gif',1)">
										<img src="../IMAGES/BUTTON/MAIN/SEARCH20.gif" alt="SEARCH" name="__bu2_image" width="20" height="20" border="0" align="absmiddle"></a>&nbsp;&nbsp;<input type="text" size="30" name="__bu2_desc" value="<%=chk.chkNullString(request.getParameter("__bu2_desc"))%>" readonly class="diabled">
									</td>
								</tr>
								<tr>
									<td width="30%"  align="right"><%=dbrec.getField("bu3").getDescription()%>&nbsp;</td>
									<td width="70%">
										<input type="text" name="__bu3" size="20" maxlength="5" value="<%=chk.chkNullString(request.getParameter("__bu3"))%>" onkeypress="chkSpecialKey(event);" onkeyup="sysIsEdit();" onblur="trimValue(this);" onfocus="this.select();" alt="หน่วยงานระดับ">&nbsp;
										<a href="javascript:goHelp('MBU3HELP','__bu3');" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('__bu3_image','','../IMAGES/BUTTON/SWAP/SEARCH_SWAP20.gif',1)">
											<img src="../IMAGES/BUTTON/MAIN/SEARCH20.gif" alt="SEARCH" name="__bu3_image" width="20" height="20" border="0" align="absmiddle"></a>&nbsp;&nbsp;<input type="text" size="30" name="__bu3_desc" value="<%=chk.chkNullString(request.getParameter("__bu3_desc"))%>" readonly class="diabled">
									</td>
								</tr>
								<tr>
									<td width="30%"  align="right"><%=dbrec.getField("bu4").getDescription()%>&nbsp;</td>
									<td width="70%">
										<input type="text" name="__bu4" size="20" maxlength="5" value="<%=chk.chkNullString(request.getParameter("__bu4"))%>" onkeypress="chkSpecialKey(event);" onkeyup="sysIsEdit();" onblur="trimValue(this);" onfocus="this.select();" alt="หน่วยงานระดับ">&nbsp;
										<a href="javascript:goHelp('MBU4HELP','__bu4');" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('__bu4_image','','../IMAGES/BUTTON/SWAP/SEARCH_SWAP20.gif',1)">
											<img src="../IMAGES/BUTTON/MAIN/SEARCH20.gif" alt="SEARCH" name="__bu4_image" width="20" height="20" border="0" align="absmiddle"></a>&nbsp;&nbsp;<input type="text" size="30" name="__bu4_desc" value="<%=chk.chkNullString(request.getParameter("__bu4_desc"))%>" readonly class="diabled">
										</td>
								</tr>
								<tr>
									<td width="30%"  align="right"><%=dbrec.getField("bu5").getDescription()%>&nbsp;</td>
									<td width="70%">
										<input type="text" name="__bu5" size="20" maxlength="5" value="<%=chk.chkNullString(request.getParameter("__bu5"))%>" onkeypress="chkSpecialKey(event);" onkeyup="sysIsEdit();" onblur="trimValue(this);" onfocus="this.select();" alt="หน่วยงานระดับ">&nbsp;
										<a href="javascript:goHelp('MBU5HELP','__bu5');" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('__bu5_image','','../IMAGES/BUTTON/SWAP/SEARCH_SWAP20.gif',1)">
											<img src="../IMAGES/BUTTON/MAIN/SEARCH20.gif" alt="SEARCH" name="__bu5_image" width="20" height="20" border="0" align="absmiddle"></a>&nbsp;&nbsp;<input type="text" size="30" name="__bu5_desc" value="<%=chk.chkNullString(request.getParameter("__bu5_desc"))%>" readonly class="diabled">
										</td>
									</tr>
									<tr>
										<td colspan=2 align="center">
											<a href="javascript:GoProcess();"><img src="../IMAGES/BUTTON/SEARCH.gif"border=0/></a>
										</td>
									</tr>
								</tr>
							</table>

							<%
								if(isprocess.equals("1")){
							%>
							<table class="maxsize" border="1" cellpadding="0" cellspacing="1" cols=11 bgcolor="#CCCCCC">
								<tr>
									<td class="row1" rowspan=2><div align="center" swlang code="SW000193">ลำดับที่</div></td>
									<td class="row1" rowspan=2><div align="center" swlang code="SW000274">รหัสพนักงาน</div></td>
									<td class="row1" rowspan=2><div align="center" swlang code="SW001984">ชื่อพนักงาน</div></td>
									<td class="row1" rowspan=2><div align="center" swlang code="SW007358">สถานที่ทำงาน</div></td>
									<td class="row1" rowspan=2><div align="center"><b><%=dbrec.getField("bu4").getDescription()%></b></div></td>
									<td class="row1" rowspan=2><div align="center" swlang code="SW000057">ตำแหน่ง</div></td>
									<td class="row1" rowspan=2><div align="center" swlang code="SW011749">วันที่เริ่มทำงาน</div></td>
									<td class="row1" rowspan=2><div align="center" swlang code="SW000739">อายุงาน</div></td>
									<td class="row1" colspan=2><div align="center" swlang code="SW012602">ส่วนที่ 1</div></td>
									<td class="row1" colspan=2><div align="center" swlang code="SW012603">ส่วนที่ 2</div></td>
									<td class="row1" colspan=2><div align="center" swlang code="SW012628">ส่วนที่ 3</div></td>
									<td class="row1" colspan=2><div align="center" swlang code="SW012629">ส่วนที่ 4</div></td>
									<td class="row1" rowspan=2><div align="center" swlang code="SW000068">คะแนนรวม</div></td>
									<td class="row1" rowspan=2><div align="center" swlang code="SW000069">เกรด</div></td>
								</tr>
								<tr>
									<td class="row1" ><div align="center">คะแนนเต็ม</div></td>
									<td class="row1" ><div align="center">คะแนนได้</div></td>
									<td class="row1" ><div align="center">คะแนนเต็ม</div></td>
									<td class="row1" ><div align="center">คะแนนได้</div></td>
									<td class="row1" ><div align="center">คะแนนเต็ม</div></td>
									<td class="row1" ><div align="center">คะแนนได้</div></td>
									<td class="row1" ><div align="center">คะแนนเต็ม</div></td>
									<td class="row1" ><div align="center">คะแนนได้</div></td>
								</tr>
								<%
									int seq = 0;
									double scoreop1 = 0;
									double scoreop2 = 0;
									double scoreop3 = 0;
									double scoreop4 = 0;
									double totalscore = 0;
									String grade = "C";
									String apsid2 = "";
									int fullscoreop1 = 0;
									int fullscoreop2 = 0;
									int fullscoreop3 = 0;
									int fullscoreop4 = 0;

									DbInquiry inqtap = new InitialInquiry(up).getDbInquiry("tapstran");
									DbInquiry inqemp = new InitialInquiry(up).getDbInquiry("memployee");
									DbInquiry inqbu4 = new InitialInquiry(up).getDbInquiry("mbu4");
									DbInquiry inqpos = new InitialInquiry(up).getDbInquiry("mposition");
									DbInquiry inqkpi = new InitialInquiry(up).getDbInquiry("mkpiscore");
									DbInquiry inqworkarea = new InitialInquiry(up).getDbInquiry("mworkarea");

									inqkpi.setColumn("*");

									inqemp.setColumn("*");
									inqemp.putChild(inqbu4);
									inqemp.putChild(inqpos);
									inqemp.putChild(inqworkarea);

									//out.print(filter);

									inqtap.setColumn("*");
									inqtap.setFilter(filter);
									inqtap.setOrderBy("apsassessy");
									inqtap.putChild(inqemp);
									inqtap.refresh();
									while(inqtap.next()){
										seq++;

										scoreop1 = (chk.chkNullStringToDouble(inqtap.getString("apsscore1")) + chk.chkNullStringToDouble(inqtap.getString("apsscore3")) + chk.chkNullStringToDouble(inqtap.getString("apsscore2")) + chk.chkNullStringToDouble(inqtap.getString("apsscore4"))) /2 ;
										scoreop2 = (chk.chkNullStringToDouble(inqtap.getString("apsscore5")) + chk.chkNullStringToDouble(inqtap.getString("apsscore_last"))) /2 ;
										scoreop3 = (chk.chkNullStringToDouble(inqtap.getString("apssumscore3")) + chk.chkNullStringToDouble(inqtap.getString("apssumscore4"))) /2 ;
										scoreop4 = chk.chkNullStringToDouble(inqtap.getString("other1"));

										totalscore = scoreop1 + scoreop2 + scoreop3 + scoreop4;

                    if(totalscore >= 85){
                      grade = "A";
                    }else if(totalscore >= 80){
                      grade = "A-";
                    }else if(totalscore >= 75){
                      grade = "B";
                    }else if(totalscore >= 65){
                      grade = "B-";
                    }else if(totalscore < 65){
                      grade = "C";
                    }

                    apsid2 = inqtap.getString("apsid");

                    if(apsid2.indexOf("LOW1")>-1){

                      inqkpi.setFilter("kpisid ='OP1'");
                      inqkpi.refresh();
                      inqkpi.next();
                      fullscoreop1 = chk.chkNullStringToInt(inqkpi.getString("score_low1"));

                      inqkpi.setFilter("kpisid ='OP2'");
                      inqkpi.refresh();
                      inqkpi.next();
                      fullscoreop2 = chk.chkNullStringToInt(inqkpi.getString("score_low1"));

                      inqkpi.setFilter("kpisid ='OP3'");
                      inqkpi.refresh();
                      inqkpi.next();
                      fullscoreop3 = chk.chkNullStringToInt(inqkpi.getString("score_low1"));

                      inqkpi.setFilter("kpisid ='OP4'");
                      inqkpi.refresh();
                      inqkpi.next();
                      fullscoreop4 = chk.chkNullStringToInt(inqkpi.getString("score_low1"));

                    }else if(apsid2.indexOf("LOW2")>-1){

                      inqkpi.setFilter("kpisid ='OP1'");
                      inqkpi.refresh();
                      inqkpi.next();
                      fullscoreop1 = chk.chkNullStringToInt(inqkpi.getString("score_low2"));

                      inqkpi.setFilter("kpisid ='OP2'");
                      inqkpi.refresh();
                      inqkpi.next();
                      fullscoreop2 = chk.chkNullStringToInt(inqkpi.getString("score_low2"));

                      inqkpi.setFilter("kpisid ='OP3'");
                      inqkpi.refresh();
                      inqkpi.next();
                      fullscoreop3 = chk.chkNullStringToInt(inqkpi.getString("score_low2"));

                      inqkpi.setFilter("kpisid ='OP4'");
                      inqkpi.refresh();
                      inqkpi.next();
                      fullscoreop4 = chk.chkNullStringToInt(inqkpi.getString("score_low2"));

                    }else if(apsid2.indexOf("UP1")>-1){

                      inqkpi.setFilter("kpisid ='OP1'");
                      inqkpi.refresh();
                      inqkpi.next();
                      fullscoreop1 = chk.chkNullStringToInt(inqkpi.getString("score_up1"));

                      inqkpi.setFilter("kpisid ='OP2'");
                      inqkpi.refresh();
                      inqkpi.next();
                      fullscoreop2 = chk.chkNullStringToInt(inqkpi.getString("score_up1"));

                      inqkpi.setFilter("kpisid ='OP3'");
                      inqkpi.refresh();
                      inqkpi.next();
                      fullscoreop3 = chk.chkNullStringToInt(inqkpi.getString("score_up1"));

                      inqkpi.setFilter("kpisid ='OP4'");
                      inqkpi.refresh();
                      inqkpi.next();
                      fullscoreop4 = chk.chkNullStringToInt(inqkpi.getString("score_up1"));

                    }else if(apsid2.indexOf("UP2")>-1){

                      inqkpi.setFilter("kpisid ='OP1'");
                      inqkpi.refresh();
                      inqkpi.next();
                      fullscoreop1 = chk.chkNullStringToInt(inqkpi.getString("score_up2"));

                      inqkpi.setFilter("kpisid ='OP2'");
                      inqkpi.refresh();
                      inqkpi.next();
                      fullscoreop2 = chk.chkNullStringToInt(inqkpi.getString("score_up2"));

                      inqkpi.setFilter("kpisid ='OP3'");
                      inqkpi.refresh();
                      inqkpi.next();
                      fullscoreop3 = chk.chkNullStringToInt(inqkpi.getString("score_up2"));

                      inqkpi.setFilter("kpisid ='OP4'");
                      inqkpi.refresh();
                      inqkpi.next();
                      fullscoreop4 = chk.chkNullStringToInt(inqkpi.getString("score_up2"));

                    }

								%>
								<tr>
									<td><center><%=seq%></center></td>
									<td><center><%=inqtap.getString("apsassessy")%></center></td>
									<td><%=inqtap.getString("memployee","fullname")%></td>
									<td><%=inqtap.getString("mworkarea","tdesc")%></td>
									<td><%=inqtap.getString("mbu4","tdesc")%></td>
									<td><%=inqtap.getString("mposition","tdesc")%></td>
									<td><%=new CscCalendar(inqtap.getString("memployee","startdate")).getDDMMYYYY()%></td>
									<td><%=inqtap.getString("memployee","empworkages")%></td>
									<td><center><b><%=fullscoreop1%></b></center></td>
									<td><center><%=dmfm1.format(scoreop1)%></center></td>
									<td><center><b><%=fullscoreop2%></b></center></td>
									<td><center><%=dmfm1.format(scoreop2)%></center></td>
									<td><center><b><%=fullscoreop3%></b></center></td>
									<td><center><%=dmfm1.format(scoreop3)%></center></td>
									<td><center><b><%=fullscoreop4%></b></center></td>
									<td><center><%=dmfm1.format(scoreop4)%></center></td>
									<td><center><%=dmfm1.format(totalscore)%></center></td>
									<td><center><b><%=grade%></b></center></td>
								</tr>

								<%
									}
								%>
						</table>
						<%
							}
						%>
					</td>
				</tr>
				<tr>
					<td colspan=2 class="blankspace"></td>
				</tr>
				<%
					if(isprocess.equals("1")){
				%>
				<tr>
					<td colspan=2 align="center">
						<div class="button">
							<a href="javascript:GoExport();"><img src="../IMAGES/BUTTON/EXPORT.gif" border=0 /></a>
						</div>
					</td>
				</tr>
				<%
					}
				%>
				<tr>
					<td colspan=2 class="blankspace"></td>
				</tr>
				<tr bordercolor="0069B3">
					<td colspan=2 class="bottom"></td>
				</tr>
			</table>
		</form>
	</body>
</html>
