<%@page contentType="text/html; charset=UTF-8"%>
<%@page import="com.csc.library.entry.HelpEntry,com.csc.library.system.*,com.csc.library.utilities.*"%>
<%@ page import="com.csc.library.entry.*,com.csc.library.database.*,com.csc.library.session.*,com.csc.library.report.ReportUDF"  %>
<jsp:useBean id="AS030" class="com.csc.library.system.Task" scope="page"/>
<%
	AS030.setChannel(request,response);
	UIManager screen = (UIManager) AS030.process("MultiEntry","AS030");
	MultiLine multi = screen.getMultiLine("MASANSWER");
	multi.setLabelBox("check box");
	multi.goFirst();
	if(screen.getDataLabel("asid").equals("")){
		multi.getTable().clear();
	}
	screen.referLangOff();
	CscCalendar cs=new CscCalendar();
	ReportUDF rp=new ReportUDF();
%>
<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>
<link href="../CSS/bootstrap.css" rel="stylesheet"  type="text/css">
<link href="../CSS/bootstrap_csc_backend.css" rel="stylesheet"  type="text/css">
<script type="text/javascript" src="../JS/jquery-2.1.3.min.js"></script>
<script type='text/javascript' src="../JS/bootstrap.js"></script>
<script type='text/javascript' src='../JS/ICONSMENU.js'></script>
<script language='javascript' src='../JS/HOTKEY.js'></script>
<script src="../JS/VIEWCALENDAR.js"></script>
<script language='javascript'>setLang('<%=screen.getUProfile().get("lang")%>');</script>

<script language="javascript">
<!--
function linkHelp(help,input){
	with(document.cscform){
	var fixcon="";
	if((__asgid.value.length>0)&&(input=="__asid")){
	     fixcon="asgid='"+__asgid.value+"'";
	}
	var param="AS000.jsp?__helpName="+help+"&__fieldSearch="+input+"&__pageCall="+__screen.value+"&__fixCon="+fixcon;
	window.open(param,"Help","left=150,top=150,width=700,height=440,resizable=yes,scrollbars=yes,toolbar=no,status=yes");
 }
}

function setmAstype(){
	with(document.cscform){
       for(i=0;i<astype.length;i++){
       if(astype[i].checked){
           _astype=astype[i].value;
           __astype.value=_astype;
		   break;
         }//if
       }//for
	}
}

function setmAsnecessary(){
		with(document.cscform){
		   for(i=0;i<asnecessary.length;i++){
		   if(asnecessary[i].checked){
			   _asnecessary=asnecessary[i].value;
			   __asnecessary.value=_asnecessary;
			   break;
			 }//if
		   }//for
		}
}

function setmAsstatus(){
	with(document.cscform){
			   for(i=0;i<asstatus.length;i++){
			   if(asstatus[i].checked){
				   _asstatus=asstatus[i].value;
				   __asstatus.value=_asstatus;
				   break;
				 }//if
			   }//for
			   if(__asstatus.value=="0"){
					 __asststart.value="2443-01-01";
					 __asstend.value="2443-01-01";
			   }
		}
}

function beforeAction(){
		//setmAstype();
		//setmAsnecessary();
		//setmAsstatus();
}

function showAnswer(page,asid){
    var page=page+"?_asid="+asid;
	window.open(page,"Help2","left=150,top=150,width=700,height=500,toolbar=no,status=yes,scrollbars=yes");
}

function gotoAnswer(){
     beforeAction();
	 var page="";
	if(nullCheck()){
	with(document.cscform){
					if(__astype.value=="2"){
						page="AS17_2.jsp";
					}else{
						 page="AS17_1.jsp";
					}
					alert(__confirm.value);
	if(__confirm.value=="0"){
		    	aCon=confirm(MyCode[1]);// จะบันทึกหรือไม่
				if (aCon==true)	{
						if(__astype.value!="0"){
							showAnswer(page,__asid.value)
							}
				__cmd.value = "save";
				submit();
				}
	}else{
				bCon=confirm(MyCode[3]);
				if (bCon==true)	{
						if(__astype.value!="0"){
							showAnswer(page,__asid.value)
							}
				__cmd.value = "save";
				__confirm.value="2";
					submit();
				}
		}
	  }//with
   }
}

function GoSave() {
     beforeAction();
	confirmSave();
}
function GoDelete(){ edelete(); }
function GoSearch(){ search(); }
function GoUpdate(){
     beforeAction();
     update();
 }
 function loadiframe(){
       var fixcon="";
	   with(document.cscform){
			   if(__asid.value!=""){
					 fixcon="asid='"+__asid.value+"'";
				   var   vframe=document.getElementById("viewframe");
					   vframe.src="AS01HELP2.jsp?__fixCon="+fixcon;
			   }
	   }
 }

function getInputFormatTimestamp(){
		document.write("<input type='hidden' name='__dateformat' value='DD/MM/YYYY  00:00:00.000000'>");
}

   function goHelp(helpName,inputName){
	var helpReturn="";
	var fcon="";
			if(inputName=="__asgid")
				helpReturn=inputName+":asgid,MASGROUP@TDESC";
			else if(inputName=="__kasid")
				helpReturn=inputName+":kasid,MKEYASS@TDESC";

		if(fcon.length==0)
	     linkHelp_Return(helpName,helpReturn);
		else
		helpPageCon(helpName,helpReturn,fcon);
}

function linkChildPru(){
	with(document.cscform){
			if(__asid.value!=""){
			if(__astype.value=="2"){
						page="AS032";
					}else{
						 page="AS031";
					}
		   window.open(page+".jsp?__gorec="+__gorec.value+"&__ack=add&__headMulti="+
		   __headMulti.value+"&__RecNo="+__maxrec.value+"&__asid="+__asid.value);
	  }else{
		     alert(MyCode[0]);
		     __asid.focus();
			 __asid.select();
		 }
	}
}

function childMulti(record){
		with(document.cscform){
			if(__astype.value=="2"){
						page="AS032";
					}else{
						 page="AS031";
					}
	    	window.open(page+".jsp?__cmd=&__gorec="+record+
		     "&__ack=edit&__asid="+__asid.value+
			 "&__headMulti="+__headMulti.value+
	    	 "&__companyid="+__companyid.value);
		}
	}


function chkAsstatus()
{	with(document.cscform)
	{	if(__asstatus[0].checked)
		{	__asststart.readOnly=true;
			__asstend.readOnly=true;
		}
		else
		{	__asststart.readOnly=false;
			__asstend.readOnly=false;
		}
	}
}
function chkSpecialStr() {
//	alert(window.event.keyCode);
		if ((window.event.keyCode == 59) || (window.event.keyCode == 60) || (window.event.keyCode == 62) ||
			 (window.event.keyCode == 92) || (window.event.keyCode == 43) ||
			 (window.event.keyCode == 42) || (window.event.keyCode == 45) ||  (window.event.keyCode == 61))
			window.event.returnValue = false;
}
//-->

</script>

</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<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="AS030">
  <input type="hidden" name="__help" value="">
  <input type="hidden" name="__cmd"  value="">
	<input type="hidden" name="__calendar">
  	<input type="hidden" name="__language" value ="<%=screen.getUProfile().get("lang")%>">
  	<input type="hidden" name="__fixCon" value="">
<input name="__gorec" type="hidden" value="">
<input name="__headMulti" type="hidden" value="AS030">
<input name="__childMulti" type="hidden" value="AS031">
<input name="__multiTable" type="hidden" value="MASANSWER">
<input name="__ack" type="hidden">
<input type="hidden" name="__maxrec" value="<%=screen.getTable("masanswer").recCount()%>">
  <input name="__notNull" type="hidden" value="<%=screen.getRequire()%>">
  <input name="__companyid" type="hidden" value="<%=screen.getUProfile().get("companyid")%>">
  <input type="hidden" name="__ascreateby" value="<%=screen.getUProfile().get("userid")%>" >
  <input type="hidden" name="__ascreatedate" value="<%=cs.getYYYYMMDDHHMMSS()%>">
  <script language="javascript">getInputFormatDate();</script>
<!--   <input type="hidden" name="__astype" value="<%//=screen.getDataLabel("astype")%>">
  <input type="hidden" name="__asnecessary" value="<%//=screen.getDataLabel("asnecessary")%>">
 -->
 <!-- <input type="hidden" name="__asstatus" value=""> -->
  <script language="JavaScript">document.write(Icons());</script>
  <br>
  <div align="center">
    <table  cellpadding="0"  cellspacing="0" class="largest">
      <tr >
        <td  class="header">AS030,
          <script language="javascript">swapLang('Assess Table Record');</script>
          &nbsp;</td>
      </tr>
      <tr >
        <td  colspan="2">
          <div align="center">
            <table  class="inframe" cellpadding="0" cellspacing="0" cols="4" >
              <tr>
                <td colspan="4"  class="blankspace"></td>
              </tr>
              <tr>
                <td  class="columnlabel" width="20%" align="right"><%=screen.getLabel("asid")%>&nbsp;</td>
                <td colspan="3" > <%=screen.getInput("asid")%></td>
              </tr>
              <tr>
                <td class="columnlabel"><%=screen.getLabel("asgid")%>&nbsp;</td>
                <td colspan="3" ><%=screen.getInput("asgid")%>
                  <input type="text" name="MASGROUP@TDESC" value="<%=screen.getDataLabel("masgroup","tdesc")%>" size="35" disabled> </td>
              </tr>
              <tr>
                <td  class="columnlabel"><%=screen.getLabel("kasid")%>&nbsp;</td>
                <td colspan="3" ><%=screen.getInput("kasid")%>
                <input type="text" name="MKEYASS@TDESC" value="<%=screen.getDataLabel("mkeyass","tdesc")%>" size="35" disabled></td>
              </tr>
              <tr>
                <td  class="columnlabel"><%=screen.getLabel("tdesc")%>&nbsp;</td>
                <td colspan="3" ><%=screen.getInput("tdesc")%></td>
              </tr>
              <tr>
                <td  class="columnlabel"><%=screen.getLabel("edesc")%>&nbsp;</td>
                <td colspan="3" ><%=screen.getInput("edesc")%></td>
              </tr>
              <tr>
                <td nowrap  class="columnlabel"><%=screen.getLabel("asobject")%>&nbsp;</td>
                <td colspan="3" ><%=screen.getInput("asobject")%></td>
              </tr>
              <tr class="14b">
                <td nowrap  class="columnlabel"><%=screen.getLabel("assuggest")%>&nbsp;</td>
                <td colspan="3" ><%=screen.getInput("assuggest")%></td>
              </tr>
              <tr >
                <td  class="columnlabel"><%=screen.getLabel("astype")%>&nbsp;</td>
                <td colspan="3" ><%=screen.getInput("astype")%></td>
              </tr>
              <tr >
                <td  class="columnlabel"><%=screen.getLabel("asnecessary")%>&nbsp;</td>
                <td colspan="3" ><%=screen.getInput("asnecessary")%></td>
              </tr>
              <tr >
                <td  class="columnlabel"><%=screen.getLabel("asanswer")%>&nbsp;</td>
                <td colspan="3" ><%=screen.getInput("asanswer")%></td>
              </tr>
<!--               <tr >
                <td  class="columnlabel"><%//=screen.getLabel("ascondition")%>&nbsp;</td>
                <td colspan="3" ><%//=screen.getInput("ascondition")%></td>
              </tr> -->
              <tr >
                <td  class="columnlabel"><%=screen.getLabel("asweight")%>&nbsp;</td>
                <td colspan="3" ><%=screen.getInput("asweight")%></td>
              </tr>
              <tr >
                <td  class="columnlabel"><%=screen.getLabel("asdefaultscore")%>&nbsp;</td>
                <td ><%=screen.getInput("asdefaultscore")%></td>
                <td  class="columnlabel"><%//=screen.getLabel("astarget")%></td>
                <td ><%//=screen.getInput("astarget")%></td>
              </tr>
              <tr >
                <td  class="columnlabel"><%=screen.getLabel("asmaxscore")%>&nbsp;</td>
                <td width="20%" ><%=screen.getInput("asmaxscore")%></td>
                <td width="20%"  class="columnlabel"><%=screen.getLabel("asminscore")%>&nbsp;</td>
                <td width="40%" ><%=screen.getInput("asminscore")%></td>
              </tr>
              <tr >
                <td  class="columnlabel"><%=screen.getLabel("asstatus")%></td>
                <td colspan="3" >
                 <%=screen.getInput("asstatus")%>
                  <%=screen.getInput("asststart")%> <a href="#" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image411','','../IMAGES/BUTTON/SWAP/CALENDAR_SWAP20.gif',1)"><img SRC="../IMAGES/BUTTON/MAIN/CALENDAR20.gif" alt="Search" name="Image1111" width="20" height="20" border="0" align="absmiddle" onClick="viewCal('__asststart')"></a>
                  - <%=screen.getInput("asstend")%> <a href="#" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image412','','../IMAGES/BUTTON/SWAP/CALENDAR_SWAP20.gif',1)"><img SRC="../IMAGES/BUTTON/MAIN/CALENDAR20.gif" alt="Search" name="Image1111" width="20" height="20" border="0" align="absmiddle" onClick="viewCal('__asstend')"></a>
				  <script language="JavaScript">chkAsstatus();</script>
				  </td>
              </tr>
              <tr >
                <td colspan="4" class="blankspace"></td>
              </tr>
              <tr >
                <td colspan="4"><div align="center">
                  </div></td>
              </tr>
              <tr >
                <td colspan="4" class="blankspace"><table border="0" cellpadding="1" cellspacing="0" bordercolor="#3366CC" id="rsTable" name="rsTable" cols=7 class="inframe tablewithborder">
                  <tr>
                    <td height="23" nowrap class="row3"><div align="center">
                        <script language='javascript'>swapLang('Select');</script>
                    </div></td>
                    <td nowrap class="row3"><div align="center"><%=multi.getLabel("masanswer","anwid")%></div></td>
                    <td nowrap  class="row3"><div align="center">
                        <%=multi.getLabel("masanswer","tdesc")%>
                    </div></td>
                    <td nowrap  class="row3"><div align="center">
                      <%=multi.getLabel("masanswer","edesc")%> </div></td>
                    <td nowrap  class="row3"><div align="center">
                      <%=multi.getLabel("masanswer","anwscore")%>
                    </div></td>
                    </tr>
                  <%
				for(int i=1;!multi.eof();multi.next(),i++){
					multi.getTable().getCurrentRecordManager().referLangOff();
		%>
                  <tr>
                    <td class="forborder"><div align="center"><%=multi.getInputCheckBox()%></div></td>
                    <td height="20" class="forborder"><div align="center"><a href="javaScript:childMulti('<%=multi.getData("MASANSWER","ANWID")%>')"><%=multi.getData("masanswer","anwid")%></a></div></td>
                    <td class="forborder">
                      <div align="left"><%=multi.getData("masanswer","tdesc")%></div></td>
                    <td class="forborder"><div align="left"><%=multi.getData("masanswer","edesc")%></div></td>
                     <td class="forborder"><div align="center"><%=multi.getData("masanswer","anwscore")%></div></td>
                    </tr>
                  <%multi.getTable().getCurrentRecordManager().referLangOn();}%>


                  <tr>
                    <td  class="buttonline" colspan="7"><div align="center">
                      <button type="button" class="btn btn-primary width100" swlang code="SW013163" onClick="checkAll();">Select All</button>&nbsp;
                      <button type="button" class="btn btn-primary width100" swlang code="SW013164" onClick="decheckAll();">Deselect All</button>&nbsp;
                      <button type="button" class="btn btn-primary width100" swlang code="SW013165" onClick="linkChildPru('AS031');">Add</button>&nbsp;
                      <button type="button" class="btn btn-primary width100" swlang code="SW013166" onClick="deleteMulti();">Delete</button>
                    </div>
                    </td>
                  </tr>
              
                </table></td>
              </tr>
              <TR>
                <TD colspan="4"><div align="center"></div></TD>
              </TR>
              <tr >
                <td colspan="4" class="blankspace"></td>
              </tr>
            </table>
          </div></td>
      </tr>
      <tr bordercolor="0069B3">
        <td  class="bottom"></td>
      </tr>
    </table>
  </div>


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

<%=screen.endJSP()%>

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

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