<%@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.*,com.csc.library.ui.controller.*"  %>

<%request.setCharacterEncoding("UTF-8");%>

<!-- Begin useBean -->

<jsp:useBean id="WELEXP001C" class="com.csc.library.system.Task" scope="page"/>
<jsp:setProperty name="WELEXP001C" property="appname" value="WELFARE" />

<%
	WELEXP001C.setChannel(request, response);
	UIManager screen = (UIManager) WELEXP001C.process("SingleEntry", "WELEXP001C");
	
	CheckNull chk=new CheckNull();
	String employeeid=chk.chkNullString(request.getParameter("employeeid")); 
	boolean isstep1=Boolean.parseBoolean(java.net.URLDecoder.decode(chk.chkNullString(request.getParameter("isstep1"))));
%>
<!-- End useBean -->

<HTML>
	<HEAD>
		<TITLE>myNOTE : Business Process Management Service</TITLE>
		<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
		<!-- Begin Link -->
		<!-- Begin CSS Links -->
		<LINK REL="stylesheet" TYPE="text/css" HREF="../CSS/DDMENU.css" />
		<LINK REL="stylesheet" TYPE="text/css" HREF="../CSS/EMV_DEFAULT.css" />
		<LINK REL="stylesheet" TYPE="text/css" HREF="../CSS/EMV_LAYOUT.css" />
		<LINK REL="stylesheet" TYPE="text/css" HREF="../CSS/EMV_LAYOUT_TWO.css" />
		<LINK REL="stylesheet" TYPE="text/css" HREF="../CSS/EMV_TEXT.css" />
		<LINK HREF="../CSS/MYNOTE.css" REL="stylesheet" TYPE="text/css">

<!-- 		<LINK REL="stylesheet" TYPE="text/css" HREF="../CSS/MYNOTE_SME.css" /> -->
		<!-- End CSS Links -->
		<!-- End Link -->
		<!-- Begin Import Script -->
		<!-- Begin script for Dropdown Menu -->
		<!-- DO NOT EDIT -->
		<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript" SRC="../JS/EVENTS.js"></SCRIPT>
		<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript" SRC="../JS/DDMENU.js"></SCRIPT>
		<!--[if lt IE 7]><script language="JavaScript" type="text/javascript" src="../JS/IEHOVER-FIX.js"></script><![endif]-->
		<!-- DO NOT EDIT -->
		<!-- End script for Dropdown Menu -->
		<SCRIPT LANGUAGE="JavaScript" TYPE='text/JavaScript' SRC='../JS/UTILITIES.js'></SCRIPT>
		<SCRIPT LANGUAGE="JavaScript" TYPE='text/JavaScript' SRC='../JS/ACTIVE_OBJECT.js'></SCRIPT>
		<SCRIPT TYPE='text/JavaScript' SRC='../JS/MYNOTE_SCREEN.js'></SCRIPT>
		<SCRIPT TYPE='text/JavaScript' SRC='../JS/MYNOTE_MENU.js'></SCRIPT>
		<SCRIPT TYPE='text/JavaScript' SRC='../JS/SCREEN.js'></SCRIPT>
		<SCRIPT TYPE='text/JavaScript' SRC='../JS/DATEINPUT.js'></SCRIPT>
		<SCRIPT TYPE='text/JavaScript' SRC='../JS/VIEWCALENDAR.js'></SCRIPT>
		<SCRIPT TYPE='text/JavaScript' SRC='../JS/ICONSMENU.js'></SCRIPT>
		<SCRIPT LANGUAGE="JavaScript">setLang('<%=screen.getUProfile().get("lang")%>');</SCRIPT>
		<!-- End Import Script -->
		<!--DWR INCLUD-->
		<script type='text/javascript' src='/hr/dwr/interface/SearchDWR.js'></script>		
		<script type='text/javascript' src='/hr/dwr/engine.js'> </script>
	    <script type='text/javascript' src='/hr/dwr/util.js'></script>
	    <script type='text/javascript' src='/hr/dwr/interface/Texpend_emp_controller.js'></script>
	    <script type='text/javascript' src='/hr/dwr/interface/CheckExpendDwr.js'></script>
	   
		<!--DWR INCLUDE-->
		<SCRIPT LANGUAGE="JavaScript" TYPE="text/JavaScript">
		ThaiCode[210]="กรุณารอสักครู่ ";
		EngCode[210]="Please wait !!!!! ";		
 	    ThaiCode[211] = "ไม่สามารถแก้ไขได้ !!!!!!";
	     EngCode[211] = "Can't Update !!!!!!";
 	    ThaiCode[212] = "ไม่มีการเบิกค่าเครื่องบิน กรุณาระบะเป็น 0";
	     EngCode[212] = "No request plane cost ,please input 0";
		 ThaiCode[213] = "ไม่สามารถบันทึกได้เนื่องจาก เคยมีการขอในช่วงวันดังกล่าวแล้ว";
	     EngCode[213] = "ไม่สามารถบันทึกได้เนื่องจาก เคยมีการขอในช่วงวันดังกล่าวแล้ว";
		ThaiCode[311]="ข้อมูลไม่ถูกต้อง วันที่ต้องอยู่ในช่วง ";
		EngCode[311]="invalid date between ";		

			setPageTitle(swap2String("Travel approve and expend"));
			var reqArray=new Array(11);
			var msg="";
			
			function addNew() {	 
				hiddenDiv();  
				if(nullCheck()&&checkPeriodDate()){
					checkDatelimit();
				}
				setTimeout("displayDiv()",2000);					
			}
			
		function CheckExpendBean(reqArray,allItem){
  			   CheckExpendDwr.checkAllItems(reqArray,allItem);	
		}

		function setItemvalue(){
			var exptype=window.opener.document.cscform.__wf__exp_type.value;
			var provinceid=window.opener.document.cscform.__wf__provinceid.value;
			var countryid=window.opener.document.cscform.__wf__countryid.value;
			var locationtype=window.opener.document.cscform.__wf__location_type.value;
			var trav_by=window.opener.document.cscform.__wf__trav_by.value;
			var trav_type=window.opener.document.cscform.__wf__trav_type.value;
			with(document.cscform){	
					var vehicle=(__vehiclestatus[1].checked)?__vehiclestatus[1].value:"0";
					if(__allowancestatus[1].checked) 
							reqArray[0]="301#"+__employeeid.value+"#"+__allowancecost.value+"# #"+__startdate.value+"#"+exptype+"#"+locationtype+"#"+provinceid+"#"+countryid+"#"+__startdate.value+"#"+__enddate.value+"#"+trav_by+"#"+trav_type+"# # #"+__allowanceday.value;
					if(__pedestalstatus[1].checked) 
							reqArray[1]="302#"+__employeeid.value+"#0# #"+__startdate.value+"#"+exptype+"#"+locationtype+"#"+provinceid+"#"+countryid+"#"+__startdate.value+"#"+__enddate.value+"#"+trav_by+"#"+trav_type+"# #"+__pedestalstatus[1].value+"#"+__pedestalday.value;
					if(__accommodationstatus[1].checked) 
							reqArray[2]="303#"+__employeeid.value+"#0# #"+__startdate.value+"#"+exptype+"#"+locationtype+"#"+provinceid+"#"+countryid+"#"+__startdate.value+"#"+__enddate.value+"#"+trav_by+"#"+trav_type+"#"+vehicle+"# #"+__accommodationday.value;
					//if(__vehiclestatus[1].checked) 
					//		reqArray[3]="304#"+__employeeid.value+"#0# #"+__startdate.value+"#"+exptype+"#"+locationtype+"#"+provinceid+"#"+countryid+"#"+__enddate.value+"#"+trav_by+"#"+trav_type;
					reqArray[4]="305#"+__employeeid.value+"#0# #"+__startdate.value+"#"+exptype+"#"+locationtype+"#"+provinceid+"#"+countryid+"#"+__startdate.value+"#"+__enddate.value+"#"+trav_by+"#"+trav_type;
					reqArray[5]="306#"+__employeeid.value+"#0# #"+__startdate.value+"#"+exptype+"#"+locationtype+"#"+provinceid+"#"+countryid+"#"+__startdate.value+"#"+__enddate.value+"#"+trav_by+"#"+trav_type;
			}
		}
		
	var allItem = function(data1){
	 msg="";
		for(var i=0;i<data1.length;i++){
				if(data1[i]!=null){						
						var vdata=data1[i].split('#');
						setValueExpend(vdata);
				}
		}
		setValue2Bean();
	}
	
	function setValueExpend(data){
		with(document.cscform){
			if(data[0]=="true"){
				if(data[8]=="301"){
					var rate=parseFloat((__exchangerate.value.length==0)?"1":__exchangerate.value);
					var cost=parseFloat(data[7]);
					if(cost==-99){
						msg="กรุณาระบุค่าเบี้ยเลี้ยง";	
						__allowancecost.disabled=false;	
					}else{
						__allowancecost.value=formatCurrency(parseFloat(data[5])*rate);
						__allowancecost.disabled=true;	
					}
				}else if(data[8]=="302"){
					__pedestalcost.value=formatCurrency(parseFloat(data[5]));
				}else if(data[8]=="303"){
				    __accommodationcost.value=formatCurrency(parseFloat(data[5]));
				}else if(data[8]=="305"){
				    if(parseFloat(__planetype.value)!=0 && parseFloat(__planetype.value)<parseFloat(data[5])){
							if(window.opener.document.cscform.__wf__outoflimit.value=="0"){
										window.opener.document.cscform.__wf__outoflimit.value="1";
							}
					}				
				}else if(data[8]=="306"){
				  if(parseFloat(__dresscost.value.replace(",",""))!=0 && parseFloat(__dresscost.value.replace(",",""))>parseFloat(data[5])){
							__dresscost.value=formatCurrency(parseFloat(data[5]));
					}else{
							__dresscost.value=formatCurrency(parseFloat(data[5]));
					}				
				}	
				displayDiv();			
		   }else{
		   		msg="ไม่สามารถเบิกได้";
		   }				
		}
	}
			
			function setValue2Bean(){		
						if(msg.length>0){
						 alert(msg);
						 }else{				
						var texpend_emp_control = { __expendid:null, __employeeid:null, __companyid:null, __startdate:null, __enddate:null, __costcenter:null , __budget:null, __pedestalcost:null, __pedestalstatus:null 
							, __pedestalday:null, __allowancecost:null,__allowancestatus:null,__allowanceday:null, __accommodationcost:null, __accommodationstatus:null, __accommodationday:null
							, __vehiclecost:null, __vehiclestatus:null, __planecost:null, __planetype:null, __dresscost:null, __boatcost:null, __traincost:null, __taxicost:null, __spacialcost:null, __coachbuscost:null 
							, __memployee_fullname:null, __budget_ptt_tdesc:null, __mcostcenter0_tdesc:null,__exchangerate:null };
						dwr.util.getValues(texpend_emp_control);
						window.opener.writeTexpend_emp_control(texpend_emp_control);						
						setTimeout("Closepage()",1000);															
						}
			}
			
			function loadFromParent(employeeid){
					var texpend_emp_control=window.opener.loadData(employeeid);
					dwr.util.setValues(texpend_emp_control);
			}
			function backhead(){
				with(window.opener.cscform){
					__cmd.value="back";
					submit();
				}
			}
			function Closepage(){
				with(window.cscform){
						//backhead();
						window.close();
				}
			}
			function goHelp(helpName,inputName){
			if("<%=isstep1%>"=="true"){
				with(document.cscform){
				var helpReturn="",fcon="";
					if(inputName == "__costcenter"){
						helpReturn="__costcenter:costcenterid,__mcostcenter0_tdesc:tdesc";
						linkHelp_Return_search(helpName,helpReturn);
				}else if(inputName == "__budget"){ 
						if(__costcenter.value.length>0){
								temp = __fixCon.value;
								__fixCon.value = "costcenterid='"+__costcenter.value+"'";
								helpReturn="__budget:budgetid,__budget_ptt_tdesc:tdesc";
								linkHelp_Return(helpName,helpReturn);
								__fixCon.value=temp;								
						}else{
								alert(MyCode[0]);
								__costcenter.focus();
						}
					}else if(inputName == "__employeeid"){
						helpReturn="__employeeid:employeeid,__memployee_fullname:fullname";
						linkHelp_Return(helpName,helpReturn);
					}
				}
			}else{
				alert(MyCode[211]);
			}
			}
			function chkBeforeAdd(){
				with(document.cscform){
					var maxday = calculateDate(__startdate.value, __enddate.value); 
					 if(__planetype.options[__planetype.selectedIndex].value=="0"){
					 		__planecost.value="0.00";
					 }
					if( (parseInt(__pedestalday.value)+parseInt(__allowanceday.value)) > parseInt(maxday) ){
						alert("จำนวนวันเกิน (ค่าปฏิบัติงานนั่งแท่น +ค่าเบี้ยเลี้ยง)");
						return false;
					}
					if((parseInt(maxday)-1)>0 && parseInt(__accommodationday.value) > (parseInt(maxday)-1) ){
						alert("จำนวนวันเกิน (ค่าที่พัก)");
						return false;
					}else if(__planetype.options[__planetype.selectedIndex].value!="0" && parseFloat(__planecost.value.replace(",",""))==0){
						alert(MyCode[212]);
						return false;
					}
					return true;
				}
			}
			
			
			function calculateDate(date1,date2){
				with(document.cscform){
				 		var day=1000*60*60;
						var bdate=date1.split("-");
						var stdate=new Date(bdate[2],bdate[1]-1,bdate[0]);
						var bdate=date2.split("-");
						var endate=new Date(bdate[2],bdate[1]-1,bdate[0]);
						var st=Math.ceil(stdate.getTime());
						var en=Math.ceil(endate.getTime());	
						var diff=(en-st)/day;
						var diffday=diff/24;
						var dd=parseInt(diffday)+1;								
						return dd;
					}
			}
			
			function disableVal(){
				with(document.cscform){
					__accommodationcost.disabled = true;
					__allowancecost.disabled = true;
					__pedestalcost.disabled = true;
					disableDay(__accommodationstatus,__accommodationday,__accommodationcost);
					disableDay(__allowancestatus,__allowanceday,__allowancecost);
					disableDay(__pedestalstatus,__pedestalday,__pedestalcost);
				}
			}
			function disableDay(status,day,objcost){
				var check = ((typeof status.length=="undefined")?status.value=="0":status[0].checked); 
				if(check){
					day.value = "0";
					day.disabled = true;
					objcost.value="0.00";					
				}else{
					 if(parseInt(day.value)==0){
							day.value = "1";
					}
					day.disabled = false;
				}
			}
			
	function hiddenDiv(){
		with(document.cscform){ 
		     msg="";
			 reqArray=new Array(11);
			 btsubmit.style.display="none";
			 showtxt.innerHTML="<p align='center'><img src='./IMAGES/WAITING.gif'><BR><font color='red' ><B>"+MyCode[210]+"</H3></font><p>";
		}
	}
	
	function displayDiv(){
				with(document.cscform){
						 btsubmit.style.display="";
						 showtxt.innerHTML="";
					}	
	}				
	
			function linkHelp_SendToReturn(help,input){
				with( document.cscform ){
					var param = "BROWSE_USER.jsp?__helpName="+help+"&__helpReturn="+input+"&__pageCall="+__screen.value+"&__fixCon="+__fixCon.value+"&__checkVerify=off&__langOn=off";
					window.open(param,"Help","left=150,top=150,width=530,height=370,toolbar=no,status=yes,scrollbars=yes,resizable=yes");
				}
			}
			
			function linkHelp_Return_search(help,input){
				with( document.cscform ){
					var param="BROWSE_WELFAREHELP.jsp?__helpName="+help+"&__helpReturn="+input+"&__pageCall="+__screen.value+"&__fixCon="+__fixCon.value+"&__checkVerify=off&__langOn=off";
					window.open(param,"Help","left=150,top=150,width=530,height=370,toolbar=no,status=yes,scrollbars=yes,resizable=yes");
				}
			}		
						
			function linkHelp_Return(help,input){
				with( document.cscform ){
					var param="EMV_PRU084.jsp?__helpName="+help+"&__helpReturn="+input+"&__pageCall="+__screen.value+"&__fixCon="+__fixCon.value+"&__checkVerify=off&__langOn=off";
					window.open(param,"Help","left=150,top=150,width=530,height=370,toolbar=no,status=yes,scrollbars=yes,resizable=yes");
				}
			}
			function linkHelpWF(help,input){
				with(document.cscform){
					var temp = __fixCon.value;
					var fix = "wf_id='"+wf_id.value+"' and wf_ver='"+wf_ver.value+"' and initiator='<%=screen.getUProfile().get("actor")%>' and (wf_status<>'4' and wf_status<>'6' and wf_status<>'3' and wf_status<>'8' and wf_status<>'A' and wf_status<>'B')";
					var param="EMV_PRU084.jsp?__helpName="+help+"&__fieldSearch="+input+"&__pageCall="+__screen.value+"&__fixCon="+fix;
					window.open(param,"Help","left=150,top=150,width=530,height=370,resizable=yes,scrollbars=yes,toolbar=no,status=yes");
					__fixCon.value = temp;
				}
			}	

			function searchCostcenter(){
				with(document.cscform){			
						SearchDWR.searchDBXMLAll(new Array("MBUDGET_PTTHELP", "mbudget_ptt.budgetid,mbudget_ptt.tdesc", "mbudget_ptt:costcenterid = '"+__costcenter.value+"'", "false", "langOn"), function(data){
										if(data.length>0){  
													__budget.value=data[0][0];
													__budget_ptt_tdesc.value=data[0][1];
										}else{
													__budget.value="";
													__budget_ptt_tdesc.value="";
										}
								});						
					}
			}
			
			function checkDatelimit(){
				with(document.cscform){		
						var stdate=__startdate.value.split("-");	
						var endate=__enddate.value.split("-");	
						var  st=stdate[2]+"-"+stdate[1]+"-"+stdate[0];;
						var  en=endate[2]+"-"+endate[1]+"-"+endate[0];
						SearchDWR.searchDBXMLAll(new Array("TEXPEND_EMPHELP", "texpend_emp.expendid,texpend_emp.employeeid", "texpend_emp:employeeid='"+__employeeid.value+"'  and (('"+st+"' between startdate and enddate) or ('"+en+"' between startdate and enddate)or (startdate between '"+st+"' and '"+en+"')or (enddate between '"+st+"' and '"+en+"')) and workingstatus!='C'", "false", "langOn"), function(data){
										if(data.length>0){ 
													alert(MyCode[213]);
													displayDiv();	
													return false;
										}else{
													if(chkBeforeAdd()){															
															setItemvalue();
															CheckExpendBean(reqArray,allItem);
													}
										}
								});						
					}
			}			
		function checkPeriodDate(){				
				var bdate=document.cscform.__startdate.value.split("-");
				var edate=document.cscform.__enddate.value.split("-");
				var cdate=new Date(bdate[2],bdate[1]-1,bdate[0]);
				var ddate=new Date(edate[2],edate[1]-1,edate[0]);
						bdate=window.opener.document.cscform.__wf__startdate.value.split("-");
				var stdate=new Date(bdate[2],bdate[1]-1,bdate[0]);
						bdate=window.opener.document.cscform.__wf__enddate.value.split("-");
				var endate=new Date(bdate[2],bdate[1]-1,bdate[0]);
				var st=Math.ceil(stdate.getTime());
				var cu=Math.ceil(cdate.getTime());
				var du=Math.ceil(ddate.getTime());
				var en=Math.ceil(endate.getTime());	
				if(cu<st || du>en){
						alert(MyCode[311]+" "+window.opener.document.cscform.__wf__startdate.value +"  -   "+window.opener.document.cscform.__wf__enddate.value);
						displayDiv();
						return false;
				}
				return true;
		}					
			
			function postReturn(){ 
				searchCostcenter();
			}
			function formatCurrency(num) {
					num = num.toString().replace(/\|\,/g,'');
					if(isNaN(num))
						num = "0";
						sign = (num == (num = Math.abs(num)));
						num = Math.floor(num*100+0.50000000001);
						cents = num%100;
						num = Math.floor(num/100).toString();
					if(cents<10)
						cents = "0" + cents;
					for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)
						num = num.substring(0,num.length-(4*i+3))+','+
						num.substring(num.length-(4*i+3));
						return (((sign)?'':'-') +  num + '.' + cents);
			}	
	
		</SCRIPT>
	</HEAD>
	<BODY>

		<FORM NAME="cscform" METHOD="post" ACTION="WELEXP001C.jsp">
			<%=screen.InitialVariable()%>
			<INPUT TYPE="hidden" NAME="__screen" VALUE="WELEXP001C">
			<INPUT TYPE="hidden" NAME="__cmd" VALUE="">
			<INPUT TYPE="hidden" NAME="cmd" VALUE="">
			<INPUT TYPE="hidden" NAME="__help" VALUE="">
			<INPUT TYPE="hidden" NAME="__fixCon" VALUE="">
			<input type="hidden" name="__ack" value="">
			<input type="hidden" name="__help" value="">
			<input type="hidden" name="__headMulti" value="<%=request.getParameter("__headMulti")%>">
			<input type="hidden" name="__gorec" value="<%=request.getParameter("__gorec")%>">
			<INPUT TYPE="hidden" NAME="__notNull" VALUE="employeeid,costcenter,budget,">
			<INPUT TYPE="hidden" NAME="__language" VALUE="<%=screen.getUProfile().get("lang")%>">
			<INPUT TYPE="hidden" NAME="__companyid" VALUE="<%=screen.getUProfile().get("companyid")%>">
			<INPUT TYPE="hidden" NAME="__calendar" VALUE="">
			<INPUT TYPE="hidden" NAME="__expendid" VALUE="<%=chk.chkNullString(request.getParameter("__expendid"),screen.getDataLabel("expendid"))%>">

			<input type="hidden" name="editac" value="<%=request.getParameter("editac") %>">
			<input type="hidden" name="editindex" value="<%=request.getParameter("editindex") %>">
			<input type="hidden" name="successed" value="<%=request.getParameter("successed") %>"> 

			<input type="hidden" name="first" value="true">
			<SCRIPT LANGUAGE="JavaScript">getInputFormatDate();</SCRIPT>
			<DIV ID="toolTipLayer" STYLE="position:absolute; visibility: hidden"></DIV>
			<SCRIPT LANGUAGE="JavaScript">initToolTips();</SCRIPT>

							<TABLE WIDTH="95%" BORDER="0" ALIGN="center" CELLPADDING="0" CELLSPACING="0">
								<TR>
									<TD WIDTH="5" HEIGHT="5"><IMG SRC="../IMAGES/MYNOTE/C-T-L.gif" WIDTH="5" HEIGHT="5"></TD>
									<TD HEIGHT="5"><IMG SRC="../IMAGES/MYNOTE/T.gif" WIDTH="100%" HEIGHT="5"></TD>
									<TD WIDTH="5" HEIGHT="5"><IMG SRC="../IMAGES/MYNOTE/C-T-R.gif" WIDTH="5" HEIGHT="5"></TD>
								</TR>
								<TR>
									<TD WIDTH="5" BACKGROUND="../IMAGES/MYNOTE/L2.gif"></TD>
									<TD VALIGN="middle">
										<TABLE WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="1">
											<tr>
												<td colspan="2"  class="column-title"><div align="center"><b><script language="javascript">swapLang('Expend Detail')</script></b></a></td>
											</tr>
											<tr>
												<td class="column-label"><%= screen.getLabel("EMPLOYEEID")%></td>
												<td class="column-input"><%= screen.getInput("EMPLOYEEID")%><input type="text" name="__memployee_fullname" value="<%=screen.getDataLabel("MEMPLOYEE","FULLNAME")%>" size="50" readonly></td>
											</tr>
											<tr>
											  <td class="column-label"><%= screen.getLabel("STARTDATE")%></td>
											  <td class="column-input"><%= screen.getInput("STARTDATE")%>&nbsp;<%if(isstep1){%><a href="#" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image1','','../IMAGES/BUTTON/SWAP/CALENDAR_SWAP20.gif',1)"><img src="../IMAGES/BUTTON/MAIN/CALENDAR20.gif" alt="calendar" name="Image1" border="0" align="absmiddle" id="Image1" onClick="viewCal('__startdate')"></a><%}%></td>
											</tr>
											<tr>
											  <td class="column-label"><%= screen.getLabel("ENDDATE")%></td>
											  <td class="column-input"><%= screen.getInput("ENDDATE")%>
											    <%if(isstep1){%><a href="#" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image2','','../IMAGES/BUTTON/SWAP/CALENDAR_SWAP20.gif',1)"><img src="../IMAGES/BUTTON/MAIN/CALENDAR20.gif" alt="calendar" name="Image2" border="0" align="absmiddle" id="Image2" onClick="viewCal('__enddate')">
										      <%}%>
										      </a></td>
											</tr>
											 <tr>
                                              <td class="column-label"><%= screen.getLabel("exchangerate")%></td>
										      <td class="column-input"><%= screen.getInput("exchangerate")%> (*กรณีเดินทางต่างประเทศ) </td>
											</tr>
											 <tr>
                                              <td class="column-label"><%= screen.getLabel("COSTCENTER")%></td>
										      <td class="column-input"><%= screen.getInput("COSTCENTER")%><input type="text" name="__mcostcenter0_tdesc" size="50" value="<%=screen.getDataLabel("MCOSTCENTER0","TDESC")%>" readonly></td>
											</tr>
											<tr>
                                              <td class="column-label"><%= screen.getLabel("BUDGET")%></td>
										      <td class="column-input"><%= screen.getInput("BUDGET")%><input type="text" name="__budget_ptt_tdesc" size="50" value="<%=screen.getDataLabel("MBUDGET_PTT","TDESC")%>" readonly></td>
											</tr>
											 <tr>
												  <td class="column-label"><%= screen.getLabel("PEDESTALCOST")%></td>
												  <td class="column-input"><%= screen.getInput("PEDESTALSTATUS")%>&nbsp;&nbsp;<%= screen.getInput("PEDESTALDAY")%>&nbsp;<script language="javascript">swapLang('Day')</script>&nbsp;&nbsp;<%= screen.getInput("PEDESTALCOST")%>&nbsp;<script language="javascript">swapLang('Bath')</script></td>
											 </tr>
											 <tr>
												  <td class="column-label"><%= screen.getLabel("ALLOWANCECOST")%></td>
												  <td class="column-input"><%= screen.getInput("ALLOWANCESTATUS")%>&nbsp;&nbsp;<%= screen.getInput("ALLOWANCEDAY")%>&nbsp;<script language="javascript">swapLang('Day')</script>&nbsp;&nbsp;<%= screen.getInput("ALLOWANCECOST")%>&nbsp;<script language="javascript">swapLang('Bath')</script></td>
											 </tr>
											 <tr>
												  <td class="column-label"><%= screen.getLabel("ACCOMMODATIONCOST")%></td>
												  <td class="column-input"><%= screen.getInput("ACCOMMODATIONSTATUS")%>&nbsp;&nbsp;<%= screen.getInput("ACCOMMODATIONDAY")%>&nbsp;<script language="javascript">swapLang('Day')</script>&nbsp;&nbsp;<%= screen.getInput("ACCOMMODATIONCOST")%>&nbsp;<script language="javascript">swapLang('Bath')</script></td>
											 </tr>
											 <tr>
												  <td class="column-label"><%= screen.getLabel("VEHICLESTATUS")%></td>
												  <td class="column-input"><%= screen.getInput("VEHICLESTATUS")%></td>
											 </tr>
											 <input type="hidden" name="__vehiclecost" value="0.00">
											 <tr>
												  <td class="column-label"><%= screen.getLabel("PLANECOST")%></td>
												  <td class="column-input"><%= screen.getInput("PLANETYPE")%>&nbsp;<%= screen.getInput("PLANECOST")%>&nbsp;<script language="javascript">swapLang('Bath')</script></td>
											 </tr>
											 <tr>
												  <td class="column-label"><%= screen.getLabel("DRESSCOST")%></td>
												  <td class="column-input"><%= screen.getInput("DRESSCOST")%>&nbsp;<script language="javascript">swapLang('Bath')</script></td>
											 </tr>
											 <tr>
												  <td class="column-label"><%= screen.getLabel("BOATCOST")%></td>
												  <td class="column-input"><%= screen.getInput("BOATCOST")%>&nbsp;<script language="javascript">swapLang('Bath')</script></td>
											 </tr>
											  <tr>
												  <td class="column-label"><%= screen.getLabel("COACHBUSCOST")%></td>
												  <td class="column-input"><%= screen.getInput("COACHBUSCOST")%>&nbsp;<script language="javascript">swapLang('Bath')</script></td>
											 </tr>
											 <tr>
												  <td class="column-label"><%= screen.getLabel("TRAINCOST")%></td>
												  <td class="column-input"><%= screen.getInput("TRAINCOST")%>&nbsp;<script language="javascript">swapLang('Bath')</script></td>
											 </tr>
											  <tr>
												  <td class="column-label"><%= screen.getLabel("TAXICOST")%></td>
												  <td class="column-input"><%= screen.getInput("TAXICOST")%>&nbsp;<script language="javascript">swapLang('Bath')</script></td>
											 </tr>
											  <tr>
												  <td class="column-label"><%= screen.getLabel("SPACIALCOST")%></td>
												  <td class="column-input"><%= screen.getInput("SPACIALCOST")%>&nbsp;<script language="javascript">swapLang('Bath')</script></td>
											 </tr>
										</TABLE>
									</TD>
									<TD WIDTH="5" BACKGROUND="../IMAGES/MYNOTE/R2.gif"></TD>
								</TR>
								<TR>
									<TD WIDTH="5" HEIGHT="5"><IMG SRC="../IMAGES/MYNOTE/C-B-L.gif" WIDTH="5" HEIGHT="5"></TD>
									<TD HEIGHT="5"><IMG SRC="../IMAGES/MYNOTE/B.gif" WIDTH="100%" HEIGHT="5"></TD>
									<TD WIDTH="5" HEIGHT="5"><IMG SRC="../IMAGES/MYNOTE/C-B-R.gif" WIDTH="5" HEIGHT="5"></TD>
								</TR>
							</TABLE>
							<TABLE WIDTH="95%"  BORDER="0" ALIGN="center" CELLPADDING="0" CELLSPACING="0" CLASS="thai03">
								<TR>
									<TD><SPAN id="showtxt"></SPAN><DIV ALIGN="right"  id="btsubmit"><%if(isstep1){%><A HREF="JavaScript:addNew();"><IMG SRC="../IMAGES/MYNOTE/BUTTON/BUTTON_SUBMIT.gif" WIDTH="89" HEIGHT="37" BORDER="0"></A><%}%><A HREF="JavaScript:Closepage();"><IMG SRC="../IMAGES/MYNOTE/BUTTON/BUTTON_CANCEL.gif" WIDTH="89" HEIGHT="37" BORDER="0"></A></DIV></TD>
								</TR>
							</TABLE>
							<% 
								if(chk.chkNullString(request.getParameter("successed")).equals("true")){
							%>
								<script language="javascript">backhead();</script>
							<%
								}

								if(employeeid.length()>0){
								%>
								<script language="javascript">
																loadFromParent("<%=employeeid%>");
																			if(document.cscform.__costcenter.value=="" ){
																				document.cscform.__costcenter.value=window.opener.document.cscform.__wf__costcenter.value;
																				document.cscform.__mcostcenter0_tdesc.value=window.opener.document.cscform.__wf__mcostcenter0_tdesc.value;
																			}																
																			if(document.cscform.__budget.value==""){
																				document.cscform.__budget_ptt_tdesc.value=window.opener.document.cscform.__wf__mbudget_ptt_tdesc.value;																												
																				document.cscform.__budget.value=window.opener.document.cscform.__wf__budget.value;				
																			}
																			if(document.cscform.__startdate.value=="")
																			document.cscform.__startdate.value=window.opener.document.cscform.__wf__startdate.value;
																			if(document.cscform.__enddate.value=="")
																			document.cscform.__enddate.value=window.opener.document.cscform.__wf__enddate.value;																				
								</script>
								<%		
								}else{
							%>
								<script language="javascript">
										document.cscform.__costcenter.value=window.opener.document.cscform.__wf__costcenter.value;
										document.cscform.__budget.value=window.opener.document.cscform.__wf__budget.value;				
										document.cscform.__mcostcenter0_tdesc.value=window.opener.document.cscform.__wf__mcostcenter0_tdesc.value;
										document.cscform.__budget_ptt_tdesc.value=window.opener.document.cscform.__wf__mbudget_ptt_tdesc.value;										
																			if(document.cscform.__startdate.value=="")
																			document.cscform.__startdate.value=window.opener.document.cscform.__wf__startdate.value;
																			if(document.cscform.__enddate.value=="")
																			document.cscform.__enddate.value=window.opener.document.cscform.__wf__enddate.value;	
								</script>							
							<%}%>							
							<script language="javascript">
							 if(document.cscform.__exchangerate.value=="0.00"){
							 		document.cscform.__exchangerate.value="1.00";
							 }
							disableVal();
							</script>		
							<%if(!isstep1){%>
							<script language="javascript">setDisabled(true);</script>		
							<%}%>
		</FORM>
	</BODY>
</HTML>