home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
DOS/V Power Report 1997 March
/
VPR9703A.ISO
/
MS_DEV
/
VID
/
SERVER
/
ASF
/
DATA.Z
/
check_out.asp
< prev
next >
Wrap
Text File
|
1996-10-28
|
9KB
|
284 lines
<!--#include virtual="/AdvWorks/Num2Dolr.inc"-->
<%
iCount = Session("ItemCount")
ARYshoppingcart = Session("MyShoppingCart")
If Request.QueryString("ProductCode") <> "" Then
iCount = iCount + 1
Session("ItemCount") = iCount
SQLcatalog_item = "SELECT ProductID, ProductCode, ProductName, ProductDescription, UnitPrice, OnSale FROM Products WHERE {fn UCASE(ProductCode)} = '" & Ucase(Request.QueryString("ProductCode")) & "'"
Set RScatalog_item = Conn.Execute(SQLcatalog_item)
If Not IsEmpty(RScatalog_item) Then
ARYshoppingcart(1,iCount) = "CHECKED"
ARYshoppingcart(2,iCount) = RScatalog_item("ProductCode")
ARYshoppingcart(3,iCount) = RScatalog_item("ProductName")
ARYshoppingcart(4,iCount) = RScatalog_item("ProductDescription")
ARYshoppingcart(5,iCount) = " "
ARYshoppingcart(6,iCount) = " "
ARYshoppingcart(7,iCount) = 1
If RScatalog_item("OnSale") Then
ARYshoppingcart(8,iCount) = RScatalog_item("UnitPrice") - (RScatalog_item("UnitPrice") * 0.1)
Else
ARYshoppingcart(8,iCount) = RScatalog_item("UnitPrice")
End If
ARYshoppingcart(9,iCount) = RScatalog_item("ProductID")
Session("MyShoppingCart") = ARYshoppingcart
End If
End If
SELECT CASE Request("Action")
CASE "Shop for More"
For i = 1 to iCount
ARYshoppingcart(5,i) = Request("Color" & CStr(i))
ARYshoppingcart(6,i) = Request("Size" & CStr(i))
If IsNumeric(Request("Quantity" & CStr(i))) Then
ARYshoppingcart(7,i) = Request("Quantity" & CStr(i))
Else
ARYshoppingcart(7,i) = 1
End If
Next
Session("MyShoppingCart") = ARYshoppingcart
Response.Redirect "/AdvWorks/equipment/default.asp"
CASE "Recalculate"
For i = 1 to iCount
ARYshoppingcart(5,i) = Request("Color" & CStr(i))
ARYshoppingcart(6,i) = Request("Size" & CStr(i))
ARYshoppingcart(7,i) = Request("Quantity" & CStr(i))
Next
For i = 1 to iCount
If Request("Confirm" & CStr(i)) = "" Then
iCount = iCount - 1
For x = 1 to UBound(ARYshoppingcart,1)
ARYshoppingcart(x,i) = ""
Next
n = i
while n < UBound(ARYshoppingcart,2)
For x = 1 to UBound(ARYshoppingcart,1)
ARYshoppingcart(x,n) = ARYshoppingcart(x,n + 1)
ARYshoppingcart(x,n + 1) = ""
Next
n = n + 1
wend
End If
Next
Session("MyShoppingCart") = ARYshoppingcart
Session("ItemCount") = iCount
CASE "Cancel Order"
iCount = 0
Session("ItemCount") = iCount
Response.Redirect "/AdvWorks/equipment/default.asp"
CASE "Click to Pay"
ARYshoppingcart(5,iCount) = Request("Color" & CStr(iCount))
ARYshoppingcart(6,iCount) = Request("Size" & CStr(iCount))
If IsNumeric(Request("Quantity" & CStr(iCount))) Then
ARYshoppingcart(7,iCount) = Request("Quantity" & CStr(iCount))
Else
ARYshoppingcart(7,iCount) = 1
End If
Session("MyShoppingCart") = ARYshoppingcart
' Check if new customer
CustomerID = Session("CustomerID")
if CustomerID = 0 then ' new customer
Response.Redirect "/AdvWorks/Equipment/GetCustomer.asp"
else
' First check to ensure that the customer was not removed from the database
Set rs = Conn.Execute( _
"select CompanyName " & _
"FROM Customers " &_
"where CustomerID = " & CustomerID & _
" and ContactFirstName = '" & Session("CustomerFirstName") & "'")
if rs.EOF then
Session("CustomerID") = -1 ' This means the user WAS in the database at one time, but isn't now
rs.Close
Response.Redirect "/AdvWorks/Equipment/GetCustomer.asp"
end if
Response.Redirect "/AdvWorks/equipment/shipping.asp"
end if
CASE ELSE
' Response.Redirect "/AdvWorks/Equipment/default.asp"
END SELECT
%>
<HTML>
<HEAD>
<TITLE>Adventure Works - Shopping Cart</TITLE>
</HEAD>
<BODY BACKGROUND="/AdvWorks/multimedia/images/back_sub.gif" LINK="#800000" VLINK="#008040">
<FONT FACE="MS SANS SERIF" SIZE=2>
<BGSOUND SRC="/AdvWorks/multimedia/sounds/cash_register.wav">
<TABLE BORDER=0>
<TR>
<TD WIDTH=30>
<IMG SRC="/AdvWorks/multimedia/images/spacer.GIF" ALIGN=RIGHT ALT="Space">
</TD>
<TD COLSPAN=5>
<IMG SRC="/AdvWorks/multimedia/images/hd_Check_out.gif" width="250" height="42" ALT="Check Out">
<HR SIZE=4>
</TD>
</TR>
<!-- BEGIN sidebar navigation -->
<TR>
<TD ROWSPAN=20 ALIGN=LEFT VALIGN=TOP>
<IMG SRC="/AdvWorks/multimedia/images/spacer.gif" WIDTH=120 ALT="Space">
</TD>
<TD>
<!-- BEGIN table inserted into table data cell --><!-- BEGIN form with first row of data -->
<FORM ACTION="/AdvWorks/equipment/check_out.asp?" METHOD=POST>
<Table COLSPAN=8 CELLPADDING=5 BORDER=0>
<!-- BEGIN column header row -->
<TR>
<TD ALIGN=CENTER BGCOLOR="#800000">
<FONT STYLE="ARIAL NARROW" COLOR="#ffffff" SIZE=1>Confirm</FONT>
</TD>
<TD ALIGN=CENTER BGCOLOR="#800000">
<FONT STYLE="ARIAL NARROW" COLOR="#ffffff" SIZE=1>Product Code</FONT>
</TD>
<TD ALIGN=CENTER BGCOLOR="#800000">
<FONT STYLE="ARIAL NARROW" COLOR="#ffffff" SIZE=1>Product Name</FONT>
</TD>
<TD ALIGN=CENTER WIDTH=150 BGCOLOR="#800000">
<FONT STYLE="ARIAL NARROW" COLOR="#ffffff" SIZE=1>Description</FONT>
</TD>
<!--
<TD ALIGN=CENTER BGCOLOR="#800000">
<FONT STYLE="ARIAL NARROW" COLOR="#ffffff" SIZE=1>Color</FONT>
</TD>
<TD ALIGN=CENTER BGCOLOR="#800000">
<FONT STYLE="ARIAL NARROW" COLOR="#ffffff" SIZE=1>Size</FONT>
</TD>
-->
<TD ALIGN=CENTER BGCOLOR="#800000">
<FONT STYLE="ARIAL NARROW" COLOR="#ffffff" SIZE=1>Quantity</FONT>
</TD>
<TD ALIGN=CENTER BGCOLOR="#800000">
<FONT STYLE="ARIAL NARROW" COLOR="#ffffff" SIZE=1>Unit Price</FONT>
</TD>
</TR>
<%
iSubtotal = 0
For i = 1 to iCount
%>
<!-- BEGIN first row of inserted product data -->
<TR>
<TD ALIGN=CENTER BGCOLOR="f7efde">
<%If ARYshoppingcart(1,i) = "CHECKED" Then%>
<INPUT TYPE="CHECKBOX" NAME=<%Response.Write "Confirm" & CStr(i)%> VALUE="Confirmed" CHECKED> <%End If%>
</TD>
<TD BGCOLOR="f7efde" ALIGN=CENTER>
<FONT STYLE="ARIAL NARROW" SIZE=1><%=ARYshoppingcart(2,i)%></FONT>
</TD>
<TD BGCOLOR="f7efde" ALIGN=CENTER>
<FONT STYLE="ARIAL NARROW" SIZE=1><%=ARYshoppingcart(3,i)%></FONT>
</TD>
<TD BGCOLOR="f7efde" ALIGN=LEFT WIDTH=150>
<FONT STYLE="ARIAL NARROW" SIZE=1><%=ARYshoppingcart(4,i)%></FONT>
</TD>
<!--
<TD BGCOLOR="f7efde" ALIGN=CENTER>
<%If ARYshoppingcart(1,i) = "CHECKED" Then%>
<FONT STYLE="ARIAL NARROW" SIZE=1><INPUT TYPE=TEXT NAME=<%Response.Write "Color" & CStr(i)%> VALUE="<%=ARYshoppingcart(5,i)%>" SIZE=10></FONT>
<%End If%>
</TD>
<TD BGCOLOR="f7efde" ALIGN=CENTER>
<%If ARYshoppingcart(1,i) = "CHECKED" Then%>
<FONT STYLE="ARIAL NARROW" SIZE=1><INPUT TYPE=TEXT NAME=<%Response.Write "Size" & CStr(i)%> VALUE="<%=ARYshoppingcart(6,i)%>" SIZE=2></FONT>
<%End If%>
</TD>
-->
<TD BGCOLOR="f7efde" ALIGN=CENTER>
<%If ARYshoppingcart(1,i) = "CHECKED" Then%>
<FONT STYLE="ARIAL NARROW" SIZE=1><INPUT TYPE=TEXT NAME=<%Response.Write "Quantity" & CStr(i)%> VALUE="<%=ARYshoppingcart(7,i)%>" SIZE=2></FONT>
<%End If%>
</TD>
<TD BGCOLOR="f7efde" ALIGN=RIGHT>
<FONT STYLE="ARIAL NARROW" SIZE=1><%=Num2Dollars(ARYshoppingcart(8,i))%></FONT>
</TD>
</TR>
<%
If (ARYshoppingcart(8,i)) <> "" Then
iSubTotal = iSubtotal + (ARYshoppingcart(8,i) * ARYshoppingcart(7,i))
End If
Next
%>
<!-- BEGIN subtotal -->
<TR>
<TD COLSPAN=4></TD>
<TD BGCOLOR="f7efde" ALIGN=LEFT><FONT STYLE="ARIAL NARROW" COLOR="#800000" SIZE=1>Subtotal:</FONT></TD>
<TD BGCOLOR="f7efde" ALIGN=RIGHT><FONT STYLE="ARIAL NARROW" SIZE=1><%=Num2Dollars(iSubtotal)%></FONT></TD>
</TR>
<TR>
<TD ALIGN=RIGHT COLSPAN=3></TD>
<TD COLSPAN=5 ALIGN=RIGHT>
<%If iCount < 5 Then%>
<INPUT TYPE=SUBMIT NAME="Action" VALUE="Shop for More">
<%End If%>
<%If iCount > 0 Then%>
<INPUT TYPE=SUBMIT NAME="Action" VALUE="Click to Pay">
<INPUT TYPE=SUBMIT NAME="Action" VALUE="Recalculate">
<%End If%>
<INPUT TYPE=SUBMIT NAME="Action" VALUE="Cancel Order">
</TD>
</TR>
</TABLE>
</FORM>
<!-- END table inserted into table data cell -->
</TD>
<% REM Column Span Value %>
<% HTML_CS = 5 %>
<% HTML_INDENT = FALSE %>
<!--#include virtual="/AdvWorks/Disclaim.inc"-->
</TABLE>
<!--#include virtual="/AdvWorks/srcform.inc"-->
</BODY>
</HTML>