<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%@page contentType="text/html; charset=UTF-8"%>
<%@ page import="com.csc.library.entry.*" %>
<%@ page import="com.csc.library.utilities.*,com.csc.library.report.*" %>
<jsp:useBean id="ASR002" scope="page" class="com.csc.library.system.Task"/>
<% 
   ASR002.setChannel(request ,response);
   ReportEntry screen=null;
   screen=(ReportEntry)ASR002.process("ReportEntry",request.getParameter("__screen"));
   UProfile uf=screen.getUProfile();
	ReportUDF rf=new ReportUDF();
%>
<html>
<head>
<title>ReportOption</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 src="../JS/VIEWCALENDAR.js"></script>
<script language='javascript'>setLang('<%=screen.getUProfile().get("lang")%>');</script>

<script language="JavaScript" type="text/JavaScript">
<!--
function back(){
	var z=0;
	if(setFilter()){
	with(document.cscform){
	 for(z=0;z<elements.length;z++){
	 	setParent(elements[z].name,elements[z].value);
	 }
	}	
	window.close();
	}
}

function setParent(inputName,inputValue){
	with(window.opener.document.cscform){
	 for(var  z=0;z<elements.length;z++){
	 	if(elements[z].name==inputName){
	 		//alert(inputName+" "+inputValue);
 			elements[z].value=inputValue;
 		}	
	 }
	}
}

function setFilter(){
	with(document.cscform){
	      var filter ="status='1' and approvestatus='1'";
		  if(__udf1.checked||__udf2.checked||__udf3.checked){
		  			filter+=" and reqtype in (";
		  			if(__udf1.checked)
					        filter+="'"+__udf1.value+"',";
		  			if(__udf2.checked)
					        filter+="'"+__udf2.value+"',";
		  			if(__udf3.checked)
					        filter+="'"+__udf3.value+"',";
					filter=filter.substring(0,filter.length-1)+")";					
				}else{
				   filter+=" and reqtype in('0','2')";
				}				
				if(__budyear.value.length>0){
						filter+=" and budyear='"+__budyear.value+"'"
				}
		}//with
		 window.opener.document.cscform.__fixfilterMCOMPLAIN.value=filter;
	return true;
}

//-->
</script>

</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<form name="cscform" method="post" >


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

<%=screen.InitialVariable()%>

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

<input type="hidden" name="__cmd" value="">
 <input type="hidden" name="__language" value ="<%=screen.getUProfile().get("lang").toUpperCase()%>"> 
  <input type="hidden" name="__calendar">
  <input type="hidden" name="__dateformat" value="YYYY-MM-DD">
  <input type="hidden" name="__fixCon" value="">
 
  <div align="center">
    <table  cellpadding="0"  cellspacing="0">
      <tr > 
        <td  class="header"> ASR002, 
		<script language="javascript">swapLang('Report Option');</script>&nbsp;</td>
      </tr>
      <tr > 
        <td  colspan="2"> 
          <div align="center"> 
            <table  cellpadding="0" cellspacing="0" >
              <tr> 
                <td colspan="2"  class="blankspace"></td>
              </tr>
			  <%
						String keyvalue[];			  
				  		String tstatus[]=rf.getSystemCode("TYPEOFREQ",screen.getUProfile().get("lang"));
						for(int n=0;n<tstatus.length;n++){
							keyvalue=tstatus[n].split(",");
							%>
							  <tr >
									<td width="159" class="blankspace">&nbsp;</td>
									<td width="409" class="blankspace"><input type="checkbox" name="__udf<%=n+1%>" value="<%=keyvalue[0]%>" size="15"><%=keyvalue[1]%></td>
							  </tr>
							<%							
							}
			  %>
              <tr > 
                <td  align="right"><script language="javascript">swapLang('ปี');</script></td>
                <td  class="blankspace"><input type="text" name="__budyear" value="<%=new CscCalendar().getThaiYYYY()%>" size="7" maxlength="4"></td>
              </tr>
              <TR> 
                <TD colspan="2"><div align="center"><img src="../IMAGES/BUTTON/OK.gif" onClick="back()"> 
                    &nbsp;&nbsp; <img src="../IMAGES/BUTTON/CANCEL.gif" onClick="window.close()"></div></TD>
              </TR>
              <tr > 
                <td colspan="2" class="blankspace"></td>
              </tr>
            </table>
          </div></td>
      </tr>
      <tr bordercolor="0069B3"> 
        <td  class="bottom"></td>
      </tr>
    </table>
  </div>
<INPUT TYPE="hidden" NAME="__screen" VALUE="<%=request.getParameter("__screen")%>">
</form>
</body>
</html>