<%@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.*"  %>
<jsp:useBean id="TAU106_LPN" class="com.csc.library.system.Task" scope="page" />
<%
TAU106_LPN.setChannel(request,response);
UIManager screen = (UIManager) TAU106_LPN.process("SingleEntry","TAU106_LPN");
  //screen.process();
  CscCalendar curDate = new CscCalendar();
%>
<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 language="javascript">setLang('<%=screen.getUProfile().get("lang")%>');</script>
<script type='text/javascript' src='JS/HOTKEY.js'></script>
<script type='text/javascript' src='../JS/ICONSMENU.js'></script>
<script type='text/javascript' src='../JS/VIEWCALENDAR.js'></script>

<script src="../JS/VIEWCALENDAR.js"></script>
<script language="JavaScript" type="text/JavaScript">

function goHelp(helpName,inputName){
  with(document.cscform){
	var helpReturn="";
	var fcon=__fixCon.value;
		 if(inputName=="__time0id" )
		 	helpReturn="__time0id:time0id";
		 if(fcon=="")
	     	linkHelp_Return(helpName,helpReturn);
	     else
	     	helpPageCon(helpName,helpReturn,fcon);
	}
}

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 goIframe(page){
   with(document.cscform){
   		NDate = new Date();
		var thmonth = new Array ("มกราคม","กุมภาพันธ์","มีนาคม","เมษายน","พฤษภาคม","มิถุนายน","กรกฎาคม","สิงหาคม","กันยายน","ตุลาคม","พฤศจิกายน","ธันวาคม");
		var engMonth=new Array("January","February","March","April","May","June","July","August","September","October","November","December");
		var thMonth=thmonth[NDate.getMonth()-1];
		var engMonth=engMonth[NDate.getMonth()-1];
		var result="";
		var lang = window.cscform.__language.value;
			if(lang=="tha"){
					result=thMonth;
				}else{
					result=engMonth;
				}
	__monthtxt.value=result;
    __pageIframe.value=page;
	__help.value="__time0id#"+window.cscform.__time0id.value+",__companyid#"+window.cscform.__companyid.value;
//	 alert("iframe"+__fixCon.value);
	 submit();
   }
}

function submitiframe(){
	NDate = new Date();
	if(document.cscform.__time0id.value.length=="")
		document.cscform.__time0id.value="0";
	document.detail1.document.cscform.__time0id.value=window.cscform.__time0id.value;
	if(document.cscform.__pageIframe.value == "TAU108_LPN.jsp") {  		
		document.detail1.document.cscform.__help.value="__time0id#"+document.cscform.__time0id.value
			+",__companyid#"+document.cscform.__companyid.value;
		//alert(document.cscform.__time0id.value+":"+document.detail1.document.cscform.__time0id.value);
		//alert(document.cscform.__tdesc.value+":"+document.detail1.document.cscform.__tdesc.value);
		//alert(document.cscform.__edesc.value+":"+document.detail1.document.cscform.__edesc.value);
	} else {  
		document.detail1.document.cscform.__help.value="__monthid#"+document.detail1.document.cscform.__month.value
			+",__yearid#"+document.detail1.document.cscform.__year.value+",__time0id#"+document.cscform.__time0id.value ;
		document.detail1.document.cscform.__fixCon.value="  time0id ='"+window.cscform.__time0id.value+"'";
	}
 }

function GoSave(){
  	aCon=confirm(MyCode[1]);// จะบันทึกหรือไม่
	if (aCon==true)	{
			document.detail1.document.cscform.__confirm.value="0";
			document.detail1.document.cscform.__cmd.value="save";
			document.detail1.document.cscform.__time0id.value = document.cscform.__time0id.value;
			document.detail1.document.cscform.__tdesc.value = document.cscform.__tdesc.value;
			document.detail1.document.cscform.__edesc.value = document.cscform.__edesc.value;
			//submitiframe();
			document.detail1.document.cscform.submit();
			//document.cscform.__buttonev.value="1";
			confirmSave();
			//document.cscform.__cmd.value = "save";
		//document.cscform.submit();
	}
}

function  confirmSave(){
	with(document.cscform){
		__cmd.value = "save";
		submit();
	}
}

function update(){
	with(document.cscform){
		__confirm.value="2";
		__cmd.value = "save";
		submit();		
   }
}

function GoUpdate(){
  	aCon=confirm(MyCode[3]);// จะบันทึกหรือไม่
	if (aCon==true)	{
			document.detail1.document.cscform.__time0id.value = document.cscform.__time0id.value;
			document.detail1.document.cscform.__tdesc.value = document.cscform.__tdesc.value;
			document.detail1.document.cscform.__edesc.value = document.cscform.__edesc.value;
			document.detail1.document.cscform.__confirm.value="s";
			document.detail1.document.cscform.__cmd.value="save";
			//alert(document.detail1.document.cscform.__time0id.value
			//	+" : "+document.detail1.document.cscform.__monthid.value
			//	+" : "+document.detail1.document.cscform.__yearid.value);
			//submitiframe();
			document.detail1.document.cscform.submit();
			update();
	}
}

function GoDelete(){ edelete(); }
function GoSearch(){
   submitiframe();
   document.detail1.document.cscform.submit();
   search();
 }


function refreshIframe(){
			if(document.cscform.__time0id.value.length>0){
				submitiframe();
				document.detail1.document.cscform.submit();
			}
}

</script>
</head>

<body leftmargin="0" topmargin="0" onLoad="refreshIframe();">
<form name="cscform" method="post" action="TAU106_LPN.jsp">


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

<%=screen.InitialVariable()%>

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

<input name="__cmd" type="hidden" value="">
	<input type="hidden" name="__calendar" value="">
	 <script language="javascript">getInputFormatDate();</script>
	<input type="hidden" name="__language" value='<%=screen.getUProfile().get("lang")%>'>
	<input type="hidden" name="__notNull" value='<%=screen.getRequire()%>'>
	<input type="hidden" name="__screen" value="TAU106_LPN">
	<input type="hidden" name="__help" value="">
	<input type="hidden" name="__gorec" value="<%=TAU106_LPN.getValue("gorec")%>">
	<input type="hidden" name="__ack" value="<%=TAU106_LPN.getValue("ack")%>">
	<input type="hidden" name="__pageIframe" value="<%=TAU106_LPN.getValue("pageIframe")%>">
	<input type="hidden" name="__helpReturn" value="">
	<input name="__companyid" type="hidden" value="<%=screen.getUProfile().get("companyid")%>">
	<input name="__employeeid" type="hidden" value="<%=screen.getUProfile().get("actor")%>">
	<input name="__fixCon" type="hidden" value=" status='1'">
	<input name="__monthtxt" type="hidden" value="">
	<input name="__month" type="hidden" value="<%=curDate.getMonth()%>">
	<input name="__year" type="hidden" value="<%=curDate.getEngYYYY()%>">
	<input type="hidden" name="__status" value="1">
	<input type="hidden" name="__buttonev" value="1">
<div id="toolTipLayer" style="position:absolute; visibility: hidden"></div>
<script language="javascript">initToolTips();</script>
<script src="../JS/HOTKEY.js"></script>
  <div align="center">
	<script language="javascript"> 
		var titlename=swap2String('Define Shift Pattern'); 
		document.write(Icons("TAU106_LPN,"+titlename)); 
	</script>
<br>
    <table width="640" align="center" class="large">
<tr >
        <td class="header" > TAU106_LPN,&nbsp; <script language="javascript">swapLang("Define Shift Pattern");</script>&nbsp; </td>
      </tr>
      <tr >
        <td >
		<table  class="maxsize" align="center" >
            <tr> 
              <td width="148" nowrap class="columnlabel"><%=screen.getLabel("time0id")%>&nbsp;</td>
              <td colspan="3"><%=screen.getInput("time0id")%> <div align="right"></div></td>
			  </tr>
            <tr> 
              <td nowrap class="columnlabel"><%=screen.getLabel("tdesc")%>&nbsp;</td>
              <td colspan="3"><%=screen.getInput("tdesc")%></td>
			  </tr>
            <tr> 
              <td nowrap class="columnlabel"><%=screen.getLabel("edesc")%>&nbsp;</td>
              <td colspan="3"><%=screen.getInput("edesc")%></td>
			  </tr>
            
            <tr> 
              <td  class="row1" colspan="2"> 
                <%if(!TAU106_LPN.getValue("pageIframe").equals("TAU107_LPN.jsp")){%>
                <a href="javascript:goIframe('TAU107_LPN.jsp');"> 
                <div align="center"><script language="javascript">swapLang("Shift Pattern");</script></div>
                </a> 
                <%}else{%>
                <div align="center"><script language="javascript">swapLang("Shift Pattern");</script></div>
                <%}%>
              </td>
              <td  class="row1" colspan="2" width="373"> 
                <%if(!TAU106_LPN.getValue("pageIframe").equals("TAU108_LPN.jsp")){%>
                <a href="javascript:goIframe('TAU108_LPN.jsp');"> 
                <div align="center"><script language="javascript">swapLang("Description");</script></div>
                </a> 
                <%}else{%>
                <div align="center"><script language="javascript">swapLang("Description");</script></div>
                <%}%>
              </td>
            </tr>
            <tr> 
              <td colspan="4"> <div align="center"> 
                  <iframe frameborder="0" height="300" width="100%"  src= "<%=TAU106_LPN.getValue("pageIframe")%>" marginwidth="0" name="detail1" ></iframe>
                </div></td>
            </tr>
          </table>

        </td>
      </tr>
	  <tr>
            <td>
				<table width="100%" border="0" cellpadding="0" cellspacing="0" class="inframe">
                <tr align="center">
					<td align="left">&nbsp;&nbsp;<%=screen.getLabel("hour_d")%>&nbsp;<%=screen.getInput("hour_d")%></td>
                	<td align="left" >&nbsp;&nbsp;<%=screen.getLabel("hour_w")%>&nbsp;<%=screen.getInput("hour_w")%></td>
                  	<td align="left">&nbsp;&nbsp;<%=screen.getLabel("hour_m")%>&nbsp;<%=screen.getInput("hour_m")%></td>
                </tr>
              	</table>
			</td>
      	</tr>
      <tr>
        <td class="bottom" >
          </td>
      </tr>
    </table>
  </div>


<!----------BEGIN CSC ENDING ZONE ------------------------>

<%=screen.endJSP()%>

<!----------END CSC ENDING ZONE -------------------------->

</form>
</body>
</html>