PI_TIME.jsp 14.6 KB
Newer Older
Thitichaipun Wutthisak committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277
<%@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">
                    &nbsp;<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()">&nbsp;
				  	<% } 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()">&nbsp;
				  	<% }%>
				  		<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>&nbsp;&nbsp;&nbsp;-&nbsp;&nbsp;&nbsp; 
					<% 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()">&nbsp;
				   	<% } 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()">&nbsp;
				  	<% }%>
			  		  <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>&nbsp;&nbsp;&nbsp;
				  	<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>