cashsave.jsp
上传用户:helenhuo66
上传日期:2007-06-01
资源大小:865k
文件大小:13k
源码类别:

百货/超市行业

开发平台:

Java

  1. <%@ page contentType="text/html;charset=GBK" language="java" import="java.sql.*" errorPage="" %>
  2. <link href="css.css" rel="stylesheet" type="text/css">
  3. <jsp:useBean id="mdb" class="ckstudio.db.faq" scope="page"/>
  4. <head>
  5. <script language="JavaScript">
  6. <!--
  7. if (parent.frames.length > 0) {
  8. parent.location.href = location.href;
  9. }
  10. function form1_onsubmit() {
  11. if (document.form1.sub_to.value=="")
  12. {
  13.   alert("收货人姓名不能为空。")
  14.   document.form1.sub_to.focus()
  15.   return false
  16.  }
  17. else if(document.form1.sub_adds.value=="")
  18. {
  19.   alert("收货人地址不能为空。")
  20.   document.form1.sub_adds.focus()
  21.   return false
  22.  }
  23. else if(document.form1.sub_post.value=="")
  24. {
  25.   alert("收货人邮编不能为空。")
  26.   document.form1.sub_post.focus()
  27.   return false
  28.  }
  29. else if(document.form1.sub_tel.value=="")
  30. {
  31.   alert("联系电话不能为空。")
  32.   document.form1.sub_tel.focus()
  33.   return false
  34.  }
  35. else if(document.form1.sub_mail.value=="")
  36. {
  37.   alert("联系信箱不能为空。")
  38.   document.form1.sub_mail.focus()
  39.   return false
  40.  }    
  41. }
  42. // -->
  43. </script>
  44. <link href=css.css rel=STYLESHEET type=text/css>
  45. <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
  46. <title>购物成功!请填写收货人的详细信息</title>
  47. </head> 
  48. <body topmargin="0">
  49. <font color="#FFFFFF"><b> 
  50. <%
  51. if(session.getAttribute("user_name")==null){%><br><center>1.你尚未登录!请登录后再订购本站图书!<br>2.第一次来本站,请先注册会员(免费)!<br><br><%
  52. }else
  53. {
  54. String count="";
  55. String hw_id="";
  56. if(request.getParameter("action")=="buy"){
  57. if(request.getParameter("count")==""){
  58.     int intcount=1;
  59.     count=Integer.toString(intcount);
  60. }
  61. else
  62.     count=request.getParameter("count");
  63. if(request.getParameter("hw_id")=="")
  64. out.print("没有此货物!");
  65. else{
  66.     hw_id=request.getParameter("hw_id");
  67. String sql="select * from basket where hw_id='"+hw_id+"' and user_name='"+(String)session.getValue("user_name")+"' and basket_check=false";
  68. ResultSet rs;
  69. rs=mdb.executeQuery(sql);
  70. if(!rs.next()){
  71. String sql1="insert into basket(hw_id,user_name,basket_count,hw_name,hw_cash,user_type) values('"+hw_id+"','"+session.getValue("user_name")+"','"+count+"','"+request.getParameter("hw_name")+"','"+request.getParameter("hw_cash")+"','"+request.getParameter("user_type")+"') where hw_id='"+hw_id+"' and user_name='"+session.getValue("user_name")+"' and basket_check=false";
  72.     mdb.executeInsert(sql1);
  73. }
  74. else{
  75. //rs("basket_count")=int(rs("basket_count"))+int(count)
  76. rs.next();
  77. int basket_count=Integer.parseInt(rs.getString("basket_count"));
  78. basket_count=basket_count+Integer.parseInt(count);
  79. String basket_count2=Integer.toString(basket_count);
  80. String sql2="update basket set basket_count='"+basket_count+"'";
  81. mdb.executeUpdate(sql2);
  82. }
  83. }
  84. }
  85. %>
  86. </b></FONT> 
  87. <br>
  88. <table width="400" border="0" cellspacing="0" cellpadding="0" align="center" height="65">
  89.   <tr> 
  90.     <td valign="top"> 
  91.       <table width="100%" border="0" cellspacing="0" cellpadding="0" >
  92.         <tr> 
  93.           <td valign="top" height="120"> <table border="0" width="100%" cellspacing="0" cellpadding="0" height="5" align="center">
  94.               <%if(session.getAttribute("user_name")==null)
  95.         response.sendRedirect("index.jsp");
  96.     else{
  97. String user_name;
  98.         user_name=(String)session.getValue("user_name");
  99. String sql1;
  100.     sql1="select * from basket where user_name='"+user_name+"' and basket_check=false";
  101.     ResultSet rs1;
  102. rs1=mdb.executeQuery(sql1);
  103.     if(!rs1.next())
  104.         out.print("你没有订购任何商品");
  105.     else{
  106.         String sub_number="";
  107. String now=(String)((new java.util.Date()).toLocaleString());
  108.         sub_number=user_name+now;
  109. sub_number=sub_number.replace('-','1');
  110. sub_number=sub_number.replace(' ','2');
  111. sub_number=sub_number.replace(':','3');
  112. rs1.previous();
  113.         while(rs1.next()){
  114. String b_c=rs1.getString("basket_count");
  115. String h_id=rs1.getString("hw_id");
  116. String sql2="update basket set basket_check=true,sub_number='"+sub_number+"' where user_name='"+user_name+"' and basket_check=false";
  117.             mdb.executeUpdate(sql2);
  118. int h_i=Integer.parseInt(h_id);
  119. String sql3="select * from hw where hw_id="+h_i+"";
  120. ResultSet rs2=mdb.executeQuery(sql3);
  121. rs2.next();
  122. int h_b=rs2.getInt("hw_buys")+Integer.parseInt(b_c);
  123. String sql4="update hw set hw_buys="+h_b+" where hw_id="+h_i+"";
  124. mdb.executeUpdate(sql4);
  125. }
  126.         
  127.     String sql5="insert into sub(user_name,sub_number) values('"+user_name+"','"+sub_number+"')";
  128.     mdb.executeInsert(sql5);
  129.     
  130.     %>
  131.               <tr> 
  132.                 <td>
  133.     <img border="0" src="img/promo_list_top.gif" width="100%" height="4"></td>
  134.               </tr>
  135.               <tr> 
  136.                 <td height="17" bgcolor="#DBC2B0" align="center">谢谢您从本站购物!您的订单号为:<font color=#FFFF00><b><%=sub_number%></b></font></td>
  137.               </tr>
  138.               <tr> 
  139.                 <td width="380"> <form method="POST" language="javascript" onsubmit="return form1_onsubmit()" name="form1" action="saveto.jsp?sub_number=<%=sub_number%>">
  140.                     <%
  141. String sql6;
  142.                     sql6="select * from member where user_name='"+(String)session.getValue("user_name")+"'";
  143. ResultSet rs3=mdb.executeQuery(sql6);
  144. rs3.next();
  145. %><table width="100%" border="0" cellspacing="0" cellpadding="0" >
  146.                       <tr> 
  147.                         <td><table width="100%" height="34" border="0" cellpadding="0" cellspacing="0">
  148.                             <tr>
  149.                               <td width="398" height="120" valign="bottom" bgcolor="#F5EFE7" ><br>
  150.                                   请记牢本订单号,你可以使用本订单号对成交情况进行查询和投诉<br> <br> 
  151.                                 <div align="center">
  152.                                   <center> 
  153.                                 <table width="90%" border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" height="243">
  154.                                   <tr background="img/pics/tile_bg.gif"> 
  155.                                     <td height="25" colspan="2"><b>请填写收货人的详细信息</b></td>
  156.                                   </tr>
  157.                                   <tr bgcolor="#FFFFFF"> 
  158.                                     <td width="19%" height="25" bgcolor="#F5EFE7"> 
  159.                                       <div align="right">姓名:</div>
  160.                                     </td>
  161.                                     <td width="81%" height="25" bgcolor="#F5EFE7">  
  162.                                       <input style="FONT-SIZE: 12px; WIDTH: 110px" type="text" name="sub_to" size="20" class=input value="<%=rs3.getString("user_name")%>">
  163.                                     </td>
  164.                                   </tr>
  165.                                   <tr bgcolor="#FFFFFF"> 
  166.                                     <td width="19%" height="25" bgcolor="#F5EFE7"> 
  167.                                       <div align="right">地址:</div>
  168.                                     </td>
  169.                                     <td height="25" bgcolor="#F5EFE7">  
  170.                                       <input style="FONT-SIZE: 12px; WIDTH: 210px" type="text" name="sub_adds" size="40" class=input value="<%=rs3.getString("user_adds")%>">
  171.                                     </td>
  172.                                   </tr>
  173.                                   <tr bgcolor="#FFFFFF"> 
  174.                                     <td width="19%" height="25" bgcolor="#F5EFE7"> 
  175.                                       <div align="right">邮编:</div>
  176.                                     </td>
  177.                                     <td height="25" bgcolor="#F5EFE7">  
  178.                                       <input style="FONT-SIZE: 12px; WIDTH: 110px" type="text" name="sub_post" size="10" class=input value="<%=rs3.getString("user_postcode")%>">
  179.                                     </td>
  180.                                   </tr>
  181.                                   <tr bgcolor="#FFFFFF"> 
  182.                                     <td width="19%" height="25" bgcolor="#F5EFE7"> 
  183.                                       <div align="right">电话:</div>
  184.                                     </td>
  185.                                     <td height="25" bgcolor="#F5EFE7">  
  186.                                       <input style="FONT-SIZE: 12px; WIDTH: 110px" type="text" name="sub_tel" size="20" class=input value="<%=rs3.getString("user_tel")%>">
  187.                                     </td>
  188.                                   </tr>
  189.                                   <tr bgcolor="#FFFFFF"> 
  190.                                     <td width="19%" height="25" bgcolor="#F5EFE7"> 
  191.                                       <div align="right">E-mail:</div>
  192.                                     </td>
  193.                                     <td height="25" bgcolor="#F5EFE7">  
  194.                                       <input style="FONT-SIZE: 12px; WIDTH: 110px" type="text" name="sub_mail" size="20" class=input value="<%=rs3.getString("user_mail")%>">
  195.                                     </td>
  196.                                   </tr>
  197.                                   <tr bgcolor="#FFFFFF"> 
  198.                                     <td width="19%" height="19" bgcolor="#F5EFE7"> 
  199.                                       <div align="right">付款方式:</div>
  200.                                     </td>
  201.                                     <td height="19" bgcolor="#F5EFE7">  
  202.                                       <select size="1" name="qian">
  203.                                         <option value="货到付款">货到付款</option>
  204.                                         <option value="银行转帐">银行转帐</option>
  205.                                         <option value="邮政汇款">邮政汇款</option>
  206.                                       </select>
  207.                                     </td>
  208.                                   </tr>
  209.                                   <tr bgcolor="#FFFFFF">
  210.                                     <td width="19%" height="39" bgcolor="#F5EFE7">
  211.                                       <div align="right">备注:<br>
  212.                                         (50汉字内) </div>
  213.                                     </td>
  214.                                     <td height="39" bgcolor="#F5EFE7">   
  215.                                       <textarea style="FONT-SIZE: 12px; WIDTH: 250px" name="other" cols="30" class="input" rows="3"></textarea>
  216.                                     </td>
  217.                                   </tr>
  218.                                   <tr bgcolor="#FFFFFF"> 
  219.                                     <td height="35" colspan="2" bgcolor="#F5EFE7"> 
  220.                                       <table width="40%" border="0" align="center" cellpadding="0" cellspacing="0">
  221.                                         <tr> 
  222.                                           <td> 
  223.                                             <div align="center"> 
  224.                                               <input 
  225.       align=absMiddle alt=确认 cache name="B1" 
  226.       src="img/pics/ok.gif" type=image tppabs="" width="45" height="20">
  227.                                             </div>
  228.                                           </td>
  229.                                           <td> 
  230.                                             <div align="center"> 
  231.                                               <input type="reset" value="清除" name="B2" class=input>
  232.                                             </div>
  233.                                           </td>
  234.                                         </tr>
  235.                                       </table>
  236.                                     </td>
  237.                                   </tr>
  238.                                 </table>
  239.                                   </center>
  240.                               </div>
  241.                                 <br> <table width="100%" height="25" border="0" cellpadding="0" cellspacing="0">
  242.                                   <tr> 
  243.                                     <td valign="middle"><div align="center"><img src="img/pics/seperator.gif" width="359" height="1"></div></td>
  244.                                   </tr>
  245.                                 </table></td>
  246.                             </tr>
  247.                             <tr> 
  248.                               <td height="1" colspan="3" valign="top"></td>
  249.                             </tr>
  250.                           </table> </td>
  251.                       </tr>
  252.                     </table>   
  253.                     <%
  254. }
  255. }
  256.                     %>
  257.                   </form></td>
  258.               </tr>
  259.             </table></td>
  260.         </tr>
  261.       </table>
  262.     </td>
  263.   </tr>
  264. </table>
  265. <%}
  266. mdb.Close();
  267. %>