<%@ page contentType="text/html;charset=gbk" %>
<%@ page import="java.util.Iterator" %>
<%@ page import="net.sz600.basicdata.*" %>
<%@ page import="net.sz600.tool.SzConvert" %>
<%@ 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.*" %>
<%@ 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>
<%
    //获取提交的参数
    String sType = SzConvert.toZeroStr(request.getParameter("type"));
    String sPKEY = SzConvert.toZeroStr(request.getParameter("PKEY"));
    String sPage = SzConvert.toZeroStr(request.getParameter("page"));
    String sSearch = SzConvert.strWriteData(request.getParameter("txtSearch"));
    String sSearchName = SzConvert.strWriteData(request.getParameter("txtSearchName"));
    String FLSYBD = SzConvert.toZeroStr(request.getParameter("FLSYBD"));

    String sTable_type = "";
    //读取数据
    LcType lcType = new LcType();
    LcTypeInfo lcTypeInfo = null;
    String sCond = "1=1";
    boolean canAdd_SESSION = false; 
    boolean canPrint_SESSION = false; 
    boolean canDelete_SESSION = false; 
    boolean canUpdate_SESSION = false; 
    //管理资料，只有管理员和有权限的人才能添加。有权限的人员可以查看、修改、删除 
    if (isBarManager_SESSION) { 
        canAdd_SESSION = true; 
        canPrint_SESSION = true; 
        canDelete_SESSION = true; 
        canUpdate_SESSION = true; 
    } 
 
    if (!sPKEY.equals("0")) {
        sCond += "";
    }
    if (!FLSYBD.equals("0")) { 
        sCond += " and FLSYBD =" + FLSYBD;
    } 
    String sSortField = SzConvert.toSpaceStr(request.getParameter("txtSortField")); 
    int iSortOrder    = Integer.parseInt(SzConvert.toZeroStr(request.getParameter("txtSortOrder"))); 
    if (sSortField.equals("")) { 
    sSortField = "FLBH";
    iSortOrder = SzProperties.I_SortOrder_ASC;
    } 
    int iCurrentPage = 1;
    try {
        iCurrentPage =  Integer.parseInt(sPage);
    }catch(Exception e) {
    }

    Iterator iter = lcType.getArrayList(sCond, sSortField, iSortOrder, iCurrentPage, sSearch).iterator();

    SzPageInfo pageInfo = lcType.getPageInfo();
    int iPageCount = pageInfo.getPageCount();
    int iRecordCount = pageInfo.getRecordCount();
    iCurrentPage = pageInfo.getCurrentPage();
    int i = 0;
    SzData szData = null;  
%>
<!-----上面的工具栏------>
<%@ include file="/flow/title.jsp"%>
<table width="100%">
  <form name="formBar" method="post">
  <input type="hidden" name="page" value="<%=sPage%>">
  <input type="hidden" name="type" value="<%=sType%>">
  <input type="hidden" name="txtSearch" value="<%=sSearch%>">
  <input type="hidden" name="txtSortField" value="<%=sSortField%>"> 
  <input type="hidden" name="txtSortOrder" value="<%=iSortOrder%>"> 
  <tr>
    <td>
    <% out.println(SzPageHelp.addButtonSubmit(canAdd_SESSION)); %> 
    <% out.println(SzPageHelp.deleteButton(canDelete_SESSION)); %>
 
      
    </td>
  </tr>
  </form>
</table>

<!-----信息列表----->
<table width="100%" border="1" bordercolorlight="#C0C0C0" bordercolordark="#FFFFFF" class="tableClass" cellpadding="1" cellspacing="0">
  <form name="formList" method="post">
  <input type="hidden" name="page" value="<%=iCurrentPage%>">
  <input type="hidden" name="txtSearch" value="<%=sSearch%>">
  <input type="hidden" name="type" value="<%=sType%>">
  <input type="hidden" name="txtSortField" value="<%=sSortField%>"> 
  <input type="hidden" name="txtSortOrder" value="<%=iSortOrder%>"> 
  <tr class="trClassTitle">
    <td width="5"><input type="checkbox" name="chkCheckAll" OnClick="javascript:CheckAll(formList, chkCheckAll, 'chkId');"></td>
    <td ><%=SzPageHelp.sortTitle("分类名称", "FLMC", sSortField, iSortOrder)%></td>
    <td width="100"><%=SzPageHelp.sortTitle("录入人员", "FLDLXM", sSortField, iSortOrder)%></td>
    <td width="100"><%=SzPageHelp.sortTitle("录入时间", "FLSJ", sSortField, iSortOrder)%></td>
    <td>操作</td>
  </tr>
<%
    while (iter != null && iter.hasNext()) {
        lcTypeInfo = (LcTypeInfo)iter.next();
        i++;
%>
  <tr>
    <td width="5" title="<%=i%>"><input type="checkbox" name="chkId" id="chkId" value="<%=lcTypeInfo.getFLBH()%>"></td>
    <td><%=SzLevelNumber.getLevelSpace(lcTypeInfo.getFLBH())%><%=lcTypeInfo.getFLMC()%>&nbsp;</td>
    <td><%=lcTypeInfo.getFLDLXM()%>&nbsp;</td>
    <td><%=lcTypeInfo.getFLSJ()%>&nbsp;</td>
    <td>
      <a href="javascript:FormSubmit(formPage,'update.jsp?OPERATOR=detail&type=<%=sType%>&KEY=<%=lcTypeInfo.getFLID()%>');">详情</a>
      <% out.println( SzPageHelp.updateButton(sType, lcTypeInfo.getFLID(), canUpdate_SESSION) );%> 
    </td>
  </tr>
<%
    }
    out.println(SzPageHelp.outIndexTableTr(i, SzProperties.I_PageSize, 5));
%>

  </form>
</table>

<!-----下面的工具栏------>
<table width="100%">
  <form name="formPage" method="post">
  <input type="hidden" name="type" value="<%=sType%>">
  <input type="hidden" name="txtSearchName" value="<%=sSearchName%>">
  <input type="hidden" name="txtSortField" value="<%=sSortField%>"> 
  <input type="hidden" name="txtSortOrder" value="<%=iSortOrder%>"> 
  <tr>
    <td align="right">
      <%@ include file="/share/page/page_include.jsp"%>
    </td>
  </tr>
  </form>
</table>

<!-----这里包含要提交的内容--->
<form name="formHidden" method="post">
  <input type="hidden" name="type" value="<%=sType%>">
  <input type="hidden" name="page" value="<%=iCurrentPage%>">
  <input type="hidden" name="txtSearch" value="<%=sSearch%>">
  <input type="hidden" name="txtSortField" value="<%=sSortField%>"> 
  <input type="hidden" name="txtSortOrder" value="<%=iSortOrder%>"> 
</form>
<script language="javascript" src="../../share/js/commonTool.js"></script>
