<%@page contentType="text/html; charset=TIS620" language="java" %> <%@page import="com.csc.library.entry.HelpEntry,com.csc.library.system.*,com.csc.library.utilities.*,java.util.*"%> <%@page import="com.csc.library.utilities.CscCalendar,com.csc.library.entry.HelpEntry,com.csc.library.system.*"%> <%@page import="com.csc.library.entry.*,com.csc.library.database.*,com.csc.library.session.*,com.csc.library.formula.FormulaString" %> <%@page import="com.csc.library.timeattendance.DayShift,com.csc.library.timeattendance.Shift,com.csc.library.timeattendance.WorkingShift" %> <%@page import="java.text.DecimalFormat" %> <% request.setCharacterEncoding("TIS620"); %> <jsp:useBean id="EMV" class="com.csc.library.system.Task" scope="page" /> <jsp:setProperty name="EMV" property="appname" value="empview" /> <% EMV.setChannel(request, response); HelpEntry screen = (HelpEntry) EMV.process("HelpEntry", "PI_TIMEHELP"); screen.inq.setFilter("employeeid = '"+EMV.getUProfile().getEmvEmpId()+"' "); screen.inq.refresh(); screen.nextRec(); CscCalendar cs=new CscCalendar(); FormulaString fs = new FormulaString(); DecimalFormat df = new DecimalFormat("0.00"); DecimalFormat df2 = new DecimalFormat("00.00"); %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="../Templates/template-emv-main.dwt.jsp" codeOutsideHTMLIsLocked="false" --> <head> <!-- InstanceBeginEditable name="doctitle" --> <title>Employee View</title> <!-- InstanceEndEditable --> <meta http-equiv="Content-Type" content="text/html; charset=TIS620" /> <!-- InstanceBeginEditable name="head" --> <!-- Begin CSS Links --> <link rel="stylesheet" type="text/css" href="../CSS/DDMENU.css" /> <link rel="stylesheet" type="text/css" href="../CSS/EMV_LAYOUT.css" /> <link rel="stylesheet" type="text/css" href="../CSS/EMV_DEFAULT.css" /> <link rel="stylesheet" type="text/css" href="../CSS/EMV_LAYOUT_TWO.css" /> <link rel="stylesheet" type="text/css" href="../CSS/EMV_TEXT.css" /> <style type="text/css"> <!-- font.holiday { color: #FF00FF; } font.week { color: #FF0000; } --> </style> <!-- End CSS Links --> <!-- Begin Scripts --> <!-- 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 language="JavaScript" type="text/javascript" src="../JS/SCREEN.js"></script> <script language="JavaScript" type="text/javascript" src="../JS/DATEINPUT.js"></script> <script language="JavaScript" type="text/javascript" src="../JS/VIEWCALENDAR.js"></script> <script language="JavaScript">setLang('<%=screen.getUProfile().get("lang")%>');</script> <!-- End Scripts --> <!-- Begin Head --> <style type="text/css"> #header { background: #FFFFFF ; } </style> <!-- End Head --> <!-- InstanceEndEditable --> </head> <body> <div id="wrapper"> <div id="header"><!-- InstanceBeginEditable name="header" --> <jsp:include page="EMV_HEADER.jsp" flush="true" /> <jsp:include page="EMV_TOPMENU.jsp" flush="true" /> <!-- InstanceEndEditable --> </div> <div id="topnav"><!-- InstanceBeginEditable name="top_navigation" --> <input type="hidden" name="__companyid" value="<%=screen.getUProfile().get("companyid")%>" /> <!-- InstanceEndEditable --> </div> <div id="container"> <div id="content"><!-- InstanceBeginEditable name="main_content" --> <jsp:include page="EMV_HELPBAR.jsp" flush="true" /> <!-- Begin Main Content --> <div class="content"> <form name="cscform" method="post" action="PI_TIME.jsp"> <input type="hidden" name="__cmd" value=""> <input type="hidden" name="__screen" value="PI_TIME"> <input type="hidden" name="__help" value=""> <input type="hidden" name="__helpReturn" value=""> <input type="hidden" name="__helpName" value=""> <input type="hidden" name="__pageCall" > <input type="hidden" name="__referPage" value=""> <input type="hidden" name="__calendar"> <script language="javascript">getInputFormatDate();</script> <input type="hidden" name="__fixCon" > <input type="hidden" name="__language" value="<%=screen.getUProfile().get("lang")%>"> <input type="hidden" name="__childFilter" > <input type="hidden" name="__empID" value="<%=screen.getString("employeeid")%>"> <input type="hidden" name="__empName" value="<%=screen.getString("fullname")%>"> <div id="toolTipLayer" style="position:absolute; visibility: hidden"></div> <script language="javascript">initToolTips();</script> <div class="content-box2"> <div class="content-header"><h2><script language="javascript">swapLang('Employee Working and OverTime')</script></h2></div> <table width="100%" border="0" cellpadding="0" cellspacing="0" class="table-search-condition"> <tr> <td class="column-input"> <strong><script language="javascript">swapLang('Date')</script></strong> <% if (request.getParameter("date_start")==null) { %> <input name="date_start" type="text" value="<%="01-"+cs.getMM()+"-"+cs.getYear()%>" size="9" maxlength="10" onKeyup = "formatDate(this)" onBlur = "chkInputDate2(this,date_end)" onKeypress = "chkIntegerOfDate(this.value)" onMouseOver="toolTip('วันเริ่มต้น(DDMMYYYY)')" onMouseOut="toolTip()"> <% } else {%> <input name="date_start" type="text" value="<%=request.getParameter("date_start")%>" size="9" maxlength="10" onKeyup = "formatDate(this)" onBlur = "chkInputDate2(this,date_end)" onKeypress = "chkIntegerOfDate(this.value)" onMouseOver="toolTip('วันเริ่มต้น(DDMMYYYY)')" onMouseOut="toolTip()"> <% }%> <a href="#" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('calendar1','','../IMAGES/EMPVIEW/ICON_CALENDAR.gif',1)"> <img src="../IMAGES/EMPVIEW/ICON_CALENDAR.gif" name="calendar1" width="20" height="20" border="0" align="absmiddle" onClick="viewCal('date_start')" alt="Calendar"></a> - <% if (request.getParameter("date_end")==null) { %> <input name="date_end" type="text" value="<%=cs.getDDMMYYYY()%>" size="9" maxlength="10" onKeyup = "formatDate(this)" onBlur = "chkInputDate2(date_start,this)" onKeypress = "chkIntegerOfDate(this.value)" onMouseOver="toolTip('วันสิ้นสุด(DDMMYYYY)')" onMouseOut="toolTip()"> <% } else {%> <input name="date_end" type="text" value="<%=request.getParameter("date_end")%>" size="9" maxlength="10" onKeyup = "formatDate(this)" onBlur = "chkInputDate2(date_start,this)" onKeypress = "chkIntegerOfDate(this.value)" onMouseOver="toolTip('วันสิ้นสุด(DDMMYYYY)')" onMouseOut="toolTip()"> <% }%> <a href="#" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('calendar2','','../IMAGES/EMPVIEW/ICON_CALENDAR.gif',1)"> <img src="../IMAGES/EMPVIEW/ICON_CALENDAR.gif" name="calendar2" width="20" height="20" border="0" align="absmiddle" onClick="viewCal('date_end')" alt="Calendar"></a> <a href="javascript:search();"><img src="../IMAGES/EMPVIEW/BUTTON/SEARCH.gif" width="60" height="23" border="0" align="absmiddle"></a> </td> </tr> </table> <table width="100%" border="0" cellpadding="0" cellspacing="1" class="table-content-list"> <tr> <td width="10%" class="column-header"><script language="javascript">swapLang('Date')</script></td> <td width="10%" class="column-header"><script language="javascript">swapLang('Day')</script></td> <td width="30%" class="column-header"><script language="javascript">swapLang('Working Time')</script></td> <td width="35%" class="column-header"><script language="javascript">swapLang('Day Type')</script></td> <td width="15%" class="column-header"><script language="javascript">swapLang('Total')</script>(<script language="javascript">swapLang('HH MM')</script>)</td> </tr> <% if (!screen.getDataLabel("employeeid").equals("")) { //out.println("employeeid -->> "+screen.getDataLabel("employeeid")); //out.println("if test emp-->> "+screen.inq.getCurrentDbRecord().getParam().get("ws")); if (screen.inq.getCurrentDbRecord().getParam().get("ws")!=null) { WorkingShift pws = (WorkingShift) screen.inq.getCurrentDbRecord().getParam().get("ws"); //out.println("-->> "+pws); HashMap hm = new HashMap(); try { DbInquiry inq = new InitialInquiry(screen.getUProfile()).getDbInquiry(); inq.setSchemaName(screen.getUProfile().getSchemaName()); inq.initMyTable("Meventgrp", "", ""); inq.setColumn("*"); inq.refresh(); while (inq.next()) { DbRecord rec = inq.getCurrentDbRecord(); hm.put(rec.getString("eventgrpid"), rec.getString("tdesc")); } } catch (Exception e) {} %> <% CscTime ot = new CscTime(); CscTime leave = new CscTime(); String cFont = ""; String tmp = ""; int rows = 1; for (Iterator IT = pws.keySet().iterator(); IT.hasNext(); ) { String key = (String) IT.next(); DayShift dShift = (DayShift) pws.get(key); rows = dShift.size(); for (Iterator IT1 = dShift.keySet().iterator(); IT1.hasNext(); ) { String key1 = (String) IT1.next(); Shift sh = (Shift) dShift.get(key1); cFont = ""; if (sh.getEventGroup().equals("H")) { cFont ="week"; } else if (sh.getEventGroup().equals("I")) { cFont = "holiday"; } if (sh.getDocType().equals("O")) { //ทำการบวกชม ที่ทำโอที ot.add(sh.getAp_ot()); } else if (sh.getDocType().equals("A") || sh.getDocType().equals("S")) { //ทำการบวกชม ที่ลา leave.add(sh.getLv()); } %> <tr> <% String date = ""; if (tmp.equals(sh.getShiftDate().getDDMMYYYY())) { date = ""; } else date = sh.getShiftDate().getDDMMYYYY(); %> <% if (rows>1 && !date.equals("")) { %> <td class="column-text-center" rowspan="<%=rows%>"><font class="<%=cFont%>"><%=date%></font></td> <% } else if (rows==1) { %> <td class="column-text-center" rowspan="<%=rows%>"><font class="<%=cFont%>"><%=date%></font></td> <% } %> <% String day = ""; if (tmp.equals(sh.getShiftDate().getDDMMYYYY())) { day = ""; } else { if (((String) screen.getUProfile().get("lang")).equalsIgnoreCase("THA")) { //แสดงวันจันทร์ , อังคาร, พุธ เป็นต้น day = sh.getShiftDate().getDOWTHI(); } else day = sh.getShiftDate().getDOWENG(); } %> <% if (rows>1 && !date.equals("")) { %> <td class="column-text-center" rowspan="<%=rows%>"><font class="<%=cFont%>"><%=day%></font></td> <% } else if (rows==1) { %> <td class="column-text-center" rowspan="<%=rows%>"><font class="<%=cFont%>"><%=day%></font></td> <% } %> <td class="column-text-center"><font class="<%=cFont%>"> <%=sh.getResult_c_dt_in().getDDMMYYYY()+" - "+df2.format(sh.getResult_c_dt_in().getCSCTime())+ " : "+ sh.getResult_c_dt_out().getDDMMYYYY()+" - "+df2.format(sh.getResult_c_dt_out().getCSCTime())%> </font></td> <td class="column-text-center"><font class="<%=cFont%>"> <% //out.println(sh.getEventGroup()); if (sh.getTR_Type().indexOf("T")>-1 && (!sh.getDocType().equals("C") && !sh.getDocType().equals("E"))) { out.println(); } else { if (sh.getEventGroup().equalsIgnoreCase("T")) { //ถ้าเป็นวันปกติ (T) ให้แสดงช่องว่าง out.println(); } else { String lv_type = (String) hm.get(sh.getEventGroup()); if (lv_type==null || lv_type.equals("null")) { out.println(); } else out.println(lv_type); } } %> </font></td> <td class="column-text-center"><font class="<%=cFont%>"> <% if (sh.getLv()==0 && sh.getAp_ot()==0) { //ถ้า ชม ลา หรือ ชม โอที = 0 ให้แสดงช่องว่าง out.println(); } else if (sh.getLv()>0) { out.println(df.format(sh.getLv())); } else if (sh.getAp_ot()>0) { out.println(df.format(sh.getAp_ot())); } %> <%//out.println(sh.getEventGroup());%> <%//out.println(sh.getDocType());%> </font></td> </tr> <% tmp = sh.getShiftDate().getDDMMYYYY(); } //End for (Iterator IT1 = dShift.keySet().iterator(); IT1.hasNext(); ) } //End for (Iterator IT = pws.keySet().iterator(); IT.hasNext(); ) %> <tr> <td class="column-header-right" colspan="4"><script language="javascript">swapLang('OT Total')</script></td> <td class="column-header"><%=df.format(ot.getFloat())%></td> </tr> <tr> <td class="column-header-right" colspan="4"><script language="javascript">swapLang('Leave Total')</script></td> <td class="column-header"><%=df.format(leave.getFloat())%></td> </tr> <% } //End if (screen.inq.getCurrentDbRecord().getParam().get("ws")!=null) } //End if (!screen.getDataLabel("employeeid").equals("")) %> </table> <div class="content-footer"><img src="../IMAGES/SPACER.gif" width="3" height="3" /></div> </div> <!-- End Main Content --> <!-- InstanceEndEditable --> </div> </div> <div id="footer"><!-- InstanceBeginEditable name="footer" --> <jsp:include page="EMV_FOOTER.jsp" flush="true" /> <!-- InstanceEndEditable --> </div> </div> </body> <!-- InstanceEnd --></html>