product_list.jsp
上传用户:jhtang88
上传日期:2014-01-27
资源大小:28528k
文件大小:8k
源码类别:

Jsp/Servlet

开发平台:

Java

  1. <%@ page contentType="text/html; charset=utf-8"%>
  2. <%@ page import = "java.util.*"%>
  3. <%@ page import = "cn.js.fan.db.*"%>
  4. <%@ page import = "cn.js.fan.web.*"%>
  5. <%@ page import = "cn.js.fan.util.*"%>
  6. <%@ page import = "com.redmoon.oa.visual.*"%>
  7. <%@ page import = "com.redmoon.oa.flow.FormDb"%>
  8. <%@ page import = "com.redmoon.oa.flow.FormField"%>
  9. <jsp:useBean id="privilege" scope="page" class="com.redmoon.oa.pvg.Privilege"/>
  10. <%
  11. String priv = "sales.product";
  12. if (!privilege.isUserPrivValid(request, priv))
  13. {
  14. out.println(cn.js.fan.web.SkinUtil.makeErrMsg(request, cn.js.fan.web.SkinUtil.LoadString(request, "pvg_invalid")));
  15. return;
  16. }
  17. String op = ParamUtil.get(request, "op");
  18. String formCode = "sales_product_info";
  19. String querystr = "";
  20. FormDb fd = new FormDb();
  21. fd = fd.getFormDb(formCode);
  22. %>
  23. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  24. <html>
  25. <head>
  26. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  27. <title><%=fd.getName()%>列表</title>
  28. <link href="../common.css" rel="stylesheet" type="text/css">
  29. <%@ include file="../inc/nocache.jsp"%>
  30. <script src="<%=Global.getRootPath()%>/inc/flow_dispose_js.jsp"></script>
  31. <script src="<%=Global.getRootPath()%>/inc/flow_js.jsp"></script>
  32. </head>
  33. <body background="" leftmargin="0" topmargin="5" marginwidth="0" marginheight="0">
  34. <%@ include file="product_inc_menu_top.jsp"%>
  35. <%
  36. String sql = "select id from " + fd.getTableNameByForm();
  37. String query = ParamUtil.get(request, "query");
  38. if (!query.equals(""))
  39. sql = query;
  40. else
  41. if (op.equals("search")) {
  42. Iterator ir = fd.getFields().iterator();
  43. String cond = "";
  44. while (ir.hasNext()) {
  45. FormField ff = (FormField)ir.next();
  46. String value = ParamUtil.get(request, ff.getName());
  47. String name_cond = ParamUtil.get(request, ff.getName() + "_cond");
  48. if (ff.getType().equals(ff.TYPE_DATE) || ff.getType().equals(ff.TYPE_DATE_TIME)) {
  49. String fDate = ParamUtil.get(request, ff.getName() + "FromDate");
  50. String tDate = ParamUtil.get(request, ff.getName() + "ToDate");
  51. if (!fDate.equals("")) {
  52. if (cond.equals(""))
  53. cond += ff.getName() + ">=" + StrUtil.sqlstr(fDate);
  54. else
  55. cond += " and " + ff.getName() + ">=" + StrUtil.sqlstr(fDate);
  56. }
  57. if (!tDate.equals("")) {
  58. if (cond.equals(""))
  59. cond += ff.getName() + "<=" + StrUtil.sqlstr(tDate);
  60. else
  61. cond += " and " + ff.getName() + "<=" + StrUtil.sqlstr(tDate);
  62. }
  63. }
  64. else {
  65. if (name_cond.equals("0")) {
  66. if (!value.equals("")) {
  67. if (cond.equals(""))
  68. cond += ff.getName() + " like " + StrUtil.sqlstr("%" + value + "%");
  69. else
  70. cond += " and " + ff.getName() + " like " + StrUtil.sqlstr("%" + value + "%");
  71. }
  72. }
  73. else if (name_cond.equals("1")) {
  74. if (!value.equals("")) {
  75. if (cond.equals(""))
  76. cond += ff.getName() + "=" + StrUtil.sqlstr(value);
  77. else
  78. cond += " and " + ff.getName() + "=" + StrUtil.sqlstr(value);
  79. }
  80. }
  81. }
  82. }
  83. if (!cond.equals(""))
  84. sql = sql + " where " + cond;
  85. }
  86. querystr = "query=" + StrUtil.UrlEncode(sql);
  87. %>
  88. <table width="49%" border="0" align="center" cellpadding="2" cellSpacing="0" class="tableframe">
  89.   <form id="form2" name="form2" action="?op=search" method="post">
  90.     <tbody>
  91.       <tr>
  92.         <td noWrap colSpan="3">
  93.           <table cellSpacing="0" cellPadding="2" width="100%" border="0">
  94.             <tbody>
  95.               <tr>
  96.                 <td colSpan="3" bgcolor="#C4DAFF"><b>产品查询</b></td>
  97.               </tr>
  98.               <tr>
  99.                 <td width="29%">供应商:</td>
  100.                 <td noWrap width="19%"><select name="provider_cond">
  101.                     <option value="1" selected>等于</option>
  102.                   </select></td>
  103.                 <td width="52%"><input name="provider" size="20"></td>
  104.               </tr>
  105.               <tr>
  106.                 <td width="29%">产品名称:</td>
  107.                 <td noWrap width="19%"><select name="product_name_cond">
  108.                     <option value="1">等于</option>
  109.                     <option value="0" selected>包含</option>
  110.                   </select></td>
  111.                 <td width="52%"><input name="product_name" size="20"></td>
  112.               </tr>
  113.               <tr>
  114.                 <td width="29%">产品类别:</td>
  115.                 <td noWrap width="19%"><select name="product_mode_cond">
  116.                     <option value="0" selected>包含</option>
  117.                     <option value="1">等于</option>
  118.                   </select></td>
  119.                 <td width="52%"><input name="product_mode" size="20"></td>
  120.               </tr>
  121.             </tbody>
  122.           </table>
  123.         </td>
  124.       </tr>
  125.       <tr align="middle">
  126.         <td noWrap align="center" colSpan="3" height="30"><input class="BigButton"  type="submit" value="查  询" name="submit"> 
  127.         &nbsp;&nbsp;&nbsp;&nbsp;</td>
  128.       </tr>
  129.       <tr>
  130.         <td width="684">
  131.       </tr>
  132.     </tbody>
  133.   </form>
  134. </table>
  135. <br>
  136. <table width="494" border="0" align="center" cellpadding="0" cellspacing="0" class="main">
  137.   <tr> 
  138.     <td height="23" valign="middle" class="right-title">&nbsp;<%=fd.getName()%></td>
  139.   </tr>
  140.   <tr> 
  141.     <td valign="top" background="workplan/images/tab-b-back.gif">
  142. <%
  143. int pagesize = 10;
  144. Paginator paginator = new Paginator(request);
  145. int curpage = paginator.getCurPage();
  146. FormDAO fdao = new FormDAO();
  147. ListResult lr = fdao.listResult(formCode, sql, curpage, pagesize);
  148. int total = lr.getTotal();
  149. Vector v = lr.getResult();
  150.     Iterator ir = null;
  151. if (v!=null)
  152. ir = v.iterator();
  153. paginator.init(total, pagesize);
  154. // 设置当前页数和总页数
  155. int totalpages = paginator.getTotalPages();
  156. if (totalpages==0)
  157. {
  158. curpage = 1;
  159. totalpages = 1;
  160. }
  161. %>
  162. <table width="95%" border="0" align="center" cellpadding="0" cellspacing="0">
  163.         <tr> 
  164.           <td width="47">&nbsp;</td>
  165.           <td align="right" backgroun="images/title1-back.gif">找到符合条件的记录 <b><%=paginator.getTotal() %></b> 条 每页显示 <b><%=paginator.getPageSize() %></b> 条 页次 <b><%=curpage %>/<%=totalpages %></td>
  166.         </tr>
  167.       </table> 
  168.       <table width="98%" border="0" align="center" cellpadding="2" cellspacing="1">
  169.         <tr align="center" bgcolor="#C4DAFF"> 
  170.           <td width="26%" bgcolor="#C4DAFF">产品名称</td>
  171.           <td width="20%" bgcolor="#C4DAFF">售价</td>
  172.           <td width="21%" bgcolor="#C4DAFF">类别</td>
  173.           <td width="17%" bgcolor="#C4DAFF">操作</td>
  174.         </tr>
  175.       <%
  176.    int i = 0;
  177. while (ir!=null && ir.hasNext()) {
  178. fdao = (FormDAO)ir.next();
  179. i++;
  180. int id = fdao.getId();
  181. %>
  182.         <tr align="center" bgcolor="#EEEEEE"> 
  183.           <td width="26%" bgcolor="#EEEEEE"> <a href="product_show.jsp?id=<%=id%>&formCode=<%=formCode%>"><%=fdao.getFieldValue("product_name")%></a></td>
  184.           <td width="20%" bgcolor="#EEEEEE"><%=fdao.getFieldValue("standard_price")%></td>
  185.           <td width="21%" bgcolor="#EEEEEE"><%=fdao.getFieldValue("product_mode")%></td>
  186.           <td width="17%" bgcolor="#EEEEEE"><a href="product_edit.jsp?id=<%=id%>&formCode=<%=StrUtil.UrlEncode(formCode)%>">编辑</a>&nbsp;&nbsp;<a href="../visual_del.jsp?id=<%=id%>&formCode=<%=formCode%>&privurl=<%=StrUtil.getUrl(request)%>">删除</a>&nbsp;&nbsp;   </td>
  187.         </tr>
  188.       <%
  189. }
  190. %>
  191.       </table>
  192.       <br>
  193.       <table width="98%" border="0" cellspacing="1" cellpadding="3" align="center" class="9black">
  194.         <tr> 
  195.           <td width="1%" height="23">&nbsp;</td>
  196.           <td height="23" valign="baseline"> 
  197.             <div align="right"> 
  198.             <%
  199. out.print(paginator.getCurPageBlock("?"+querystr));
  200. %>
  201.               &nbsp;</div></td>
  202.         </tr>
  203.       </table>
  204.     </td>
  205.   </tr>
  206.   <tr> 
  207.     <td height="9">&nbsp;</td>
  208.   </tr>
  209. </table>
  210. </body>
  211. </html>