cash.jsp
上传用户:szlmxq
上传日期:2014-01-31
资源大小:740k
文件大小:5k
源码类别:

Applet

开发平台:

Java

  1. <%@ page contentType="text/html;charset=GBK" language="java" import="java.sql.*" errorPage="" %>
  2. <head>
  3. <link href=css.css rel=STYLESHEET type=text/css>
  4. <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
  5. <title>收银台</title></head> 
  6. <body topmargin="0">
  7. <font color="#000000"><b>
  8. <jsp:useBean id="mdb" class="ckstudio.db.faq" scope="page"/>
  9. <%
  10. if(session.getAttribute("user_name")==null){
  11. %>
  12. <br>1.你尚未登录!请登录后再订购本站商品!<br>2.第一次来本站,请先注册会员(免费)!<br><br>
  13. <%
  14. }else{
  15. String count="";
  16. String hw_id="";
  17. if(request.getParameter("action")=="buy"){
  18. if(request.getParameter("count")==""){
  19.     int intcount=1;
  20.     count=Integer.toString(intcount);
  21. }
  22. else
  23.     count=request.getParameter("count");
  24. if(request.getParameter("hw_id")=="")
  25. out.print("没有此货物!");
  26. else{
  27.     hw_id=request.getParameter("hw_id");
  28. String sql="select * from basket where hw_id='"+hw_id+"' and user_name='"+(String)session.getValue("user_name")+"' and basket_check=false";
  29. ResultSet rs;
  30. rs=mdb.executeQuery(sql);
  31. if(!rs.next()){
  32. 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";
  33.     mdb.executeInsert(sql1);
  34. }
  35. else{
  36. //rs("basket_count")=int(rs("basket_count"))+int(count)
  37. rs.next();
  38. int basket_count=Integer.parseInt(rs.getString("basket_count"));
  39. basket_count=basket_count+Integer.parseInt(count);
  40. String basket_count2=Integer.toString(basket_count);
  41. String sql2="update basket set basket_count='"+basket_count+"'";
  42. mdb.executeUpdate(sql2);
  43. }
  44. }
  45. }
  46. %>
  47. </b></FONT> 
  48. <br>
  49. <table width="400" border="0" cellspacing="0" cellpadding="0" align="center" height="50">
  50.   <tr> 
  51.     <td align="center">
  52.     <img border="0" src="img/promo_list_top.gif" width="100%" height="4"></td>
  53.   </tr>
  54.   <tr> 
  55.     <td height="18" bgcolor="#DBC2B0" align="center">收银台</td>
  56.   </tr>
  57.   <tr> 
  58.     <td height="25" valign="top"> <form method="POST" action="cashsave.jsp">
  59.         <table width="100%" border="0" cellspacing="0" cellpadding="0" >
  60.           <tr> 
  61.             <td valign="top"> 
  62.             <table border="0" width="416" cellspacing="0" height="34" cellpadding="0">
  63.                 <tr> 
  64.                   <td width="378" height="120" valign="bottom" bgcolor="#F5EFE7"><p><br>
  65.                        您订购的物品如下:</p>
  66.                     <div align="center">
  67.                       <center>
  68.                     <table width="90%" border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111">
  69.                       <tr background="img/pics/tile_bg.gif"> 
  70.                         <td width="195" height="25"><div align="center">商品名称</div></td>
  71.                         <td width="60" height="25"><div align="center">单价</div></td>
  72.                         <td width="60" height="25"><div align="center">数量</div></td>
  73.                         <td width="80" height="25"><div align="center">合计</div></td>
  74.                       </tr>
  75.                       <%
  76.       String user_name=(String)session.getValue("user_name");
  77.       String sql3="select * from basket where user_name='"+user_name+"'and basket_check=false";
  78.   ResultSet rs2;
  79.   rs2=mdb.executeQuery(sql3);
  80.   int totalcash=0;
  81.       if(!rs2.next())
  82.   out.print("你没有订购任何商品");
  83.       else{
  84.   rs2.previous();
  85.   while(rs2.next()){
  86.   String h_cash=rs2.getString("hw_cash");
  87.   String b_count=rs2.getString("basket_count");
  88.   int h_c=Integer.parseInt(h_cash);
  89.   int b_c=Integer.parseInt(b_count);
  90.       String h_n=rs2.getString("hw_name");
  91.       %>
  92.                       <tr> 
  93.                         <td width="195" height="25"><div align="center"><font color=red><%=h_n%></font></div></td>
  94.                         <td width="60" height="25"><div align="center"><%=h_cash%>元</div></td>
  95.                         <td width="60" height="25"><div align="center"><%=b_count%></div></td>
  96.                         <td width="80" height="25"><div align="center"><%=(h_c*b_c)%>元 
  97.                           </div></td>
  98.                       </tr>
  99.                       <%
  100.   totalcash=totalcash+(h_c*b_c);
  101.   }
  102.   }
  103.       %>
  104.                       <tr> 
  105.                         <td height="25"><div align="center"><b class="dz1">总计:<font color=red><%=totalcash%></font>元</b></div></td>
  106.                         <td height="25" colspan="3"><div align="center"><b class="dz1"> 
  107.                             <input 
  108.       align=absMiddle alt=确认 cache name="B1" 
  109.       src="img/pics/ok.gif" type=image tppabs="" width="45" height="20">
  110.                             </b></div></td>
  111.                       </tr>
  112.                     </table>
  113.                       </center>
  114.                   </div>
  115.                     <br> <table width="100%" height="25" border="0" cellpadding="0" cellspacing="0">
  116.                       <tr> 
  117.                         <td valign="middle"><div align="center"><img src="img/pics/seperator.gif" width="359" height="1"></div></td>
  118.                       </tr>
  119.                     </table></td></tr>
  120.               </table>
  121.               
  122.             </td>
  123.           </tr>
  124.         </table>
  125.       </form></td>
  126.   </tr>
  127. </table>
  128. <%}
  129. mdb.Close();
  130. %>