<!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.session.*" %>
<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();
%>
<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 language='javascript'>setLang('<%=screen.getUProfile().get("lang")%>');</script>
<script src="../JS/VIEWCALENDAR.js"></script>

<script language="JavaScript" type="text/JavaScript">
<!--
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_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 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];}
}
function back(){ 
	var whereCuz = "";
	var whereCuz1 = "";
	var whereCuzT0 = "1=1";
	var startDate = "";
	var endDate = "";
	with(document.cscform){ 
		startDate = __condition$startDate.value;
		endDate = __condition$endDate.value;
		if(startDate.length>0){ 
			var strStartDate=convertDate(__condition$startDate.value);
			var strEndDate=convertDate(__condition$endDate.value);  
			whereCuz += " and fscardid in (select fscardid from tforgetcard1 where forget_date between '"+strStartDate+"' and '"+strEndDate+"')";
			whereCuz1 += "(forget_date between '"+strStartDate+"' and '"+strEndDate+"')";
		}else{
			alert(" กรุณากรอกวันที่ ..."); 
		}
		if(__salatype.value!="dontChoose"){
				whereCuzT0+=" and employeeid in ( select employeeid from memployee where salatype = '"+__salatype.value+"' )";
		}
	}

	with(window.opener.document.cscform){ 
		if(startDate.length>0){ 
			__STARTDATE.value = startDate;
			__ENDDATE.value = endDate;
			__fixfilterTFORGETCARD1.value = whereCuz1;	
			__fixfilterTFORGETCARD0.value = whereCuzT0+whereCuz;
			window.close();
		}
	}
	
}


 function convertDate(date){
	var tempDate = date.split("-");
	return tempDate[2]+"-"+tempDate[1]+"-"+tempDate[0];
}

//-->
</script>

</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onLoad="MM_preloadImages('../IMAGES/BUTTON/SWAP/SEARCH_SWAP20.gif')">
<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")%>">
<script language="javascript">getInputFormatDate();</script>
<input type="hidden" name="__calendar">
  <div align="center" style='1px solid green'>
    <table  cellpadding="0"  cellspacing="0">
      <tr > 
        <td  class="header"> TAR701, 
		<script language="javascript">swapLang('Report Option');</script>&nbsp;</td>
      </tr>
      <tr > 
        <td  colspan="2"> 
          <div align="right"> 
            <table cellpadding="1" cellspacing="1" >
			  <tr> 
					<td class="blankspace"></td>
					<%CscCalendar c = new CscCalendar();%>
			  </tr>
			  <tr>
					<td>
						<div align="center"> 
						<script language="javascript">swapLang('วันที่เริ่ม');</script>&nbsp; 
 
								<input type="text" onMouseOut="toolTip()" onMouseOver="toolTip('วันเริ่มต้น(DDMMYYYY)')" onKeyPress="chkIntegerOfDate(this.value)" onBlur="chkInputDate2(this,__condition$endDate)" onKeyUp="formatDate(this)" maxlength="10" size="10" name="__condition$startDate"/> 
								<a onClick="viewCal('__condition$startDate')" onMouseOver="MM_swapImage('Image1','','../IMAGES/BUTTON/SWAP/CALENDAR_SWAP20.gif',1)" onMouseOut="MM_swapImgRestore()" href="#">
									<img height="20" border="0" align="absmiddle" width="20" name="Image1" alt="Calendar" src="../IMAGES/BUTTON/MAIN/CALENDAR20.gif"/>
								</a>
								-  
		  					<script language="javascript">swapLang("End Date");</script>
								<input type="text" onMouseOut="toolTip()" onMouseOver="toolTip('วันสิ้นสุด(DDMMYYYY)')" onKeyPress="chkIntegerOfDate(this.value)" onBlur="chkInputDate2(__condition$startDate,this)" onKeyUp="formatDate(this)" maxlength="10" size="10" name="__condition$endDate"/> 
							<a onClick="viewCal('__condition$endDate')" onMouseOver="MM_swapImage('Image2','','../IMAGES/BUTTON/SWAP/CALENDAR_SWAP20.gif',1)" onMouseOut="MM_swapImgRestore()" href="#">
								<img height="20" border="0" align="absmiddle" width="20" name="Image2" alt="Calendar" src="../IMAGES/BUTTON/MAIN/CALENDAR20.gif"/>
							</a>
					</td>
				</tr>
				<tr>
					<td>
						<div align="center">
							ประเภทรายได้ 
							<select name="__salatype" id="salatype"  style="width:195px"> 
								<option value="dontChoose"> ทั้งหมด </option>
<%
							DbInquiry inquiry =  new InitialInquiry(screen.getUProfile()).getDbInquiry("msalatype0");
							inquiry.setColumn("codeid,tdesc,edesc");
							inquiry.refresh();
							//out.print(inquiry.next());
							while(inquiry.next()){ 
%>
									<option value="<%=inquiry.getString("codeid")%>"><%=inquiry.getString("tdesc")%></option>
<%
							}
%>
							</select>
						</div>
					</td>
				</tr> 
              <tr> 
                <td class="blankspace"></td>
              </tr>
              <tr> 
                <td>
					<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 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>