HrmTimeCardWarpList.jsp
12 KB
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
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
<%@ page import="weaver.general.Util" %>
<%@ page import="weaver.conn.*" %>
<%@ page import="weaver.file.*" %>
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
<%@ include file="/systeminfo/init_wev8.jsp" %>
<%
if(!HrmUserVarify.checkUserRight("HrmWorktimeWarp:Maintenance", user)){
response.sendRedirect("/notice/noright.jsp") ;
return ;
}
%>
<jsp:useBean id="rs" class="weaver.conn.RecordSet" scope="page"/>
<jsp:useBean id="rs2" class="weaver.conn.RecordSet" scope="page"/>
<jsp:useBean id="ScheduleDiffComInfo" class="weaver.hrm.schedule.HrmScheduleDiffComInfo" scope="page"/>
<jsp:useBean id="ResourceComInfo" class="weaver.hrm.resource.ResourceComInfo" scope="page"/>
<jsp:useBean id="DepartmentComInfo" class="weaver.hrm.company.DepartmentComInfo" scope="page"/>
<HTML><HEAD>
<LINK href="/css/Weaver_wev8.css" type=text/css rel=STYLESHEET>
</head>
<%
String imagefilename = "/images/hdReport_wev8.gif";
String titlename = SystemEnv.getHtmlLabelName(16887,user.getLanguage()) ;
String needfav ="1";
String needhelp ="";
String resourceidpar = Util.null2String(request.getParameter("resourceid"));
String departmentidpar = Util.null2String(request.getParameter("departmentid"));
String fromdate = Util.null2String(request.getParameter("fromdate"));
String todate = Util.null2String(request.getParameter("todate"));
String isself = Util.null2String(request.getParameter("isself")); // 是否当页搜索
Calendar todaycal = Calendar.getInstance ();
String month = Util.add0(todaycal.get(Calendar.MONTH)+1,2);
String year = Util.add0(todaycal.get(Calendar.YEAR),4);
if(fromdate.equals("") && todate.equals("")) {
fromdate = year + "-" + month + "-01" ;
todate = year + "-" + month + "-31" ;
}
String sqlwhere = "";
ArrayList reesourceshifts = new ArrayList() ;
if(isself.equals("1")) {
if(!resourceidpar.equals("")) {
sqlwhere += " and resourceid =" + Util.fromScreen2(resourceidpar , user.getLanguage()) + "" ;
}
if(!departmentidpar.equals("")) {
sqlwhere += " and resourceid in (select id from HrmResource where departmentid = " + Util.fromScreen2(departmentidpar , user.getLanguage()) +")" ;
}
if(!fromdate.equals("")) {
sqlwhere += " and carddate >='" + fromdate + "'" ;
}
if(!todate.equals("")) {
sqlwhere += " and carddate <='" + todate + "'" ;
}
// 得到按照排班来管理的所有人员
rs.executeSql(" select resourceid from HrmArrangeShiftSet " ) ;
while( rs.next() ) {
String resourceid = Util.null2String(rs.getString("resourceid")) ;
reesourceshifts.add( resourceid ) ;
}
}
%>
<BODY>
<%@ include file="/systeminfo/TopTitle_wev8.jsp" %>
<%@ include file="/systeminfo/RightClickMenuConent_wev8.jsp" %>
<%
RCMenu += "{"+SystemEnv.getHtmlLabelName(197,user.getLanguage())+",javascript:submitData(),_self} " ;
RCMenuHeight += RCMenuHeightStep ;
RCMenu += "{"+SystemEnv.getHtmlLabelName(15846,user.getLanguage())+",javascript:recreateData(),_self} " ;
RCMenuHeight += RCMenuHeightStep ;
%>
<%@ include file="/systeminfo/RightClickMenu_wev8.jsp" %>
<table width=100% height=100% border="0" cellspacing="0" cellpadding="0">
<colgroup>
<col width="10">
<col width="">
<col width="10">
<tr>
<td height="0" colspan="3"></td>
</tr>
<tr>
<td ></td>
<td valign="top">
<TABLE class=Shadow>
<tr>
<td valign="top">
<FORM id=frmmain name=frmmain method=post action="HrmTimeCardWarpList.jsp">
<input class=inputstyle type="hidden" name="id">
<input class=inputstyle type="hidden" name="operation">
<input type="hidden" name="isself" value="1">
<div>
<table class=Viewform>
<tbody>
<COLGROUP>
<COL width="20%">
<COL width="20%">
<COL width="30%">
<COL width="30%">
<TR class=Title>
<TH colSpan=3><%=SystemEnv.getHtmlLabelName(15774,user.getLanguage())%></TH>
</TR>
<TR class=Spacing style="height:1px">
<TD class=Line1 colSpan=6 ></TD>
</TR>
<tr>
<td><%=SystemEnv.getHtmlLabelName(124,user.getLanguage())%></td>
<td class=field>
<input class="wuiBrowser" type=hidden name=departmentid value="<%=departmentidpar%>"
_url="/systeminfo/BrowserMain.jsp?url=/hrm/company/DepartmentBrowser.jsp"
_displayText="<%=DepartmentComInfo.getDepartmentname(departmentidpar)%>">
</td>
<td><%=SystemEnv.getHtmlLabelName(97,user.getLanguage())%></td>
<td class=field>
<BUTTON class=Calendar type="button" id=selectfromdate onclick="getDate(fromdatespan,fromdate)"></BUTTON>
<SPAN id=fromdatespan ><%=fromdate%></SPAN>
<input class=inputstyle type="hidden" name="fromdate" value="<%=fromdate%>">
-<BUTTON class=Calendar type="button" id=selecttodate onclick="getDate(todatespan,todate)"></BUTTON>
<SPAN id=todatespan ><%=todate%></SPAN>
<input class=inputstyle type="hidden" name="todate" value="<%=todate%>">
</td>
<td>
</tr>
<TR style="height:1px"><TD class=Line colSpan=6></TD></TR>
<tr>
<td><%=SystemEnv.getHtmlLabelName(179,user.getLanguage())%></td>
<td class=field>
<input class="wuiBrowser" type=hidden name=resourceid value="<%=resourceidpar%>"
_url="/systeminfo/BrowserMain.jsp?url=/hrm/resource/ResourceBrowser.jsp"
_displayText="<%=ResourceComInfo.getResourcename(resourceidpar)%>">
</td>
<td></td>
<td></td>
</tr>
<TR style="height:1px"><TD class=Line colSpan=2></TD></TR>
</tbody>
</table>
<% if(isself.equals("1")) { %>
<table class=ListStyle cellspacing=1 >
<colgroup>
<col width="20%">
<col width="20%">
<col width="35%">
<col width="25%">
<tbody>
<tr class=header>
<td><%=SystemEnv.getHtmlLabelName(16703,user.getLanguage())%></td>
<td><%=SystemEnv.getHtmlLabelName(179,user.getLanguage())%></td>
<td><%=SystemEnv.getHtmlLabelName(16886,user.getLanguage())%></td>
<td><%=SystemEnv.getHtmlLabelName(15090,user.getLanguage())%></td>
</tr>
<%
boolean isLight = false ;
String theresourcecardate = "" ; // 判断是否是新的一个人一天
String thecardtime = "" ; // 一个人一天的所有打卡记录 ,多个用<br> 分开
String theshiftname = "" ;
String id = "" ;
String resourceid = "" ;
String carddate = "" ;
String cardtime = "" ;
String tempresourcecardate = "" ;
String sql = "select * from HrmRightCardInfo where islegal = 2 and workout=0 " + sqlwhere + " order by carddate desc , resourceid , cardtime ";
rs.executeSql(sql);
while(rs.next()){
id = Util.null2String(rs.getString("id"));
resourceid = Util.null2String(rs.getString("resourceid"));
carddate = Util.null2String(rs.getString("carddate"));
cardtime = Util.null2String(rs.getString("cardtime"));
tempresourcecardate = resourceid+"_"+ carddate ;
if( theresourcecardate.equals("") ) theresourcecardate = tempresourcecardate ;
if( !tempresourcecardate.equals(theresourcecardate) ) {
if( !thecardtime.equals("") ) {
String theresourcecardates[] = Util.TokenizerString2(theresourcecardate , "_" ) ;
String oldresourceid = theresourcecardates[0] ;
String oldcarddate = theresourcecardates[1] ;
int shiftindex = reesourceshifts.indexOf(oldresourceid) ;
if( shiftindex != -1 ) {
rs2.executeSql( "select shiftname from HrmArrangeShift a , HrmArrangeShiftInfo b where a.id = b.shiftid and b.resourceid = " + oldresourceid + " and shiftdate = '" + oldcarddate +"' " ) ;
while(rs2.next()) {
String tempshiftname = Util.toScreen(rs2.getString("shiftname") , user.getLanguage()) ;
if( theshiftname.equals("") ) theshiftname = tempshiftname ;
else theshiftname += "<br>" + tempshiftname ;
}
}
else theshiftname = SystemEnv.getHtmlLabelName(16687,user.getLanguage()) ;
isLight = !isLight ;
%>
<TR class='<%=( isLight ? "datalight" : "datadark" )%>'>
<td><%=oldcarddate%></td>
<td><%=Util.toScreen(ResourceComInfo.getResourcename(oldresourceid),user.getLanguage())%></td>
<td><%=thecardtime%></td>
<td><%=theshiftname%></td>
</tr>
<%
}
// 不同人天初始化
theresourcecardate = tempresourcecardate ;
theshiftname = "" ;
thecardtime = cardtime + " <a onclick='doDelete("+id+")' style='CURSOR:HAND'>"+ SystemEnv.getHtmlLabelName(91,user.getLanguage()) +"</a> <a onclick='doWorkOut("+id+")' style='CURSOR:HAND'>"+ SystemEnv.getHtmlLabelName(6151,user.getLanguage()) +"</a>" ;
}
else {
if( thecardtime.equals("") ) {
thecardtime = cardtime + " <a onclick='doDelete("+id+")' style='CURSOR:HAND'>"+ SystemEnv.getHtmlLabelName(91,user.getLanguage()) +"</a> <a onclick='doWorkOut("+id+")' style='CURSOR:HAND'>"+ SystemEnv.getHtmlLabelName(6151,user.getLanguage()) +"</a>" ;
}
else {
thecardtime += "<br><br>" + cardtime + " <a onclick='doDelete("+id+")' style='CURSOR:HAND'>"+ SystemEnv.getHtmlLabelName(91,user.getLanguage()) +"</a> <a onclick='doWorkOut("+id+")' style='CURSOR:HAND'>"+ SystemEnv.getHtmlLabelName(6151,user.getLanguage()) +"</a>" ;
}
}
}
if( !tempresourcecardate.equals("") ) {
isLight = !isLight ;
int shiftindex = reesourceshifts.indexOf(resourceid) ;
if( shiftindex != -1 ) {
rs2.executeSql( "select shiftname from HrmArrangeShift a , HrmArrangeShiftInfo b where a.id = b.shiftid and b.resourceid = " + resourceid + " and shiftdate = '" + carddate +"' " ) ;
while(rs2.next()) {
String tempshiftname = Util.toScreen(rs2.getString("shiftname") , user.getLanguage()) ;
if( theshiftname.equals("") ) theshiftname = tempshiftname ;
else theshiftname += "<br>" + tempshiftname ;
}
}
else theshiftname = SystemEnv.getHtmlLabelName(16687,user.getLanguage()) ;
%>
<TR class='<%=( isLight ? "datalight" : "datadark" )%>'>
<td><%=carddate%></td>
<td><%=Util.toScreen(ResourceComInfo.getResourcename(resourceid),user.getLanguage())%></td>
<td><%=thecardtime%></td>
<td><%=theshiftname%></td>
</tr>
<%
}
%>
</tbody>
</table>
<%}%>
</form>
</td>
</tr>
</TABLE>
</td>
<td></td>
</tr>
<tr>
<td height="10" colspan="3"></td>
</tr>
</table>
<script language=javascript>
function doDelete(theid){
if(confirm("<%=SystemEnv.getHtmlNoteName(7 , user.getLanguage())%>")) {
document.frmmain.isself.value="<%=isself%>";
document.frmmain.operation.value = "delete" ;
document.frmmain.action = "HrmTimeCardWarpOperation.jsp" ;
document.frmmain.id.value = theid ;
document.frmmain.submit() ;
}
}
function doWorkOut(theid){
if(confirm("<%=SystemEnv.getHtmlLabelName(83872,user.getLanguage())%>")) {
document.frmmain.isself.value="<%=isself%>";
document.frmmain.operation.value = "workout" ;
document.frmmain.action = "HrmTimeCardWarpOperation.jsp" ;
document.frmmain.id.value = theid ;
document.frmmain.submit() ;
}
}
function recreateData() {
document.frmmain.isself.value="<%=isself%>";
document.frmmain.action = "HrmTimeCardWarpCreate.jsp" ;
document.frmmain.submit();
}
function submitData() {
document.frmmain.submit();
}
</script>
<script language=vbs>
sub onShowResourceID(spanname,inputename)
id = window.showModalDialog("/systeminfo/BrowserMain.jsp?url=/hrm/resource/ResourceBrowser.jsp")
if (Not IsEmpty(id)) then
if id(0)<> "" then
spanname.innerHtml = id(1)
inputename.value=id(0)
else
spanname.innerHtml = ""
inputename.value=""
end if
end if
end sub
sub onShowDepartment(spanname,inputename)
id = window.showModalDialog("/systeminfo/BrowserMain.jsp?url=/hrm/company/DepartmentBrowser.jsp?selectedids="&inputename.value)
issame = false
if (Not IsEmpty(id)) then
if id(0)<> 0 then
spanname.innerHtml = id(1)
inputename.value=id(0)
else
spanname.innerHtml = ""
inputename.value=""
end if
end if
end sub
</script>
</body>
<SCRIPT language="javascript" defer="defer" src="/js/datetime_wev8.js"></script>
<SCRIPT language="javascript" defer="defer" src="/js/JSDateTime/WdatePicker_wev8.js"></script>
</html>