HrmTrainAttendReport.jsp
7.81 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
<%@ page import="weaver.general.Util" %>
<%@ page import="weaver.file.*" %>
<%@ page import="java.util.*" %>
<%@ page language="java" contentType="text/html; charset=UTF-8" %> <%@ include file="/systeminfo/init_wev8.jsp" %>
<jsp:useBean id="rs" class="weaver.conn.RecordSet" scope="page" />
<jsp:useBean id="TrainReportManage" class="weaver.hrm.report.TrainReportManage" scope="page" />
<jsp:useBean id="TrainResourceComInfo" class="weaver.hrm.train.TrainResourceComInfo" scope="page" />
<jsp:useBean id="ResourceComInfo" class="weaver.hrm.resource.ResourceComInfo" scope="page"/>
<jsp:useBean id="ExcelFile" class="weaver.file.ExcelFile" scope="session"/>
<HTML>
<HEAD>
<LINK href="/css/Weaver_wev8.css" type=text/css rel=STYLESHEET>
</head>
<%
String actor = Util.null2String(request.getParameter("actor"));
String startdatefrom = Util.null2String(request.getParameter("startdatefrom"));
String startdateto = Util.null2String(request.getParameter("startdateto"));
String sqlwhere = " where t1.traindayid=t2.id and t2.trainid=t3.id and t1.isattend=1 ";
int ishead = 0;
if(!sqlwhere.equals("")) ishead = 1;
if(!actor.equals("")){
if(ishead==0){
ishead = 1;
sqlwhere += " where t1.resourceid =" + actor +" ";
}
else
sqlwhere += " and t1.resourceid =" + actor +" ";
}
if(!startdatefrom.equals("")){
if(ishead==0){
ishead = 1;
sqlwhere += " where t2.traindate >='" + startdatefrom +"' ";
}
else
sqlwhere += " and t2.traindate >='" + startdatefrom +"' ";
}
if(!startdateto.equals("")){
if(ishead==0){
ishead = 1;
if(rs.getDBType().equals("oracle")){
sqlwhere += " where (t2.traindate is not null and t2.traindate <='" + startdateto +"') ";
}else{
sqlwhere += " where (t2.traindate <> '' and t2.traindate <='" + startdateto +"') ";
}
}
else
if(rs.getDBType().equals("oracle")){
sqlwhere += " and (t2.traindate is not null and t2.traindate <='" + startdateto +"') ";
}else{
sqlwhere += " and (t2.traindate<>'' and t2.traindate <='" + startdateto +"') ";
}
}
String imagefilename = "/images/hdReport_wev8.gif";
String titlename = SystemEnv.getHtmlLabelName(352,user.getLanguage())+":"+SystemEnv.getHtmlLabelName(17535,user.getLanguage());
String needfav ="1";
String needhelp ="";
%>
<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 += "{Excel,/weaver/weaver.file.ExcelOut,_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="10" colspan="3"></td>
</tr>
<tr>
<td ></td>
<td valign="top">
<TABLE class=Shadow>
<tr>
<td valign="top">
<form name=frmmain method=post action="HrmTrainAttendReport.jsp">
<table class=ViewForm>
<colgroup>
<col width=10%>
<col width=20%>
<col width=10%>
<col width=56%>
<tbody>
<tr>
<td class=field><%=SystemEnv.getHtmlLabelName(15761,user.getLanguage())%></td>
<td class=field>
<INPUT class=wuiBrowser id=actor type=hidden name=actor value="<%=actor%>"
_url="/systeminfo/BrowserMain.jsp?url=/hrm/resource/ResourceBrowser.jsp"
_displayText="<%=ResourceComInfo.getLastname(actor)%>"
>
</td>
<td class=field><%=SystemEnv.getHtmlLabelName(532,user.getLanguage())+SystemEnv.getHtmlLabelName(277,user.getLanguage())%></td>
<td class=field colspan=3>
<BUTTON type=button class=Calendar id=selectstartdatefrom onclick="getDate(startdatefromspan,startdatefrom)"></BUTTON>
<SPAN id=startdatefromspan ><%=startdatefrom%></SPAN> -
<BUTTON type=button class=Calendar id=selectstartdateto onclick="getDate(startdatetospan,startdateto)"></BUTTON>
<SPAN id=startdatetospan ><%=startdateto%></SPAN>
<input class=inputStyle type="hidden" name="startdatefrom" value="<%=startdatefrom%>">
<input class=inputStyle type="hidden" name="startdateto" value="<%=startdateto%>">
</td>
</tr>
<TR style="height:2px"><TD class=Line colSpan=2></TD></TR>
</tbody>
</table>
<table class=ListStyle cellspacing=1 >
<colgroup>
<col width=25%>
<col width=35%>
<col width=40%>
<tbody>
<tr class=header>
<td><%=SystemEnv.getHtmlLabelName(15761,user.getLanguage())%></td>
<td><%=SystemEnv.getHtmlLabelName(277,user.getLanguage())%></td>
<td><%=SystemEnv.getHtmlLabelName(678,user.getLanguage())%></td>
</tr>
<TR class=Line><TD colspan="3" ></TD></TR>
<%
int line=0;
ExcelFile.init ();
String filename = SystemEnv.getHtmlLabelName(17535,user.getLanguage());
ExcelFile.setFilename(""+filename) ;
// 下面建立一个头部的样式, 我们系统中的表头都采用这个样式!
ExcelStyle es = ExcelFile.newExcelStyle("Header") ;
es.setGroundcolor(ExcelStyle.WeaverHeaderGroundcolor) ;
es.setFontcolor(ExcelStyle.WeaverHeaderFontcolor) ;
es.setFontbold(ExcelStyle.WeaverHeaderFontbold) ;
es.setAlign(ExcelStyle.WeaverHeaderAlign) ;
ExcelSheet et = ExcelFile.newExcelSheet(""+filename) ;
// 下面设置每一列的宽度, 如果不设置, 将按照excel默认的宽度
et.addColumnwidth(4000) ;
et.addColumnwidth(4000) ;
et.addColumnwidth(8000) ;
ExcelRow er = null ;
er = et.newExcelRow() ;
er.addStringValue(SystemEnv.getHtmlLabelName(15761,user.getLanguage()),"Header");
er.addStringValue(SystemEnv.getHtmlLabelName(277,user.getLanguage()),"Header");
er.addStringValue(SystemEnv.getHtmlLabelName(678,user.getLanguage()),"Header");
String sql = "SELECT distinct t1.resourceid, t2.traindate, t3.name, t3.id FROM HrmTrainActor t1, HrmTrainDay t2, HrmTrain t3 " + sqlwhere +
"order by traindate desc";
rs.executeSql(sql);
while(rs.next()){
String resourceid = Util.null2String(rs.getString("resourceid"));
String traindate = Util.null2String(rs.getString("traindate"));
String name = Util.null2String(rs.getString("name"));
String id = Util.null2String(rs.getString("id"));
ExcelRow erres = et.newExcelRow();
erres.addStringValue(ResourceComInfo.getLastname(resourceid));
erres.addStringValue(traindate);
erres.addStringValue(name);
if(line==0){
line = 1;
%>
<tr class=datalight>
<%}else{
line=0;
%>
<tr class=datadark>
<%}%>
<td><a href="/hrm/resource/HrmResource.jsp?id=<%=resourceid%>"><%=ResourceComInfo.getLastname(resourceid)%></a></td>
<td><%=traindate%></td>
<td><a href="/hrm/train/train/HrmTrainEdit.jsp?id=<%=id%>"><%=name%></a></td>
</tr>
<%
}
%>
</tbody>
</table>
</form>
</td>
</tr>
</TABLE>
</td>
<td></td>
</tr>
<tr>
<td height="10" colspan="3"></td>
</tr>
</table>
<script language=vbs>
sub onShowResource(inputname,spanname)
id = window.showModalDialog("/systeminfo/BrowserMain.jsp?url=/hrm/resource/ResourceBrowser.jsp")
if NOT isempty(id) then
if id(0)<> "" then
document.all(spanname).innerHtml = id(1)
document.all(inputname).value=id(0)
else
document.all(spanname).innerHtml = ""
document.all(inputname).value=""
end if
end if
end sub
sub onShowTrainResource()
id = window.showModalDialog("/systeminfo/BrowserMain.jsp?url=/hrm/train/trainresource/HrmTrainResourceBrowser.jsp")
if Not isempty(id) then
if id(0)<> 0 then
resourcespan.innerHtml = id(1)
frmMain.resource.value=id(0)
else
resourcespan.innerHtml = ""
frmMain.resource.value=""
end if
end if
end sub
</script>
<script language=javascript>
function submitData() {
frmmain.submit();
}
</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>