<%@page contentType="text/html; charset=UTF-8"%>
<%@page import="java.util.*,java.io.*"%>
<%@page import="com.csc.library.util.download.*"%>
<%@page import="com.csc.library.util.ManageDocumentService"%>
<%@page import="com.csc.library.databean.util.FileUtil"%>
<%@page import="com.csc.library.approve.*,com.csc.library.databean.*"%>
<%@page import="com.csc.library.entry.*,com.csc.library.utilities.*"%>
<%@page import="com.csc.library.session.*"%>
<%@page import="com.csc.library.components.*"%>

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

<!-- Begin useBean -->

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

<%
TEMPLATE_WORKFLOW.setChannel(request,response);
TEMPLATE_WORKFLOW.checkProfile();
if( TEMPLATE_WORKFLOW.getUProfile() != null ){
	//TEMPLATE_WORKFLOW.getUProfile().set("appname","TA");
	UIManager screenSingle = (UIManager) TEMPLATE_WORKFLOW.process("SingleEntry","TEMPLATE_WORKFLOW");
	String wf = null;
	CheckNull chkNull = new CheckNull();
	Organization og = new Masfactor(screenSingle.getUProfile());
	String subject = null;
	String remark = null;
	String step_type = null;
	String emp_fullname = null;
	String bossid = og.getBoss(screenSingle.getUProfile().get("employeeid"),screenSingle.getUProfile().get("job")).get(0).toString();
	String bossjob = bossid.substring(bossid.indexOf(":")+1);
	CscCalendar calendar = new CscCalendar();
	long attach_time = Long.parseLong(chkNull.chkNullString(request.getParameter("attach_time"),String.valueOf(calendar.getTimeInMillis())));
	ManageDocumentService md = new ManageDocumentService();
	md.setUProfile(screenSingle.getUProfile());
	md.setRequest(request);
	md.setScreen(screenSingle);
	md.setTableSize("100%");

	if( !chkNull.chkNullString(request.getParameter("__cmd")).equals("save") ){
		subject = chkNull.chkNullString(request.getParameter("subject"));
		remark = chkNull.chkNullString(request.getParameter("__remark"));
		emp_fullname = chkNull.chkNullString(request.getParameter("emp_fullname"));
	}else if( chkNull.chkNullString(request.getParameter("__cmd")).equals("save") ){
		if(chkNull.chkNullString(request.getParameter("isAdminEdit")).equals("true")){
			response.sendRedirect("../WORKFLOW_ADMIN/ADMIN_EDIT.jsp");
		}else if(chkNull.chkNullString(request.getParameter("isAdminCancel")).equals("true")){
			response.sendRedirect("../WORKFLOW_ADMIN/ADMIN_CANCEL.jsp");
		}else	if(chkNull.chkNullString(request.getParameter("isAdminClean")).equals("true")){
			response.sendRedirect("../WORKFLOW_ADMIN/ADMIN_CLEAN.jsp");
		}else if(chkNull.chkNullString(request.getParameter("isAdminDelete")).equals("true")){
			response.sendRedirect("../WORKFLOW_ADMIN/ADMIN_DELETE.jsp");
		}else if(chkNull.chkNullString(request.getParameter("draft_cmd")).equals("save") || chkNull.chkNullString(request.getParameter("draft_cmd")).equals("delete")){
			response.sendRedirect("../MYNOTE/INBOX.jsp");
		}else{
			response.sendRedirect("../MYNOTE/SENT_COMPLETE.jsp");
		}
		//response.sendRedirect("../MYNOTE/SENT_COMPLETE.jsp");
	}else{
		subject = "";
		remark = "";
		emp_fullname = "";
	}

	bossid = bossid.substring(0,bossid.indexOf(":"));
	DbRecord memployee_dr = new InitialRecord(screenSingle.getUProfile()).getDbRecord("Memployee");
	memployee_dr.setColumn("*");
	memployee_dr.set("COMPANYID",screenSingle.getUProfile().get("companyid"));
	memployee_dr.set("EMPLOYEEID",bossid);
	memployee_dr.search();

	//WF_STATUS 1 = รอการอนุมัติ
	//          3 = ยกเลิกการอนุมัติ
	//          4 = อนุมัติแล้ว
	//          5 = ไม่อนุมัติ
	//          6 = แก้ไขโดย HR
	//          7 = ส่งกลับ
	//          8 = ยกเลิกเอกสาร
	//          9 = ประวัติ

	if( (request.getParameter("__runno") == null || request.getParameter("__runno").equals("")) && 
		(request.getParameter("__help") == null || request.getParameter("__help").equals("")) ){
		screenSingle.clean();
	}

	if( (!screenSingle.getDataLabel("WF_STATUS").equals("1")) && (!screenSingle.getDataLabel("WF_STATUS").equals("4")) &&
		(!screenSingle.getDataLabel("WF_STATUS").equals("7")) ){
		wf = "false";
	}else{
		wf = "true";
	}

	if( request.getParameter("downfile") != null ){
		ThaiUtilities tu = new ThaiUtilities();
		String filePath = request.getParameter("downfile");
		File f = new File(tu.ASCII2Unicode(filePath));
		String fileName = f.getName();
		String fileType = fileName.substring(fileName.indexOf(".")+1,fileName.length());
		if ( f.exists() && f.canRead() ) {
			response.setContentType("application/octet-stream");
			response.setHeader("Content-Disposition", "attachment; filename="+tu.Unicode2ASCII(f.getName()));
			response.setHeader("cache-control", "no-cache");
			response.setContentLength((int) f.length());
			BufferedInputStream fileInput = new BufferedInputStream(new FileInputStream(f));
			byte buffer[] = new byte[8 * 1024];
			out.clearBuffer();
			OutputStream out_s = response.getOutputStream();
			CopyStreams.copyStreamsWithoutClose(fileInput, out_s, buffer);
			out_s.flush();
			out_s.close();
			fileInput.close();
		}
	}
%>
<!-- 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('<%=screenSingle.getUProfile().get("lang")%>');</SCRIPT>
		<!-- End Import Script -->
		<!--DWR INCLUDE-->
		<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/SystemCode.js"></script>
		<script type="text/javascript" src="/hr/dwr/interface/CscCalendar.js"></script>
		<script type="text/javascript" src="/hr/dwr/interface/Tabsent_nstda_dwr.js"></script>
		<script type="text/javascript" src="/hr/dwr/interface/ManageDocumentDWR.js"></script>
		<script type='text/javascript'  src='/hr/dwr/interface/Texpend_emp_controller.js'></script>
		<!--DWR INCLUDE-->
		<SCRIPT LANGUAGE="JavaScript" TYPE="text/JavaScript">
		<!--
			setPageTitle(swap2String("Travel approve and expend"));			
			function goHelp(helpName,inputName,condition){
				with( document.cscform ){
					var helpReturn;
					var temp;
					if( inputName == "sendto" ){
						temp = __fixCon.value;
						if( condition.indexOf(",") > -1 ){
							condition = condition.replace(/,/g,"','");
						}
						//__fixCon.value="job='"+condition+"'";
						__fixCon.value="EMPLOYEEID IN ('"+condition+"')";
					 	helpReturn="wf_next_actor:EMPLOYEEID,sendto:FULLNAME";
						//linkHelp_SendToReturn(helpName,helpReturn);
						linkHelp_Return(helpName,helpReturn);
						__fixCon.value=temp;
					}else if( inputName == "cc" ){
						temp = __fixCon.value;
						helpReturn="wf_cc_actor:EMPLOYEEID,cc:FULLNAME";
						linkHelp_SendToReturn(helpName,helpReturn);
						//linkHelp_Return(helpName,helpReturn);
						__fixCon.value=temp;
					} else if(inputName=="__wf__abroadid" ){
						temp = __fixCon.value;
						__fixCon.value = "";
						helpReturn=inputName+":countryid,MCOUNTRY@TDESC";
						linkHelp_Return(helpName,helpReturn);
						__fixCon.value=temp;
					} else if(inputName=="__wf__employeeid"){
						temp = __fixCon.value;
						__fixCon.value = "((EMPLOYEEID = '<%=screenSingle.getUProfile().get("employeeid")%>') OR (BOSSID = '<%=screenSingle.getUProfile().get("employeeid")%>') OR (BOSSID IN (SELECT EMPLOYEEID FROM MEMPLOYEE WHERE BOSSID = '<%=screenSingle.getUProfile().get("employeeid")%>'))) AND STATUS != 'Y'";
						helpReturn=inputName+":employeeid,MEMPLOYEE@FULLNAME,__wf__old_shift:time0";
						linkHelp_Return_CallFunction(helpName,helpReturn,"searchEmp");
						__fixCon.value=temp;						
					}else if( inputName=="__employeeid" ){
						temp = __fixCon.value;
						__fixCon.value = "";
						helpReturn="__employeeid:EMPLOYEEID,MEMPLOYEE@FULLNAME,emp_fullname:MEMPLOYEE.FULLNAME";
						linkHelp_Return(helpName,helpReturn);
						__fixCon.value=temp;
					}else if( inputName.indexOf("__wf__emp_request") > -1 ){
						temp = __fixCon.value;
						helpReturn=inputName+":employeeid,MEMPLOYEE@FULLNAME"+inputName.substring(inputName.indexOf("$"), inputName.length);
						linkHelp_Return(helpName,helpReturn);
						__fixCon.value=temp;
					}else if(inputName == "__costcenter"){
						helpReturn="__wf__costcenter:costcenterid,__wf__mcostcenter0_tdesc:tdesc";
						linkHelp_Return(helpName,helpReturn);
					}else if(inputName == "__budget"){
						helpReturn="__wf__budget:budgetid,__wf__mbudget_ptt_tdesc:tdesc";
						linkHelp_Return(helpName,helpReturn);
					}
				}
			}
			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(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='<%=screenSingle.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;
					alert("param is:"+param);
					window.open(param,"Help","left=150,top=150,width=530,height=370,resizable=yes,scrollbars=yes,toolbar=no,status=yes");
					__fixCon.value = temp;
				}
			}
			function searchEmp(){
				var condition = " AND STATUS not in('Y','X','Z')";
				searchDescEmp(document.cscform.__wf__employeeid,  'memployee.fullname:MEMPLOYEE@FULLNAME,mposition.tdesc:__position,mbu1.tdesc:__bu1,mbu2.tdesc:__bu2,mbu3.tdesc:__bu3,mbu4.tdesc:__bu4,mbu5.tdesc:__bu5,memployee.startdate:__startdate,memployee.tel_ext:__tel_ext,mjobcode.jobgroup:__wf__jobgroupid,mjobcode.tdesc:__wf__jobgroupdesc,memployee.tel_no:__wf__phone,memployee.mobile:__wf__mobile', condition);
			}
			function chkAttachFile(){
				with(document.cscform){
					var msg = "Please Attach File";
					if(__language.value == "tha") msg = "กรุณาแนบไฟล์หนังสือรับรอง";
					if((parseInt(__wf__leave_day.value) >= parseInt(__guarantee_date.value)) && dwr.util.getValue("__wf__format_leave") == "0" &&(__attach_value.value == "1")) {
						if(!CheckAttachFile()){
							alert(msg);						
							return true;
						}else return true;
					}else{
						return true;
					}
				}
			}
			function getDocumentRouting(){
				with(document.cscform){
					ManageDocumentDWR.getRouting(new Array(__wf_id.value,__wf_ver.value,wf_seq_no.value,1,1,__wf__employeeid.value,'ALLBJOBSUPERVISOR'),
						function(data){
							__wf__document_routing.value = data[1];
							__wf__command_line.value = data[2];
						}
					);
				}
			}
			function showRouting(){
				with(document.cscform){
					ManageDocumentDWR.getRouting(new Array(__wf_id.value,__wf_ver.value,wf_seq_no.value,1,1,__wf__employeeid.value,'ALLBJOBSUPERVISOR'),
						function(data){
							viewrouting.innerHTML=data[0];
							__wf__document_routing.value = data[1];
							__wf__command_line.value = data[2];
						}
					);
				}
			}
			function searchDescEmp(empid, desc, condition){
				var splitDesc="",getField="",setField="";
				splitDesc = desc.split(",");
				for(var i = 0; i < splitDesc.length; i++){
					if(splitDesc[i].indexOf("@") > -1 && splitDesc[i].indexOf(":") == -1){
						if(splitDesc[i].indexOf("$") > -1) {
							var newDesc = splitDesc[i].substring(0,splitDesc[i].indexOf("$"));
							getField += newDesc.replace(/@/g,".");
						}else{
							getField += splitDesc[i].replace(/@/g,".");
						}
						setField += splitDesc[i];
					}else{
						getField += splitDesc[i].substring(0,splitDesc[i].indexOf(":"));
						setField += splitDesc[i].substring(splitDesc[i].indexOf(":")+1,splitDesc[i].length);
					}
					if(i+1 == splitDesc.length){
						break;
					}else{
						getField+=",";
						setField+=",";
					}
				}
				SearchDWR.searchDBXMLAll(new Array("MEMPLOYEEHELP3", getField, "memployee:employeeid = '"+empid.value+"' "+condition, "false", "langOn"), function(data){ 
					setField = setField.split(",");
					if(data.length > 0){
						for(i=0;i<setField.length;i++){
							dwr.util.setValue(setField[i],data[0][i]);
						}
					}else{
						empid.value ="";
						for(i=0;i<setField.length;i++){
							dwr.util.setValue(setField[i],"");
						}
					}
				});
			}
			function toolTip(data){
			}
			function setTrav_type(){
				with(document.cscform){
					if(__wf__trav_type.checked){
						__wf__trav_type.value = "1";
					}else{
						__wf__trav_type.value = "0";
					}
				}
			}
			function chkTravelType(){
				with(document.cscform){
					if(__wf__trav_by.value=="1"){
						__wf__trav_type.disabled = false;
					}else{
						__wf__trav_type.checked = false;
						__wf__trav_type.disabled = true;
						setTrav_type();
					}
				}
			}
			function addChild(){
				window.open("WELEXP001C.jsp?isstep1="+document.cscform.isstep1.value,"addChilds","left=150,top=150,width=600,height=450,toolbar=no,status=yes,scrollbars=yes,resizable=yes");
			}
			function editChild(index){
				window.open("WELEXP001C.jsp?employeeid="+index+"&isstep1="+document.cscform.isstep1.value,"addChilds","left=150,top=150,width=600,height=450,toolbar=no,status=yes,scrollbars=yes,resizable=yes");
			}
			/***/
			var peopleCache = { };
			function init() {
				dwr.util.useLoadingMessage();
				dwr.engine.beginBatch();
				fillTable();
				dwr.engine.endBatch();
			}
			function setDefChild(){
				var blank = true;
				for(key in peopleCache){
					blank = false;
				}
				if(blank){
					with(document.cscform){ 
					var texpend_emp_control = { __expendid:"", __employeeid:'<%=TEMPLATE_WORKFLOW.getUProfile().get("employeeid") %>'
								,  __companyid:__companyid.value, __startdate:"<%=new CscCalendar().getDDMMYYYY()%>"
								, __enddate:"<%=new CscCalendar().getDDMMYYYY()%>", __costcenter:"" , __budget:"", __pedestalcost:"0.00"
								, __pedestalstatus:"0"	, __pedestalday:"0", __allowancecost:"0.00", __allowancestatus:"0" ,__allowanceday:"0" , __accommodationcost:"0.00", __accommodationstatus:"0"
								, __accommodationday:"0"	, __vehiclecost:"0.00", __vehiclestatus:"0", __planecost:"0.00", __planetype:"0" , __dresscost:"0.00", __boatcost:"0.00", __traincost:"0.00"
								, __taxicost:"0.00", __spacialcost:"0.00"
								, __coachbuscost:"0.00", __memployee_fullname:'<%=TEMPLATE_WORKFLOW.getUProfile().get("fullname") %>', __budget_ptt_tdesc:"", __mcostcenter0_tdesc:"" };
					}
					Texpend_emp_controller.setTexpend_emp_control(texpend_emp_control);
				}
			}
			function fillTable() {
				
				// Delete all the rows except for the "pattern" row
				this.removeAllRow();
				this.setDefChild();
				// Create a new set cloned from the pattern row
				Texpend_emp_controller.getSmallCrowd(function(texpend_emp_controller) {
				texpend_emp_controller.sort(function(p1, p2) { return p1.__employeeid.localeCompare(p2.__employeeid); });
				var hdata, employeeid;
				var total_allcost = 0.00;
				var __wf__list_record = document.cscform.__wf__list_record;
				__wf__list_record.value = "";
				var isstep1= document.cscform.isstep1.value;				
				for (var i = 0; i < texpend_emp_controller.length; i++) {
					hdata = texpend_emp_controller[i];
					employeeid = hdata.__employeeid;
					dwr.util.cloneNode("pattern", { idSuffix:employeeid });
					
					 if(isstep1=="true")
						$("_tb_selected$"+employeeid).innerHTML="<input type=\"checkbox\" id=\"deleteItem\" value="+hdata.__employeeid+">";
					else
						$("_tb_selected$"+employeeid).innerHTML="";
					$("_tb_employeeid$"+employeeid).innerHTML="<a href=\"javascript:editChild('"+hdata.__employeeid+"')\">"+hdata.__employeeid+"</a>";
					$("_tb_name_surname$"+employeeid).innerHTML=hdata.__memployee_fullname;
					$("_tb_datefrom$"+employeeid).innerHTML = hdata.__startdate;
					$("_tb_dateto$"+employeeid).innerHTML = hdata.__enddate;

					$("__wf__texpend_emp$totalcost$"+employeeid).value = setTotalCost(hdata); 
					checkNumFloat($("__wf__texpend_emp$totalcost$"+employeeid),0,900000000);
					$("_tb_totalcost$"+employeeid).innerHTML = $("__wf__texpend_emp$totalcost$"+employeeid).value;
					total_allcost = parseFloat(total_allcost)+parseFloat(($("__wf__texpend_emp$totalcost$"+employeeid).value.replace(",","")));

					for(key in hdata){
						if(key != "$dwrClassName"){
							$("__wf__texpend_emp$"+key.replace("__","")+"$"+employeeid).value = eval("hdata."+key);
							$("__wf__texpend_emp$"+key.replace("__","")+"$"+employeeid).name = "__wf__texpend_emp$"+key.replace("__","")+"$"+employeeid;
						}     
					}
					document.getElementById("pattern" + employeeid).style.display = "";  // officially we should use table-row, but IE prefers "" for some reason
					peopleCache[employeeid] = hdata;
					__wf__list_record.value += ((__wf__list_record.value != "")?",":"")+employeeid;
				}
				
				document.cscform.__wf__totalemp.value = texpend_emp_controller.length;
				document.cscform.__wf__totalcost.value = total_allcost;
				checkNumFloat(document.cscform.__wf__totalcost,0,900000000);
				this.sumTotal();
			  });
			}
			function setTotalCost(hdata){
				var total = 0.00;
				var costlist = "__pedestalcost,__allowancecost,__accommodationcost,__planecost,__dresscost,__boatcost,__coachbuscost,__traincost,__taxicost,__spacialcost".split(",");
				for(var c=0; c<costlist.length; c++){
					total = parseFloat(total)+parseFloat((eval("hdata."+costlist[c])).replace(",",""));
				}
				return total;
			}
			function loadData(employeeid){
				  var texpend_emp_control = peopleCache[employeeid];
				  return 	texpend_emp_control;
			}
			function writeTexpend_emp_control(texpend_emp_control) {
				dwr.engine.beginBatch();
				Texpend_emp_controller.setTexpend_emp_control(texpend_emp_control);
				fillTable();
				dwr.engine.endBatch();
			}
			function removeAllRow(){
				dwr.util.removeAllRows("childbody", { filter:function(tr) {
				  return (tr.id != "pattern");
				}}); 
			}
			function deleteed(eleid) {
				var hdata = peopleCache[eleid]; 
				dwr.engine.beginBatch();
				Texpend_emp_controller.deleteTexpend_emp_control(hdata.__employeeid);
				fillTable();
				dwr.engine.endBatch();
			}

			function deleteItems(){
					var dellist= new Array();
					if (confirm("Are you sure you want to delete ?")) {
					with(document.cscform){
							for(var i=0;i<elements.length;i++){ 
								 if(elements[i].id=="deleteItem" && elements[i].checked){
											dellist[dellist.length]=elements[i].value;
									   }
								 }
							}				
					}
					for(var i=0;i<dellist.length;i++){
							deleteed(dellist[i]);
					}
			}
			function clearTexpend_emp_control() {
				dwr.engine.beginBatch();
				Texpend_emp_controller.clear();
				dwr.engine.endBatch();
			}
			function chkType_Location(){
				var thai = "0140";
				var bangkok = "K02";
				with(document.cscform){
					if(__wf__location_type.value=="1"){
						setCountry(thai);
						if(__wf__provinceid.value==""){
							setProvince(bangkok);
						}
					}else{
						setProvince("");
						if(__wf__countryid.value==thai){
							setCountry("");
						}
					}
				}
			}
			function setCountry(val){
				with(document.cscform){
					country : for(var i=0; i<__wf__countryid.length; i++){
						if(__wf__countryid.options(i).value == val){
							__wf__countryid.options(i).selected = true;
							break country;
						}
					}
				}
			}
			function setProvince(val){
				with(document.cscform){
					province : for(var i=0; i<__wf__provinceid.length; i++){
						if(__wf__provinceid.options(i).value == val){
							__wf__provinceid.options(i).selected = true;
							break province;
						}
					}
				}
			}
			function PreGoWF(){
				with(document.cscform){
					__wf__exp_type_desc.value = __wf__exp_type.options(__wf__exp_type.options.selectedIndex).text;
					__wf__location_type_desc.value = __wf__location_type.options(__wf__location_type.options.selectedIndex).text;
					__wf__provinceid_desc.value = __wf__provinceid.options(__wf__provinceid.options.selectedIndex).text;
					__wf__countryid_desc.value = __wf__countryid.options(__wf__countryid.options.selectedIndex).text;
					if(__wf__trav_reason.value.length>0){
							GoWF();
					}else{
							alert(MyCode[0]);
							__wf__trav_reason.focus();
					}
				}
				
			}
			function sumTotal(){
				with(document.cscform){
					var total = 0.00;
					total += parseFloat(__wf__totalcost.value.replace(",",""));
					total += parseFloat(__wf__oilcost.value.replace(",",""));
					total += parseFloat(__wf__vehiclecost.value.replace(",",""));
					total += parseFloat(__wf__receptioncost.value.replace(",",""));
					total += parseFloat(__wf__othercost.value.replace(",",""));
					__wf__summarycost.value = total;
					checkNumFloat(__wf__summarycost,0,900000000);
				}
			}
//-->
		</SCRIPT>
	</HEAD>
	<BODY onLoad="init();MM_preloadImages('../IMAGES/BUTTON/SWAP/SEARCH_SWAP20.gif')">
		<DIV ID="wrapper">
			<DIV ID="header"><jsp:include page="../EMPVIEW/EMV_HEADER.jsp" flush="true" /></DIV>
			<DIV ID="topnav"><jsp:include page="../EMPVIEW/EMV_TOPMENU.jsp" flush="true" /></DIV>
			<DIV ID="container">
				<DIV ID="sidebar"><jsp:include page="../EMPVIEW/EMV_SIDEBAR.jsp" flush="true" /></DIV>
				<DIV ID="content"><jsp:include page="../EMPVIEW/EMV_HELPBAR.jsp" flush="true" />

		<FORM NAME="cscform" METHOD="post" ACTION="WELEXP001.jsp">
			<INPUT TYPE="hidden" NAME="__screen" VALUE="WELEXP001">
			<INPUT TYPE="hidden" NAME="__cmd" VALUE="">
			<INPUT TYPE="hidden" NAME="__help" VALUE="">
			<INPUT TYPE="hidden" NAME="__fixCon" VALUE="">
			<INPUT TYPE="hidden" NAME="__notNull" VALUE="<%=screenSingle.getRequire()%>">
			<INPUT TYPE="hidden" NAME="__language" VALUE="<%=screenSingle.getUProfile().get("lang")%>">
			<INPUT TYPE="hidden" NAME="__companyid" VALUE="<%=screenSingle.getUProfile().get("companyid")%>">
			<INPUT TYPE="hidden" NAME="__calendar" VALUE="">
			
			<SCRIPT LANGUAGE="JavaScript">getInputFormatDate();</SCRIPT>

			<INPUT TYPE="hidden" NAME="wf_id" VALUE="3101">
			<INPUT TYPE="hidden" NAME="__wf_id" VALUE="3101">
			<INPUT TYPE="hidden" NAME="wf_ver" VALUE="<%=chkNull.chkNullString(request.getParameter("wf_ver"),"1")%>">
			<INPUT TYPE="hidden" NAME="__wf_ver" VALUE="<%=chkNull.chkNullString(request.getParameter("__wf_ver"),"1")%>">
			<INPUT TYPE="hidden" NAME="wf_seq_no" VALUE="<%=chkNull.chkNullString(request.getParameter("wf_seq_no"),"0")%>">
			<INPUT TYPE="hidden" NAME="step_id" VALUE="<%=chkNull.chkNullString(request.getParameter("step_id"),"0")%>">
			<INPUT TYPE="hidden" NAME="step_seq_no" VALUE="<%=chkNull.chkNullString(request.getParameter("step_seq_no"),"0")%>">
			<INPUT TYPE="hidden" NAME="wf_return_actor" VALUE="IINIT">
			<input type="hidden" name="__oldDocumentID" value="<%=(!screenSingle.getDataLabel("DOC_NO").equals("")?screenSingle.getDataLabel("DOC_NO"):chkNull.chkNullString(request.getParameter("__oldDocumentID"),"0"))%>">
			<input type="hidden" name="__oldWF" value="<%=(!screenSingle.getDataLabel("DOC_NO").equals("")?screenSingle.getDataLabel("WF_STATUS"):chkNull.chkNullString(request.getParameter("__oldWF"),"0"))%>">
			
			<INPUT TYPE="hidden" NAME="__wf" VALUE="<%=wf%>">
			<INPUT TYPE="hidden" NAME="__wfcmd" VALUE="false">
			<INPUT TYPE="hidden" NAME="used" VALUE="">
			<INPUT TYPE="hidden" NAME="__wf__limitleave" VALUE="">
			<INPUT TYPE="hidden" NAME="remark" VALUE="<%=remark%>">
			<INPUT TYPE="hidden" NAME="__employeeid" VALUE="<%=TEMPLATE_WORKFLOW.getUProfile().get("employeeid") %>">
			<INPUT TYPE="hidden" NAME="__attach_value" VALUE="0">
			<INPUT TYPE="hidden" NAME="wf_default_actor" VALUE="true">
			
			<INPUT TYPE="hidden" NAME="__flag" VALUE="<%=chkNull.chkNullString(request.getParameter("__flag"), "0")%>">
			<INPUT TYPE="hidden" NAME="__field_list" VALUE="__wf__employeeid,__wf__type_absent,__wf__start_date,__wf__start_time,__wf__start_date,__wf__end_time,__wf__leave_day,__wf__format_leave">
			<INPUT TYPE="hidden" NAME="__temp_value" VALUE="<%=chkNull.chkNullString(request.getParameter("__temp_value"))%>">

			<INPUT TYPE="hidden" NAME="draft_cmd" VALUE="">              
			<INPUT TYPE="hidden" NAME="draft_no" VALUE="<%=chkNull.chkNullString(request.getParameter("draft_no"),"0")%>">               
			<INPUT TYPE="hidden" NAME="admin_cmd" VALUE="">		
			<INPUT TYPE="hidden" NAME="__checkPage" VALUE="true">

			<!-- Redirect Page -->
			 <INPUT TYPE="hidden" NAME="isAdminEdit" VALUE="<%=chkNull.chkNullString(request.getParameter("isAdminEdit"))%>">
			 <INPUT TYPE="hidden" NAME="isAdminCancel" VALUE="<%=chkNull.chkNullString(request.getParameter("isAdminCancel"))%>">
			 <INPUT TYPE="hidden" NAME="isAdminClean" VALUE="<%=chkNull.chkNullString(request.getParameter("isAdminClean"))%>">
			 <INPUT TYPE="hidden" NAME="isAdminDelete" VALUE="<%=chkNull.chkNullString(request.getParameter("isAdminDelete"))%>">

			<INPUT TYPE="hidden" NAME="__wf__document_routing" VALUE="">
			<INPUT TYPE="hidden" NAME="__wf__document_command_line" VALUE="">

			<INPUT TYPE="hidden" NAME="__wf__list_record" VALUE="">

			<%=screenSingle.InitialVariable()%>
			
			<DIV ID="toolTipLayer" STYLE="position:absolute; visibility: hidden"></DIV>
			<SCRIPT LANGUAGE="JavaScript">initToolTips();</SCRIPT>
			
<!-- Begin Step1 -->
<%=md.getStepDocument("3101","1")%>
		<INPUT TYPE="hidden" NAME="isstep1" VALUE="<%=md.isStep1%>">
<%=md.getHeadDocument()%>
                      <br>
<%=md.getHelpDocument("Travel approve and expend")%>
                      <br>
<%=md.getSendToDocument("Travel approve and expend")%>
					  <br>
						<!-- Begin Code -->
							<TABLE WIDTH="100%" 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">
										<!-- Begin User Code -->
											<tr>
												<td colspan="2" class="column-title" ><script language="javascript">swapLang('Employee Details')</script></td>
											</tr>
										    <tr>
										      <INPUT TYPE="hidden" NAME="__subordinate" VALUE="<%=screenSingle.getUProfile().get("subordinateall")%>">
											  <INPUT TYPE="hidden" NAME="__wf__request_date" VALUE="<%=chkNull.chkNullString(request.getParameter("__wf__request_date"))%>">
											  <INPUT TYPE="hidden" NAME="__wf__request_time" VALUE="<%=chkNull.chkNullString(request.getParameter("__wf__request_time"))%>">
                                              <td class="column-label"><script language="javascript">swapLang('Employee Code')</script></td>
										      <td class="column-input">
										          <input name="__wf__employeeid" type="text" size="15" value="<%= chkNull.chkNullString(request.getParameter("__wf__employeeid"),screenSingle.getUProfile().get("employeeid"))%>"  readonly class="disabled">
										          <input name="MEMPLOYEE@FULLNAME" type="text" size="40" value="<%= chkNull.chkNullString(request.getParameter("MEMPLOYEE@FULLNAME"),"") %>" readonly class="disabled"></td>
									      </tr>
										    <tr>
                                              <td width="25%" class="column-label"><script language="javascript">swapLang('Position')</script></td>
										      <td class="column-input"><input type="text" name="__position" value="<%= chkNull.chkNullString(request.getParameter("__position"),"") %>" size="52" readonly class="disabled"></td>
									      </tr>
										    <tr>
                                              <td class="column-label"><script language="javascript">swapLang('Business Unit 1')</script></td>
										      <td class="column-input"><input type="text" name="__bu1" value="<%= chkNull.chkNullString(request.getParameter("__bu1"),"") %>" size="52" readonly class="disabled"></td>
									      </tr>
										    <tr>
                                              <td class="column-label"><script language="javascript">swapLang('Business Unit 2')</script></td>
										      <td class="column-input"><input type="text" name="__bu2" value="<%= chkNull.chkNullString(request.getParameter("__bu2"),"") %>" size="52" readonly class="disabled"></td>
									      </tr>
										    <tr>
                                              <td class="column-label"><script language="javascript">swapLang('Business Unit 3')</script></td>
										      <td class="column-input"><input type="text" name="__bu3" value="<%= chkNull.chkNullString(request.getParameter("__bu3"),"") %>" size="52" readonly class="disabled"></td>
									      </tr>
										    <tr>
                                              <td class="column-label"><script language="javascript">swapLang('Business Unit 4')</script></td>
										      <td class="column-input"><input type="text" name="__bu4" value="<%= chkNull.chkNullString(request.getParameter("__bu4"),"") %>" size="52" readonly class="disabled"></td>
									      </tr>
										    <tr>
                                              <td class="column-label"><script language="javascript">swapLang('Business Unit 5')</script></td>
										      <td class="column-input"><input type="text" name="__bu5" value="<%= chkNull.chkNullString(request.getParameter("__bu5"),"") %>" size="52" readonly class="disabled"><input type="hidden" name="__wf__jobgroupid" value="<%= chkNull.chkNullString(request.getParameter("__wf_jobgroupid"),"") %>">
									          <input type="hidden" name="__wf__jobgroupdesc" value="<%= chkNull.chkNullString(request.getParameter("__wf__jobgroupdesc"),"") %>"></td>
									      </tr>
										  <input type="hidden" name="__startdate" value="<%= chkNull.chkNullString(request.getParameter("__startdate"),"") %>">
										  <input type="hidden" name="__tel_ext" value="<%= chkNull.chkNullString(request.getParameter("__tel_ext"),"") %>">
											<%
													DbRecord db_texpend=new InitialRecord(TEMPLATE_WORKFLOW.getUProfile()).getDbRecord("TEXPEND");
													ListBox listbox = new ListBox();
													listbox.setUProfile(TEMPLATE_WORKFLOW.getUProfile());
											%>
										  <tr>
												<td colspan="2" class="column-title" ><script language="javascript">swapLang('Request_Approve_Detail')</script></td>
										  </tr>
										   <%
													listbox.setName("wf__exp_type");
													listbox.setValidCode(db_texpend.getField("EXP_TYPE").getValidCode());
													listbox.setChecked(chkNull.chkNullString(request.getParameter("__wf__exp_type"),db_texpend.getField("EXP_TYPE").getDefault()));
										  %>
										  <tr>
                                              <td class="column-label"><%=db_texpend.getField("EXP_TYPE").getDescription()%></td>
										      <td class="column-input"><%=listbox.process()%></td>
									      </tr>
										  <input type="hidden" name="__wf__exp_type_desc" value="<%= chkNull.chkNullString(request.getParameter("__wf__exp_type_desc"),"") %>">
										   <%
													listbox.setName("wf__location_type");
													listbox.setValidCode(db_texpend.getField("LOCATION_TYPE").getValidCode());
													listbox.setChecked(chkNull.chkNullString(request.getParameter("__wf__location_type"),db_texpend.getField("LOCATION_TYPE").getDefault()));
													listbox.setonChange("chkType_Location();");
										  %>
										  <tr>
                                              <td class="column-label"><%=db_texpend.getField("LOCATION_TYPE").getDescription()%></td>
										      <td class="column-input"><%=listbox.process()%></td>
									      </tr>
										  <input type="hidden" name="__wf__location_type_desc" value="<%= chkNull.chkNullString(request.getParameter("__wf__location_type_desc"),"") %>">
										  <%
													listbox.setName("wf__provinceid");
													listbox.setTable("MPROVINCEHELP","PROVINCEID","LONG_TNAME","","LONG_TNAME","PROVINCEID");
													listbox.setBlank(true);
													listbox.setChecked((request.getParameter("__wf__provinceid")!=null)?request.getParameter("__wf__provinceid"):"K02");
										  %>
										  <tr>
                                              <td class="column-label"><%=db_texpend.getField("PROVINCEID").getDescription()%></td>
										      <td class="column-input"><%=listbox.process()%></td>
									      </tr>
										  <input type="hidden" name="__wf__provinceid_desc" value="<%= chkNull.chkNullString(request.getParameter("__wf__provinceid_desc"),"") %>">
										  <%
													listbox.setName("wf__countryid");
													listbox.setTable("MCOUNTRYHELP","COUNTRYID","TDESC","","TDESC","COUNTRYID");
													listbox.setChecked((request.getParameter("__wf__countryid")!=null)?request.getParameter("__wf__countryid"):"0140");
										  %>
										  <tr>
                                              <td class="column-label"><%=db_texpend.getField("COUNTRYID").getDescription()%></td>
										      <td class="column-input"><%=listbox.process()%></td>
									      </tr>
										  <input type="hidden" name="__wf__countryid_desc" value="<%= chkNull.chkNullString(request.getParameter("__wf__countryid_desc"),"") %>">
										 <tr>
											<td class="column-label"><%=db_texpend.getField("STARTDATE").getDescription()%></td>
											<td class="column-input">
												<input type="text" name="__wf__startdate" size="10" maxlength="10" value="<%=chkNull.chkNullString(request.getParameter("__wf__startdate"),new CscCalendar().getDDMMYYYY())%>" onKeyPress="chkIntegerOfDate(this.value,event);" onKeyUp="sysIsEdit();formatDate(this);" onBlur="chkInputDate2(this,__wf__enddate);" />
												<%if( md.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('__wf__startdate')"></a><%}%>
											</td>
										</tr>
										<tr>
											<td class="column-label"><%=db_texpend.getField("ENDDATE").getDescription()%></td>
										  <td class="column-input">
												<input type="text" name="__wf__enddate" size="10" maxlength="10" value="<%=chkNull.chkNullString(request.getParameter("__wf__enddate"),new CscCalendar().getDDMMYYYY())%>" onKeyPress="chkIntegerOfDate(this.value,event);" onKeyUp="sysIsEdit();formatDate(this);" onBlur="chkInputDate2(__wf__startdate,this);" />
											  <a href="#" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image2','','../IMAGES/BUTTON/SWAP/CALENDAR_SWAP20.gif',1)">
												<%if( md.isStep1 ){%>
											  <img src="../IMAGES/BUTTON/MAIN/CALENDAR20.gif" alt="calendar" name="Image2" border="0" align="absmiddle" id="Image2" onClick="viewCal('__wf__enddate')"></a>
											  <%}%>
</td>
										</tr>
										<tr>
                                              <td class="column-label"><%=db_texpend.getField("COSTCENTER").getDescription()%></td>
										      <td class="column-input">
												<input type="text" name="__wf__costcenter" size="10" maxlength="10" value="<%=chkNull.chkNullString(request.getParameter("__wf__costcenter"))%>" onKeyPress="chkSpecialStr(event);" onBlur="trimValue(this);" />
												<a href="javascript:goHelp('MCOSTCENTER0HELP','__costcenter');"  onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('__costcenter_image','','../IMAGES/BUTTON/SWAP/SEARCH_SWAP20.gif',1)">
												<%if( md.isStep1 ){%>
												<img src="../IMAGES/BUTTON/MAIN/SEARCH20.gif" alt="SEARCH" name="__costcenter_image" width="20" height="20" border="0" align="absmiddle"  ></a>
												<%}%>
												<input type="text" name="__wf__mcostcenter0_tdesc" size="60" value="<%=chkNull.chkNullString(request.getParameter("__wf__mcostcenter0_tdesc"))%>" readonly>
											</td>
									     </tr>
										 <tr>
                                              <td class="column-label"><%= db_texpend.getField("BUDGET").getDescription()%></td>
										      <td class="column-input">
												<input type="text" name="__wf__budget" size="10" maxlength="10" value="<%=chkNull.chkNullString(request.getParameter("__wf__budget"))%>" onKeyPress="chkSpecialStr(event);" onBlur="trimValue(this);" />
												<a href="javascript:goHelp('MBUDGET_PTTHELP','__budget');"  onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('__budget_image','','../IMAGES/BUTTON/SWAP/SEARCH_SWAP20.gif',1)">
												<%if( md.isStep1 ){%>
												<img src="../IMAGES/BUTTON/MAIN/SEARCH20.gif" alt="SEARCH" name="__budget_image" width="20" height="20" border="0" align="absmiddle"  >
												<%}%>
												</a>
												<input type="text" name="__wf__mbudget_ptt_tdesc" size="60" value="<%=chkNull.chkNullString(request.getParameter("__wf__mbudget_ptt_tdesc"))%>" readonly>
											</td>
									     </tr>
										 <%
													Tel tel = new Tel();
													tel.setUProfile(TEMPLATE_WORKFLOW.getUProfile());
													tel.setName("wf__phone"); 
													tel.setValue(chkNull.chkNullString(request.getParameter("__wf__phone")));
										 %>
										 <tr>
                                              <td class="column-label"><%= db_texpend.getField("PHONE").getDescription()%></td>
										      <td class="column-input"><%//=tel.process()%><input type="text" name="__wf__phone" value="" class="disabled" readonly></td>
									     </tr>
										 <%
													Mobile mobile = new Mobile();
													mobile.setUProfile(TEMPLATE_WORKFLOW.getUProfile());
													mobile.setName("wf__mobile");
													mobile.setValue(chkNull.chkNullString(request.getParameter("__wf__phone")));
										 %>
										 <tr>
                                              <td class="column-label"><%= db_texpend.getField("MOBILE").getDescription()%></td>
										      <td class="column-input"><%//=mobile.process()%><input type="text" name="__wf__mobile" value="" class="disabled" readonly></td>
									     </tr>
										 <%
													listbox.setName("wf__trav_by");
													listbox.setValidCode(db_texpend.getField("TRAV_BY").getValidCode());
													listbox.setonChange("chkTravelType();");
													listbox.setChecked(chkNull.chkNullString(request.getParameter("__wf__trav_by"),db_texpend.getField("TRAV_BY").getDefault()));
										  %>
										  <tr>
                                              <td class="column-label"><%=db_texpend.getField("TRAV_BY").getDescription()%></td>
										      <td class="column-input"><%=listbox.process()%>
											  <input type="checkbox" name="__wf__trav_type" value="<%=chkNull.chkNullString(request.getParameter("__wf__trav_type"))%>"  onclick="setTrav_type();"><%= db_texpend.getField("TRAV_TYPE").getDescription()%></td>
									     </tr>
										 <tr>
                                              <td class="column-label"><%= db_texpend.getField("TRAV_REASON").getDescription()%></td>
										      <td class="column-input">
												<textarea NAME='__wf__trav_reason' COLS='80' ROWS='4' onKeyPress="chkSpecialStr(event);" onKeyUp="chkLimitTextArea(this,1000);sysIsEdit();" onBlur="trimValue(this);" ><%=chkNull.chkNullString(request.getParameter("__wf__trav_reason"))%></textarea>
											  </td>
									     </tr>
										 <tr>
                                              <td class="column-title" colspan="2"><div align="center"><script language="javascript">swapLang('Traveler is all')</script></div></td>
									     </tr>
										 <TR>
											<TD CLASS="column-input" colspan="2">
												<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 class="column-title" width="5%"><div align="center"><input type="checkbox" name="chkall" onClick="chkAll();"></div></td>
																	<td class="column-title" width="15%"><div align="center"><script language="javascript">swapLang('Employee ID')</script></div></td>
																	<td class="column-title" width="30%"><div align="center"><script language="javascript">swapLang('Name Surname')</script></div></td>
																	<td class="column-title" width="15%"><div align="center"><script language="javascript">swapLang('Date From')</script></div></td>
																	<td class="column-title" width="15%"><div align="center"><script language="javascript">swapLang('Date To')</script></div></td>
																	<td class="column-title" width="20%"><div align="center"><script language="javascript">swapLang('Expenses')</script></div></td>
																</tr>
																<tbody id="childbody">
																	<tr id="pattern" style="display:none;">
																		<td class="column-input" ><div align ="center"><span id="_tb_selected$"></span></div></td>
																		<td class="column-input" ><div align ="center"><span id="_tb_employeeid$"></span></div></td>
																		<td class="column-input" >&nbsp;<span id="_tb_name_surname$"></span></td>
																		<td class="column-input" ><div align="center"><span id="_tb_datefrom$"></span></div></td>
																		<td class="column-input" ><div align="center"><span id="_tb_dateto$"></span></div></td>
																		<td class="column-input" ><div align="center"><span id="_tb_totalcost$"></span></div></td>
																		<input type="hidden" id="__wf__texpend_emp$totalcost$">
																		<input type="hidden" id="__wf__texpend_emp$expendid$">
																		<input type="hidden" id="__wf__texpend_emp$employeeid$">
																		<input type="hidden" id="__wf__texpend_emp$companyid$">
																		<input type="hidden" id="__wf__texpend_emp$startdate$">
																		<input type="hidden" id="__wf__texpend_emp$enddate$">
																		<input type="hidden" id="__wf__texpend_emp$costcenter$">
																		<input type="hidden" id="__wf__texpend_emp$budget$">
																		<input type="hidden" id="__wf__texpend_emp$pedestalcost$">
																		<input type="hidden" id="__wf__texpend_emp$pedestalstatus$">
																		<input type="hidden" id="__wf__texpend_emp$pedestalday$">
																		<input type="hidden" id="__wf__texpend_emp$allowancecost$">
																		<input type="hidden" id="__wf__texpend_emp$allowancestatus$">
																		<input type="hidden" id="__wf__texpend_emp$allowanceday$">
																		<input type="hidden" id="__wf__texpend_emp$accommodationcost$">
																		<input type="hidden" id="__wf__texpend_emp$accommodationstatus$">
																		<input type="hidden" id="__wf__texpend_emp$accommodationday$">
																		<input type="hidden" id="__wf__texpend_emp$vehiclecost$">
																		<input type="hidden" id="__wf__texpend_emp$vehiclestatus$">
																		<input type="hidden" id="__wf__texpend_emp$planecost$">
																		<input type="hidden" id="__wf__texpend_emp$planetype$">
																		<input type="hidden" id="__wf__texpend_emp$dresscost$">
																		<input type="hidden" id="__wf__texpend_emp$boatcost$">
																		<input type="hidden" id="__wf__texpend_emp$traincost$">
																		<input type="hidden" id="__wf__texpend_emp$taxicost$">
																		<input type="hidden" id="__wf__texpend_emp$spacialcost$">
																		<input type="hidden" id="__wf__texpend_emp$coachbuscost$">
																		<input type="hidden" id="__wf__texpend_emp$memployee_fullname$">
																		<input type="hidden" id="__wf__texpend_emp$budget_ptt_tdesc$">
																		<input type="hidden" id="__wf__texpend_emp$mcostcenter0_tdesc$">
																	</tr>
																</tbody>
															</TABLE>							  
														</TD>
														<TD WIDTH="5" BACKGROUND="../IMAGES/MYNOTE/R2.gif"></TD>
													</TR>
													<%if( md.isStep1 ){%>
													<TR>
														<TD WIDTH="5" BACKGROUND="../IMAGES/MYNOTE/L2.gif"></TD>
														<TD CLASS="column-input"><div align="center"><a href="javascript:goHelp('MBUDGET_PTTHELP','__budget');"  onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('__budget_image','','../IMAGES/BUTTON/SWAP/SEARCH_SWAP20.gif',1)">
														  
														</a><BR>
															<a href="javascript:addChild();"><IMG SRC="../IMAGES/MYNOTE/BUTTON/BUTTON_ADD.gif" WIDTH="89" HEIGHT="37" BORDER="0" ALT="Add"></a>
															&nbsp;&nbsp;&nbsp;&nbsp;<a href="javascript:deleteItems();"><IMG SRC="../IMAGES/MYNOTE/BUTTON/BUTTON_DELETE.gif" WIDTH="89" HEIGHT="37" BORDER="0" ALT="Delete"></a>
															
															<BR>
														</div>
														</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>													
											</TD>
										</TR>
										 <tr>
                                              <td class="column-label"><%= db_texpend.getField("TOTALEMP").getDescription()%></td>
										      <td class="column-input"><input type="text" name="__wf__totalemp" size="10" maxlength="10" value="<%=chkNull.chkNullString(request.getParameter("__wf__totalemp"),"0")%>" class="numeric" onKeyPress="chkInteger(event);" onBlur="checkNumInt(this,0,900000000);" onFocus="callDelComma(this);"/>&nbsp;<script language="javascript">swapLang('Man')</script></td>
									     </tr>
										 <tr>
                                              <td class="column-label"><%= db_texpend.getField("TOTALCOST").getDescription()%></td>
										      <td class="column-input"><input type="text" name="__wf__totalcost" size="10" maxlength="10" value="<%=chkNull.chkNullString(request.getParameter("__wf__totalcost"),"0.00")%>" class="numeric" onKeyPress="checkWordNumber(this.value,event);" onKeyUp="sysIsEdit();checkComma(this,2);" onBlur="checkNumFloat(this,0,900000000);sumTotal();" onFocus="callDelComma(this);"/>&nbsp;<script language="javascript">swapLang('Bath')</script></td>
									     </tr>
										 <tr>
                                              <td class="column-label"><%= db_texpend.getField("OILCOST").getDescription()%></td>
										      <td class="column-input"><input type="text" name="__wf__oilcost" size="10" maxlength="10" value="<%=chkNull.chkNullString(request.getParameter("__wf__oilcost"),"0.00")%>" class="numeric" onKeyPress="checkWordNumber(this.value,event);" onKeyUp="sysIsEdit();checkComma(this,2);" onBlur="checkNumFloat(this,0,900000000);sumTotal();" onFocus="callDelComma(this);"/>&nbsp;<script language="javascript">swapLang('Bath')</script></td>
									     </tr>
										 <tr>
                                              <td class="column-label"><%= db_texpend.getField("VEHICLECOST").getDescription()%></td>
										      <td class="column-input"><input type="text" name="__wf__vehiclecost" size="10" maxlength="10" value="<%=chkNull.chkNullString(request.getParameter("__wf__vehiclecost"),"0.00")%>" class="numeric" onKeyPress="checkWordNumber(this.value,event);" onKeyUp="sysIsEdit();checkComma(this,2);" onBlur="checkNumFloat(this,0,900000000);sumTotal();" onFocus="callDelComma(this);"/>&nbsp;<script language="javascript">swapLang('Bath')</script></td>
									     </tr>
										 <tr>
                                              <td class="column-label"><%= db_texpend.getField("RECEPTIONCOST").getDescription()%></td>
										      <td class="column-input"><input type="text" name="__wf__receptioncost" size="10" maxlength="10" value="<%=chkNull.chkNullString(request.getParameter("__wf__receptioncost"),"0.00")%>" class="numeric" onKeyPress="checkWordNumber(this.value,event);" onKeyUp="sysIsEdit();checkComma(this,2);" onBlur="checkNumFloat(this,0,900000000);sumTotal();" onFocus="callDelComma(this);"/>&nbsp;<script language="javascript">swapLang('Bath')</script></td>
									     </tr>
										 <tr>
                                              <td class="column-label"><%= db_texpend.getField("OTHERCOST").getDescription()%>&nbsp;<input type="text" name="__wf__other" size="20" maxlength="30" value="<%=chkNull.chkNullString(request.getParameter("__wf__other"),"")%>"></td>
										      <td class="column-input"><input type="text" name="__wf__othercost" size="10" maxlength="10" value="<%=chkNull.chkNullString(request.getParameter("__wf__othercost"),"0.00")%>" class="numeric" onKeyPress="checkWordNumber(this.value,event);" onKeyUp="sysIsEdit();checkComma(this,2);" onBlur="checkNumFloat(this,0,900000000);sumTotal();" onFocus="callDelComma(this);"/>&nbsp;<script language="javascript">swapLang('Bath')</script></td>
									     </tr>
										 <tr>
                                              <td class="column-label"><script language="javascript">swapLang('Summary Cost')</script></td>
										      <td class="column-input"><input type="text" name="__wf__summarycost" size="10" maxlength="10" disabled value="<%=chkNull.chkNullString(request.getParameter("__wf__summarycost"),"0.00")%>" class="numeric" onKeyPress="checkWordNumber(this.value,event);" onKeyUp="sysIsEdit();checkComma(this,2);" onBlur="checkNumFloat(this,0,900000000);" onFocus="callDelComma(this);"/>&nbsp;<script language="javascript">swapLang('Bath')</script></td>
									     </tr>
										<input type="hidden" name="priority" value="0">
										<!-- End User Code -->
										</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>
							
							<BR>
							<TABLE WIDTH="100%" 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>
											<TABLE WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="1" CLASS="txt01">
											<TR>
											  <TD class="column-label"><script language="javascript">swapLang('Priority');</script></TD>
											  <TD class="column-input left"><input type="radio" name="__wf__priority" value="N" ><script language="javascript">swapLang('Normal');</script> <input type="radio" name="__wf__priority" value="F"><script language="javascript">swapLang('Fast');</script><input type="hidden" name="__wf__outoflimit" value="0"></TD>
											  </TR>
											<TR>
														<TD class="column-label" width="25%"><script language="javascript">swapLang('Find Workfow Routing')</script>														</TD>
														<TD class="column-input right"><A HREF="javascript:showRouting();"><IMG SRC="../IMAGES/MYNOTE/BUTTON/BUTTON_PROCESS.gif" WIDTH="89" HEIGHT="37" BORDER="0" ALT="Process"></A>														</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>
							<BR>
							<span id="viewrouting"></span>

							
						<!-- End Code -->
					  <br>
<%=md.getRemarkDocument()%>
                      <br>
<%=md.getWorkflowCommandDocument()%>
					<br>
<%=md.getReferenceNoteDocument()%>
					<br>
<%=md.getAttachFileDocument()%>
					<br>
                      <!-- Begin Workflow Button -->
                      <%
           				if( !md.isStep3 ){
           				%>
                      <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
                        <tr>
                          <%
           						if(md.isStep1||md.isDraft){
           				%>
                          <td><div align="right">
                          			<A HREF="JavaScript:SaveDraft();">
                                    <IMG SRC="../IMAGES/MYNOTE/BUTTON/BUTTON_SAVE.gif" WIDTH="89" HEIGHT="37" BORDER="0"></A>
									<a href="JavaScript:PreGoWF();">
                                    <img src="../IMAGES/MYNOTE/BUTTON/BUTTON_SUBMIT.gif" width="89" height="37" border="0"  id="imgSubmit"></a>
									<%if(md.isDraft){%><A HREF="JavaScript:DelDraft();">
                                    <IMG SRC="../IMAGES/MYNOTE/BUTTON/BUTTON_CANCEL.gif" WIDTH="89" HEIGHT="37" BORDER="0"></A><%}%></div></td>
       				      <%
           						}else if( md.isStepCancel || md.isAdminCancel){
           				%>
                          <td><div align="right"><!-- <a href="JavaScript:DelWF();"><img src="../IMAGES/MYNOTE/BUTTON/BUTTON_EDIT.gif" width="89" height="37" border="0"></a> --><a href="JavaScript:DelWF();"><img src="../IMAGES/MYNOTE/BUTTON/BUTTON_CANCEL.gif" width="89" height="37" border="0"></a></div></td>
       				      <%
           						}else if( md.isStep2 || md.isStepComment ){
           				%>
                          <td><div align="right"><a href="JavaScript:GoWF();"><img src="../IMAGES/MYNOTE/BUTTON/BUTTON_SUBMIT.gif" width="89" height="37" border="0"></a></div></td>
       				      <%
           						}else if( md.isStepReturn ){
           				%>
           							<TD><DIV ALIGN="right"><A HREF="JavaScript:EditWF();"><IMG SRC="../IMAGES/MYNOTE/BUTTON/BUTTON_EDIT.gif" WIDTH="89" HEIGHT="37" BORDER="0"></A><A HREF="JavaScript:DelWF();"><IMG SRC="../IMAGES/MYNOTE/BUTTON/BUTTON_CANCEL.gif" WIDTH="89" HEIGHT="37" BORDER="0"></A></DIV></TD>
           				<%
           						}else if( md.isStepCopy ){
           				%>
           							<TD><DIV ALIGN="right"><A HREF="JavaScript:CopyWF();"><IMG SRC="../IMAGES/MYNOTE/BUTTON/BUTTON_EDIT.gif" WIDTH="89" HEIGHT="37" BORDER="0"></A></DIV></TD>
						<%
           						}else if( md.isAdminEdit ){
           				%>
									<TD><DIV ALIGN="right"><A HREF="JavaScript:AdminEditWF();"><IMG SRC="../IMAGES/MYNOTE/BUTTON/BUTTON_SAVE.gif" WIDTH="89" HEIGHT="37" BORDER="0"></A></DIV></TD>
						<%
           						}else if( md.isAdminDelete ){
           				%>
									<TD><DIV ALIGN="right"><A HREF="JavaScript:AdminDeleteWF();"><IMG SRC="../IMAGES/MYNOTE/BUTTON/BUTTON_DELETE.gif" WIDTH="89" HEIGHT="37" BORDER="0"></A></DIV></TD>
						<%
           						}else if( md.isAdminClean ){
           				%>
									<TD><DIV ALIGN="right"><A HREF="JavaScript:AdminCleanWF();"><IMG SRC="../IMAGES/MYNOTE/BUTTON/BUTTON_CLEAN.gif" WIDTH="89" HEIGHT="37" BORDER="0"></A></DIV></TD>
						<%
           						}
           				%>
           			
                        </tr>
          </table>
						<%}%>
   					    <br>
                      <!-- End Workflow Button -->
					
<%=md.getRoutingDocument()%>
					<br>
<%=md.getCommentDocument()%>						
						<!-- Begin Set Value -->
           				<%
           				if(md.isStep1){
           				%>
           					<!-- Begin Set Value Step1 -->
           					<SCRIPT LANGUAGE="JavaScript">
           						setValue('comments','<%=chkNull.chkNullString(request.getParameter("comments"))%>');
								searchEmp();
								dwr.util.setValue("__wf__priority","<%=chkNull.chkNullString(request.getParameter("__wf__priority"),"N")%>");
           					</SCRIPT>
           					<!-- End Set Value Step1 -->
           				<%
           				}else if(md.isStep2 || md.isStepCancel || md.isStepComment || md.isStepReturn || md.isStepCopy || md.isDraft){
           				%>
           					<!-- Begin Set Value Step2 -->
								<SCRIPT LANGUAGE="JavaScript">clearTexpend_emp_control();</SCRIPT>
							<%
								String list[] = md.getWFDataValue("__wf__list_record").split(",");
								String wf_t = "__wf__texpend_emp";
								for(int i=0; i<list.length; i++){
							%>
								<SCRIPT LANGUAGE="JavaScript">
									var texpend_emp_control = { __expendid:'<%=md.getWFDataValue(wf_t+"$expendid$"+list[i])%>'
										, __employeeid:'<%=md.getWFDataValue(wf_t+"$employeeid$"+list[i])%>', __companyid:'<%=md.getWFDataValue(wf_t+"$companyid$"+list[i])%>'
										, __startdate:'<%=md.getWFDataValue(wf_t+"$startdate$"+list[i])%>', __enddate:'<%=md.getWFDataValue(wf_t+"$enddate$"+list[i])%>'
										, __costcenter:'<%=md.getWFDataValue(wf_t+"$costcenter$"+list[i])%>' , __budget:'<%=md.getWFDataValue(wf_t+"$budget$"+list[i])%>'
										, __pedestalcost:'<%=md.getWFDataValue(wf_t+"$pedestalcost$"+list[i])%>', __pedestalstatus:'<%=md.getWFDataValue(wf_t+"$pedestalstatus$"+list[i])%>' 
										, __pedestalday:'<%=md.getWFDataValue(wf_t+"$pedestalday$"+list[i])%>', __allowancecost:'<%=md.getWFDataValue(wf_t+"$allowancecost$"+list[i])%>'
										, __allowancestatus:'<%=md.getWFDataValue(wf_t+"$allowancestatus$"+list[i])%>', __allowanceday:'<%=md.getWFDataValue(wf_t+"$allowanceday$"+list[i])%>'
										, __accommodationcost:'<%=md.getWFDataValue(wf_t+"$accommodationcost$"+list[i])%>', __accommodationstatus:'<%=md.getWFDataValue(wf_t+"$accommodationstatus$"+list[i])%>'
										, __accommodationday:'<%=md.getWFDataValue(wf_t+"$accommodationday$"+list[i])%>', __vehiclecost:'<%=md.getWFDataValue(wf_t+"$vehiclecost$"+list[i])%>'
										, __vehiclestatus:'<%=md.getWFDataValue(wf_t+"$vehiclestatus$"+list[i])%>'
										, __planecost:'<%=md.getWFDataValue(wf_t+"$planecost$"+list[i])%>', __planetype:'<%=md.getWFDataValue(wf_t+"$planetype$"+list[i])%>'
										, __dresscost:'<%=md.getWFDataValue(wf_t+"$dresscost$"+list[i])%>', __boatcost:'<%=md.getWFDataValue(wf_t+"$boatcost$"+list[i])%>'
										, __traincost:'<%=md.getWFDataValue(wf_t+"$traincost$"+list[i])%>', __taxicost:'<%=md.getWFDataValue(wf_t+"$taxicost$"+list[i])%>'
										, __spacialcost:'<%=md.getWFDataValue(wf_t+"$spacialcost$"+list[i])%>', __coachbuscost:'<%=md.getWFDataValue(wf_t+"$coachbuscost$"+list[i])%>' 
										, __memployee_fullname:'<%=md.getWFDataValue(wf_t+"$memployee_fullname$"+list[i])%>', __budget_ptt_tdesc:'<%=md.getWFDataValue(wf_t+"$budget_ptt_tdesc$"+list[i])%>'
										, __mcostcenter0_tdesc:'<%=md.getWFDataValue(wf_t+"$mcostcenter0_tdesc$"+list[i])%>' };
									peopleCache['<%=list[i]%>'] = texpend_emp_control;
									//writeTexpend_emp_control(texpend_emp_control);
									Texpend_emp_controller.setTexpend_emp_control(texpend_emp_control);
								</SCRIPT>
							<%
								}
							%>
							<SCRIPT LANGUAGE="JavaScript">
								dwr.engine.beginBatch();
								fillTable();
								dwr.engine.endBatch();</SCRIPT>

           					<SCRIPT LANGUAGE="JavaScript">
								hideSendTo('<%=step_type%>');
								setValue('__wf__employeeid','<%=md.getWFDataValue("__wf__employeeid")%>');
								setValue('__wf__exp_type','<%=md.getWFDataValue("__wf__exp_type")%>');
								setValue('__wf__exp_type_desc','<%=md.getWFDataValue("__wf__exp_type_desc")%>');
								setValue('__wf__location_type','<%=md.getWFDataValue("__wf__location_type")%>');
								setValue('__wf__location_type_desc','<%=md.getWFDataValue("__wf__location_type_desc")%>');
								setValue('__wf__provinceid','<%=md.getWFDataValue("__wf__provinceid")%>');
								setValue('__wf__provinceid_desc','<%=md.getWFDataValue("__wf__provinceid_desc")%>');
								setValue('__wf__countryid','<%=md.getWFDataValue("__wf__countryid")%>');
								setValue('__wf__countryid_desc','<%=md.getWFDataValue("__wf__countryid_desc")%>');
								setValue('__wf__startdate','<%=md.getWFDataValue("__wf__startdate")%>');
								setValue('__wf__enddate','<%=md.getWFDataValue("__wf__enddate")%>');
								setValue('__wf__costcenter','<%=md.getWFDataValue("__wf__costcenter")%>');
								setValue('__wf__mcostcenter0_tdesc','<%=md.getWFDataValue("__wf__mcostcenter0_tdesc")%>');
								setValue('__wf__budget','<%=md.getWFDataValue("__wf__budget")%>');
								setValue('__wf__mbudget_ptt_tdesc','<%=md.getWFDataValue("__wf__mbudget_ptt_tdesc")%>');
								setValue('__wf__phone','<%=md.getWFDataValue("__wf__phone")%>');
								setValue('__wf__phonearea','<%=md.getWFDataValue("__wf__phonearea")%>');
								setValue('__wf__phone_view','<%=md.getWFDataValue("__wf__phone_view")%>');
								setValue('__wf__mobile','<%=md.getWFDataValue("__wf__mobile")%>');
								setValue('__wf__mobile_view','<%=md.getWFDataValue("__wf__mobile_view")%>');
								setValue('__wf__trav_by','<%=md.getWFDataValue("__wf__trav_by")%>');
								setValue('__wf__trav_type','<%=md.getWFDataValue("__wf__trav_type")%>');
								setValue('__wf__trav_reason','<%=md.getWFDataValue("__wf__trav_reason")%>');
								setValue('__wf__totalemp','<%=md.getWFDataValue("__wf__totalemp")%>');
								setValue('__wf__totalcost','<%=md.getWFDataValue("__wf__totalcost")%>');
								setValue('__wf__oilcost','<%=md.getWFDataValue("__wf__oilcost")%>');
								setValue('__wf__vehiclecost','<%=md.getWFDataValue("__wf__vehiclecost")%>');
								setValue('__wf__receptioncost','<%=md.getWFDataValue("__wf__receptioncost")%>');
								setValue('__wf__other','<%=md.getWFDataValue("__wf__other")%>');
								setValue('__wf__othercost','<%=md.getWFDataValue("__wf__othercost")%>');
								setValue('__wf__summarycost','<%=md.getWFDataValue("__wf__summarycost")%>');
								dwr.util.setValue("__wf__priority","<%=md.getWFDataValue("__wf__priority")%>");
								dwr.util.setValue("__wf__outoflimit","<%=md.getWFDataValue("__wf__outoflimit")%>");
								searchDescEmp(document.cscform.__wf__employeeid,  'memployee.fullname:MEMPLOYEE@FULLNAME,mposition.tdesc:__position,mbu1.tdesc:__bu1,mbu2.tdesc:__bu2,mbu3.tdesc:__bu3,mbu4.tdesc:__bu4,mbu5.tdesc:__bu5,memployee.startdate:__startdate,memployee.tel_ext:__tel_ext', "");
							<%
								if(!md.isDraft){
							%>
								setDisabled(true);
							<%
									}else{
							%>
								setValue('__checkPage','false');
							<%
							}
							%>
           						setReadOnlyOn('__remark');           						
           					</SCRIPT>
           					<!-- End Set Value Step2 -->
           				<%
           				}else if(md.isStep3 || md.isAdminEdit || md.isAdminCancel || md.isAdminDelete || md.isAdminClean || md.isArchive){
           				%>
           					<!-- Begin Set Value Step3 -->
           					<SCRIPT LANGUAGE="JavaScript">clearTexpend_emp_control();</SCRIPT>
							<%
								String list[] = md.getWFDataValue("__wf__list_record").split(",");
								String wf_t = "__wf__texpend_emp";
								for(int i=0; i<list.length; i++){
							%>
								<SCRIPT LANGUAGE="JavaScript">
									var texpend_emp_control = { __expendid:'<%=md.getWFDataValue(wf_t+"$expendid$"+list[i])%>'
										, __employeeid:'<%=md.getWFDataValue(wf_t+"$employeeid$"+list[i])%>', __companyid:'<%=md.getWFDataValue(wf_t+"$companyid$"+list[i])%>'
										, __startdate:'<%=md.getWFDataValue(wf_t+"$startdate$"+list[i])%>', __enddate:'<%=md.getWFDataValue(wf_t+"$enddate$"+list[i])%>'
										, __costcenter:'<%=md.getWFDataValue(wf_t+"$costcenter$"+list[i])%>' , __budget:'<%=md.getWFDataValue(wf_t+"$budget$"+list[i])%>'
										, __pedestalcost:'<%=md.getWFDataValue(wf_t+"$pedestalcost$"+list[i])%>', __pedestalstatus:'<%=md.getWFDataValue(wf_t+"$pedestalstatus$"+list[i])%>' 
										, __pedestalday:'<%=md.getWFDataValue(wf_t+"$pedestalday$"+list[i])%>', __allowancecost:'<%=md.getWFDataValue(wf_t+"$allowancecost$"+list[i])%>'
										, __allowancestatus:'<%=md.getWFDataValue(wf_t+"$allowancestatus$"+list[i])%>', __allowanceday:'<%=md.getWFDataValue(wf_t+"$allowanceday$"+list[i])%>'
										, __accommodationcost:'<%=md.getWFDataValue(wf_t+"$accommodationcost$"+list[i])%>', __accommodationstatus:'<%=md.getWFDataValue(wf_t+"$accommodationstatus$"+list[i])%>'
										, __accommodationday:'<%=md.getWFDataValue(wf_t+"$accommodationday$"+list[i])%>', __vehiclecost:'<%=md.getWFDataValue(wf_t+"$vehiclecost$"+list[i])%>'
										, __vehiclestatus:'<%=md.getWFDataValue(wf_t+"$vehiclestatus$"+list[i])%>'
										, __planecost:'<%=md.getWFDataValue(wf_t+"$planecost$"+list[i])%>', __planetype:'<%=md.getWFDataValue(wf_t+"$planetype$"+list[i])%>'
										, __dresscost:'<%=md.getWFDataValue(wf_t+"$dresscost$"+list[i])%>', __boatcost:'<%=md.getWFDataValue(wf_t+"$boatcost$"+list[i])%>'
										, __traincost:'<%=md.getWFDataValue(wf_t+"$traincost$"+list[i])%>', __taxicost:'<%=md.getWFDataValue(wf_t+"$taxicost$"+list[i])%>'
										, __spacialcost:'<%=md.getWFDataValue(wf_t+"$spacialcost$"+list[i])%>', __coachbuscost:'<%=md.getWFDataValue(wf_t+"$coachbuscost$"+list[i])%>' 
										, __memployee_fullname:'<%=md.getWFDataValue(wf_t+"$memployee_fullname$"+list[i])%>', __budget_ptt_tdesc:'<%=md.getWFDataValue(wf_t+"$budget_ptt_tdesc$"+list[i])%>'
										, __mcostcenter0_tdesc:'<%=md.getWFDataValue(wf_t+"$mcostcenter0_tdesc$"+list[i])%>' };
									peopleCache['<%=list[i]%>'] = texpend_emp_control;
									//writeTexpend_emp_control(texpend_emp_control);
									Texpend_emp_controller.setTexpend_emp_control(texpend_emp_control);
								</SCRIPT>
							<%
								}
							%>
							<SCRIPT LANGUAGE="JavaScript">
								dwr.engine.beginBatch();
								fillTable();
								dwr.engine.endBatch();</SCRIPT>

           					<SCRIPT LANGUAGE="JavaScript">
								hideSendTo('<%=step_type%>');
								setValue('__wf__employeeid','<%=md.getWFDataValue("__wf__employeeid")%>');
								setValue('__wf__exp_type','<%=md.getWFDataValue("__wf__exp_type")%>');
								setValue('__wf__exp_type_desc','<%=md.getWFDataValue("__wf__exp_type_desc")%>');
								setValue('__wf__location_type','<%=md.getWFDataValue("__wf__location_type")%>');
								setValue('__wf__location_type_desc','<%=md.getWFDataValue("__wf__location_type_desc")%>');
								setValue('__wf__provinceid','<%=md.getWFDataValue("__wf__provinceid")%>');
								setValue('__wf__provinceid_desc','<%=md.getWFDataValue("__wf__provinceid_desc")%>');
								setValue('__wf__countryid','<%=md.getWFDataValue("__wf__countryid")%>');
								setValue('__wf__countryid_desc','<%=md.getWFDataValue("__wf__countryid_desc")%>');
								setValue('__wf__startdate','<%=md.getWFDataValue("__wf__startdate")%>');
								setValue('__wf__enddate','<%=md.getWFDataValue("__wf__enddate")%>');
								setValue('__wf__costcenter','<%=md.getWFDataValue("__wf__costcenter")%>');
								setValue('__wf__mcostcenter0_tdesc','<%=md.getWFDataValue("__wf__mcostcenter0_tdesc")%>');
								setValue('__wf__budget','<%=md.getWFDataValue("__wf__budget")%>');
								setValue('__wf__mbudget_ptt_tdesc','<%=md.getWFDataValue("__wf__mbudget_ptt_tdesc")%>');
								setValue('__wf__phone','<%=md.getWFDataValue("__wf__phone")%>');
								setValue('__wf__mobile','<%=md.getWFDataValue("__wf__mobile")%>');
								setValue('__wf__trav_by','<%=md.getWFDataValue("__wf__trav_by")%>');
								setValue('__wf__trav_type','<%=md.getWFDataValue("__wf__trav_type")%>');
								setValue('__wf__trav_reason','<%=md.getWFDataValue("__wf__trav_reason")%>');
								setValue('__wf__totalemp','<%=md.getWFDataValue("__wf__totalemp")%>');
								setValue('__wf__totalcost','<%=md.getWFDataValue("__wf__totalcost")%>');
								setValue('__wf__oilcost','<%=md.getWFDataValue("__wf__oilcost")%>');
								setValue('__wf__vehiclecost','<%=md.getWFDataValue("__wf__vehiclecost")%>');
								setValue('__wf__receptioncost','<%=md.getWFDataValue("__wf__receptioncost")%>');
								setValue('__wf__other','<%=md.getWFDataValue("__wf__other")%>');
								setValue('__wf__othercost','<%=md.getWFDataValue("__wf__othercost")%>');
								setValue('__wf__summarycost','<%=md.getWFDataValue("__wf__summarycost")%>');
								dwr.util.setValue("__wf__priority","<%=md.getWFDataValue("__wf__priority")%>");
								dwr.util.setValue("__wf__outoflimit","<%=md.getWFDataValue("__wf__outoflimit")%>");					
								searchDescEmp(document.cscform.__wf__employeeid,  'memployee.fullname:MEMPLOYEE@FULLNAME,mposition.tdesc:__position,mbu1.tdesc:__bu1,mbu2.tdesc:__bu2,mbu3.tdesc:__bu3,mbu4.tdesc:__bu4,mbu5.tdesc:__bu5,memployee.startdate:__startdate,memployee.tel_ext:__tel_ext', "");
							<%
								if(!md.isAdminEdit){
							%>
								setDisabled(true);
							<%
									}
							%>
           					</SCRIPT>
           					<!-- End Set Value Step3 -->
           				<%
           				}
           				%>
           				<!-- End Set Value -->
						<!--/DIV>
					</TD>
					<TD VALIGN="top" BACKGROUND="../IMAGES/MYNOTE/BPM_07.jpg">&nbsp;</TD>
				</TR>
				<TR>
					<TD COLSPAN="2" HEIGHT="20" BACKGROUND="../IMAGES/MYNOTE/BPM_09.jpg"><DIV ALIGN="center"><SPAN CLASS="txt02">&nbsp;</SPAN></DIV></TD>
				</TR>
			</TABLE-->
			<%=screenSingle.endJSP()%>
				</FORM>
			</DIV>
			</DIV>
			<DIV ID="footer"><jsp:include page="../EMPVIEW/EMV_FOOTER.jsp" flush="true" /></DIV>
	</DIV>
		</DIV>
</BODY>
</HTML>
<%
}
%>