<%@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="AS017" class="com.csc.library.system.Task" scope="page"/>
<%
	AS017.setChannel(request,response);
	UIManager screen = (UIManager) AS017.process("MultiEntry","AS017");
	CheckNull ck = new CheckNull(); 
   if(!ck.chkNullString(request.getParameter("__screen"),"").equals("AS017")){
	   screen.getRecord().set("quotaid","1");
	   	   screen.getRecord().search();
   }	  

	MultiLine multi = screen.getMultiLine("MQUOTAGRADE_DETAIL");
	multi.setLabelBox("check box");
	
	multi.goFirst();
	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>

<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(input=="__quotaid"){
			var param="AS000.jsp?__helpName="+help+"&__fieldSearch="+input+"&__pageCall="+__screen.value+"&__fixCon="+fixcon;
		}else{
			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(page){
	//alert("555");
	with(document.cscform){
			if(__quotaid.value!=""){
				window.open(page+".jsp?__gorec="+__gorec.value+"&__ack=add&__headMulti="+
				__headMulti.value+"&__RecNo="+__maxrec.value+"&__quotaid="+__quotaid.value);
			}else{
				alert(MyCode[0]);
				__quotaid.focus();
				__quotaid.select();
			}
	}

}

/*function childMulti(record){
		with(document.cscform){
			if(__astype.value=="2"){
						page="AS032";
					}else{
						 page="AS017E";
					}		
	    	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 chkEmpnum(obj){
	with(document.cscform){
		
		for(var i=0;i<empnum.length;i++){
			if(empnum[i].value==obj.value){
				alert("จำนวนนี้มีอยู่แล้ว");				
			}
		}
		//obj.focus();
	}
}

//-->

</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="AS017">
<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="AS017">
<input name="__childMulti" type="hidden" value="AS017E">
<input name="__multiTable" type="hidden" value="MQUOTAGRADE_DETAIL">
<input name="__ack" type="hidden">
<input type="hidden" name="__maxrec" value="<%=screen.getTable("MQUOTAGRADE_DETAIL").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()%>">
<input name="__quotaid" type="hidden" value="1">

<script language="javascript">getInputFormatDate();</script>
 <script language="JavaScript">document.write(Icons());</script>
  <br>
  <div align="center">
    <table  cellpadding="0"  cellspacing="0" class="largest">
      <tr >
        <td  class="header">AS017,
          <script language="javascript">swapLang('Quota Grade');</script>
          &nbsp;</td>
      </tr>
      <tr >
        <td  colspan="2">
          <div align="center">
            <table  class="inframe" cellpadding="0" cellspacing="0" >
             <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="0" cellspacing="1" bordercolor="#3366CC" id="rsTable" name="rsTable" cols=7 class="inframe">
                  <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("MQUOTAGRADE_DETAIL","empnum")%></div></td>
                    <td nowrap  class="row3"><div align="center"><%=multi.getLabel("MQUOTAGRADE_DETAIL","quota_a")%></div></td>
                    <td nowrap  class="row3"><div align="center"><%=multi.getLabel("MQUOTAGRADE_DETAIL","quota_b")%></div></td>
                    <td nowrap  class="row3"><div align="center"><%=multi.getLabel("MQUOTAGRADE_DETAIL","quota_c")%></div></td>
                    </tr>
                  <!-- aaaaaaaaaaaaaaaa -->
				  <%
				for(int i=1;!multi.eof();multi.next(),i++){ 				
					multi.getTable().getCurrentRecordManager().referLangOn();
		%>
                  <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("MQUOTAGRADE_DETAIL","line_no")%>')"><%=multi.getData("MQUOTAGRADE_DETAIL","empnum")%></a>
						<input type="hidden" id="empnum" name="empnum" value="<%=multi.getData("MQUOTAGRADE_DETAIL","empnum")%>">
						</div></td>
                    <td class="forborder"><div align="center"><%=multi.getData("MQUOTAGRADE_DETAIL","quota_a")%></div></td>
                    <td class="forborder"><div align="center"><%=multi.getData("MQUOTAGRADE_DETAIL","quota_b")%></div></td>
                    <td class="forborder"><div align="center"><%=multi.getData("MQUOTAGRADE_DETAIL","quota_c")%></div></td>
                    </tr>
                  <%
				multi.getTable().getCurrentRecordManager().referLangOff();
			}
		%>
		<!-- ********************* -->
                  <tr>
                    <td colspan="5"   class="blankspace"></td>
                  </tr>
                  <tr>
                    <td colspan="5"  class="noborder"><div align="center" > <a href="#" onClick="checkAll()"><img src="../IMAGES/BUTTON/SELECTALL.gif" border="0"></a>&nbsp;&nbsp; <a href="#" onClick="decheckAll()"><img src="../IMAGES/BUTTON/DESELECTALL.gif" border="0"></a>&nbsp;&nbsp; <a href="javascript:linkChildPru('AS017E');"><img src="../IMAGES/BUTTON/ADD.gif" border="0"></a>&nbsp;&nbsp; <a href="javascript:deleteMulti();"><img src="../IMAGES/BUTTON/DELETE.gif" border="0"></a>&nbsp;&nbsp;<!-- <input type="button" value="test" onclick="testScript()"> --></div></td>
                  </tr>
                  <tr>
                    <td colspan="5"  class="blankspace"></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>
