product_service_list_sel.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 = "read";
  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_service";
  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. <script>
  33. function sel(sth) {
  34. window.opener.setIntpuObjValue(sth);
  35. window.close();
  36. }
  37. </script>
  38. </head>
  39. <body background="" leftmargin="0" topmargin="5" marginwidth="0" marginheight="0">
  40. <%@ include file="product_service_inc_menu_top.jsp"%>
  41. <%
  42. String sql = "select id from " + fd.getTableNameByForm();
  43. String query = ParamUtil.get(request, "query");
  44. if (!query.equals(""))
  45. sql = query;
  46. else
  47. if (op.equals("search")) {
  48. Iterator ir = fd.getFields().iterator();
  49. String cond = "";
  50. while (ir.hasNext()) {
  51. FormField ff = (FormField)ir.next();
  52. String value = ParamUtil.get(request, ff.getName());
  53. String name_cond = ParamUtil.get(request, ff.getName() + "_cond");
  54. if (ff.getType().equals(ff.TYPE_DATE) || ff.getType().equals(ff.TYPE_DATE_TIME)) {
  55. String fDate = ParamUtil.get(request, ff.getName() + "FromDate");
  56. String tDate = ParamUtil.get(request, ff.getName() + "ToDate");
  57. if (!fDate.equals("")) {
  58. if (cond.equals(""))
  59. cond += ff.getName() + ">=" + StrUtil.sqlstr(fDate);
  60. else
  61. cond += " and " + ff.getName() + ">=" + StrUtil.sqlstr(fDate);
  62. }
  63. if (!tDate.equals("")) {
  64. if (cond.equals(""))
  65. cond += ff.getName() + "<=" + StrUtil.sqlstr(tDate);
  66. else
  67. cond += " and " + ff.getName() + "<=" + StrUtil.sqlstr(tDate);
  68. }
  69. }
  70. else {
  71. if (name_cond.equals("0")) {
  72. if (!value.equals("")) {
  73. if (cond.equals(""))
  74. cond += ff.getName() + " like " + StrUtil.sqlstr("%" + value + "%");
  75. else
  76. cond += " and " + ff.getName() + " like " + StrUtil.sqlstr("%" + value + "%");
  77. }
  78. }
  79. else if (name_cond.equals("1")) {
  80. if (!value.equals("")) {
  81. if (cond.equals(""))
  82. cond += ff.getName() + "=" + StrUtil.sqlstr(value);
  83. else
  84. cond += " and " + ff.getName() + "=" + StrUtil.sqlstr(value);
  85. }
  86. }
  87. }
  88. }
  89. if (!cond.equals(""))
  90. sql = sql + " where " + cond;
  91. }
  92. querystr = "query=" + StrUtil.UrlEncode(sql);
  93. %>
  94. <table width="58%" border="0" align="center" cellSpacing="1" class="tableframe">
  95.   <form id="form2" name="form2" action="?op=search" method="post">
  96.     <tbody>
  97.       <tr>
  98.         <td noWrap colSpan="3">
  99.           <table cellSpacing="0" cellPadding="0" width="100%" border="0">
  100.             <tbody>
  101.               <tr>
  102.                 <td colSpan="3" bgcolor="#C4DAFF"><b>服务型产品查询</b></td>
  103.               </tr>
  104.               <tr>
  105.                 <td width="29%">服务提供商:</td>
  106.                 <td noWrap width="19%"><select name="provider_cond">
  107.                   <option value="1">等于</option>
  108.                   <option value="0" selected>包含</option>
  109.                 </select></td>
  110.                 <td width="52%"><input name="provider" size="20"></td>
  111.               </tr>
  112.               <tr>
  113.                 <td width="29%">服务名称:</td>
  114.                 <td noWrap width="19%"><select name="service_name_cond">
  115.                     <option value="1">等于</option>
  116.                     <option value="0" selected>包含</option>
  117.                   </select></td>
  118.                 <td width="52%"><input name="service_name" size="20"></td>
  119.               </tr>
  120.               <tr>
  121.                 <td width="29%">服务收费标准:</td>
  122.                 <td noWrap width="19%"><select name="standad_name_cond">
  123.                     <option value="1">等于</option>
  124.                     <option value="0" selected>包含</option>
  125.                   </select></td>
  126.                 <td width="52%"><input name="standad_name" size="20"></td>
  127.               </tr>
  128.             </tbody>
  129.           </table>
  130.         </td>
  131.       </tr>
  132.       <tr align="middle">
  133.         <td noWrap align="middle" colSpan="3" height="35"><input class="BigButton"  type="submit" value="查  询" name="submit"> 
  134.           &nbsp;&nbsp;&nbsp;&nbsp;</td>
  135.       </tr>
  136.     </tbody>
  137.   </form>
  138. </table>
  139. <br>
  140. <table width="494" border="0" align="center" cellpadding="0" cellspacing="0" class="main">
  141.   <tr> 
  142.     <td height="23" valign="middle" class="right-title">&nbsp;<%=fd.getName()%></td>
  143.   </tr>
  144.   <tr> 
  145.     <td valign="top" background="workplan/images/tab-b-back.gif">
  146. <%
  147. int pagesize = 10;
  148. Paginator paginator = new Paginator(request);
  149. int curpage = paginator.getCurPage();
  150. FormDAO fdao = new FormDAO();
  151. ListResult lr = fdao.listResult(formCode, sql, curpage, pagesize);
  152. int total = lr.getTotal();
  153. Vector v = lr.getResult();
  154.     Iterator ir = null;
  155. if (v!=null)
  156. ir = v.iterator();
  157. paginator.init(total, pagesize);
  158. // 设置当前页数和总页数
  159. int totalpages = paginator.getTotalPages();
  160. if (totalpages==0)
  161. {
  162. curpage = 1;
  163. totalpages = 1;
  164. }
  165. %>
  166. <table width="95%" border="0" align="center" cellpadding="0" cellspacing="0">
  167.         <tr> 
  168.           <td width="47">&nbsp;</td>
  169.           <td align="right" backgroun="images/title1-back.gif">找到符合条件的记录 <b><%=paginator.getTotal() %></b> 条 每页显示 <b><%=paginator.getPageSize() %></b> 条 页次 <b><%=curpage %>/<%=totalpages %></td>
  170.         </tr>
  171.       </table> 
  172.       <table width="98%" border="0" align="center" cellpadding="2" cellspacing="1">
  173.         <tr align="center" bgcolor="#C4DAFF"> 
  174.           <td width="26%" bgcolor="#C4DAFF">服务产品名称</td>
  175.           <td width="20%" bgcolor="#C4DAFF">收费标准</td>
  176.           <td width="17%" bgcolor="#C4DAFF">操作</td>
  177.         </tr>
  178.       <%
  179.    int i = 0;
  180. while (ir!=null && ir.hasNext()) {
  181. fdao = (FormDAO)ir.next();
  182. i++;
  183. int id = fdao.getId();
  184. %>
  185.         <tr align="center" bgcolor="#EEEEEE"> 
  186.           <td width="26%" bgcolor="#EEEEEE"> <a href="product_service_show.jsp?id=<%=id%>&formCode=<%=formCode%>"><%=fdao.getFieldValue("service_name")%></a></td>
  187.           <td width="20%" bgcolor="#EEEEEE"><%=fdao.getFieldValue("standad_name")%></td>
  188.           <td width="17%" bgcolor="#EEEEEE">&nbsp;&nbsp;<a href="javascript:sel('<%=fdao.getFieldValue("service_name")%>')">选择</a>&nbsp;&nbsp;   </td>
  189.         </tr>
  190.       <%
  191. }
  192. %>
  193.       </table>
  194.       <br>
  195.       <table width="98%" border="0" cellspacing="1" cellpadding="3" align="center" class="9black">
  196.         <tr> 
  197.           <td width="1%" height="23">&nbsp;</td>
  198.           <td height="23" valign="baseline"> 
  199.             <div align="right"> 
  200.             <%
  201. out.print(paginator.getCurPageBlock("?"+querystr));
  202. %>
  203.               &nbsp;</div></td>
  204.         </tr>
  205.       </table>
  206.     </td>
  207.   </tr>
  208.   <tr> 
  209.     <td height="9">&nbsp;</td>
  210.   </tr>
  211. </table>
  212. </body>
  213. </html>