<%@ page contentType="text/html;charset=UTF-8" %>
<%@ page import="java.util.*" %>
<%@ page import="net.sz600.basicdata.*" %>
<%@ page import="net.sz600.tool.SzConvert" %>
<%@ page import="net.sz600.tool.SzDateHelp" %>
<%@ page import="net.sz600.organize.*" %>
<%@ page import="net.sz600.database.SzPageInfo" %>
<%@ page import="net.sz600.system.SzProperties" %>
<%@ page import="net.sz600.system.SzLevelNumber" %>
<%@ page import="net.sz600.system.SzPageHelp" %>
<%@ page import="net.sz600.flow.*" %>
<%@ page import="net.sz600.formEngine2.*" %>
<%@ include file="/sessionInfo.jsp"%>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link href="<%=strSkin_SESSION%>/css2007.css" rel="stylesheet" type="text/css">
</head>
<%@ include file="/share/title.jsp"%>
<%
  int iFormID = SzConvert.toInt(request.getParameter("FormID"));
	String condValue = SzConvert.toSpaceStr(request.getParameter("condValue"));
	String sBegin = "";
	String sEnd = "";
	/*
	BdFormControl formControl = new BdFormControl();
    String assistant = formControl.getAssistant(iFormID);  
    boolean bStatDepart = false;
		if ((";" + assistant + ";").indexOf(";8;") >=0) {
			bStatDepart = true;
		}    
    if (!bStatDepart) {
    		out.println("本模块没有此功能");
    		out.println(SzPageHelp.backButton());
    		return;
    }
  */
	String sBMMC = SzConvert.strWriteData(request.getParameter("BMMC"));
	String sDLXM = SzConvert.strWriteData(request.getParameter("DLXM"));
	String sSearchBegin = SzConvert.strWriteData(request.getParameter("txtSearchBegin"));	
%>
<%
	BdMonthStat monthStat = new BdMonthStat(iFormID);
	BdFormControl formControl = new BdFormControl();
  String strDate = SzDateHelp.getDateStr();
  if (!sSearchBegin.equals("")) {
	  strDate = sSearchBegin;
  }
	ArrayList list = monthStat.getUserMonthStat(request, isBarManager_SESSION, iDLID_SESSION, strDate,0, 0);
	Iterator iter = list.iterator();
	String s[] = null;
	String title = formControl.getFormDesc(iFormID);
	if (!condValue.equals("")) {
		title += "(" + condValue + ")";
	}	
%><br>
<table border="0" align="center">
<form method="post" name="form" action="stat_month_user.jsp">
  <input type="hidden" name="FormID" value="<%=iFormID%>">
  <tr><td><font size=4><b><%=title %>&nbsp;<%=SzConvert.format(strDate, "cm")%>个人统计表</b></font></td></tr>
  <tr><td>
  部门<input type="text" name="BMMC" class="txtClassSearch" value="<%=sBMMC %>">
  姓名<input type="text" name="DLXM" class="txtClassSearch" value="<%=sDLXM %>">
  月份<input type="text" name="txtSearchBegin" class="txtClassSearch" readonly  value="<%=strDate %>">
  <%=SzPageHelp.calendar2Select("../../","form.txtSearchBegin")%>
  <%=SzPageHelp.button("查询", "javascript:this.form.submit();")%>  
  </td></tr>
</form>  
</table>
<table width="100%" border="1" bordercolorlight="#C0C0C0" bordercolordark="#FFFFFF" class="tableClass" cellpadding="1" cellspacing="0">
<tr class="trClassTitle_c">
	<td>部门</td>
  <td>姓名</td>
  <%
		if (!monthStat.shiji.equals("")	) {
  		out.println("<td>");
  		out.println(monthStat.shiji);
  		out.println("</td>");
  	}  
  	if (!monthStat.yusuan.equals("")	) {
  		out.println("<td>");
  		out.println(monthStat.yusuan);
  		out.println("</td>");
  	}
  	if (!monthStat.tongqi.equals("")	) {
  		out.println("<td>");
  		out.println(monthStat.tongqi);
  		out.println("</td>");
  	}  
  	if (!monthStat.shangyue.equals("")	) {
  		out.println("<td>");
  		out.println(monthStat.shangyue);
  		out.println("</td>");
  	}  
  	if (!monthStat.limit.equals("")	 && monthStat.limitType.equals("0")) {
  		out.println("<td>");
  		out.println(monthStat.limit);
  		out.println("</td>");
  	}   	
  	if (!monthStat.yusuan2.equals("")	) {
  		out.println("<td>");
  		out.println(monthStat.yusuan2);
  		out.println("</td>");
  	}
  	if (!monthStat.tongqi2.equals("")	) {
  		out.println("<td>");
  		out.println(monthStat.tongqi2);
  		out.println("</td>");
  	}  
  	if (!monthStat.shangyue2.equals("")	) {
  		out.println("<td>");
  		out.println(monthStat.shangyue2);
  		out.println("</td>");
  	}  
  	if (!monthStat.limit2.equals("")	 && monthStat.limitType.equals("0")) {
  		out.println("<td>");
  		out.println(monthStat.limit2);
  		out.println("</td>");
  	  out.println("<td>预警</td>");  		
  	}    	
  %>
    
</tr>
<%  
  while (iter != null && iter.hasNext()) {
		s = (String[])iter.next();
		if (s == null) {
			continue;
		}
	
		if (s[2].equals("合计")) {
			s[0] = "";
			out.println("<tr class='trClassTitle2'>");
		} else {
			out.println("<tr>");
			s[0] = SzUserHelp.getDepartName(s[0]);
		}
%>
  <td align="center"><%=s[0]%>&nbsp;</td>
  <td align="center"><%=s[2] %>&nbsp;</td>
  <%
		if (!monthStat.shiji.equals("")	) {
  		out.println("<td align='center'>");
  		out.println(s[3]);
  		out.println("&nbsp;</td>");
  	}  
  	if (!monthStat.yusuan.equals("")	) {
  		out.println("<td align='center'>");
  		out.println(s[4]);
  		out.println("&nbsp;</td>");
  	}
  	if (!monthStat.tongqi.equals("")	) {
  		out.println("<td align='center'>");
  		out.println(s[5]);
  		out.println("&nbsp;</td>");
  	}  
  	if (!monthStat.shangyue.equals("")	) {
  		out.println("<td align='center'>");
  		out.println(s[6]);
  		out.println("&nbsp;</td>");
  	}  
  	if (!monthStat.limit.equals("")	 && monthStat.limitType.equals("0")) {
  		out.println("<td align='center'>");
  		out.println(s[7]);
  		out.println("&nbsp;</td>");
  	}   	
  	if (!monthStat.yusuan2.equals("")	) {
  		out.println("<td align='center'>");
  		out.println(s[8]);
  		out.println("%&nbsp;</td>");
  	}
  	if (!monthStat.tongqi2.equals("")	) {
  		out.println("<td align='center'>");
  		out.println(s[9]);
  		out.println("%&nbsp;</td>");
  	}  
  	if (!monthStat.shangyue2.equals("")	) {
  		out.println("<td align='center'>");
  		out.println(s[10]);
  		out.println("%&nbsp;</td>");
  	}  
  	if (!monthStat.limit2.equals("")	 && monthStat.limitType.equals("0")) {
  		out.println("<td align='center'>");
  		out.println(s[11]);
  		out.println("%&nbsp;</td>");
  		
  		out.println("<td align='center'>");
  	  if ( Double.parseDouble(s[11]) > 50) {  		
  	  		out.println("<img src='../../images/skin1/bar/bar_6.gif' width='10'>");
  	  } else if ( Double.parseDouble(s[11]) > 0) {  
  	  		out.println("<img src='../../images/skin1/bar/bar_2.gif' width='10'>");
  	  } else {
  	  		out.println("&nbsp;");
  	  }  		
  	  out.println("</td>");
  	}      	
  %>  
  </td>
</tr>
<%
  }
%>
<%
    ////如果要使用日历控件，必须输出这个calendarFrame
    out.println(SzPageHelp.calendar2Frame("../../"));
%>
