<%@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.*,com.csc.library.database.DataSet"%> <%@page import="com.csc.library.entry.*,com.csc.library.utilities.*"%> <%@page import="com.csc.library.session.*"%> <%@page import="com.csc.library.components.*,com.csc.library.report.ReportUDF"%> <%request.setCharacterEncoding("UTF-8");%> <jsp:useBean id="welexp003c5" class="com.csc.library.system.Task" scope="page"/> <jsp:setProperty name="welexp003c5" property="appname" value="WELFARE" /> <jsp:setProperty name="welexp003c5" property="classauthen" value="WorkflowUIAuthen" /> <% welexp003c5.setChannel(request,response); welexp003c5.checkProfile(); if( welexp003c5.getUProfile() != null ){ DbRecord borrow_emp=new InitialRecord(welexp003c5.getUProfile()).getDbRecord("Texpend_cost"); ReportUDF rf=new ReportUDF(); CheckNull chkNull = new CheckNull(); String billno=chkNull.chkNullString(request.getParameter("billno")); boolean isstep1=Boolean.parseBoolean(java.net.URLDecoder.decode(chkNull.chkNullString(request.getParameter("isstep1")))); %> <HTML> <HEAD> <TITLE>myNOTE : Business Process Management Service</TITLE> <META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8"> <LINK HREF="../CSS/MYNOTE.css" REL="stylesheet" TYPE="text/css"> <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/SearchDWR.js'></script> <script type='text/javascript' src='/hr/dwr/interface/ExchangerateCtrl.js'></script> <SCRIPT TYPE='text/JavaScript' SRC='../JS/SCREEN.js'></SCRIPT> <SCRIPT TYPE='text/JavaScript' SRC='../JS/MYNOTE_SCREEN.js'></SCRIPT> <SCRIPT TYPE='text/JavaScript' SRC='../JS/VIEWCALENDAR.js'></SCRIPT> <SCRIPT LANGUAGE="JavaScript">setLang('tha');</SCRIPT> <SCRIPT LANGUAGE="JavaScript" TYPE="text/JavaScript"> ThaiCode[311]="ข้อมูลไม่ถูกต้อง วันที่ต้องอยู่ในช่วง "; EngCode[311]="invalid date between "; function saveValue() { if(checkPeriodDate()&&checkValid()){ var nobillcost={expendid:null , employeeid:null , companyid:null , billdate:null , billno:null , costtype:null , checkindate:null , checkoutdate:null , hotelname:null , hotelcompany:null , hoteltaxno:null , hoteladdr:null , hotelzipcode:null , amt_dollar:null , vat_dollar:null , nets_dollar:null , moneytype:null , amount:null , vat:null , nets:null , workarea:null , workareadesc:null , costcenter:null , costcenterdesc:null , budget:null , budgetdesc:null , billstatus:null ,costtypedesc:null} dwr.util.getValues(nobillcost); window.opener.writeNobillcost(nobillcost); window.close(); } } function checkValid(){ with(document.cscform){ if($("costtype").options[$("costtype").selectedIndex].value==""){ alert(MyCode[0]); return false; }; return true; } } function checkPeriodDate(){ var bdate=$("billdate").value.split("-"); var cdate=new Date(bdate[2],bdate[1]-1,bdate[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 en=Math.ceil(endate.getTime()); if(cu<st || cu>en){ alert(MyCode[311]+" "+window.opener.document.cscform.__wf__startdate.value +" - "+window.opener.document.cscform.__wf__enddate.value); return false; } return true; } function goHelp(helpName,inputName){ with(document.cscform){ var helpReturn="",fcon=""; if(inputName == "costcenter"){ helpReturn="costcenter:costcenterid,costcenterdesc: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,budgetdesc:tdesc"; linkHelp_Return(helpName,helpReturn); __fixCon.value=temp; }else{ alert(MyCode[0]); costcenter.focus(); } }*/else if(inputName == "workarea"){ helpReturn="workarea:workareaid,workareadesc:tdesc"; linkHelp_Return(helpName,helpReturn); } } } function loadFromParent(keyid){ var obj=window.opener.loadDataNobill(keyid); dwr.util.setValues(obj); } function setcosttypedesc(obj){ $("costtypedesc").value=obj.options[obj.options.selectedIndex].text; } 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='<%=welexp003c5.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 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]; budgetdesc.value=data[0][1]; }else{ budget.value=""; budgetdesc.value=""; } }); } } function postReturn(){ //searchCostcenter(); } function chkInputDate(obj) { var temp = obj.value; var tempdate = obj.value.split("-"); var chk = true; //ตรวจสอบดูว่าพิมเป็นตัวอักษรหรือไม่ if (!chkIntNotChar (temp)) { alert(MyAlert[30]); obj.value = datePresent(); obj.select(); chk = false; } //ตรวจสอบดูว่ากรอกตัวเลขครบแปดหลักแล้วหรือไม่ else if ((obj.value.length < 8) && (obj.value.length > 0)) { alert(MyAlert[31]); obj.value = datePresent(); obj.select(); chk = false; } //ตรวจสอบดูว่าถ้ากรอกวันที่ครบแปดตัวเลขแล้ว กรอก วัน เดือน ปี ถูกต้องหรือไม่ ( โดยเรียก script checkTrueDay(str) ) else if ( (tempdate[0].length == 2) && (tempdate[1].length == 2) && (tempdate[2].length == 4) && (temp.length > 0 ) && (!checkTrueDay(delWordDate(temp))) ) { alert(MyAlert[31]); obj.select(); chk = false; } //ตรวจสอบดูว่ากรอก วันเป็นเลขสองหลัก เดือนเป็นเลขสองหลัก และปีเป็นเลขสี่หลักหรือป่าว else if ( (tempdate[0].length != 2 || tempdate[1].length != 2 || tempdate[2].length != 4) && temp.length > 0 ) { alert(MyAlert[31]); obj.select(); chk = false; } //ตรวจสอบดูว่ากรอกวันเกินสิบตัวเลขหรือไม่ ( กรณีที่เกิดคือ copy คำมาแปะอาจเป็นภาษาไทย หรือ อักษร ) else if ( (temp != delWordDate(obj.value)) && (temp.length > 10) ) { obj.value = datePresent(); alert(MyAlert[31]); obj.select(); chk = false; } //ตรวจสอบดูว่ารูปแบบวันที่อยู่ในรูปของ ddmmyyyy หรือ dd-mm-yyyy แล้วหรือยัง else if ( tempdate.length != 3 ) { obj.value = datePresent(); alert(MyAlert[31]); obj.select(); chk = false; } //ตรวจสอบดูว่า วันที่กรอกเป็นเลขสองหลัก เดือนเป็นเลขสองหลัก และปีเป็นเลขสี่หลักหรือไม่ else if ( (tempdate[0].length != 2) && (tempdate[1].length != 2) && (tempdate[2].length != 4) ) { obj.value = datePresent(); alert(MyAlert[31]); obj.select(); chk = false; } return chk; //ถ้ากรอกวันที่ถูกต้องตามเงื่อนไขแล้วจะ retrun เป็น true } </script> <STYLE TYPE="text/css"> <!-- .style1 { color: #FFFFFF; font-weight: bold; } --> </STYLE> </HEAD> <BODY onLoad="MM_preloadImages('../IMAGES/BUTTON/SWAP/SEARCH_SWAP20.gif','../IMAGES/BUTTON/SWAP/CALENDAR_SWAP20.gif')"> <FORM NAME="cscform" METHOD="post" ACTION="WELEXP003C5_INT.jsp"> <INPUT TYPE="hidden" NAME="__screen" VALUE="WELEXP003C5_INT"> <INPUT TYPE="hidden" NAME="__cmd" VALUE=""> <INPUT TYPE="hidden" NAME="__fixCon" VALUE=""> <INPUT TYPE="hidden" NAME="__help" VALUE=""> <INPUT TYPE="hidden" NAME="__language" VALUE="<%=welexp003c5.getUProfile().get("lang")%>"> <INPUT TYPE="hidden" NAME="__companyid" VALUE="<%=welexp003c5.getUProfile().get("companyid")%>"> <INPUT TYPE="hidden" NAME="companyid" VALUE="<%=welexp003c5.getUProfile().get("companyid")%>"> <INPUT TYPE="hidden" NAME="__calendar" VALUE=""> <INPUT TYPE="hidden" NAME="expendid" VALUE="<%=request.getParameter("expendid")%>"> <INPUT TYPE="hidden" NAME="employeeid" VALUE="<%=request.getParameter("employeeid")%>"> <INPUT TYPE="hidden" NAME="billstatus" VALUE="1"> <INPUT TYPE="hidden" NAME="billno" VALUE="<%=(billno.length()>0)?billno:String.valueOf(System.currentTimeMillis())%>"> <INPUT TYPE="hidden" id="costtypedesc" VALUE=""> <INPUT TYPE="hidden" NAME="__server_date" id="__server_date" VALUE="<%=new CscCalendar().getDDMMYYYY()%>"> <SCRIPT LANGUAGE="JavaScript">getInputFormatDate();</SCRIPT> <TABLE WIDTH="580" 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"><FONT COLOR="#FFFFFF"></FONT></TD> <TD > <TABLE WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="1" CLASS="txt01"> <td width="34%"> <TR BGCOLOR="#EFF7FA"> <TD COLSPAN="2" class="column-title"><DIV ALIGN="CENTER"><B><script language="javascript">swapLang("ค่าใช้จ่ายอื่นๆ / ค่าพาหนะที่ไม่ี่มีใบเสร็จ");</script></B></DIV></TD> </TR> <TR> <TD align="right" nowrap class="column-label"><%=borrow_emp.getField("billdate").getDescription()%></td> <TD width="66%" NOWRAP="nowrap" CLASS="desc"><INPUT TYPE="text" NAME="billdate" id="billdate" VALUE="<%=new CscCalendar().getDDMMYYYY()%>" SIZE="10" MAXLENGTH="10" ONKEYPRESS="chkInteger();" ONBLUR="chkInputDate(this);" ONKEYUP="formatDate(this);" ONFOCUS="this.select();"> <%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('billdate')"></a><%}%></TD> </TR> <% String tmp="<select id=\"costtype\" onchange=\"setcosttypedesc(this)\">"; tmp+="<option value=\"\">...</option>"; try{ /* String module[]=rf.getSystemCode("COST_TYPE",welexp003c5.getUProfile().get("lang")); String keyvalue[]; String tmp="<select id=\"costtype\" onchange=\"setcosttypedesc(this)\">"; tmp+="<option value=\"\">...</option>"; for(int n=0;n<module.length;n++){ keyvalue=module[n].split(","); tmp+="<option value=\""+keyvalue[0]+"\" >"+keyvalue[1]+"</option>"; } tmp+="</select>"; String tmp="<select id=\"costtype\" onchange=\"setCosttype(this)\">"; tmp+="<option value=\"\">...</option>"; */ DataSet ds= new DataSet("select payment_code,description FROM mgl where status!='BI' order by description", welexp003c5.getUProfile().getDbName(), "mgl"); ds.setFetchAll(true); ds.initConnection(welexp003c5.getUProfile()); while(ds.next()){ tmp+="<option value=\""+ds.getString("payment_code")+"\" >"+ds.getString("description")+"</option>"; } }catch(Exception ex){} %> <TR> <TD align="right" nowrap class="column-label"><%=borrow_emp.getField("costtype").getDescription()%></td> <TD NOWRAP="nowrap" CLASS="desc"><%=tmp%></TD> </TR> <TR> <TD align="right" nowrap bgcolor=#0099cc class="column-label"><%=borrow_emp.getField("nets").getDescription()%></td> <TD NOWRAP="nowrap" CLASS="desc"><span class="column-input"> <input type="text" id="nets" size="10" maxlength="10" value="0.00" onKeyPress="checkWordNumber(this.value,event);" onKeyUp="sysIsEdit();checkComma(this,2);" onBlur="checkNumFloat(this,0,900000000);" onFocus="callDelComma(this);" class="numeric" /> </span></TD> </TR> <TR> <TD align="right" nowrap bgcolor=#0099cc class="column-label"><%=borrow_emp.getField("workarea").getDescription()%></td> <TD NOWRAP="nowrap" CLASS="desc"><DIV ALIGN="left"> <INPUT TYPE="text" NAME="workarea" id="workarea" size="10" VALUE="" ><%if(isstep1){%><A HREF="javascript:goHelp('MWORKAREAHELP','workarea')" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('999','','../IMAGES/BUTTON/SWAP/SEARCH_SWAP20.gif',1)"><IMG SRC="../IMAGES/BUTTON/MAIN/SEARCH20.gif" ALT="SEARCH" NAME="employee_image2" WIDTH="20" HEIGHT="20" BORDER="0" ALIGN="absmiddle"></A><%}%> <INPUT TYPE="text" SIZE="50" NAME="workareadesc" id="workareadesc" VALUE="" readonly class="disabled"> </DIV></TD> </TR> <TR> <TD align="right" nowrap bgcolor=#0099cc class="column-label"><%=borrow_emp.getField("costcenter").getDescription()%></td> <TD NOWRAP="nowrap" CLASS="desc"><DIV ALIGN="left"> <INPUT TYPE="text" NAME="costcenter" id="costcenter" VALUE="" size="10" ><%if(isstep1){%><A HREF="javascript:goHelp('MCOSTCENTER0HELP','costcenter')" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('999','','../IMAGES/BUTTON/SWAP/SEARCH_SWAP20.gif',1)"><IMG SRC="../IMAGES/BUTTON/MAIN/SEARCH20.gif" ALT="SEARCH" NAME="employee_image2" WIDTH="20" HEIGHT="20" BORDER="0" ALIGN="absmiddle"></A><%}%> <INPUT TYPE="text" SIZE="50" NAME="costcenterdesc" id="costcenterdesc" VALUE="" readonly class="disabled"> </DIV></TD> </TR> <TR style="display:none"> <TD align="right" nowrap bgcolor=#0099cc class="column-label"><%=borrow_emp.getField("budget").getDescription()%></td> <TD NOWRAP="nowrap" CLASS="desc"><DIV ALIGN="left"> <INPUT TYPE="text" NAME="budget" id="budget" VALUE="" size="10" ><%if(isstep1){%><A HREF="javascript:goHelp('MBUDGET_PTTHELP','budget')" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('999','','../IMAGES/BUTTON/SWAP/SEARCH_SWAP20.gif',1)"><IMG SRC="../IMAGES/BUTTON/MAIN/SEARCH20.gif" ALT="SEARCH" NAME="employee_image2" WIDTH="20" HEIGHT="20" BORDER="0" ALIGN="absmiddle"></A><%}%> <INPUT TYPE="text" SIZE="50" NAME="budgetdesc" id="budgetdesc" VALUE="" readonly class="disabled"> </DIV></TD> </TR> </TABLE> </FONT></TD> <TD WIDTH="5" BACKGROUND="../IMAGES/MYNOTE/R2.gif"><FONT COLOR="#FFFFFF"></FONT></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="500" BORDER="0" ALIGN="center" CELLPADDING="0" CELLSPACING="0" CLASS="thai03"> <TR> <TD><DIV ALIGN="right"> <%if(isstep1){%><A HREF="JavaScript:saveValue();"><IMG SRC="../IMAGES/MYNOTE/BUTTON/BUTTON_SUBMIT.gif" WIDTH="89" HEIGHT="37" BORDER="0"></A><%}%><A HREF="JavaScript:window.close();"><IMG SRC="../IMAGES/MYNOTE/BUTTON/BUTTON_CANCEL.gif" WIDTH="89" HEIGHT="37" BORDER="0"></A></DIV></TD> </TR> </TABLE> <% if(billno.length()>0){ %> <script language="javascript">loadFromParent("<%=billno%>");</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.costcenterdesc.value=window.opener.document.cscform.mcostcenter0_tdesc.value; document.cscform.budgetdesc.value=window.opener.document.cscform.budgetdesc.value; </script> <%}%> <%if(!isstep1){%> <script language="javascript">setDisabled(true);</script> <%}%> </FORM> </BODY> </HTML> <%}%>