<%@page contentType="text/html; charset=UTF-8"%> <%@page import="com.csc.library.entry.HelpEntry,com.csc.library.system.*,com.csc.library.utilities.*"%> <%@page import="com.csc.library.entry.*,com.csc.library.database.*,com.csc.library.session.*" %> <jsp:useBean id="TAU353" class="com.csc.library.system.Task" scope="page"/> <% TAU353.setChannel(request,response); HelpEntry screen = (HelpEntry) TAU353.process("HelpEntry","MEMPL_VACATIONHELP"); screen.setMaxLine(2000); screen.process(); screen.referLangOff(); CheckNull chkNull = new CheckNull(); CscCalendar calendar = new CscCalendar(); long attach_time = Long.parseLong(chkNull.chkNullString(request.getParameter("attach_time"),String.valueOf(calendar.getTimeInMillis()))); String group_name = chkNull.chkNullString(request.getParameter("__wf__group_name"),""); String pathname = chkNull.chkNullString( request.getParameter("__wf__pathname")); String filename = chkNull.chkNullString( request.getParameter("__wf__filename")); if(!group_name.equals("")){ saveData(pathname, filename, screen.getUProfile()); } %> <%! public void saveData(String pathname, String filename, UProfile up) { String fullpath = pathname + "" + filename; ReadFile rf = new ReadFile(fullpath); String[] colum; try { if (rf.hasMoreData()) { rf.readLine(); // อ่าน header เฉยๆ ไม่ได้ทำอะไรกับมัน } while (rf.hasMoreData()) { try { colum = rf.readLine().split(","); String employeeid = colum[0]; String companyid = colum[1]; String yearid = colum[2]; String vacation1 = colum[3]; String eventgrpid = colum[4]; DbRecord rec = new InitialRecord(up).getDbRecord("Mempl_vacation"); rec.setColumn("*"); rec.set("EMPLOYEEID", employeeid); rec.set("COMPANYID", companyid); rec.set("YEARID", yearid); rec.set("EVENTGRP", eventgrpid); rec.search(); rec.set("VACATION1", vacation1); rec.save(); } catch (Exception e) { System.out.println(e); MyLog.error(">>>>>>>>> employee null <<<<<<<<<<<"); } } } catch (Exception e) { System.out.println(e); MyLog.error(">>>>>>>>> ImportUnsuccess <<<<<<<<<<<"); } } %> <html> <head> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <link href="../CSS/TISCO.css" rel="stylesheet" type="text/css"> <link href="../CSS/bootstrap.css" rel="stylesheet" type="text/css"> <link href="../CSS/bootstrap_csc_backend.css" rel="stylesheet" type="text/css"> <script type="text/javascript" src="../JS/jquery-2.1.3.min.js"></script> <script type='text/javascript' src="../JS/bootstrap.js"></script> <script language="javascript" src="../JS/SCREEN.js"></script> <script type='text/javascript' src='../JS/ICONSMENU.js'></script> <script language="javascript">setLang('<%=screen.getUProfile().get("lang")%>');</script> <script type='text/javascript' src='../JS/DATEINPUT.js'></script> <script type='text/javascript' src='../JS/VIEWCALENDAR.js'></script> <script language="JavaScript" type="text/JavaScript"> <!-- function MM_preloadImages() { //v3.0 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array(); var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++) if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}} } //--> function MM_swapImgRestore() { //v3.0 var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc; } function MM_findObj(n, d) { //v4.01 var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) { d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);} if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n]; for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); if(!x && d.getElementById) x=d.getElementById(n); return x; } function MM_swapImage() { //v3.0 var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3) if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];} } function goHelp(helpName,inputName) { with(document.cscform){ var helpReturn=""; var fcon=__fixCon.value; if (inputName=="__employeeid" ) { helpName = "MEMPLOYEETAHELP"; //helpReturn="__employeeid:employeeid,MEMPLOYEE@FNAME;__shift_old:time0,MTIME0@EDESC"; //helpReturn="__employeeid:employeeid,MEMPLOYEE@FULLNAME"; helpReturn="__employeeid:employeeid,MEMPLOYEE@FULLNAME,__old_shift:time0,MTIME0@EDESC"; }else if(inputName=="__new_shift" ) { helpReturn="__new_shift:time0id,MTIME0@EDESC$1"; } else if(inputName=="__old_shift" ) { helpReturn="__old_shift:time0id,MTIME0@EDESC"; } if(fcon=="") { linkHelp_Return(helpName,helpReturn); } else { helpPageCon(helpName,helpReturn,fcon); } } } function goSave(){ var isRed = document.getElementById('viewframe').contentWindow.document.getElementById('__isRed').value; // alert("isRed : "+isRed); with(document.cscform){ if(__wf__group_name.value==""){ alert("กรุณาอัพโหลดไฟล์..!!"); }else if(isRed=="1"){ alert("ไม่สามารถบันทึกข้อมูลได้ \n กรุณาตรวจสอบข้อมูลให้ถูกต้อง..!!") }else{ var bCon = confirm("ต้องการอัพโหลดข้อมูลหรือไม่"); if(bCon){ confirmSave(); } } } } function GoSave2(){ if (document.cscform.__tchshiftid.value!=0) { alert(MyCode[61]); } else { if (document.cscform.__old_shift.value == document.cscform.__new_shift.value) { if (document.cscform.__language.value == "tha") { alert("รหัสกะเก่าและรหัสกะที่ขอทำต้องไม่ใช่รหัสเดียวกัน !!!"); } else alert("Old shift must not equals new shift !!!"); } else if(chk_Time()&&chk_Time2()){ with (document.cscform) { for(i=0;i<__docInputType.length;i++){ if (__docInputType[i].checked){ if (__docInputType[i].value==0) { __wf_status.value='8'; } else if (__docInputType[i].value==1) { __wf_status.value='4'; } else if (__docInputType[i].value==2) { __wf_status.value='6'; } } } } confirmSave(); } } } function GoUpdate(){ if (document.cscform.__tchshiftid.value!=0) { alert(MyCode[62]); } else { if(chk_Time()&&chk_Time2()){ update(); } } } function GoDelete(){edelete();} function GoSearch(){search();} function chk_Time(){ var count=0; with(document.cscform){ for (j=0;j<elements.length; j++){ if(elements[j].name.indexOf("start_date") > -1){ if(!isValidDate(elements[j].value)){ count+=1; elements[j].focus(); elements[j].select(); break; } } if(elements[j].name.indexOf("end_date") > -1){ if(!isValidDate(elements[j].value)){ count+=1; elements[j].focus(); elements[j].select(); break; } } }//for if(count>0){ return false; }else{ return true; } } } function chk_Time2(){ with(document.cscform){ if(!dateDifference(eval("__start_date.value"),eval("__end_date.value"))){ eval("__start_date.focus()"); eval("__start_date.select()"); return false; } return true; } } function setcframe(source,mframe){ var vframe=document.getElementById(mframe); vframe.src=source; } function initiframe(type){ var source = ""; with( document.cscform){ if(__wf__group_name.value != "" || type == undefined){ __fixCon.value = "employeeid ='"+__wf__group_name.value+"'"; var A = 1; source="../TA/TAU353_ADMIN.jsp?__wf__pathname="+__wf__pathname.value+"&__wf__filename="+__wf__filename.value+"&__empListid="+__empListid.value; setcframe(source,"viewframe"); }else if(type != undefined){ let msg = getLang() === 'tha' ? "กรุณาอัพโหลดไฟล์" : "Please Upload File"; alert(msg); } } } function showView(){ with(document.cscform){ document.getElementById("head").style.display=""; document.getElementById("content01").style.display=""; } } function showperview(){ initiframe('x'); } function uploadFileLeaveBL() { var oldfilename=""; with(document.cscform){ if( __wf__filename.value!=""){ oldfilename = __wf__filename.value; } page = "/hr/TAU353_UPLOADFILE.jsp?uploadfield=import_mempl_valcation.file_name&subfolder=" +attach_time.value+"&__del="+__wf__group_name.value+"&oldfilename="+oldfilename+"&emp_boss=&fieldreturn=__wf__group_name"; var win = window.open(page,"","height=320,width=650,resizable=1,toolbar=0,scrollbars=1,status=1"); win.focus(); } } //--> function chk_view(){ var isview = document.getElementById('viewframe').contentWindow.__wf__view; alert(isview); if(isview != undefined){ if(isview.value == "0"){ return false; }else{ return true; } } } </script> </head> <body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0"> <form name="cscform" method="post" action="TAU353.jsp"> <!----------BEGIN CSC INITIAL ZONE ------------------------> <%=screen.InitialVariable()%> <!----------END CSC INITIAL ZONE --------------------------> <input type="hidden" name="__screen" value="TAU353"> <input type="hidden" name="__help" value=""> <input type="hidden" name="__status" value=""> <input type="hidden" name="__notNull" value="<%//=screen.getRequire()%>"> <input type="hidden" name="__cmd" value=""> <input type="hidden" name="__emp_request" value="<%//=screen.getUProfile().get("employeeid")%>"> <input type="hidden" name="__companyid" value='<%=screen.getUProfile().get("companyid")%>'> <input type="hidden" name="__calendar" value=""> <script language="javascript">getInputFormatDate();</script> <input type="hidden" name="__language" value ="<%=screen.getUProfile().get("lang")%>"> <input type="hidden" name="__fixCon" value=""> <input type="hidden" name="__wf_status" value="6" > <input type="hidden" name="__wfcmd" value="false"> <input type="hidden" name="__autonum" value="shiftid, "> <input type="hidden" name="attach_time" value="<%=attach_time%>"> <input type="hidden" name="__wf__pathname" id="__wf__pathname" maxlength="50" value="<%=chkNull.chkNullString(request.getParameter("__wf__pathname"),"") %>" class="disabled" readonly > <input type="hidden" name="__wf__filename" id="__wf__filename" class="disabled" readonly value="<%=chkNull.chkNullString(request.getParameter("__wf__filename"),"") %>"> <input type="hidden" name="__oldfilename" id="__oldfilename" class="disabled" readonly value="<%=chkNull.chkNullString(request.getParameter("__oldfilename"),"") %>"> <input type="hidden" name="__uploadFile" value="<%=chkNull.chkNullString(request.getParameter("__uploadFile"),"false")%>"> <input type="hidden" name="__isRed" value=""> <input type="hidden" name="__empListid" value="<%=chkNull.chkNullString(request.getParameter("__empListid")) %>"> <div id="toolTipLayer" style="position:absolute; visibility: hidden"></div> <script language="javascript"> // var titlename=swap2String('Change Shift'); // document.write(Icons("TAU353_APF,"+titlename+" (Admin)")); </script> <script language="javascript">initToolTips();</script> <script language="JavaScript" src="../JS/HOTKEY.js"></script> <BR> <div align="center"> <table cellpadding="0" cellspacing="0" class="normal"> <tr > <td class="header" colspan="2" >TAU353, <script language="javascript">swapLang("นำเข้าสิทธิการลา (CSV)");</script> </td> </tr> <tr> <td> <table border="0" cellspacing="0" cellpadding="0" class="maxsize"> <tr> <td class="blankspace" colspan="2"></td> </tr> <tr> <td class="columnobject1" align="center" ><div align="center"> <input name="__wf__group_name" class="disabled" id="__wf__group_name" type="text" size="30" maxLength="50" readOnly=""/> <a href="javascript:uploadFileLeaveBL();"><img name="browse_image" width="20" height="20" align="absMiddle" alt="SEARCH" src="../IMAGES/BUTTON/MAIN/SEARCH20.gif" border="0"/></a> </div></td> </tr> <!-- <tr> <td colspan="3"><div align="center"><a href="javascript:showView();"><img src="../IMAGES/BUTTON/VIEW.gif" border=0></a> <a href="javascript:uploadFile('welfare.import','myFile');setConfigField(document.cscform.__typeimport.options[document.cscform.__typeimport.selectedIndex].value);"><img src="../IMAGES/BUTTON/UPLOAD.gif" border=0></a> </div></td> </tr> --> <tr> <td class="blankspace" colspan="2"></td> </tr> <tr> <td class="buttonline" colspan="7"><div align="center"> <button type="button" class="btn btn-primary width100" swlang code="SW013170" onClick="showView();">VIEW</button> <button type="button" class="btn btn-primary width100" swlang code="SW013183" onClick="showperview();">PREVIEW</button> <button type="button" class="btn btn-primary width100" swlang code="SW013181" onClick="goSave();">UPLOAD</button> </div> </td> </tr> <tr> <td class="blankspace" colspan="2"></td> </tr> <!-- ------------------------------------------------------------------------------------------------------------- ดึงข้อมูลตรวจสอบสิทธิการลา -------------------------------------------------------------------------------------------------------------------------- --> <tr id="head" style="display:none"> <!-- id="head" style="display:none" --> <td class="header" ><script language="javascript">swapLang("Text File's Format Example");</script> </td> </tr> <tr id="content01" style="display:none" > <td align="center"> <table width="200" border="0" align="center" cellpadding="0" cellspacing="0" class="large"> <tr> <td> <table width="200" border="0" cellpadding="0" cellspacing="0" class="inframe"> <tr> <td><b><script language="javascript">swapLang("Example");</script>: </b></td> </tr> <tr> <td class="row3">employeeid,companyid,yearid,vacation1,eventgrp</td> </tr> <tr> <td class="columnData" nowrap> 181001,100,2020,00:00:00,ANL</td> </tr> <tr> <td class="columnData" nowrap> 181002,100,2019,00:00:00,ODL</td> </tr> <tr> <td class="columnData" nowrap> 181003,100,2018,45:00:00,MTL</td> </tr> </table> </td> </tr> </table> </td> </tr> <tr> <td class="blankspace"></td> </tr> <tr> <td colspan="4" nowrap class="columnlabel_baseline2"> <iframe id="viewframe" name="detail1" src="" width="100%" height="300"></iframe> </td> </tr> <tr> <td class="blankspace" colspan="3"></td> </tr> </table></td> </tr> <tr> <td class="bottom"></td> </tr> </table> </div> <script language="javascript">initiframe();</script> <!----------BEGIN CSC ENDING ZONE ------------------------> <%=screen.endJSP()%> <!----------END CSC ENDING ZONE --------------------------> </form> </body> </html>