<%@ page contentType="text/html;charset=gbk" %>
<%@ 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=GBK">
<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 = "";
	String sBMMC = SzConvert.strWriteData(request.getParameter("BMMC"));
	String sDLXM = SzConvert.strWriteData(request.getParameter("DLXM"));
	String sSearchBegin = SzConvert.strWriteData(request.getParameter("txtSearchBegin"));
%>
<%

	BdFormControl formControl = new BdFormControl();
	String strDate = SzDateHelp.getDateStr();
	if (!sSearchBegin.equals("")) {
		  strDate = sSearchBegin;
	}	
	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_qingjia.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 %>">
  <%=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 rowspan="2">部门</td>
  <td rowspan="2">姓名</td>
  
  <td colspan="8">当年累计请休假情况</td>
	<td colspan="3">当年加班调休情况</td>    
</tr>
<tr class="trClassTitle_c">

  <td>事假</td>
  <td>病假</td>
  <td>年假</td>
  <td>陪产假</td>
  <td>产假</td>
  <td>婚假</td>
  <td>丧假</td>
  <td>其他</td>
  
  
  <td>累计加班</td>
  <td>已调休</td>
  <td>剩余可调休(30天内)</td>  
    
</tr>
<%  
	BdMonthStat monthStat = new BdMonthStat(iFormID);
	BdOtherControl otherControl = new BdOtherControl(); 


	//取得用户
	ArrayList loginList = SzUserHelp.getUserStaticList();
	Iterator iter = loginList.iterator();
	SzLoginInfo loginInfo = null; 
	
	//今年累计事假
	monthStat = new BdMonthStat(iFormID, "事假");
	Map mapSJ = monthStat.statAll(strDate, 0, 0, 1);

	monthStat = new BdMonthStat(iFormID, "病假");
	Map mapBJ = monthStat.statAll(strDate, 0, 0, 1);
	
	monthStat = new BdMonthStat(iFormID, "年假");
	Map mapNJ = monthStat.statAll(strDate, 0, 0, 1);	
	
	monthStat = new BdMonthStat(iFormID, "陪产假");
	Map mapPCJ = monthStat.statAll(strDate, 0, 0, 1);	
	monthStat = new BdMonthStat(iFormID, "产假");
	Map mapCJ = monthStat.statAll(strDate, 0, 0, 1);	
	monthStat = new BdMonthStat(iFormID, "婚假");
	Map mapHJ = monthStat.statAll(strDate, 0, 0, 1);	
	monthStat = new BdMonthStat(iFormID, "丧假");
	Map mapSANJ = monthStat.statAll(strDate, 0, 0, 1);	
	monthStat = new BdMonthStat(iFormID, "其他");
	Map mapQT = monthStat.statAll(strDate, 0, 0, 1);	
	
	String sj = "";		//事假
	String bj = "";		//病假
	String nj = "";		//年假
	String pcj = "";	//陪产假
	String cj = "";		//产假
	String hj = "";		//婚假
	String sanj = "";	//丧假
	String qt = "";		//其他
	
	
	Map mapJB = otherControl.statAllJiaban(1347, strDate, 0, 0, 1);
	Map mapYX = otherControl.statAllJiaban(1347, strDate, 0, 1, 1);
	Map mapKX = otherControl.statAllJiaban(1347, strDate, 0, 2, 1);
	String jb = ""; //加班
	String yx = "";	//已休
	String kx = "";	//可休
	
	Integer intBMID = null;
	String strManageDepartID = "";
	if (!isBarManager_SESSION) {
		SzUserHelp szUserHelp = new SzUserHelp(); 
		strManageDepartID = "," + szUserHelp.getManageDepartID(iDLID_SESSION) + ",";
	}	
  while (iter != null && iter.hasNext()) {	  
	  loginInfo = (SzLoginInfo)iter.next();
	  intBMID = new Integer(loginInfo.getDLID() );
		//根据权限查询
		if (!isBarManager_SESSION && loginInfo.getDLID() != iDLID_SESSION) {
			//非管理员，只能查询部门内的
			if (strManageDepartID.indexOf("," + loginInfo.getDLBM() + ",") == -1) {
		    continue;
			}
		} 
		//System.out.println(sBMMC + "==" + sDLXM);
		// 是否有限制条件
		if (!sBMMC.equals("") && !sBMMC.equals(SzUserHelp.getDepartName(loginInfo.getDLBM()))) {
				continue;
		}
		if (!sDLXM.equals("") && !sDLXM.equals(loginInfo.getDLXM())) {
				continue;
		}	  
	  
	  sj = SzConvert.toSpaceStr(mapSJ.get(intBMID));
	  bj = SzConvert.toSpaceStr(mapBJ.get(intBMID));
	  nj = SzConvert.toSpaceStr(mapNJ.get(intBMID));
	  pcj = SzConvert.toSpaceStr(mapPCJ.get(intBMID));
	  cj = SzConvert.toSpaceStr(mapCJ.get(intBMID));
	  hj = SzConvert.toSpaceStr(mapHJ.get(intBMID));
	  sanj = SzConvert.toSpaceStr(mapSANJ.get(intBMID));
	  qt = SzConvert.toSpaceStr(mapQT.get(intBMID));
	  jb = SzConvert.toZeroStr(mapJB.get(intBMID));
	  yx = SzConvert.toZeroStr(mapYX.get(intBMID));
	  kx = SzConvert.toZeroStr(mapKX.get(intBMID));

%>
  <td align="center"><%=SzUserHelp.getDepartName(loginInfo.getDLBM()) %>&nbsp;</td>
  <td align="center"><%=loginInfo.getDLXM() %>&nbsp;</td>
  <td align="center"><%=SzConvert.hToDay(SzConvert.toDouble(sj))%>&nbsp;</td>
  <td align="center"><%=SzConvert.hToDay(SzConvert.toDouble(bj))%>&nbsp;</td>
  <td align="center"><%=SzConvert.hToDay(SzConvert.toDouble(nj))%>&nbsp;</td>
  <td align="center"><%=SzConvert.hToDay(SzConvert.toDouble(pcj))%>&nbsp;</td>
  <td align="center"><%=SzConvert.hToDay(SzConvert.toDouble(cj))%>&nbsp;</td>
  <td align="center"><%=SzConvert.hToDay(SzConvert.toDouble(hj))%>&nbsp;</td>
  <td align="center"><%=SzConvert.hToDay(SzConvert.toDouble(sanj))%>&nbsp;</td>
  <td align="center"><%=SzConvert.hToDay(SzConvert.toDouble(qt))%>&nbsp;</td>
  <td align="center"><%=jb %>天&nbsp;</td>
  <td align="center"><%=yx %>天&nbsp;</td>
  <td align="center"><%=kx %>天&nbsp;</td>
</tr>
<%
  }
%>
<%
    ////如果要使用日历控件，必须输出这个calendarFrame
    out.println(SzPageHelp.calendar2Frame("../../"));
%>
