orderofind.jsp
上传用户:xjrzjk
上传日期:2022-07-31
资源大小:1585k
文件大小:8k
源码类别:

Jsp/Servlet

开发平台:

Java

  1. <%@ page contentType="text/html; charset=GBK" %>
  2. <%@ page import="java.sql.*"%>
  3. <%@ page import="java.text.DecimalFormat"%>
  4. <%
  5. try{
  6.   String strId = request.getParameter("Form_Id");
  7.   String strLoginSuccess = (String)request.getSession(true).getAttribute("LoginSuccess");
  8.   if (strLoginSuccess == null || strLoginSuccess.equals("")){
  9.     response.sendRedirect("orderlogin.jsp");
  10.   }else{
  11.   Class.forName("oracle.jdbc.driver.OracleDriver");
  12.   String strUrl = "jdbc:oracle:thin:@slight:1521:LOCAL";
  13.   String strUser = "eshop";
  14.   String strPassword = "eshop";
  15.   Connection con = DriverManager.getConnection(strUrl, strUser, strPassword);
  16.     Statement st = con.createStatement();
  17.     String sql = "select * from orderlist where form_id = '" + strId +"'";
  18.     ResultSet rs = st.executeQuery(sql);
  19.     if (rs.next()){
  20.       String strUserid = rs.getString("user_id");
  21.       String strFormId = String.valueOf(rs.getLong("form_id"));
  22.       String strName = rs.getString("name");
  23.       String strAddress = rs.getString("Address");
  24.       String strZip = rs.getString("zip");
  25.       String strPhone = rs.getString("phone");
  26.       String strEmail = rs.getString("Email");
  27.       String strPays = rs.getString("pays");
  28.       String strRemark = rs.getString("remark");
  29.       String strRegtime = rs.getDate("regtime").toString();
  30.       String strFlag = rs.getString("flag");
  31.       if (!strFlag.equals("尚未处理")){
  32.         strFlag = "已经发货";
  33.       }
  34.       if (strLoginSuccess.equals(strUserid)){
  35. %>
  36. <html>
  37. <head>
  38. <title>
  39. 客户订货单详细信息
  40. </title>
  41. <STYLE type=text/css>
  42. .main {
  43. FONT-SIZE: 12px
  44. }
  45. .main1 {
  46. FONT-SIZE: 14px
  47. }
  48. .main2 {
  49. FONT-SIZE: 16px
  50. }
  51. .main3 {
  52. FONT-SIZE: 7px
  53. }
  54. .main4 {
  55. FONT-SIZE: 10px
  56. }
  57. A:link {
  58. COLOR: #ffffff; TEXT-DECORATION: none
  59. }
  60. A:visited {
  61. COLOR: #ffffff; TEXT-DECORATION: none
  62. }
  63. A:active {
  64. COLOR: #ff0000; TEXT-DECORATION: none
  65. }
  66. A:hover {
  67. COLOR: #aa0000; TEXT-DECORATION: underline
  68. }
  69. </STYLE>
  70. <link rel="stylesheet" type="text/css" href="style.css">
  71. </head>
  72. <body bgcolor="#ffffff">
  73.   <br>    <div align="center">
  74.         <center>
  75.         <form method='POST' action="">
  76.             <TABLE cellSpacing=1 cellPadding=4 width=562 bgColor=#416327 height="159">
  77.               <TBODY>
  78.               <TR vAlign=top bgColor=#eeeeee>
  79.                 <TD  colSpan=2 width="548" height="10" bgcolor="#006699"></TD></TR>
  80.               <TR vAlign=top bgColor=#eeeeee>
  81.                 <TD  colSpan=2 width="548" height="32">客户订货单详细资料--</TD></TR>
  82.               <TR bgColor=#eeeeee>
  83.                 <TD  width=126 bgColor=#006699 height=25 align="right"><SPAN
  84.                   ><font color="#FFFFFF">订货单号:</font></SPAN></TD>
  85.                 <TD  width=410 height=25>&nbsp; <%=strFormId%></TD></TR>
  86.              <tr>
  87.                 <TD  width=126 bgColor=#006699 height=25 align="right"><SPAN
  88.                   ><font color="#FFFFFF">收货人姓名:</font></SPAN></TD>
  89.                 <TD  width=410 height=25 bgcolor="#eeeeee">&nbsp; <%=strName%></TD></TR>
  90.               <tr>
  91.                 <TD  width=126 bgColor=#006699 height=25 align="right"><SPAN
  92.                   ><font color="#FFFFFF">收货人联系地址:</font></SPAN></TD>
  93.                 <TD  width=410 height=25 bgcolor="#eeeeee">&nbsp; <%=strAddress%></TD>
  94.               </tr>
  95.               <tr>
  96.                 <TD  width=126 bgColor=#006699 height=25 align="right"><SPAN
  97.                   ><font color="#FFFFFF">邮政编码:</font></SPAN></TD>
  98.                 <TD  width=410 height=25 bgcolor="#eeeeee">&nbsp; <%=strZip%></TD>
  99.               </tr>
  100.               <tr>
  101.                 <TD  width=126 bgColor=#006699 height=25 align="right"><SPAN
  102.                   ><font color="#FFFFFF">联系电话:</font></SPAN></TD>
  103.                 <TD  width=410 height=25 bgcolor="#eeeeee">&nbsp; <%=strPhone%></TD>
  104.               </tr>
  105.               <tr>
  106.                 <TD  width=126 bgColor=#006699 height=25 align="right"><SPAN
  107.                   ><font color="#FFFFFF">电子信箱:</font></SPAN></TD>
  108.                 <TD  width=410 height=25 bgcolor="#eeeeee">&nbsp; <%=strEmail%></TD>
  109.               </tr>
  110.               <tr>
  111.                 <TD  width=126 bgColor=#006699 height=25 align="right"><SPAN
  112.                   ><font color="#FFFFFF">付款方式:</font></SPAN></TD>
  113.                 <TD  width=410 height=25 bgcolor="#eeeeee">&nbsp; <%=strPays%></TD>
  114.               </tr>
  115.               <tr>
  116.                 <TD  width=126 bgColor=#006699 height=25 align="right"><SPAN
  117.                   ><font color="#FFFFFF">备注:</font></SPAN></TD>
  118.                 <TD  width=410 height=25 bgcolor="#eeeeee">&nbsp; <%=strRemark%></TD>
  119.               </tr>
  120.               <tr>
  121.                 <TD  width=126 bgColor=#006699 height=24 align="right"><SPAN
  122.                   ><font color="#FFFFFF">订货日期:</font></SPAN></TD>
  123.                 <TD  width=410 height=24 bgcolor="#eeeeee">&nbsp; <%=strRegtime%></TD>
  124.               </tr>
  125.               <tr>
  126.                 <TD  width=126 bgColor=#006699 height=25 align="right"><SPAN
  127.                   ><font color="#FFFFFF">订单是否已经处理:</font></SPAN></TD>
  128.                 <TD  width=410 height=25 bgcolor="#eeeeee"><%=strFlag%></TD>
  129.               </tr>
  130.               <TR vAlign=top bgColor=#eeeeee>
  131.                 <TD  colSpan=2 width="548" height="31">订货商品细目--</TD></TR>
  132. <%
  133.   rs.close();
  134.   sql = "select * from shoplist where form_id = '" + strId + "'";
  135.   rs = st.executeQuery(sql);
  136.   DecimalFormat df = new DecimalFormat("0.00");
  137. %>
  138.               <TR vAlign=top bgColor=#eeeeee>
  139.                 <TD  colSpan=2 width="548" height="15">
  140.                   <div align="center">
  141.                     <table border="1" cellpadding="0" cellspacing="0" width="100%" bordercolorlight="#006699" bordercolordark="#eeeeee"  height="68">
  142.                       <tr>
  143.                         <td width="16%" bgcolor="#006699" height="18" align="center"><font color="#FFFFFF">商品编号</font></td>
  144.                         <td width="33%" bgcolor="#006699" height="18" align="center"><font color="#FFFFFF">商品名称</font></td>
  145.                         <td width="21%" bgcolor="#006699" height="18" align="center"><font color="#FFFFFF">商品价格</font></td>
  146.                         <td width="12%" bgcolor="#006699" height="18" align="center"><font color="#FFFFFF">商品数量</font></td>
  147.                         <td width="18%" bgcolor="#006699" height="18" align="center"><font color="#FFFFFF">金额小计</font></td>
  148.                       </tr>
  149. <%
  150.   double sum = 0;
  151.   while (rs.next()){
  152.     String strProductId = rs.getString("product_id");
  153.     String strProductName = rs.getString("product_name");
  154.     String strPrice = df.format(rs.getDouble("p_newprice"));
  155.     String strNum = String.valueOf(rs.getLong("number1"));
  156.     String strXj = df.format(rs.getDouble("p_newprice") * rs.getLong("number1"));
  157. %>
  158.                         <tr>
  159.                         <td width="22%" align="center" height="22"><%=strProductId%></td>
  160.                         <td width="33%" align="center" height="22"><%=strProductName%></td>
  161.                         <td width="21%" align="center" height="22"><%=strPrice%></td>
  162.                         <td width="12%" align="center" height="22"><%=strNum%></td>
  163.                         <td width="18%" align="center" height="22"><%=strXj%>元</td>
  164.                       </tr>
  165. <%
  166.   sum = sum + rs.getDouble("p_newprice") * rs.getLong("number1");
  167.   }
  168. %>
  169.         </center>
  170.                       <tr>
  171.                         <td width="100%" colspan="5" height="22">
  172.                           <p align="right">总计金额:<%=df.format(sum)%>元</p>
  173.                         </td>
  174.                       </tr>
  175.                     </table>
  176.                   </div>
  177.                 </TD></TR>
  178.         <center>
  179.               <TR bgColor=#eeeeee>
  180.                 <TD  colSpan=2 width="548" height="27">
  181.                   <p align="center">
  182.  <input type="button" value="返回" name="B4" onclick="javascript:window.close()">
  183.                 </TD></TR>
  184.               <TR bgColor=#eeeeee>
  185.                 <TD  colSpan=2 width="548" height="4" bgcolor="#006699"></TD></TR></TBODY></TABLE>
  186.         </center>
  187.       </div>
  188. </form>
  189. <%
  190.       }else{
  191.         out.println("您不能查看不属于您的订单,请重新输入您自己的订单号");
  192.       }
  193.     }else{
  194.       out.println("您输入的订单号不存在或格式不正确,请重新输入");
  195.     }
  196. }
  197. %>
  198. </body>
  199. </html>
  200. <%
  201. }catch(Exception e){
  202.   throw (e);
  203. }
  204. %>