<%@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="AS05_21SAVE" class="com.csc.library.system.Task" scope="page"/>
<%
AS05_21SAVE.setChannel(request,response);
UIManager screen = (UIManager) AS05_21SAVE.process("SingleEntry","AS05_21SAVE");
screen.referLangOff();
CheckNull chk =new CheckNull();

%>
<jsp:useBean id="AS05_21" scope="page" class="com.csc.library.system.Task"/>
<%
    AS05_21.setChannel(request, response);
    HelpEntry screen1 = (HelpEntry) AS05_21.process("HelpEntry","AS05_21");
	screen1.process();
    ReportUDF rp=new ReportUDF();
    CscCalendar cs=new CscCalendar();
%>

<!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 goBackpage(apsid){
		with(document.cscform){
					__fixCon.value="apsid='"+apsid+"' and apsassessor='<%=screen.getUProfile().get("employeeid")%>'";
					action="AS05_1.jsp";
                     submit();
		}
}

function GoSave() {
  confirmSave();
  }
function GoDelete(){ edelete(); }
function GoSearch(){ search(); }
function GoUpdate(){
  update();
 }

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

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

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 gotolink(pages,apsid,apsassessor,apsassessy,asfid,asssource,asysource,status){
		with(document.cscform){
				__help.value="__apsid#"+apsid+",__apsassessor#"+apsassessor+",__apsassessy#"+apsassessy+",__asfid#"+asfid+",__apsasssource#"+asssource+",__apsasysource#"+asysource;
				__fixCon.value="apsid='"+apsid+"' and apsassessor='"+apsassessor+"' and apsassessy='"+apsassessy+"' and asfid='"+asfid+"' and apsasssource='"+asssource+"' and apsasysource='"+asysource+"'";
				__apsid.value=apsid;
				__apsassessor.value=apsassessor;
				__apsassessy.value=apsassessy;
				__asfid.value=asfid;
				__apsasssource.value=asssource;
				__apsasysource.value=asysource;
				__status.value=status;								
				action=pages;
				submit();
		}
}

function getDocno(){
	with(document.cscform){
			if((typeof __apsidtmp.length)!="undefined"){
			        for(i=0;i<__apsidtmp.length;i++){
					            if(__apsidtmp[i].value!=""){
								docno.innerHTML=__apsidtmp[i].value;
								break;
								}
					}
			}else{
						if((typeof __apsidtmp)!="undefined"){
									if(__apsidtmp.value!=""){
							         docno.innerHTML=__apsidtmp.value;
								}
						}
			}
	}
}

function getTitle(){
	with(document.cscform){
			if((typeof __tdesc.length)!="undefined"){
			        for(i=0;i<__tdesc.length;i++){
					  			if(__tdesc[i].value!=""){
								mtitle.innerHTML=__tdesc[i].value;
								break;
								}
					}
			}else{
						if((typeof __tdesc)!="undefined"){
								if(__tdesc.value!=""){
							    mtitle.innerHTML=__tdesc.value;
								}
						}
			}
	}
}

function getAsyname(){
	with(document.cscform){
			if((typeof __assessyname.length)!="undefined"){
			        for(i=0;i<__assessyname.length;i++){
					  			if(__assessyname[i].value!=""){
								asyname.innerHTML=__assessyname[i].value;
								break;
								}
					}
			}else{
						if((typeof __assessyname)!="undefined"){
								if(__assessyname.value!=""){
							    asyname.innerHTML=__assessyname.value;
								}
						}
			}
	}
}

function getstDate(){
	with(document.cscform){
			if((typeof __apsstartdate.length)!="undefined"){
			        for(i=0;i<__apsstartdate.length;i++){
					  			if(__apsstartdate[i].value!=""){
								stdate.innerHTML=__apsstartdate[i].value;
								break;
								}
					}
			}else{
						if((typeof __apsstartdate)!="undefined"){
								if(__apsstartdate.value!=""){
							    stdate.innerHTML=__apsstartdate.value;
								}
						}
			}
	}
}

function getedDate(){
	with(document.cscform){
			if((typeof __apsenddate.length)!="undefined"){
			        for(i=0;i<__apsenddate.length;i++){
					  			if(__apsenddate[i].value!=""){
								eddate.innerHTML=__apsenddate[i].value;
								break;
								}
					}
			}else{
						if((typeof __apsenddate)!="undefined"){
								if(__apsenddate.value!=""){
							    eddate.innerHTML=__apsenddate.value;
								}
						}
			}
	}
}


function wrtietoSpan(){
			getDocno();
			getAsyname();
			getTitle();
   		    getstDate();
		    getedDate();
}

function checkGrade(str){
			with(document.cscform){
			if(__apsconfirm.value!="2"){					
					if(__apsstatus.value=="2"){
								  __confgrade.value="1";
								   if(str.length>0){
										  __apsconfirm.value=str;
								  }
							GoUpdate();
					}else{
							alert(MyCode[42]);
					}
			}else{
							alert(MyCode[44]);			
			}
		}
}

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];}
}
//-->
</script>

</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onLoad="wrtietoSpan();MM_preloadImages('../IMAGES/BUTTON/SWAP/BACK_SWAP20.gif')">
<div id="toolTipLayer" style="position:absolute; visibility: hidden"></div>
<script language="javascript">initToolTips();</script>
  <form name="cscform" method="post">
 

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

<%=screen.InitialVariable()%>

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

  <input type="hidden"name="__screen"  value="AS05_21">
  <input type="hidden"name="__screenpage"  value="<%=request.getServletPath()%>">  
  <input type="hidden" name="__help" value="<%=request.getParameter("__help")%>">
  <input type="hidden" name="__cmd"  value="">
 <input type="hidden" name="__language" value ="<%=screen.getUProfile().get("lang")%>"> 
  <input type="hidden" name="__fixCon" value="<%=request.getParameter("__fixCon")%>">
  <input name="__notNull" type="hidden" value="<%=screen.getRequire()%>">
  <input name="__companyid" type="hidden" value="<%=screen.getUProfile().get("companyid")%>">
  <input type="hidden" name="__apscreateby" value="<%=screen.getUProfile().get("user")%>" >
  <input type="hidden" name="__apsdate" value="<%=cs.getYYYYMMDDHHMMSS()%>">
  <input type="hidden" name="__apsid" value="<%=request.getParameter("__apsid")%>">
  <input type="hidden" name="__asfid" value="">
  <input type="hidden" name="__confgrade" value="">
  <input type="hidden" name="__apsassessor" value="<%=request.getParameter("__apsassessor")%>">
  <input type="hidden" name="__apsassessy" value="<%=request.getParameter("__apsassessy")%>">
  <input type="hidden" name="__apsasssource" value="<%=request.getParameter("__apsasssource")%>">  
  <input type="hidden" name="__apsasysource" value="<%=request.getParameter("__apsasysource")%>">  
  <input type="hidden" name="__status" value="">
  <div align="center">
    <table  cellpadding="0"  cellspacing="0"  class="large">
      <tr >
        <td   class="header">AS05_21,
          <script language="javascript">swapLang('Save score');</script></td></tr>
      <tr >
        <td  >&nbsp; </td>
      </tr>
      <tr >
        <td  colspan="2"> <div align="center">
            <table class="largest" border="1" cellspacing="1" cellpadding="1">
              <tr>
                <td><table border="0" align="center" cellpadding="3" cellspacing="1" class="largest">
                    <tr valign="baseline">
                      <td width="19%" nowrap><font size="2" color="#1D95E2">
                        <script language="javascript">swapLang('Docno');</script>
                        </font></td>
                      <td colspan="3"><font class="normal"><span id="docno"></span></font></td>
                    </tr>
                    <tr valign="baseline">
                      <td width="19%" nowrap><font size="2" color="#1D95E2">
                        <script language="javascript">swapLang('Title');</script>
                        </font></td>
                      <td colspan="3"><font class="normal"><span id="mtitle"></span></font></td>
                    </tr>
                    <tr valign="baseline">
                      <td width="19%" nowrap><font size="2" color="#1D95E2">
                        <script language="javascript">swapLang('assessy');</script>
                        </font></td>
                      <td colspan="3"><font class="normal"> <span id="asyname"></span></font></td>
                    </tr>
                    <tr valign="baseline">
                      <td width="19%" nowrap><font size="2" color="#1D95E2">
                        <script language="javascript">swapLang('start date');</script>
                        </font></td>
                      <td width="10%" nowrap> <font class="normal"><span id="stdate"></span> </font></td>
                      <td width="11%" nowrap><font size="2" color="#1D95E2">
                        <script language="javascript">swapLang('end date');</script>
                        </font></td>
                      <td width="60%" nowrap> <font class="normal"> <span id="eddate"></span></font></td>
                    </tr>
                  </table></td>
              </tr>
            </table>
            <div align="right"><br>
              <table class="largest" border="0" align="center" cellpadding="1" cellspacing="1" >
                <tr bgcolor="#DFDFDF">
                  <td width="30%" nowrap  class="headerLight2"><div align="center"><font size="2" color="#1D95E2">
                      <script language="javascript">swapLang('Uniform');</script>
                      </font></div></td>
                  <td colspan="2" nowrap class="headerLight2"> <div align="center"><strong><font size="2" color="#1D95E2">
                      <script language="javascript">swapLang('Status');</script>
                      </font></strong></div></td>
                  <td width="20%" nowrap class="headerLight2"> <div align="center"><strong><font size="2" color="#1D95E2">
                      <script language="javascript">swapLang('Total Score');</script>
                      </font></strong></div></td>
                </tr>
                <%
				    double sumscore=0.0f;
                while(screen1.nextRec()){
		%>
			  <input type="hidden" name="__tdesc" value="<%=screen1.getString("tapstran0","tdesc")%>">
			  <input type="hidden" name="__apsidtmp" value="<%=screen1.getString("tapstran0","apsid")%>">
			  <input type="hidden" name="__apsstartdate" value="<%=screen1.getDateLabel("tapstran0","apsstartdate")%>">
			  <input type="hidden" name="__apsenddate" value="<%=screen1.getDateLabel("tapstran0","apsenddate")%>">
			  <input type="hidden" name="__assessyname" value="<%=screen1.getString("tapstran","apsasydesc")%>">
			  <%
			  %>
                <tr >
                  <td class="writeback" > <div align="left"><font class="normal">&nbsp;<%= screen1.getString("asfid")%>
                      <%= screen1.getString("masform","tdesc")%></font></div></td>
                  <td colspan="2" nowrap class="writeback"> <div align="center"><a href="javascript:gotolink('<%=rp.getSystemCode(screen1.getString("getLinkPage"),screen.getUProfile().get("lang"),screen1.getString("masform","astid"))%>','<%=screen1.getString("apsid")%>','<%= screen1.getString("apsassessor")%>','<%= screen1.getString("apsassessy")%>','<%=  screen1.getString("asfid")%>','<%=screen1.getString("apsasssource")%>','<%=screen1.getString("apsasysource")%>','<%=screen1.getString("apsstatus")%>')"><%=rp.getSystemCode("apsstatuscolor",screen.getUProfile().get("lang"), screen1.getString("apsstatus"))%></a></div></td>
                  <td width="20%" nowrap class="writeback"><div align="center"><font size="2"><%=  screen1.getString("apsscorepc")%></font></div></td>
                </tr>
                <%
				sumscore+=Double.parseDouble(chk.chkNullString(screen1.getString("apsscorepc"),"0"));
				}
				%>
                <tr>
                  <td nowrap bgcolor="#DFDFDF"><div align="left"></div></td>
                  <td width="12%" nowrap bgcolor="#F5F5F5"><div align="center"></div></td>
                  <td width="4%" nowrap bgcolor="#F5F5F5"><div align="center"></div></td>
                  <td nowrap  class="headerLight2"> <div align="center"><font size="2"><%=sumscore%></font></div></td>
                </tr>
                <tr>
                  <td nowrap bgcolor="#DFDFDF"><font size="2" color="#1D95E2">
                    <script language="javascript">swapLang('Grade and Score');</script>
                    </font></td>
                  <td colspan="2" nowrap ><div align="center">
 						  <a href="javascript:checkGrade('')"> <script language="javascript">swapLang('Process Grade');</script></a>
                      </div></td>
                  <td nowrap class="headerLight2"><div align="center"><font size="2"><%=screen1.getString("tapstran","apsgrade")%></font></div></td>
                </tr>
                <tr>
                  <td nowrap bgcolor="#DFDFDF"><div align="left"><font size="2" color="#1D95E2">
                      <script language="javascript">swapLang('Confirm');</script>
                      </font></div></td>
                  <td colspan="2" nowrap ><div align="center"><a href="javascript:checkGrade('2')"><%=rp.getSystemCode("apsconfirmcolor",screen.getUProfile().get("lang"),screen1.getString("tapstran","apsconfirm"))%></a></div></td>
                  <td nowrap bgcolor="#F5F5F5"> <div align="right"></div></td>
                </tr>
              </table>
              <br>
              <a href="javascript:goBackpage('<%=screen1.getString("apsid")%>');" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image41','','../IMAGES/BUTTON/SWAP/BACK_SWAP20.gif',1)"><img SRC="../IMAGES/BUTTON/MAIN/BACK20.gif" alt="กลับไปหน้าที่แล้ว" name="Image41" width="20" height="20" border="0" align="absmiddle" id="Image41"></a> 
            </div>
          </div></td>
      </tr>
      <tr bordercolor="0069B3">
        <td  class="bottom"></td>
      </tr>
    </table>
    <br>
    <br>
  </div>
  <input type="hidden" name="__apsassessy1" value="<%=screen1.getString("tapstran","ggid")%>">
  <input type="hidden" name="__ggid" value="<%=screen1.getString("tapstran","ggid")%>">   
  <input type="hidden" name="__asysource" value="<%=  screen1.getString("vasysource","dsclass")%>">
 <input type="hidden" name="__apsconfirm" value="<%=screen1.getString("tapstran","apsconfirm")%>">
 <input type="hidden" name="__apsstatus" value="<%=screen1.getString("tapstran","apsstatus")%>">


<!----------BEGIN CSC ENDING ZONE ------------------------>

<%=screen.endJSP()%>

<!----------END CSC ENDING ZONE -------------------------->

</form>
</body>
</html>
