REPORT.jsp 12.5 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
<%@page contentType="text/html; charset=UTF-8"%>
<%@ page import = "com.csc.library.databean.workload.*"%>
<%@ page import="com.csc.library.entry.*,com.csc.library.database.*,com.csc.library.session.*,java.util.*"  %>
<%@ page import="java.text.DecimalFormat" %>
<%
    com.csc.library.utilities.UProfile up=(com.csc.library.utilities.UProfile)session.getAttribute("userprofile");
    String users[]=request.getParameterValues("user_code");
    WorkloadReport    wr=new WorkloadReport(up);
    Vector v=wr.getWorkloadReport(users);
	DecimalFormat df = new DecimalFormat("0.00");
%>
<html>
<head>
<title>Workload Report</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script language="JavaScript" type="text/JavaScript">
<!--
function Start(page) {
	OpenWin = this.open(page, "CtrlWindow", "toolbar=no,menubar=no,location=no,scrollbars=no,resizable=no" );
}
function showGraph() {
  	document.cscform.action = "GRAPH.jsp";
        document.cscform.submit();
}
//-->
</script>
<link rel="stylesheet" href="CSS/PRINTPAGE.css" type="text/css">
<script language="JavaScript">
var linkset=new Array();
linkset[0]='<table width=\"75%\" border=\"0\" cellpadding=\"1\" cellspacing=\"2\">' 
linkset[0]+='<td  nowrap><font size="2"><a href="javascript:window.print()"><IMG SRC="IMAGES/ARROW.gif" WIDTH="12" HEIGHT="12" BORDER="0" HSPACE="0" VSPACE="0" >&nbsp;พิมพ์</a></font></td>' 
linkset[0]+='</table>'
</script>
<script language="JavaScript1.2" src="JS/PRINTPAGE.js"></script>
</head>
<body>
<div align="center"> </div>
<div align="center">
<form name="cscform" method="post" action="">
   

<!----------BEGIN CSC INITIAL ZONE ------------------------>

<%=screen.InitialVariable()%>

<!----------END CSC INITIAL ZONE -------------------------->

<div align="center">
      <table width="702" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td width="702" bgcolor="#336699" ><div align="right"><font color="#FFFFFF" size="2" face="MS Sans Serif, Tahoma, sans-serif"><strong>Workload
              Me</strong></font></div>
            <div align="right"></div></td>
        </tr>
      </table>
      <table width="705" border="0" cellpadding="0" cellspacing="0" bgcolor="#CCCCCC">
        <tr>
          <td width="705" bgcolor="#FFFFFF"><div align="right">
              <%
                         StringBuffer concat_=new StringBuffer();
                          for( int i=0;i<users.length;i++) {
                          concat_.append("user_code="+users[i]+"&");
              %>
                         <input type="hidden" name="user_code" value="<%=users[i]%>">
              <%
                  }
                 concat_.deleteCharAt(concat_.indexOf("&"));
               %>
             <!-- <input type="button" name="Submit2" value="Print" onClick="Start('PRINTREPORT.jsp?<%= concat_.toString() %>')">-->
              <input type="button" name="Submit" value="Graph"  onClick="showGraph()">
              <font size="2" face="MS Sans Serif, Tahoma, sans-serif"></font></div></td>
        </tr>
      </table>
    </div>
      <div align="center">
    <%
      Workload wk=null;
      HashMap hm=null;
      Set s=null;
      Iterator it=null;
      String uname="";
	   int percent_total=0;
      boolean ishead=true;
      long total_amount=0;
      long total_MN=0,total_ME=0,total_ML=0;
      long total_SN=0,total_SE=0,total_SL=0;
      double percent_N=0,percent_E=0,percent_L=0;
      for( int i=0;i<v.size();i++ ){
        hm=(HashMap)v.get(i);
        s=hm.keySet();
        it=s.iterator();
    %>
      <table width="704" border="1" cellpadding="0" cellspacing="0" bordercolor="#000000" bgcolor="#000000" onMouseover="showmenu(event,linkset[0])" onMouseout="delayhidemenu()" >
        <tr bgcolor="#FFFFFF">
          <td width="30" rowspan="2" bgcolor="#CCCCCC" class="bottonc"><div align="center"><strong><font size="1" face="MS Sans Serif, Tahoma, sans-serif">order</font></strong></div></td>
          <td width="131" rowspan="2" bgcolor="#CCCCCC"><div align="center"><strong><font size="1" face="MS Sans Serif, Tahoma, sans-serif">User
              Name</font></strong></div></td>
          <td width="103" rowspan="2" bgcolor="#CCCCCC"><div align="center"><strong><font size="1" face="MS Sans Serif, Tahoma, sans-serif">Workflow
              Name</font></strong></div></td>
          <td width="42" rowspan="2" bgcolor="#CCCCCC"><div align="center"><strong><font size="1" face="MS Sans Serif, Tahoma, sans-serif">Amount</font></strong></div></td>
          <td height="15" colspan="2" bgcolor="#99FF00"><div align="center"><strong><font size="1" face="MS Sans Serif, Tahoma, sans-serif">Normal</font></strong></div></td>
          <td colspan="2" bgcolor="#FFFF00"><div align="center"><strong><font size="1" face="MS Sans Serif, Tahoma, sans-serif">Extension</font></strong></div></td>
          <td colspan="2" bgcolor="#FF0000"><div align="center"><strong><font size="1" face="MS Sans Serif, Tahoma, sans-serif">Late</font></strong></div></td>
        </tr>
        <tr bgcolor="#FFFFFF">
          <td width="59" height="15" bgcolor="#99FF00"><div align="center"><strong><font size="1" face="MS Sans Serif, Tahoma, sans-serif">MyWork</font></strong></div></td>
          <td width="63" bgcolor="#99FF00"><div align="center"><strong><font size="1" face="MS Sans Serif, Tahoma, sans-serif">ShareWork</font></strong></div></td>
          <td width="58" bgcolor="#FFFF00"><div align="center"><strong><font size="1" face="MS Sans Serif, Tahoma, sans-serif">MyWork</font></strong></div></td>
          <td width="64" bgcolor="#FFFF00"><div align="center"><strong><font size="1" face="MS Sans Serif, Tahoma, sans-serif">ShareWork</font></strong></div></td>
          <td width="61" bgcolor="#FF0000"><div align="center"><strong><font size="1" face="MS Sans Serif, Tahoma, sans-serif">MyWork</font></strong></div></td>
          <td width="71" bgcolor="#FF0000"><div align="center"><strong><font size="1" face="MS Sans Serif, Tahoma, sans-serif">ShareWork</font></strong></div></td>
        </tr>
        <%
        total_amount=0;
		total_MN=0;
		total_ME=0;
		total_ML=0;
        total_SN=0;
		total_SE=0;
		total_SL=0;
        while( it.hasNext() ){
        	wk=(Workload)hm.get(it.next());
          	if( !uname.equalsIgnoreCase(wk.getUser_name()) )
            		uname=wk.getUser_name();
		total_amount = total_amount + wk.getTotal();
        total_MN = total_MN + wk.getMyworkNormal();
        total_ME = total_ME + wk.getMyworkExtend();
        total_ML = total_ML + wk.getMyworkLate();
        total_SN = total_SN + wk.getShareworkNormal();
        total_SE = total_SE + wk.getShareworkExtend();
        total_SL = total_SL + wk.getShareworkLate();
        if( ishead ){
        %>
        <tr bgcolor="#FFFFFF">
          <td bgcolor="#F2F2F2"><div align="center"><font size="1" face="MS Sans Serif, Tahoma, sans-serif"><%= i+1 %></font></div></td>
          <td height="15" bgcolor="#F2F2F2"><font size="1" face="MS Sans Serif, Tahoma, sans-serif"><%= uname%></font></td>
          <td bgcolor="#F2F2F2"><div align="left"><font size="1" face="MS Sans Serif, Tahoma, sans-serif"><%= wk.getWf_name()%></font></div></td>
          <td bgcolor="#F2F2F2"><div align="center"><font size="1" face="MS Sans Serif, Tahoma, sans-serif"><%= wk.getTotal()%></font></div></td>
          <td bgcolor="#E8FFF3"><div align="center"><font size="1" face="MS Sans Serif, Tahoma, sans-serif"><%= wk.getMyworkNormal()%></font></div></td>
          <td bgcolor="#E8FFF3"><div align="center"><font size="1" face="MS Sans Serif, Tahoma, sans-serif"><%= wk.getShareworkNormal()%></font></div></td>
          <td bgcolor="#FFFFE6"><div align="center"><font face="MS Sans Serif, Tahoma, sans-serif"><font size="1"><%= wk.getMyworkExtend()%></font></font></div></td>
          <td bgcolor="#FFFFE6"><div align="center"><font face="MS Sans Serif, Tahoma, sans-serif"><font size="1"><%= wk.getShareworkExtend()%></font></font></div></td>
          <td bgcolor="#FFEAEA"><div align="center"><font face="MS Sans Serif, Tahoma, sans-serif"><font size="1"><%= wk.getMyworkLate()%></font></font></div></td>
          <td bgcolor="#FFEAEA"><div align="center"><font face="MS Sans Serif, Tahoma, sans-serif"><font size="1"><%= wk.getShareworkLate()%></font></font></div></td>
        </tr>
        <%
          ishead=false;
        }else{
        %>
        <tr bgcolor="#FFFFFF">
          <td bgcolor="#F2F2F2"><font size="1" face="MS Sans Serif, Tahoma, sans-serif">&nbsp;</font></td>
          <td height="15" bgcolor="#F2F2F2"></td>
          <td bgcolor="#F2F2F2"><div align="left"><font size="1" face="MS Sans Serif, Tahoma, sans-serif"><%= wk.getWf_name()%></font></div></td>
          <td bgcolor="#F2F2F2"><div align="center"><font size="1" face="MS Sans Serif, Tahoma, sans-serif"><%= wk.getTotal()%></font></div></td>
          <td bgcolor="#E8FFF3"><div align="center"><font size="1" face="MS Sans Serif, Tahoma, sans-serif"><%= wk.getMyworkNormal()%></font></div></td>
          <td bgcolor="#E8FFF3"><div align="center"><font size="1" face="MS Sans Serif, Tahoma, sans-serif"><%= wk.getShareworkNormal()%></font></div></td>
          <td bgcolor="#FFFFE6"><div align="center"><font size="1" face="MS Sans Serif, Tahoma, sans-serif"><%= wk.getMyworkExtend()%></font></div></td>
          <td bgcolor="#FFFFE6"><div align="center"><font size="1" face="MS Sans Serif, Tahoma, sans-serif"><%= wk.getShareworkExtend()%></font></div></td>
          <td bgcolor="#FFEAEA"><div align="center"><font size="1" face="MS Sans Serif, Tahoma, sans-serif"><%= wk.getMyworkLate()%></font></div></td>
          <td bgcolor="#FFEAEA"><div align="center"><font size="1" face="MS Sans Serif, Tahoma, sans-serif"><%= wk.getShareworkLate()%></font></div></td>
        </tr>
        <%
          }
        }
        ishead=true;
	    percent_total=100;
        if( total_amount <= 0 ){
          percent_N=0;
          percent_E=0;
          percent_L=0;
		  percent_total=0;
        }else{
			double tmn = total_MN;
			double tsn = total_SN;
          percent_N=((tmn+tsn)*100/total_amount);
		  double tme = total_ME;
		  double tse = total_SE;
          percent_E=((tme+tse)*100/total_amount);
		  double tml = total_ML;
		  double tsl = total_SL;
          percent_L=((total_ML+total_SL)*100/total_amount);
        }
        %>
        <tr bgcolor="#F2F2F2">
          <td height="15" colspan="3" bgcolor="#F2F2F2"><div align="right"><font size="1"><font face="MS Sans Serif, Tahoma, sans-serif">Total</font></font></div></td>
          <td><div align="center"><font size="1" face="MS Sans Serif, Tahoma, sans-serif"><%= total_amount %></font></div></td>
          <td><div align="center"><font color="#000000" size="1" face="MS Sans Serif, Tahoma, sans-serif"><%= total_MN %></font></div></td>
          <td><div align="center"><font color="#000000" size="1" face="MS Sans Serif, Tahoma, sans-serif"><%= total_SN %></font></div></td>
          <td><div align="center"><font color="#000000" face="MS Sans Serif, Tahoma, sans-serif"><font size="1"><%= total_ME%></font></font></div></td>
          <td><div align="center"><font color="#000000" face="MS Sans Serif, Tahoma, sans-serif"><font size="1"><%= total_SE%></font></font></div></td>
          <td><div align="center"><font color="#000000" size="1" face="MS Sans Serif, Tahoma, sans-serif"><%= total_ML%></font></div></td>
          <td><div align="center"><font color="#000000" face="MS Sans Serif, Tahoma, sans-serif"><font size="1"><%= total_SL%></font></font></div></td>
        </tr>
        <tr bgcolor="#CCCCCC">
          <td height="15" colspan="3"><div align="right"><font size="1" face="MS Sans Serif, Tahoma, sans-serif">%Total</font></div></td>
          <td><div align="center"><font size="1" face="MS Sans Serif, Tahoma, sans-serif"><%= percent_total+"%" %></font></div></td>
          <td colspan="2"><div align="center"><font size="1" face="MS Sans Serif, Tahoma, sans-serif"><%= df.format(percent_N) + "%" %></font></div></td>
          <td colspan="2"><div align="center"><font face="MS Sans Serif, Tahoma, sans-serif"><font size="1"><%= df.format(percent_E) + "%" %></font></font></div>
          <div align="center"><font face="MS Sans Serif, Tahoma, sans-serif"></font></div></td>
          <td colspan="2"><div align="center"><font face="MS Sans Serif, Tahoma, sans-serif"><font size="1"><%= df.format(percent_L) + "%" %></font></font></div>
          <div align="center"><font face="MS Sans Serif, Tahoma, sans-serif"></font></div></td>
        </tr>
      </table>
      <br>
      <%
      	}
      %>
    </div>
  
</form>
</div>
<div id="popmenu" class="menuskin" onMouseover="clearhidemenu();highlightmenu(event,'on')" onMouseout="highlightmenu(event,'off');dynamichide(event)"> 
</div>
</body>
</html>