<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%@ page import="com.csc.library.entry.*" %>
<%@ page import="com.csc.library.utilities.*" %>
<%@page contentType="text/html; charset=UTF-8"%>
<jsp:useBean id="PR075_OPTION" scope="page" class="com.csc.library.system.Task"/>
<% 
   PR075_OPTION.setChannel(request ,response);
   ReportEntry screen=null;
   screen=(ReportEntry)PR075_OPTION.process("ReportEntry",request.getParameter("__screen"));
   UProfile uf=screen.getUProfile();
   CheckNull chk = new CheckNull();
%>
<html ng-app="myHR">
<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">
<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 language='javascript' src='../JS/SCREEN.js'></script>
<script src="../JS/angular-1.3.15/angular.js" type="text/javascript"></script>
<script src="../JS/ANGULAR/SCREEN_ANGULAR.js" type="text/javascript"></script>
<script language='javascript'>setLang('<%=screen.getUProfile().get("lang")%>');</script>
<script src="../JS/VIEWCALENDAR.js"></script>

<script language="JavaScript" type="text/JavaScript">

function back(){
	with(document.cscform){
		var startdate = __startdate.value;
		var enddate = __enddate.value;
		var swap = new swaplang();
		var titlename = swap.swap2String("SW012144");
		if(chkfield()){
			with(window.opener.document.cscform){
				var arraysdate = startdate.split("-");
				var sdate = arraysdate[2] + "-" + arraysdate[1] + "-" + arraysdate[0];

				var arrayedate = enddate.split("-");
				var edate = arrayedate[2] + "-" + arrayedate[1] + "-" + arrayedate[0];

				var dbtype = '<%=screen.getUProfile().getDbType()%>';
				var filterhead = "status!='Y' and startdate BETWEEN '"+sdate+"' and '"+edate+"' and ssl_flag='1' ";

				__fixfiltermemployee.value = filterhead;
				window.close();
			}
		}
	}
}

function chkfield(){
	with(document.cscform){
		var swap = new swaplang();
        var title_emp = swap.swap2String("SW012144");
		var title_date = swap.swap2String("SW012158");
		var chk = true;

		/*if(__employeeidstart.value === "" && __employeeidend.value === ""){
			chk = false;
			alert(title_emp);			
		}else if(__startdate.value === ""){
			chk = false;
			alert(title_date);
		}else if(__enddate === ""){
			chk = false;
			alert(title_date);
		}*/
		return chk;
	}
}

function chkInputDate2(obj1,obj2) {
		var swap = new swaplang();
       // var titlename = swap.swap2String("SW012033");
		var temp1 = obj1.value;
		var temp2 = obj2.value;
		var tempdate1 = obj1.value.split("-");
		var tempdate2 = obj2.value.split("-");
		var chk = true;
		if (obj1.value == "") {
			if(obj2.value == "" ) {
				obj1.value = datePresent();
			} else {
				obj1.value = obj2.value;
			}
		}
		if (obj2.value == "") {
			if(obj1.value == "" ) {
				obj2.value = datePresent();
			} else {
				obj2.value = obj1.value;
			}
		}
		if (!chkInputDate(obj1)) {
			chk = false;
			obj1.select();
		} else if (!chkInputDate(obj2)) {
			chk = false;
			obj2.select();
		} else if (!checkFdateEdate(obj1.value,obj2.value)) { 
			obj2.value = obj1.value;
			chk = false;
			obj2.select();
			alert("วันที่สิ้นสุดไม่สามารถน้อยกว่าวันเริ่มได้"); 
		}
		return chk;
	}
/*
function goHelp(helpName,inputName) {
	var helpReturn;
        var filter = "";
        with(document.cscform){
            if (inputName=="__employeeidstart" ){
				helpReturn="__employeeidstart:employeeid";
			}else if(inputName=="__employeeidend" ){
                helpReturn="__employeeidend:employeeid";
			}
        } 
        
	linkHelp_Return(helpName, helpReturn, filter);
} */



</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" >
<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">
  <center>
    <table  cellpadding="0"  cellspacing="0">
      <tr > 
        <td  class="header"> PR075_OPTION, <span swlang code="SW000128">Report Option</span>&nbsp;</td>
      </tr>
      <tr > 
        <td  colspan="2" align="center"> 
            <table  cellpadding="0" cellspacing="0" >
              <tr> 
                <td height="12" colspan="2"  class="blankspace"></td>
              </tr>
			  
              <tr>
				<td align="right" style="width:200px"><span swlang code="SW012799">Start Date</span>&nbsp;</td>
				<td>
					<input type="text" name="__startdate" size="10" maxlength="10"  onkeypress="chkInteger(event);" onkeyup="sysIsEdit();formatDate(this);" onblur="chkInputDate2(this,document.cscform.__enddate);" onfocus="this.select();">&nbsp;
					<a href="#" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image17','','../IMAGES/BUTTON/SWAP/CALENDAR_SWAP20.gif',1)"  onclick="viewCal('__startdate')"><img src="../IMAGES/BUTTON/MAIN/CALENDAR20.gif" alt="Calendar" name="Image17" width="20" height="20" border="0" align="absmiddle"></a>

					 &nbsp;-&nbsp;

					<input type="text" name="__enddate" size="10" maxlength="10"  onkeypress="chkInteger(event);" onkeyup="sysIsEdit();formatDate(this);" onblur="chkInputDate2(document.cscform.__startdate,this);" onfocus="this.select();" >&nbsp;
					<a href="#" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image1101','','../IMAGES/BUTTON/SWAP/CALENDAR_SWAP20.gif',1)" onClick="viewCal('__enddate')"><img src="../IMAGES/BUTTON/MAIN/CALENDAR20.gif" alt="Calendar" name="Image1101" width="20" height="20" border="0" align="absmiddle" id="Image1101"></a>
				</td>
			  </tr>
              <tr> 
                <td colspan="2" class="blankspace"></td>
              </tr>

              <tr>
                <td  class="buttonline" colspan="7"><div align="center">
                  <button type="button" class="btn btn-primary width100" swlang code="SW013169" onClick="back();">OK</button>&nbsp;
                  <button type="button" class="btn btn-primary width100" swlang code="SW006927" onClick="window.close();">CANCEL</button>
                </div>
                </td>
              </tr>
              <tr > 
                <td colspan="2" class="blankspace"></td>
              </tr>
            </table>
          </td>
      </tr>
      <tr bordercolor="0069B3"> 
        <td  class="bottom"></td>
      </tr>
    </table>
  </center>
<INPUT TYPE="hidden" NAME="__screen" VALUE="<%=request.getParameter("__screen")%>">
</form>
</body>
</html>