<%@ page contentType="text/html;charset=gbk" %>
<%@ page import="net.sz600.tool.SzConvert" %>
<%@ page import="net.sz600.tool.SzDateHelp" %>
<%@ page import="net.sz600.organize.*" %>
<%@ page import="net.sz600.system.*" %>
<%@ page import="java.util.*" %>
<%@ include file="/sessionInfo.jsp"%>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=GBK">
<link href="../../images/skin_blue2/css2007.css" rel="stylesheet" type="text/css">
</head>
<%
	//查询时间段
	int iGSID = SzConvert.toInt(request.getParameter("DLGSID"));
    String sType = SzConvert.toZeroStr(request.getParameter("type")); 
    if (sType.equals("0")) {
    	sType = "1";
    }
    
    SzLogStat logStat = new SzLogStat();
    Map companyLog = logStat.stat(sType);
    Map userLog = null;
    Iterator iterLog = null;
    String s[] = null;
    
	String sSearchBegin = logStat.getBegin();
	String sSearchEnd =  logStat.getEnd();
%>
<br>
<table width="100%" border="1" bordercolorlight="#C0C0C0" bordercolordark="#FFFFFF" class="tableClass" cellpadding="1" cellspacing="0">

<form action="logStat.jsp" method="post" name="form">
     <input type="hidden" name="type">

     <%=SzPageHelp.button("当天","javascript:Set(1);") %>     
     <%=SzPageHelp.button("本周","javascript:Set(2);") %>     
     <%=SzPageHelp.button("本月","javascript:Set(3);") %>
     &nbsp;
     <%=SzPageHelp.button("昨天","javascript:Set(4);") %>
     <%=SzPageHelp.button("上周","javascript:Set(5);") %>
     <%=SzPageHelp.button("上月","javascript:Set(6);") %>
      
      开始日期<input type="text" name="txtSearchBegin" class="txtClassSearch" value="<%=sSearchBegin%>" readonly>
      结束日期<input type="text" name="txtSearchEnd" class="txtClassSearch" value="<%=sSearchEnd%>" readonly>   
      
     <%=SzPageHelp.idSelectTreeSubmit("SZXT_JTGS","GSID","GSMC","GSBH", "DLGSID", iGSID, "txtClass250")%>    
</form>
<script language="javascript">
  function Set(v) {
      form.type.value=v;
      form.submit();
  }
</script>


  <tr class="trClassTitle">
    <td>公司名称</td>
    <td>登陆帐号</td>
    <td>登陆次数</td>
    <td>登陆IP数量</td>
    <td>尝试登陆次数</td>
    <td>尝试登陆IP数量</td>    
    <td>其他操作次数</td>
    <td>其他操作IP数量</td>
  </tr>
<%

    //所有公司
    Map companyMap = SzUserHelp.getCompanyStaticMap();
	Iterator iterCompany = companyMap.keySet().iterator();

    int i =0;
    int iDLID = 0;
    int iCompany = 0;

    Integer intGSID = null;
    String sCompany_name = "";
    boolean flag = true;
    while (flag && iterCompany.hasNext()) {
    	if (intGSID == null) {
    		intGSID = new Integer("0");
    		sCompany_name = "集团设置";
    	} else if (iterCompany.hasNext()) {
	    	intGSID = (Integer)iterCompany.next();	    
	    	//公司名称
	    	sCompany_name = (String)SzUserHelp.getCompanyName(intGSID);
	    	if (iGSID >0 && intGSID.intValue() != iGSID) {
	    		continue;
	    	}
    	} else {
    		flag = false;	
    	}
    	
	    //统计这个公司的操作数据
	    userLog = (Map)companyLog.get(intGSID.toString());
	    if (userLog == null) {
	    	//System.out.println("null");
	    	continue;
	    }
	    //遍历
	    //System.out.println(userLog.values());
	    iterLog = userLog.values().iterator();
	    while (iterLog != null && iterLog.hasNext()) {
	    	s = (String[])iterLog.next();

%>
  <tr>
    <td>&nbsp;<%=sCompany_name %></td>
    <td align="center"><%=s[0]%>&nbsp;</td>
    <td align="center"><%=s[1]%>&nbsp;</td>
    <td align="center"><%=s[2]%>&nbsp;</td>
    <td align="center"><%=s[3]%>&nbsp;</td>
    <td align="center"><%=s[4]%>&nbsp;</td>
    <td align="center"><%=s[5]%>&nbsp;</td>
    <td align="center"><%=s[6]%>&nbsp;</td>
  </tr>
<%		
	    }
    }
%>	
</table>