home *** CD-ROM | disk | FTP | other *** search
- <%@ page language="java"
- session="true"
- import="com.websina.bean.*,com.websina.util.*,com.websina.util.log.Log"
- errorPage="error.jsp"
- %>
- <html>
- <head>
- <title>Summary Report</title>
- </head>
- <body topmargin=0>
- <%@ include file="_cache.jspf" %>
- <%
- Label label = Label.getInstance();
- com.websina.bean.Report report =
- (com.websina.bean.Report)session.getAttribute("summary_report");
- java.util.Map summary = null;
- if (report != null) {
- summary = report.getSummary();
- }
- if (summary == null) {
- out.print("<center><font color=red><b>");
- out.print(" <br> <br>"+MessageCode.get("servlet.report.no_summary_report"));
- out.print("</b></font></center>");
- return;
- }
- String xName = report.getXName();
- String yName = report.getYName();
- String projectId = report.getProjectId();
-
- Project conf = Project.getInstance(projectId);
- DateTime dateTime = (DateTime)session.getAttribute("datetime");
-
- String[] x = null;
- String[] xDisplay = null;
- String[] y = null;
- String[] yDisplay = null;
- int[] total = null;
- if ("responsible".equalsIgnoreCase(xName)) {
- com.websina.util.Field field = conf.getAccess().getUsers("edit");
- x = field.getValue();
- xDisplay = field.getText();
- } else {
- x = (String[])summary.keySet().toArray(new String[0]);
- xDisplay = x;
- }
- if ("responsible".equalsIgnoreCase(yName)) {
- com.websina.util.Field field = conf.getAccess().getUsers("edit");
- y = field.getValue();
- yDisplay = field.getText();
- } else {
- java.util.HashSet set = new java.util.HashSet();
- for (int i=0; i<x.length; i++) {
- set.addAll( ((java.util.Map)summary.get(x[i])).keySet());
- }
- y = (String[])set.toArray(new String[0]);
- yDisplay = y;
- }
- total = new int[x.length+1];
- for (int i=0; i<=x.length; i++) {
- total[i] = 0;
- }
- %>
- <center>
- <br>
- <font size="+2"><b><%=conf.getName()%></b></font>
- <font size="+1">Summary Report</font>
- <br>
-
- <%=label.get(yName, projectId)%> versus <%=label.get(xName, projectId)%>
- <br><%=dateTime.localTime()%>
- <p>
-
- <table cellspacing=1 cellpadding=2 border=0>
- <tr>
- <td bgcolor="#b3c3db"> </td>
- <% for (int i=0; i<x.length; i++) {
- %>
- <td bgcolor="#b3c3db" align=center> <%= xDisplay[i] %></td>
- <% } %>
- <td bgcolor="#b3c3db" align=center>Total </td>
- </tr>
-
- <% for (int i=0; i<y.length; i++) {
- int xTotal = 0;
- %>
- <tr><td bgcolor="#b3c3db" align=right><%= yDisplay[i] %> </td>
- <% for (int j=0; j<x.length; j++) {
- Integer count = null;
- java.util.Map yMap = (java.util.Map)summary.get(x[j]);
- if (yMap != null) {
- count = (Integer)yMap.get(y[i]);
- }
- if (count == null) {
- count = new Integer(0);
- }
- int c = count.intValue();
- xTotal += c;
- total[j] += c;
- total[x.length] += c;
- %>
- <td bgcolor="#efefef" align=center> <%= count %></td>
- <% } %> <td bgcolor="#efefef" align=center><%=xTotal%></td></tr>
- <% } %>
-
- <tr><td bgcolor="#b3c3db" align=right>Total </td>
- <% for (int j=0; j<=x.length; j++) {
- %>
- <td bgcolor="#efefef" align=center><%=total[j] %></td>
- <% } %> </tr>
- <tr><td colspan=<%=(x.length+2)%> align=right>
- <br>
- <a href="<%=request.getContextPath()%>/servlet/export/summary.csv?type=3" title="Export to CSV">Export <img src="img/excel.gif" border=0></a>
- </td></tr>
- </table>
- </center>
- </body>
- </html>
-