?? ordersent.asp
字號:
<!--#include file="../Comm/subconn.asp" -->
<%
Name=session("estore_userid") '登陸用戶id
RecName=request.form("RecName") '必填字段
RecPhone=request.form("RecPhone") '必填字段
RecAddress=request.form("RecAddress") '必填字段
PayType=request.form("PayType") '必填字段
Notes=request.form("Notes") '
Recmail=request.form("Recmail") '
RecTime=request.form("RecTime") '
Zipcode=request.form("ZipCode") '
Discount=request.form("Discount") '
if Name="" then Name="游客"
if reg<>"1" then
'判斷是否正常購買,如果不是,需要登陸
if session("estore_userid")="" then
response.redirect "../error.asp?error=006"
response.end
end if
end if
'判斷購物車是否為空
ProductList = Session("ProductList")
if productlist="" then
response.redirect "../error.asp?error=007"
response.end
else
sql="select * from ProdMain where ProdId in ("&productlist&") order by ProdId"
Set rs = conn.Execute( sql )
end if
'如果沒有購買任何物品的出錯處理
if session("sum")="" then response.redirect "../error.asp?error=007"
Total=session("sum")
'產生訂單號(內部和外部)及定單產生日期及其他信息
BranchID="0022"
CoNo="000040"
'交易日期,格式:YYYYMMDD
yy=right(year(date),2)
mm=right("00"&month(date),2)
dd=right("00"&day(date),2)
riqi=yy & mm & dd
'生成訂單號所有所需元素,格式為:小時,分鐘,秒
xiaoshi=right("00"&hour(time),2)
fenzhong=right("00"&minute(time),2)
miao=right("00"&second(time),2)
'產生外部和內部定單號
BillNo=xiaoshi & fenzhong & miao
inBillNo=yy & mm & dd & "-" & xiaoshi & fenzhong & miao
'初始化用戶選擇的支付方式,產生對用戶的反饋信息
paytype=request("PayType")
sqlp="select * from paydefault where paytype='"&paytype&"'"
set rsp=server.createobject("adodb.recordset")
rsp.open sqlp,conn,1,1
payurl=rsp("payurl")
if rsp("paymark")="1" then message="<br><a href='"&payurl&"' target=_blank>點此開始在線支付<br><br>"
Set rsadd=server.createobject("adodb.recordset")
rsadd.Open "OrderList" ,conn,3,3
Set rsdetail=server.createobject("adodb.recordset")
rsdetail.Open "OrderDetail" ,conn,3,3
'事務定義開始
conn.Begintrans
'操作之一開始寫入訂單列表信息
rsadd.AddNew
rsadd("UserId")=Name
rsadd("OrderNum")=inBillNo
rsadd("RecName")=RecName
rsadd("OrderSum")=Total
rsadd("RecPhone")=RecPhone
rsadd("RecAddress")=RecAddress
if ZipCode<>"" then rsadd("ZipCode")=ZipCode
if RecTime<>"" then rsadd("RecTime")=RecTime
if Recmail<>"" then rsadd("Recmail")=Recmail
if Discount="" then Discount=0
rsadd("Discount")=Discount
rsadd("PayType")=PayType
if Notes<>"" then rsadd("Notes")=Notes
if error>0 then
response.write " 操作訂單列表生成錯誤!!"
return
end if
rsadd.Update
'擦作二訂單詳細信息寫入另外的表中
Sum = 0
While Not rs.EOF '把購買的產品資料讀出來,寫入定單詳細資料表中
Quatity = CInt( Request( "Q_" & rs("ProdId")) )
If Quatity <= 0 Then
Quatity = CInt( Session(rs("ProdId")) )
If Quatity <= 0 Then Quatity = 1
End If
Session(rs("ProdName")) = Quatity
Sum = Sum + csng(rs("PriceList")) * Quatity
Sum = FormatNumber(Sum,2)
rsdetail.AddNew
if Name<>"" then rsdetail("UserId")=Name '下單用戶號
rsdetail("OrderNum")=inBillNo '訂單號碼
rsdetail("ProdId")=rs("ProdId") '產品編碼
rsdetail("ProdUnit")=Quatity '購買數量
rsdetail("BuyPrice")=rs("PriceList")'購買單價
IF ERROR>0 THEN
response.write "操作訂單詳細信息表生成錯誤!!"
RETURN
END if
rsdetail.Update
rs.MoveNext
Wend
'事務操作結束
conn.CommitTrans
rsdetail.close
set rsdetail=nothing
rsadd.close
set rsadd=nothing
Conn.Close
Session("ProductList") = ""
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>訂單提交成功</TITLE>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="../shop.css" type="text/css">
</HEAD>
<BODY>
<table border="0" cellspacing="1" cellpadding="0" align="center" valign=absmiddle width="100%" height="100%" bgcolor="B0266D">
<tr bgcolor="eeeeee">
<td bgcolor="eeeeee" align="center"><font color="B0266D">您的訂單提交成功,請您記住您的訂單號碼。<br></font></td>
</tr> <tr bgcolor="#FFFFFF">
<td width="100%" height="100%" align="center" valign="middle"> <font color="B0266D"><b>謝謝您,您的訂單提交成功!<br>如果您是注冊用戶,您隨時可以進入<a href="../my_accounts.asp">用戶中心</a>查看和修改該訂單<br><br></b></font><b><br>
<br><font color="B0266D">您的訂單號碼是:<b><%=inBillNo%></b><br>
<br>
</font>
<%
response.write message
%>
</b>
<p> </p>
<p><b>
<br><br>
<a href="../my_accounts.asp" target="_blank">進入用戶中心</a>
<a href="../b_about.asp" target="_blank">查看付款方法</a>
<a href="javascript:self.close()">點擊關閉窗口</a></p>
</td>
</tr>
</table>
</BODY>
</HTML>
<%
set conn=nothing
%>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -