<%@ page contentType="text/html;charset=UTF-8" %>
<%@ page import="java.util.Iterator" %>
<%@ page import="java.util.Map" %>
<%@ page import="java.util.ArrayList" %>
<%@ page import="java.util.Collection" %>
<%@ page import="net.sz600.tool.SzConvert" %>
<%@ page import="net.sz600.database.SzPageInfo" %>
<%@ page import="net.sz600.system.SzProperties" %>
<%@ page import="net.sz600.system.SzPageHelp" %>
<%@ page import="net.sz600.system.SzLevelNumber" %>
<%@ page import="net.sz600.organize.*" %>
<%@ include file="/sessionInfo.jsp"%>
<html>
<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">
<SCRIPT src="../share/js/ftiens4_tree.js"></SCRIPT>
</head>
<body>
<%@ include file="/share/title.jsp" %>
<%

    //读取部门
    SzUserHelp szUserHelp = new SzUserHelp();
    Collection collDepart = szUserHelp.getDepartStaticList(szCOMPANY_SESSION);
    Iterator iter = null;
    if (collDepart != null) {
	iter = collDepart.iterator();
    }
    SzDepartInfo szDepartInfo = new SzDepartInfo();

    //取得员工
    Map mapUser = SzUserHelp.getUserStaticMap();
    ArrayList arrayList = null;
    Iterator iterUser = null;
    SzUserHelpInfo info = null;

    String sUserInfo = "";
    int i = 0;
    boolean flag = true;
%>
<table width=100% border="0" cellpadding=0 cellspacing=0>
  <tr>
    <td align="center" width="33">
    <td width="751" colspan="2" align="center"><p align="left">
      <!--名字，连接，定位的页面，图片---->
      <SCRIPT>
        USETEXTLINKS = 1
        level_0 = gFld("<b>组织结构</b>", "","","images/skin1/menu/asset.gif")
<%
    String sBMBH = "";
    String sBMBH_SJ = "";
    String sBMMC = "";
    int iBMID = 0;
    while (flag) {
        if (iter.hasNext()) {
            szDepartInfo = (SzDepartInfo)iter.next();
            iBMID = szDepartInfo.getBMID();
            sBMBH = szDepartInfo.getBMBH();
            sBMBH_SJ = SzConvert.toZeroStr(SzLevelNumber.getParentNumber(sBMBH));
            sBMMC = szDepartInfo.getBMMC();
%>
            level_<%=sBMBH%> = insFld(level_<%=sBMBH_SJ%>, gFld("<b><%=sBMMC%></b>", "","","images/skin1/menu/asset.gif"))
<%
        } else {
            flag = false;
            iBMID = 0;
            sBMBH = "0";
        } //if else ends


        //根据部门ID读取下面的员工
        //arrayList = (ArrayList)mapUser.get(new Integer(iBMID));
        arrayList = (ArrayList)mapUser.get(new String(szCOMPANY_SESSION + "-" + iBMID));
        if (arrayList == null) {
           continue;
        }
        iterUser = arrayList.iterator();
        while (iterUser.hasNext()) {
            info = (SzUserHelpInfo)iterUser.next();
            sUserInfo = info.getUserInfo();
            i++;
%>
            level_<%=sBMBH%>0<%=i%> = insFld(level_<%=sBMBH%>, gFld("<%=sUserInfo%>", "","","images/skin1/menu/asset.gif"))
<%
        }
    } //while (flag) ends
    mapUser = null;
    arrayList = null;
%>
      </SCRIPT>
<SCRIPT>
    initializeDocument();
</SCRIPT>
    </td>
  </tr>
</table>
</body>

