📄 checkout_ok.asp
字号:
<%@LANGUAGE="VBSCRIPT"%>
<!--#include file="Connections/conn.asp" -->
<%
Set rs_grade = Server.CreateObject("ADODB.Recordset")
sql_grade= "SELECT grade FROM DB_Member WHERE ID = '" +_
Replace(session("UserID"), "'", "''") + "'"
rs_grade=conn.execute(sql_grade)
session("grade")=""
session("grade")=Replace(rs_grade("grade"), "'", "''")
Set rs_rebate = Server.CreateObject("ADODB.Recordset")
sql_rebate= "SELECT rebate FROM DB_rebate WHERE grade = '" +_
session("grade") + "'"
rs_rebate.open sql_rebate,conn,3
%>
<%
set rs_max= Server.CreateObject("ADODB.RecordSet")
sql_max="select MAX(OrderID) AS MAXID from DB_sell"
rs_max=conn.execute(sql_max)
%>
<%
sql = "Select * From DB_bookinfo Where BookID In (" & session("checkBook") & ")"
Set rs_C = conn.Execute( sql )
%>
<% no=trim(rs_max("MaxID"))
if len(month(date()))=1 then
cmonth="0"& cstr(month(date()))
else
cmonth=cstr(month(date()))
end if
if len(day(date()))=1 then
cday="0"& cstr(day(date()))
else
cday=cstr(day(date()))
end if
select case len(int(Right(no,5)+1))
case 1
cno="0000"+Cstr(int(Right(no,5)+1))
case 2
cno="000"+Cstr(int(Right(no,5)+1))
case 3
cno="00"+Cstr(int(Right(no,5)+1))
case 4
cno="0"+Cstr(int(Right(no,5)+1))
case 5
cno=Cstr(int(Right(no,5)+1))
case Else
cno="00001"
end select
intno=cStr(Year(Date()))& cmonth& cday&cno
%>
<%
ASL=""
ASL=split(session("sl"),",")
i=0
sum=0
shuliang=0
while not rs_C.eof
bookID=rs_C("BookID")
bookName=rs_C("BookName")
price=rs_C("price")
paSL=cInt(ASL(i))
sum_1=sum_1+rs_C("price")*ASL(i)
booksum=rs_C("price")*ASL(i)*CSng(left(rs_rebate("rebate"),len(rs_rebate("rebate"))-1))/10
sum=sum+booksum
oDate=now()
parID=Session("UserID")
sql_Ins="insert into DB_sell(OrderID,BookID,BookName,Price,bnumber,sum,HYID,OrderDate)"&_
"values('"&intno&"','"&bookID&"','"&bookName&"',"&price&","&paSL&","&booksum&_
",'"&parID&"',#"&oDate&"#)"
conn.execute sql_Ins
sql_update="select * from DB_sellsum where BookID='"&bookID&"'"
set rs_update=conn.execute (sql_update)
if rs_update.eof then
sql_num="insert into DB_sellsum(BookID,BookName,bnumber) values('"&bookID&_
"','"&bookName&"',"&paSL&")"
conn.execute sql_num
else
sql_num="update DB_sellsum set bnumber=bnumber+"&paSL&" where BookID='"&bookID&"'"
conn.execute sql_num
end if
i=i+1
rs_C.movenext
wend %>
<%
sql="update DB_member set amount=amount+ "&sum&" where ID= '"&parID&"'"
conn.execute sql
'自动更新会员等级
autosql="select grade,amount from DB_member where ID= '"&parID&"'"
set rs_auto=conn.execute (autosql)
samount=rs_auto("amount")
sql_rebate="select* from DB_rebate"
set rs_rebateall=conn.execute (sql_rebate)
rs_rebateall.movefirst
bz=0
while not rs_rebateall.eof
if samount>rs_rebateall("sum") then
newgrade=rs_rebateall("grade")+1
bz=1
else
if bz=0 then newgrade=0
end if
rs_rebateall.movenext
wend
if newgrade>4 then newgrade=4
sql_newgrade="update DB_member set grade='"&newgrade&"' where ID= '"&parID&"'"
conn.execute sql_newgrade
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>收银台结账!</title>
<link href="style.css" rel="stylesheet">
</head>
<body leftmargin="0" topmargin="0">
<table width="640" height="133" border="0" cellpadding="-1" cellspacing="-1">
<tr>
<td background="images/checkout_top.jpg"> </td>
</tr>
</table>
<table width="640" height="341" border="0" cellpadding="-1" cellspacing="-1">
<tr>
<td valign="top" background="images/buycar_bottom.jpg"> <div align="center">
<form name="form1" method="POST">
<table width="97%" height="153" border="0" cellpadding="-1" cellspacing="-1">
<tr>
<td height="71">
<div align="center"><strong><font color="#C60001" size="3">
您本次购物享受<%=(rs_rebate.Fields.Item("rebate").Value)%>优惠!<br>
您本次消费金额为<%= sum_1%>元,实际应付费用<%=sum%>元。</font>
</strong> <strong><font color="#C60001" size="3"></font></strong></div></td>
</tr>
<tr>
<td><div align="center"><strong><font color="#C60001" size="3">
结账已经完成,欢迎下次惠顾!</font></strong></div></td>
</tr>
</table>
</form>
<a href="#" onClick="JScript:window.close();"><img src="images/register_back.gif"
width="81" height="36" border="0"></a></div></td>
</tr>
</table>
</body>
</html>
<%session.Abandon()%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -