<%@ page contentType="text/html;charset=UTF-8" %>
<%@ page import="java.util.*" %>
<%@ page import="net.sz600.tool.SzConvert" %>
<%@ page import="net.sz600.system.*" %>
<%@ page import="net.sz600.formEngine2.*" %>
<%@ page import="net.sz600.flow.*" %>
<%@ 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>

<%
	int iFormID = SzConvert.toInt(request.getParameter("FormID"));
	int iFrom = SzConvert.toInt(request.getParameter("From"));
    //取得表单的信息
    String moduleName = "";
    String formName = "";
	//根据表单取得moduleName, formName
	LcForm lcForm = new LcForm();
	LcFormInfo lcFormInfo = null;    
    if (iFormID == 0) {
    	moduleName = SzConvert.toSpaceStr(request.getParameter("moduleName"));
    	formName = SzConvert.toSpaceStr(request.getParameter("formName")); 
    	//
    	iFormID = lcForm.getKeyByCond(moduleName, formName); 
    } else {
    	lcFormInfo = (LcFormInfo)lcForm.getInfoByKey(iFormID);    
    	if (lcFormInfo != null) {
    		moduleName = lcFormInfo.getBDLJ();
    		formName = lcFormInfo.getBDBY1();  
    	}
    }    

    BdStatControl statControl = new BdStatControl();
    Iterator iter = statControl.getInfoFromXML(moduleName, formName).iterator();
    /*
    String sUrl = "index.jsp";
    if (iFrom == 2) {
    	sUrl = "index_manage.jsp";
    } 
    */
    String sUrl = "stat.jsp";
%>
<!-----上面的工具栏------>
<%@ include file="title.jsp"%>
<table width="100%">
  <form name="formBar" method="post">
  <input type="hidden" name="FormID" value="<%=iFormID%>"> 
  <input type="hidden" name="From" value="<%=iFrom%>">     
  <tr>
    <td>
      <%=SzPageHelp.button("添加", "javascript:FormSubmit(formList, 'stat_update.jsp?OPERATOR=add&moduleName=" + moduleName + "&formName=" +formName + "&From=" + iFrom + "');")%>
      <%=SzPageHelp.button("返回","javascript:FormSubmit(formBar, '" + sUrl + "');") %>    
    </td>
  </tr>
  </form>
</table>

<!-----信息列表----->
<table width="100%" border="1" bordercolorlight="#C0C0C0" bordercolordark="#FFFFFF" class="tableClass" cellpadding="1" cellspacing="0">
  <form name="formList" method="post" >

  <tr class="trClassTitle">
    <td>名称</td>
    <td>统计的字段</td>
    <td>分组的字段</td>
    <td width="40">操作</td>
  </tr>
<%
    String id = ""; 
    String s[] = null;
    int i = 0;
    BdFormControl bdFormControl = new BdFormControl();
    while (iter != null && iter.hasNext()) {
    	s = (String[])iter.next();
    	if (s == null) {
    		continue;
    	}
    	id = s[0];
    	i++;
%>
  <tr>
    <td><%=s[3]%>&nbsp;</td>
    <td><%=bdFormControl.getFieldDescByName(iFormID, s[5]) %>&nbsp;</td>
    <td><%=s[6]%>&nbsp;</td>
    <td>
      <a href="stat_update.jsp?OPERATOR=update&id=<%=id%>&moduleName=<%=moduleName %>&formName=<%=formName %>&From=<%=iFrom %>">修改</a>    
      <a href="stat_control.jsp?OPERATOR=delete&id=<%=id%>&moduleName=<%=moduleName %>&formName=<%=formName %>&From=<%=iFrom %>">删除</a>&nbsp;
    </td>
  </tr>
<%
    }
    out.println(SzPageHelp.outIndexTableTr(i, SzProperties.I_PageSize, 4));
%>
  </form>
</table>

<!-----下面的工具栏------>
<table width="100%" cellpadding="1" cellspacing="0">
  <form name="formPage" method="post">
  <tr>
    <td align="right">
      &nbsp;
    </td>
  </tr>
  </form>
</table>

<!-----这里包含要提交的内容--->
<form name="formHidden" method="post">
</form>
<script language="javascript" src="../../share/js/commonTool.js"></script>
