provider_info_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.util.*"%>
  5. <%@ page import = "com.redmoon.oa.visual.*"%>
  6. <%@ page import = "com.redmoon.oa.flow.FormDb"%>
  7. <%@ page import = "com.redmoon.oa.flow.FormField"%>
  8. <jsp:useBean id="privilege" scope="page" class="com.redmoon.oa.pvg.Privilege"/>
  9. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  10. <html>
  11. <head>
  12. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  13. <title>选择供应商</title>
  14. <link href="../common.css" rel="stylesheet" type="text/css">
  15. <script>
  16. function sel(sth) {
  17. window.opener.setIntpuObjValue(sth);
  18. window.close();
  19. }
  20. </script>
  21. <%@ include file="../inc/nocache.jsp"%>
  22. </head>
  23. <body background="" leftmargin="0" topmargin="5" marginwidth="0" marginheight="0">
  24. <%
  25. String priv = "read";
  26. if (!privilege.isUserPrivValid(request, priv))
  27. {
  28. // out.println(cn.js.fan.web.SkinUtil.makeErrMsg(request, cn.js.fan.web.SkinUtil.LoadString(request, "pvg_invalid")));
  29. // return;
  30. }
  31. String op = ParamUtil.get(request, "op");
  32. String formCode = "sales_provider_info";
  33. String querystr = "";
  34. FormDb fd = new FormDb();
  35. fd = fd.getFormDb(formCode);
  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. querystr = "query=" + sql;
  86. }
  87. %>
  88. <table width="494" border="0" align="center" cellpadding="0" cellspacing="0" class="main">
  89.   <tr> 
  90.     <td height="23" valign="middle" class="right-title">&nbsp;选择<%=fd.getName()%></td>
  91.   </tr>
  92.   <tr> 
  93.     <td valign="top" background="workplan/images/tab-b-back.gif">
  94. <%
  95. int pagesize = 10;
  96. Paginator paginator = new Paginator(request);
  97. int curpage = paginator.getCurPage();
  98. FormDAO fdao = new FormDAO();
  99. ListResult lr = fdao.listResult(formCode, sql, curpage, pagesize);
  100. int total = lr.getTotal();
  101. Vector v = lr.getResult();
  102.     Iterator ir = null;
  103. if (v!=null)
  104. ir = v.iterator();
  105. paginator.init(total, pagesize);
  106. // 设置当前页数和总页数
  107. int totalpages = paginator.getTotalPages();
  108. if (totalpages==0)
  109. {
  110. curpage = 1;
  111. totalpages = 1;
  112. }
  113. %>
  114. <table width="61%" border="0" align="center" cellSpacing="1" class="tableframe">
  115.   <form id="form2" name="form2" action="?op=search" method="post">
  116.     <tbody>
  117.       <tr>
  118.         <td noWrap colSpan="3"><table cellSpacing="0" cellPadding="2" width="100%" border="0">
  119.           <tbody>
  120.             <tr>
  121.               <td colSpan="3" bgcolor="#C4DAFF"><b>供应商查询</b></td>
  122.             </tr>
  123.             <tr>
  124.               <td width="29%">供应商名称:</td>
  125.               <td noWrap width="19%"><select name="provide_name_cond">
  126.                 <option value="1">等于</option>
  127.                 <option value="0" selected>包含</option>
  128.               </select></td>
  129.               <td width="52%"><input name="provide_name" size="20"></td>
  130.             </tr>
  131.             <tr>
  132.               <td width="29%">电话:</td>
  133.               <td noWrap width="19%"><select name="tel_cond">
  134.                 <option value="1">等于</option>
  135.                 <option value="0" selected>包含</option>
  136.               </select></td>
  137.               <td width="52%"><input name="tel" size="20"></td>
  138.             </tr>
  139.             <tr>
  140.               <td width="29%">网址:</td>
  141.               <td noWrap width="19%"><select name="web_cond">
  142.                 <option value="1">等于</option>
  143.                 <option value="0" selected>包含</option>
  144.               </select></td>
  145.               <td width="52%"><input name="web" size="20"></td>
  146.             </tr>
  147.             <tr>
  148.               <td width="29%">电子邮件:</td>
  149.               <td noWrap width="19%"><select name="email_cond">
  150.                 <option value="1">等于</option>
  151.                 <option value="0" selected>包含</option>
  152.               </select></td>
  153.               <td width="52%"><input name="email" size="20"></td>
  154.             </tr>
  155.             <tr>
  156.               <td width="29%">地区:</td>
  157.               <td noWrap width="19%"><select name="area_cond">
  158.                 <option value="1" selected>等于</option>
  159.               </select></td>
  160.               <td width="52%"><input name="area" size="20"></td>
  161.             </tr>
  162.           </tbody>
  163.         </table></td>
  164.       </tr>
  165.       <tr align="middle">
  166.         <td noWrap align="center" colSpan="3" height="30"><input class="BigButton"  type="submit" value="查  询" name="submit">
  167.           &nbsp;&nbsp;&nbsp;&nbsp;</td>
  168.       </tr>
  169.     </tbody>
  170.   </form>
  171. </table>
  172. <table width="95%" border="0" align="center" cellpadding="0" cellspacing="0">
  173.         <tr> 
  174.           <td width="47">&nbsp;</td>
  175.           <td align="right" backgroun="images/title1-back.gif">找到符合条件的记录 <b><%=paginator.getTotal() %></b> 条 每页显示 <b><%=paginator.getPageSize() %></b> 条 页次 <b><%=curpage %>/<%=totalpages %></td>
  176.         </tr>
  177.       </table> 
  178.       <table width="98%" border="0" align="center" cellpadding="2" cellspacing="1">
  179.         <tr align="center" bgcolor="#C4DAFF">
  180.           <td width="26%">供应商名称</td>
  181.           <td width="20%">电话</td>
  182.           <td width="21%">网址</td>
  183.           <td width="17%" bgcolor="#C4DAFF">操作</td>
  184.         </tr>
  185.       <%
  186.    int i = 0;
  187. while (ir!=null && ir.hasNext()) {
  188. fdao = (FormDAO)ir.next();
  189. i++;
  190. int id = fdao.getId();
  191. %>
  192.         <tr align="center" bgcolor="#EEEEEE">
  193.           <td width="26%"><a href="provider_info_show.jsp?id=<%=id%>&formCode=<%=formCode%>"><%=fdao.getFieldValue("provide_name")%></a></td>
  194.           <td width="20%"><%=fdao.getFieldValue("tel")%></td>
  195.           <td width="21%"><%=fdao.getFieldValue("web")%></td>
  196.           <td width="17%" bgcolor="#EEEEEE"><a href="javascript:sel('<%=fdao.getFieldValue("provide_name")%>')">选择</a>&nbsp;&nbsp;&nbsp;&nbsp;   </td>
  197.         </tr>
  198.       <%
  199. }
  200. %>
  201.       </table>
  202.       <br>
  203.       <table width="98%" border="0" cellspacing="1" cellpadding="3" align="center" class="9black">
  204.         <tr> 
  205.           <td width="1%" height="23">&nbsp;</td>
  206.           <td height="23" valign="baseline"> 
  207.             <div align="right"> 
  208.             <%
  209. out.print(paginator.getCurPageBlock("?"+querystr));
  210. %>
  211.               &nbsp;</div></td>
  212.         </tr>
  213.       </table>
  214.     </td>
  215.   </tr>
  216.   <tr> 
  217.     <td height="9">&nbsp;</td>
  218.   </tr>
  219. </table>
  220. </body>
  221. </html>