OutReportStatResult.jsp
8.34 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
<%@ page import="java.util.*,java.math.*,java.io.*,weaver.general.Util,weaver.file.*,weaver.datacenter.*" %>
<%@ page language="java" contentType="text/html; charset=GBK" %> <%@ include file="/systeminfo/init.jsp" %>
<jsp:useBean id="rs" class="weaver.conn.RecordSet" scope="page" />
<jsp:useBean id="OutReportManage" class="weaver.datacenter.OutReportManage" scope="session" />
<jsp:useBean id="ExcelFile" class="weaver.file.ExcelFile" scope="session"/>
<HTML><HEAD>
<LINK href="/css/Weaver.css" type=text/css rel=STYLESHEET>
</head>
<%
String acceptlanguage = request.getHeader("Accept-Language");
if(!"".equals(acceptlanguage))
acceptlanguage = acceptlanguage.toLowerCase();
String islink = Util.null2String(request.getParameter("islink"));
String outrepid = Util.null2String(request.getParameter("outrepid"));
String modulename = Util.null2String(request.getParameter("modulename"));
//String userid = "" + user.getUID();
//String usertype = user.getLogintype() ;
String designusername = user.getUsername() ;
Calendar today = Calendar.getInstance();
String currentyear = Util.add0(today.get(Calendar.YEAR), 4) ;
String currentmonth = Util.add0(today.get(Calendar.MONTH) + 1, 2) ;
String currentday = Util.add0(today.get(Calendar.DAY_OF_MONTH), 2) ;
String currentdate = currentyear + " " + SystemEnv.getHtmlLabelName(445,user.getLanguage()) + " " + currentmonth + " " + SystemEnv.getHtmlLabelName(6076,user.getLanguage()) + " " + currentday + " " + SystemEnv.getHtmlLabelName(16889,user.getLanguage()) ;
ExcelSheet es = null ;
ExcelRow er = null ;
if(!islink.equals("1")) {
OutReportManage.init(request, user) ;
OutReportManage.initReportValue() ;
es = new ExcelSheet() ;
}
String outrepname = OutReportManage.getOutRepName() ;
String modulefilename = OutReportManage.getModulefilename() ;
int reportrowcount = OutReportManage.getReportRowCount() ;
int outrepcolumn = OutReportManage.getReportColumnCount() ;
if(!modulename.equals("")) outrepname += " (" + modulename + ") " ;
String yearf = OutReportManage.getYearf() ;
String monthf = OutReportManage.getMonthf() ;
String dayf = OutReportManage.getDayf() ;
String yeart = OutReportManage.getYeart() ;
String montht = OutReportManage.getMontht() ;
String dayt = OutReportManage.getDayt() ;
String imagefilename = "/images/hdHRM.gif";
String titlename = SystemEnv.getHtmlLabelName(15101,user.getLanguage()) + ": " + outrepname ;
String needfav ="1";
String needhelp ="";
%>
<BODY <% if( !modulefilename.equals("") ) {%>onload="return init()"<%}%> >
<%@ include file="/systeminfo/TopTitle.jsp" %>
<DIV>
<BUTTON class=btn accessKey=S onClick="javascript:location.href='OutReportSel.jsp?outrepid=<%=outrepid%>'"><U>S</U>-<%=SystemEnv.getHtmlLabelName(15518,user.getLanguage())%></BUTTON>
<% if( modulefilename.equals("") ) { // 没有插件的时候导出Excel插件来显示报表的时候不显示excel %>
<BUTTON class=btn accessKey=E onClick="javascript:location.href='/weaver/weaver.file.ExcelOut'"><U>E</U>-<%=SystemEnv.getHtmlLabelName(17416,user.getLanguage())%>Excel</BUTTON>
<% } else { // 插件的功能 %>
<BUTTON class=btn accessKey=E onClick="javascript:ChinaExcel.OnSaveAsExcelFile();"><U>E</U>-<%=SystemEnv.getHtmlLabelName(17416,user.getLanguage())%>Excel</BUTTON>
<BUTTON class=btn accessKey=P onClick="javascript:ChinaExcel.OnFilePrint();"><U>P</U>-<%=SystemEnv.getHtmlLabelName(257,user.getLanguage())%></BUTTON>
<BUTTON class=btn accessKey=U onClick="javascript:ChinaExcel.OnPrintSetup();"><U>U</U>-<%=SystemEnv.getHtmlLabelName(20756,user.getLanguage())%></BUTTON>
<BUTTON class=btn accessKey=V onClick="javascript:ChinaExcel.OnFilePrintPreview();"><U>V</U>-<%=SystemEnv.getHtmlLabelName(20757,user.getLanguage())%></BUTTON>
<% } %>
</DIV>
<br>
<table width=100% height=90% 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">
<%
if( modulefilename.equals("") ) { // 原来的显示方式
%>
<TABLE class=liststyle cellspacing=1 >
<TBODY>
<TR class=header>
<TH colSpan=<%=outrepcolumn%>><%=SystemEnv.getHtmlLabelName(15101,user.getLanguage())%> : <%=outrepname%>
</TH>
</TR>
<TR class=line>
<TD colSpan=<%=outrepcolumn%>></TD>
</TR>
<%
boolean isLight = false;
for(int j=1; j<reportrowcount+1 ; j++) { // 每行
if(!islink.equals("1")) er =es.newExcelRow () ;
isLight = ! isLight ;
%>
<TR class='<%=( isLight ? "datalight" : "datadark" )%>'>
<%
for(int i= 1; i<outrepcolumn+1 ; i++) { // 每列
String thevalue = OutReportManage.getReportValue(j,i) ;
boolean isdigital = false ;
if(Util.getDoubleValue(thevalue,-9999.99) != -9999.99 && i!=1 && j!=1) {
isdigital = true ;
thevalue = "" + (new BigDecimal(thevalue)).divide ( new BigDecimal ( 1 ), 2, BigDecimal.ROUND_HALF_DOWN ).doubleValue() ;
if(!islink.equals("1")) er.addValue(Util.getfloatToString(thevalue)) ;
thevalue = Util.getFloatStr(Util.getfloatToString(thevalue),3) ;
}
else {
String tempthevalue = thevalue ;
thevalue = Util.StringReplace(thevalue,"^" , "<br>") ;
if(!islink.equals("1")) er.addStringValue(Util.StringReplace(tempthevalue,"^" , ",")) ;
}
%>
<TD <%if(i==1 || j==1) {%> style="BACKGROUND-COLOR:#d6d3ce" align=center <%} else if(isdigital) {%> align=right <%}%>><nobr>
<% if(thevalue.equals("")) {%> <%} else {%><%=thevalue%><%}%>
</TD>
<%
}
%>
</TR>
<%
}
if(!islink.equals("1")) {
ExcelFile.init() ;
ExcelFile.setFilename(outrepname) ;
ExcelFile.addSheet(outrepname, es) ;
}
%>
</TBODY></TABLE>
<%
} else { // 由插件显示
%>
<%if(acceptlanguage.indexOf("zh-tw")>-1||acceptlanguage.indexOf("zh-hk")>-1){%>
<script language=javascript src="/workflow/mode/chinaexcelobj_tw.js"></script>
<%}else{%>
<script language=javascript src="/workflow/mode/chinaexcelobj.js"></script>
<%} %>
<%
}
%>
</td>
</tr>
</TABLE>
</td>
<td></td>
</tr>
<tr>
<td height="10" colspan="3"></td>
</tr>
</table>
<% if( !modulefilename.equals("") ) {%>
<SCRIPT FOR="ChinaExcel" EVENT="MouseLClick()" LANGUAGE="JavaScript" >
rightMenu.style.visibility="hidden";
return false;
</SCRIPT>
<SCRIPT FOR="ChinaExcel" EVENT="MouseRClick()" LANGUAGE="JavaScript" >
rightMenu.style.left=ChinaExcel.offsetLeft+ChinaExcel.GetMousePosX();
rightMenu.style.top=ChinaExcel.offsetTop+ChinaExcel.GetMousePosY();
rightMenu.style.visibility="visible";
return false;
</SCRIPT>
<script language=javascript>
function init()
{
ChinaExcel.Login("泛微软件","891e490cd34e3e33975b1b7e523e8b32","上海泛微网络技术有限公司");
ChinaExcel.ReadHttpTabFile("/reportModel/<%=modulefilename%>.tab");
// ChinaExcel.SetStatFetchDataMode("OutReportXml.jsp",1);
ChinaExcel.DesignMode = false;
ChinaExcel.ReCalculate();
ChinaExcel.SetOnlyShowTipMessage(false);
setChinaExcelValue("ReportTitle","<%=outrepname%>");
setChinaExcelValue("ReportDesigner","<%=designusername%>");
setChinaExcelValue("ReportDate","<%=currentdate%>");
setChinaExcelValue("yearf","<%=yearf%>");
setChinaExcelValue("monthf","<%=monthf%>");
setChinaExcelValue("dayf","<%=dayf%>");
setChinaExcelValue("yeart","<%=yeart%>");
setChinaExcelValue("montht","<%=montht%>");
setChinaExcelValue("dayt","<%=dayt%>");
ChinaExcel.ReCalculate();
ChinaExcel.SetPasteType(1);
ChinaExcel.SetCanAutoSizeHideCols(true);
ChinaExcel.SetProtectFormShowCursor(true);
ChinaExcel.ShowGrid = false;
ChinaExcel.height="100%";
ChinaExcel.RefreshViewSize();
}
function setChinaExcelValue(setKey,valueStr)
{
TitleRow=ChinaExcel.GetCellUserStringValueRow(setKey);
TitleCol=ChinaExcel.GetCellUserStringValueCol(setKey);
ChinaExcel.SetCellVal(TitleRow,TitleCol,valueStr);
ChinaExcel.Refresh();
}
function onCbClick(szCommand)
{
switch(szCommand.toUpperCase())
{
case "CMDPRINTSETUP":
ChinaExcel.OnPrintSetup();
break;
case "CMDFILEPRINT":
ChinaExcel.OnFilePrint();
break;
case "CMDFILEPRINTPREVIEW":
ChinaExcel.OnFilePrintPreview();
break;
case "CMDABOUT":
ChinaExcel.AboutBox();
break;
}
}
</script>
<%}%>
</BODY></HTML>