<%@ page import="com.csc.library.entry.*,com.csc.library.utilities.*,com.csc.library.session.*,com.csc.library.database.*,java.util.*"  contentType="text/html;charset=UTF-8"%>
<jsp:useBean id="AS017E" scope="page" class="com.csc.library.system.Task"/>
<%
	AS017E.setChannel(request ,response);
	UIManager screen=(UIManager)AS017E.process("ChildEntry","mquotagrade_detail");
	CheckNull chk = new CheckNull();
	java.text.DecimalFormat df=new java.text.DecimalFormat("0000");
	String quotaid=chk.chkNullString(request.getParameter("__quotaid"));

	screen.referLangOff();
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link href="../CSS/TISCO.css" rel="stylesheet" type="text/css">
<script type='text/javascript' src='../JS/SCREEN.js'></script>
<script language='javascript'>setLang('<%=screen.getUProfile().get("lang")%>');</script>
<script src="../JS/VIEWCALENDAR.js"></script>
<script language='javascript' src="../JS/DATEINPUT.js"></script>
<script language="javascript">getTitleName();</script>
<script language="JavaScript" type="text/JavaScript">
<!--
function back(){
		with(window.opener.cscform){
			__cmd.value = 'ack';
	    	submit();	    
		}
	}

	function chkInputEmpNum(obj){
				
				if(document.cscform.__maxrec.value==1){					
					if(obj.value==window.opener.cscform.empnum.value){
							alert("จำนวนพนักงานนี้มีอยู่แล้ว");
							obj.value="";
							obj.focus();
					}
				}

				if(document.cscform.__maxrec.value>1){			
					for(var i=0;i<window.opener.cscform.empnum.length;i++){
						if(obj.value==window.opener.cscform.empnum[i].value){
							alert("จำนวนพนักงานนี้มีอยู่แล้ว");
							obj.value="";
							obj.focus();
						}
					}
				}
			
	}//----------

	function chkSaveChild(){
		with(document.cscform){
			var empnum = parseInt(__empnum.value);
			var gradeA = parseInt(__quota_a.value);
			var gradeB = parseInt(__quota_b.value);
			var gradeC = parseInt(__quota_c.value);

			if(empnum==(gradeA+gradeB+gradeC)){
				saveChild();
			}else{
				alert("จำนวนเกรดรวมกันต้องเท่าจำนวนพนักงาน");
				__quota_a.focus();
			}
			
		}
	
	}//-----

//-->
</script>

</head>
<body>
<div id="toolTipLayer" style="position:absolute; visibility: hidden"></div>
<script language="javascript">initToolTips();</script>
<form name="cscform" method="post" action="AS017E.jsp">
  

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

<%=screen.InitialVariable()%>

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

<input type="hidden" name="__cmd" value="">
	<input type="hidden" name="__cmdchild">
	<input type="hidden" name="__ack" value="<%=request.getParameter("__ack")%>">
	<input type="hidden" name="__referPage" value="">
	<input type="hidden" name="__fixCon" value="">
	<input type="hidden" name="__help" value="">
	<input type="hidden" name="__notNull" value="<%=screen.getRequire()%>">	
	<input type="hidden" name="__screen" value="mquotagrade_detail">
	<input type="hidden" name="__companyid"  value='<%=screen.getUProfile().get("companyid")%>'>
	<input type="hidden" name="__employeeid" value="<%=request.getParameter("__employeeid")%>">
	<input type="hidden" name="__language" value ="<%=screen.getUProfile().get("lang")%>">
	<input type="hidden" name="__lastrec" value="<%=request.getParameter("__lastrec")%>">
	<input type="hidden" name="__maxrec" value="<%=screen.getTable("mquotagrade_detail").recCount()%>">
	<input type="hidden" name="__gorec" value="<%=request.getParameter("__gorec")%>">  
	<input type="hidden" name="__headMulti" value="<%=request.getParameter("__headMulti")%>">
	<script language="javascript">getInputFormatDate();</script>
	<input type="hidden" name="__calendar">
	<input type="hidden" name="__Rec_No" value="<%=request.getParameter("__Rec_No")%>">
	<input type="hidden" name="__quotaid" value="<%=quotaid%>">	
	<input type="hidden" name="__anwcompare" value=" ">	
	 <%
	double lineno=1;
	if((request.getParameter("__gorec")!=null)&&(!request.getParameter("__gorec").equals("")))
		{
			lineno= Double.parseDouble(request.getParameter("__gorec").toString());
		}
	else
		{
			if(screen.getTable("mquotagrade_detail").recCount()==0)
				{
					lineno=1;
				}
			else
				{
				
					screen.getTable("masanswer").last();
	 				String lastrec=screen.getTable("masanswer").getString("line_no");
					lineno=Double.parseDouble(lastrec)+1;
				}
		}	 
	%>
	
	<input type="hidden" name="__line_no" value="<%=df.format(lineno)%>" size="15" maxlength="15">
	<br>  
	<div align="center">      
		<table  cellpadding="0"  cellspacing="0">
          <tr >
            <td  class="header">AS017E,
                <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 width="200" class="columnlabel"><div align="right"><%=screen.getLabel("empnum")%></div></td>
                    <td width="400" colspan="3" > <%=screen.getInput("empnum")%> </td>
                  </tr>
                  <tr>
                    <td class="columnlabel"><div align="right"><%=screen.getLabel("quota_a")%></div></td>
                    <td colspan="3" > <%=screen.getInput("quota_a")%> </td>
                  </tr>
                  <tr >
                    <td class="columnlabel"><div align="right"><%=screen.getLabel("quota_b")%></div></td>
                    <td colspan="3" ><%=screen.getInput("quota_b")%></td>
                  </tr>
				  <tr >
                    <td class="columnlabel"><div align="right"><%=screen.getLabel("quota_c")%></div></td>
                    <td colspan="3" ><%=screen.getInput("quota_c")%></td>
                  </tr>
                  <tr >
                    <td colspan="4" class="blankspace"></td>
                  </tr>
                  <TR>
                    <TD colspan="4"><div align="center"><span class="buttonline"><a href="javaScript:chkSaveChild();"><img src="../IMAGES/BUTTON/SAVE.gif" width="73" height="23" border="0"></a>&nbsp;&nbsp; <a href="javaScript:backhead();"><img src="../IMAGES/BUTTON/BACK.gif" border="0"></a></span></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>
	<% 
	if((request.getParameter("__cmdchild")!=null)&&(!request.getParameter("__cmdchild").equals(""))){%>
	<script language="javascript">back();</script>
	<%}%>
	
</form>
<% screen.referLangOff(); %>
<!--Start ERROR AND WARNING -->
<!--END ERROR AND WARNING -->
</body>
</html>

