<%@page contentType="text/html; charset=UTF-8"%>
<%@ page import="com.csc.library.entry.HelpEntry,com.csc.library.system.*,com.csc.library.utilities.*,com.csc.library.entry.*,com.csc.library.database.*,com.csc.library.session.*,com.csc.library.report.ReportUDF"  %>
<jsp:useBean id="AS_REP_02" class="com.csc.library.system.Task"  scope="request" />
<%AS_REP_02.setChannel(request, response);%>
<%HelpEntry screen = (HelpEntry) AS_REP_02.process("HelpEntry","AS_REP_02");%>
<%
     ThaiUtilities thaicode= new ThaiUtilities();
     CheckNull nu= new CheckNull();
     String fixcon=nu.chkNullString(request.getParameter("__fixCon"));
    if(fixcon.trim().length()>0){
			screen.process();
   }
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link href="../CSS/TISCO.css" rel="stylesheet" type="text/css">
<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 language="JavaScript" type="text/JavaScript">
<!--
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 MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function setmHelp(page,obj,obj1,obj2){
      with(document.cscform){
     if((__apsid1.value.length==0)||(__asid1.value.length==0)||(__labels.value.length==0)){
	       alert(MyCode[0]);
		}else{
			page=page+"?__labels="+__labels.value+"&__data0="+__data0.value+"&__data1="+__data1.value;
			__data2.value=page;
			showHelp(page);
		}
		}
}

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

function showHelp2(page){
	with(document.cscform){
			if(__apsid1.value.length==0){
			       alert(MyCode[43]);
			}else{
			       page+="?__fixCon=apsid='"+__apsid1.value+"'";
			      showHelp(page);
			}
	}
}

function checkAps(){
var fx="";
		with(document.cscform){
					if(__apsid1.value.length>0){
					     fx="  apsid ='"+__apsid1.value+"'";
					}
					if(fx.length>0){
					    fx+=" and ";
					}
					if(__asid1.value.length>0){
					     fx+="  asid ='"+__asid1.value+"'";
					}
					return fx;
		}
}

function checkSearch(){
 with(document.cscform){
				if((__apsid1.value.length==0)||(__asid1.value.length==0)){
					  alert(MyCode[0]);
					  return false;
				}else{
						 return true;
				}
	}
}

function setSearchby(){
var fixcon="";
	with(document.cscform){
		if (__valueSearch.value == "")	{
			return "";
		} else{
                fixcon= __searchBy.options[__searchBy.selectedIndex].value+__conSearch.options[__conSearch.selectedIndex].value+"'"+__valueSearch.value+"'";
		 return  fixcon;
		}
	}
}

function setOrderby(){
	with(document.cscform){
		__orderBy.value=__listOrder.options[__listOrder.selectedIndex].value;
	}
}

function setmSearch(){
	with(document.cscform){
	if(checkSearch()){
		   //setOrderby();
          __fixCon.value="";   		   
		 __fixCon.value+=setSearchby();
		 if(__fixCon.value.length>0){
		        __fixCon.value+="  and "
		 }
		  __fixCon.value+=checkAps();
			__cmd.value="search";
			submit();
			}
	}
}

//-->
</script>

</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onLoad="MM_preloadImages('../IMAGES/BUTTON/SWAP/HELP_SWAP20.gif','../IMAGES/BUTTON/SWAP/SEARCH_SWAP20.gif')">
<form name="cscform" method="post" >
  

<!----------BEGIN CSC INITIAL ZONE ------------------------>

<%=screen.InitialVariable()%>

<!----------END CSC INITIAL ZONE -------------------------->

<input type="hidden"name="__screen"  value="AS_REP_02">
  <input type="hidden" name="__help" value="">
  <input type="hidden" name="__cmd"  value="">
  <input type="hidden" name="__language" value="eng">
  <input type="hidden" name="__orderBy" value="">
  <input type="hidden" name="__tdesc" value="">
  <input type="hidden" name="__apsobjective" value="">
  <input type="hidden" name="__apsid" value="">
 <input type="hidden" name="__fixCon" value="">
  <br>
  <div align="center">
    <table  cellpadding="0"  cellspacing="0">
      <tr > 
        <td  class="header">AS_REP_02,
          <script language="javascript">swapLang('Result the evaluation by title');</script>
          &nbsp;</td></tr>
      <tr > 
        <td  colspan="2"> 
          <div align="center"> 
            <table class="largest"  cellpadding="0" cellspacing="0" >
              <tr> 
                <td colspan="2" class="blankspace">&nbsp;</td>
              </tr>
              <!--tr> 
                <td width="70" nowrap><div align="left"><strong>&nbsp; 
                    <script language="javascript">swapLang('Order By');</script>
                    </strong></div></td>
                <td width="555"><%//=screen.getTagOrder()%></td>
              </tr-->
              <tr> 
                <td height="22" nowrap><strong>&nbsp; 
                  <script language="javascript">swapLang('Search By');</script>
                  </strong></td>
                <td><%=screen.getTagSearchBy()%><%=screen.getTagConSearch()%> 
                  <%=screen.getTagValueSearch()%> </td>
              </tr>
              <tr> 
                <td nowrap><div align="left"><strong>&nbsp; 
                    <script language="javascript">swapLang('Title');</script>
                    </strong></div></td>
                <td> <input name="__apsid1" type="text" value="<%=nu.chkNullString(request.getParameter("__apsid1"))%>" size="10" > 
                  <a href="javascript:showHelp('AS_REP_05HELP.jsp');" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image411','','../IMAGES/BUTTON/SWAP/HELP_SWAP20.gif',1)"><img SRC="../IMAGES/BUTTON/MAIN/HELP20.gif" alt="ค้นหา" name="Image411" width="20" height="20" border="0" align="absmiddle" id="Image41"></a> 
                  <input name="__tilte1" type="text" value="<%=thaicode.ASCII2Unicode(request.getParameter("__tilte1"))%>" size="30" >
                </td>
              </tr>
              <tr> 
                <td nowrap><div align="left"><strong>&nbsp; 
                    <script language="javascript">swapLang('Head Title');</script>
                    </strong></div></td>
                <td> <input name="__asid1" type="text" value="<%=nu.chkNullString(request.getParameter("__asid1"))%>" size="10" > 
                  <a href="javascript:showHelp2('AS_REP_02HELP.jsp');" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image41','','../IMAGES/BUTTON/SWAP/HELP_SWAP20.gif',1)"><img SRC="../IMAGES/BUTTON/MAIN/HELP20.gif" alt="ค้นหา" name="Image41" width="20" height="20" border="0" align="absmiddle" id="Image41"></a> 
                  <input name="__asdesc1" type="text" value="<%=thaicode.ASCII2Unicode(request.getParameter("__asdesc1"))%>" size="30" > 
                  <a href="javascript:setmSearch();" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image4','','../IMAGES/BUTTON/SWAP/SEARCH_SWAP20.gif',1)"><img src="../IMAGES/BUTTON/MAIN/SEARCH20.gif" alt="ค้นหา" name="Image4" width="20" height="20" border="0" align="absmiddle"></a></td>
              </tr>
              <tr> 
                <td colspan="2"  class="blankspace"></td>
              </tr>
              <tr> 
                <td><div align="left"><strong><a href="javascript:setmHelp('../chart/apprisal/apprisal_rep21.jsp');">Graph</a></strong></div></td>
                <td><div align="right"></div></td>
              </tr>
              <tr > 
                <td colspan="2" bgcolor="#FFFFFF"  >  <table class="largest" border="0" align="center" cellpadding="1" cellspacing="1">
                    <tr> 
                      <td width="15%" class="title1"><div align="center"> 
                          <script language="javascript">swapLang('Code');</script>
                        </div></td>
                      <td class="title1"><div align="center"> 
                          <script language="javascript">swapLang('Description');</script>
                        </div></td>
                      <td width="9%" class="title1"> <div align="center"> 
                          <script language="javascript">swapLang('Score');</script>
                        </div></td>
                      <td width="9%" class="title1" nowrap> <div align="center"> 
                          <script language="javascript">swapLang('Standard');</script>
                        </div></td>
                    </tr>
                    <%
					double score=0;
					double standard=0;
					String assessy="";
					String assessyname="";
					String group="";
					String  labels="";
					String data0="";
					String data1="";
    		         java.text.DecimalFormat df = new java.text.DecimalFormat("#0.00");
					  while(screen.nextRec()){
					  if(assessy.equals("")){
					         assessy=screen.getString("apsassessy");
							 assessyname=screen.getString("apsasydesc");
					  if(!group.equals(screen.getString("apsasygroup"))){
					  group=screen.getString("apsasygroup");
					  %>
                    <tr> 
                      <td colspan="4" nowrap class="headerLight2"><font class="normal">&nbsp;<%=group%></font></td>
                    </tr>
                    <%
					  }							 
					  }
					  if(assessy.equals(screen.getString("apsassessy"))){
					          score+=Double.parseDouble(screen.getString("asrscore"));
					          standard+=Double.parseDouble(screen.getString("asdefaultscore"));
					  }else{
					  		labels+=assessy+",";
							data0+=df.format(score)+",";
							data1+=df.format(standard)+",";
					  %>
                    <tr> 
                      <td nowrap class="writeback" ><div align="center"><%=assessy%></div></td>
                      <td nowrap class="writeback" ><%=assessyname%></td>
                      <td nowrap class="writeback" ><div align="center"><%=df.format(score)%></div></td>
                      <td nowrap class="writeback" ><div align="center"><%=df.format(standard)%></div></td>
                    </tr>
                    <%
					  if(!group.equals(screen.getString("apsasygroup"))){
					  group=screen.getString("apsasygroup");
					  %>
                    <tr> 
                      <td colspan="4" nowrap class="headerLight2"><font class="normal">&nbsp;<%=group%></font></td>
                    </tr>
                    <%
					  }					
					          score=Double.parseDouble(screen.getString("asrscore"));
					          standard=Double.parseDouble(screen.getString("asdefaultscore"));
	   					      assessy=screen.getString("apsassessy");
							  assessyname=screen.getString("apsasydesc");
				    }
					}
					  if(!group.equals(screen.getString("apsasygroup"))){
					  group=screen.getString("apsasygroup");
					  %>
                    <tr> 
                      <td colspan="4" nowrap class="headerLight2"><font class="normal">&nbsp;<%=group%></font></td>
                    </tr>
                    <%
					  }
					  		labels+=assessy+",";
							data0+=df.format(score)+",";
							data1+=df.format(standard)+",";
					  %>
                    <tr> 
                      <td nowrap class="writeback" ><div align="center"><%=assessy%></div></td>
                      <td nowrap class="writeback" ><%=assessyname%></td>
                      <td nowrap class="writeback" ><div align="center"><%=df.format(score)%></div></td>
                      <td nowrap class="writeback" ><div align="center"><%=df.format(standard)%></div></td>
                    </tr>
                  </table>
                  <br> </td>
              </tr>
              <tr > 
                <td colspan="2" class="blankspace"></td>
              </tr>
            </table>
          </div></td>
      </tr>
      <tr bordercolor="0069B3"> 
        <td  class="bottom"></td>
      </tr>
    </table>
    <br>
  </div>
  <%
  if(labels.length()>0){
       labels=labels.substring(0,labels.length()-1);
  }
  if(data0.length()>0){
       data0=data0.substring(0,data0.length()-1);
  }
  if(data1.length()>0){
       data1=data1.substring(0,data1.length()-1);
  }
  %>
  <input type="hidden" name="__labels" value="<%=labels%>">
  <input type="hidden" name="__data0" value="<%=data0%>">
  <input type="hidden" name="__data1" value="<%=data1%>">
  <input type="hidden" name="__data2" value="">
   <input type="hidden" name="__language" value ="<%=screen.getUProfile().get("lang")%>"> 
</form>
</body>
</html>