%@ LANGUAGE="VBScript" %>
<% Response.AddHeader "cache-control", "private" %>
<% Response.AddHeader "pragma", "no-cache" %>
<% Response.Expires = 0 %>
<%
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' System : StoreFront 2000 Version 4.04.1
' Date : 2.24.2000
' Author : LaGarde, Incorporated
' Description : StoreFront Customer Order Tracking Routines
' Notes : There are no configurable elements in this file.
'
' COPYRIGHT NOTICE
'
' The contents of this file is protected under the United States
' copyright laws as an unpublished work, and is confidential and
' proprietary to LaGarde, Incorporated. Its use or disclosure in
' whole or in part without the expressed written permission of
' LaGarde, Incorporated is expressely prohibited.
'
' (c) Copyright 1998 by LaGarde, Incorporated. All rights reserved.
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
%>
<%
Dim DSN_Name
DSN_Name = Session("DSN_Name")
set Connection = Server.CreateObject("ADODB.Connection")
Connection.Open DSN_Name
ORDER_ID = Trim(Session("ORDER_ID"))
Cust_ID = Trim(Request.Cookies("CustID"))
session.LCID = Session("LCID")
%>
<%
SQL = "SELECT GRAND_TOTAL from customer WHERE " _
& " CUSTOMER_ID = " & ORDER_ID & ""
Set RSOrderCheck = Connection.Execute(SQL)
If FormatCurrency(RSOrderCheck("GRAND_TOTAL")) > FormatCurrency("0") Then
Set RSOrderCheck = nothing
Connection.Close
Set Connection = nothing
Response.Redirect "order_complete.asp"
End If
'***** MODIFY ITEMS IN CURRENT ORDER *****************************
If Request("MODIFY") = "1" Then
SQL = " SELECT PRICE, DESCRIPTION, SHIP, WEIGHT FROM PRODUCT WHERE " _
& " PRODUCT_ID = '" & Request("PRODUCT_ID") & "' "
set RSUpdt = Connection.Execute(SQL)
SQL = "UPDATE ORDERS SET QUANTITY = " & Request("QUANTITY") & ", " _
& " SHIP = '" & XValAmt((RSUpdt("SHIP")*Request("Quantity"))) & "', " _
& " TOTAL = '" & XValAmt((RSUpdt("Price")*Request("Quantity"))) & "', " _
& " WEIGHT = '" & ((RSUpdt("WEIGHT"))*Request("Quantity")) & "' " _
& " WHERE ORDERS.ID = " & Request("ID") & " "
'response.write SQL
set RSMod = Connection.Execute(SQL)
Set RSMod = nothing
Set RSUpdt = nothing
'***** RE-ORDER ITEMS IN PREVIOUS ORDER *****************************
ElseIf Request("RE-ORDER") = "1" Then
For Each element In Request.Form
If InStr(element,"PRODUCT_ID") Then
PROD_NAME = element
End If
Next
PRODUCT_ID = Request(""&PROD_NAME&"")
SQLStmt = " SELECT PRICE, DESCRIPTION, MESSAGE, WEIGHT, SHIP FROM PRODUCT WHERE "
SQLStmt = SQLStmt & " PRODUCT_ID = '" & PRODUCT_ID & "' "
Set RSOrder = Connection.Execute(SQLStmt)
DESCRIPTION = RSOrder("DESCRIPTION")
WEIGHT = RSOrder("WEIGHT")
SHIP = RSOrder("SHIP")
ProdPrice = RSOrder("Price")
Set RSOrder = nothing
ExtPrice =(XValAmt(ProdPrice)*Request("Quantity"))
ExtWeight = (XValAmt(WEIGHT)*Request("Quantity"))
ExtShip = (XValAmt(SHIP)*Request("QUANTITY"))
AttA = Trim(Replace(Request("AttributeA"),"'","''"))
AttB = Trim(Replace(Request("AttributeB"),"'","''"))
AttC = Trim(Replace(Request("AttributeC"),"'","''"))
SQL = "SELECT * FROM orders WHERE (PRODUCT_ID = '" & PRODUCT_ID & "' AND"_
&" ORDER_ID = " & Session("ORDER_ID") & ""_
&" AND ATTRIBUTEA = '"& AttA & "' AND ATTRIBUTEB = '"& AttB &"' AND" _
&" ATTRIBUTEC = '"& AttC &"')"
Set RSOrdChk = Connection.Execute(SQL)
If (RSOrdChk.BOF AND RSOrdChk.EOF) Then
SQL = "INSERT INTO ORDERS(ORDER_ID, PRODUCT_ID," _
& " DESCRIPTION, ATTRIBUTEA, ATTRIBUTEB, ATTRIBUTEC, QUANTITY, WEIGHT, SHIP, PRICE, TOTAL) " _
& " VALUES(" & Session("ORDER_ID") & "," _
& " '" & PRODUCT_ID & "', '" & DESCRIPTION & "'," _
& " '" & AttA & "', '" & AttB & "', '" & AttC & "', "_
& " " & Request("Quantity") & "," _
& " '" & ExtWeight & "', '" & ExtShip & "', " _
& " '" & ProdPrice & "'," _
& " '" & FormatCurrency(ExtPrice) & "')"
Set RSAddProd = Connection.Execute(SQL)
ElseIf ((Trim(RSOrdChk("ATTRIBUTEA")) <> AttA) OR (Trim(RSOrdChk("ATTRIBUTEB")) <> AttB) OR (Trim(RSOrdChk("ATTRIBUTEC")) <> AttC)) Then
SQL = "INSERT INTO ORDERS(ORDER_ID, PRODUCT_ID," _
& " DESCRIPTION, ATTRIBUTEA, ATTRIBUTEB, ATTRIBUTEC, QUANTITY, WEIGHT, SHIP, PRICE, TOTAL) " _
& " VALUES(" & Session("ORDER_ID") & "," _
& " '" & PRODUCT_ID & "', '" & DESCRIPTION & "'," _
& " '" & AttA & "', '" & AttB & "', '" & AttC & "', "_
& " " & Request("Quantity") & "," _
& " '" & ExtWeight & "', '" & ExtShip & "', " _
& " '" & ProdPrice & "'," _
& " '" & ExtPrice & "')"
Set RSAddProd = Connection.Execute(SQL)
ElseIf ((Trim(RSOrdChk("ATTRIBUTEA")) = AttA and Trim(RSOrdChk("ATTRIBUTEB")) = AttB and Trim(RSOrdChk("ATTRIBUTEC")) = AttC) AND RSOrdChk("PRODUCT_ID") = PRODUCT_ID) Then
Set RSOrdChk = nothing
SQL = "SELECT Sum(QUANTITY) AS OrdQuan, Sum(TOTAL) AS OrdTotal, Sum(WEIGHT) AS OrdWt, Sum(SHIP) As OrdShip FROM orders " _
& "WHERE (PRODUCT_ID = '" & PRODUCT_ID & "' AND ORDER_ID = " & Session("ORDER_ID") & " "_
&" AND ATTRIBUTEA = '"& AttA & "' AND ATTRIBUTEB = '"& AttB &"' AND ATTRIBUTEC = '"& AttC &"')"
Set RSOrdUpdt = Connection.Execute(SQL)
UpdtQnty = ((RSOrdUpdt("OrdQuan"))+(Request("Quantity")))
UpdtExtPrice = (XValAmt(RSOrdUpdt("OrdTotal"))+(ExtPrice))
UpdExtWeight = XValAmt(RSOrdUpdt("OrdWt")+ExtWeight)
UpdExtShip = XValAmt(RSOrdUpdt("OrdShip")+ExtShip)
SQL = "UPDATE orders SET QUANTITY = '" & UpdtQnty & "', PRICE = '" & ProdPrice & "', TOTAL = '" & UpdtExtPrice & "',"_
& " WEIGHT = '" & UpdExtWeight & "', SHIP = '" & ValAmt(UpdExtShip) & "' WHERE (PRODUCT_ID = '" & PRODUCT_ID & "' AND ORDER_ID = " & Session("ORDER_ID") & " "_
&" AND ATTRIBUTEA = '"& AttA & "' AND ATTRIBUTEB = '"& AttB &"' AND ATTRIBUTEC = '"& AttC &"')"
Set RSUpdtProd = Connection.Execute(SQL)
Set RSUpdtProd = nothing
End If
If Request.Cookies("CUSTID") <> "" Then
SQL = "SELECT GRAND_TOTAL FROM customer WHERE CUSTOMER_ID = " & Request.Cookies("CUSTID") & ""
set RSOrderCheck = Connection.Execute(SQL)
If Not RSOrderCheck.EOF Then
If FormatCurrency(RSOrderCheck("GRAND_TOTAL")) = FormatCurrency("0") Then
Set RSOrderCheck = nothing
SQL = "DELETE * FROM ORDERS WHERE ID = " & Request("ID") & ""
Set RSDel = Connection.Execute(SQL)
End If
End If
End If
'***** DELETE ITEMS FROM CURRENT ORDER *******************
ElseIf Request("DELETE") = "1" Then
SQL = "DELETE * FROM ORDERS WHERE ID = " & Request("ID") & ""
set RSDel = Connection.Execute(SQL)
Set RSDel = nothing
End If
'****** GET RSAdmin DATA *************************
SQL = "SELECT * FROM Admin"
set RSAdmin = Connection.Execute(SQL)
SQL = "SELECT COUNTRY from locales WHERE Country_ABB = " _
& " '" & Trim(RSAdmin("ORIGIN_COUNTRY")) & "' "
Set RSDefCountry = Connection.Execute(SQL)
'***** SET RSAdmin VARIABLES **********************
'***** SET RSAdmin VARIABLES **********************
SSLPath = Trim(RSAdmin("SSL_PATH"))
OCountry = Trim(RSAdmin("ORIGIN_COUNTRY"))
OZip = Trim(RSAdmin("ORIGIN_ZIP"))
ShipType = Trim(RSAdmin("SHIP_TYPE"))
Handling = Trim(RSAdmin("HANDLING"))
DefCountry = Trim(RSDefCountry("COUNTRY"))
DefCountryAbb = Trim(RSAdmin("ORIGIN_COUNTRY"))
CODAmt = Trim(RSAdmin("COD_AMOUNT"))
ShipMin = Trim(RSAdmin("SHIP_MIN"))
HandlingSwitch = Trim(RSAdmin("HANDLINGSWITCH"))
COD = Trim(RSAdmin("COD"))
CREDIT = Trim(RSAdmin("CREDIT"))
PO = Trim(RSAdmin("PO"))
ECHECK = Trim(RSAdmin("ECHECK"))
PHONEFAX = Trim(RSAdmin("PHONEFAX"))
INTERNETCASH = Trim(RSAdmin("INTERNET_CASH"))
UseCookies = Trim(RSAdmin("COOKIES"))
set RSAdmin = nothing
'****** GET ORDER DETAIL **************************
If Request.Cookies("CustID") <> "" Then
CUST_ID = Request.Cookies("CustID")
SQL = "SELECT ORDERS.PRODUCT_ID, " _
& "ORDERS.PRICE, ORDERS.ATTRIBUTEA, ORDERS.ATTRIBUTEB, ORDERS.ATTRIBUTEC, " _
& "ORDERS.TOTAL, PRODUCT.WEIGHT, " _
& "ORDERS.QUANTITY, ORDERS.ID, ORDERS.DESCRIPTION " _
& "FROM ORDERS, PRODUCT " _
& "WHERE (ORDERS.ORDER_ID = " & CUST_ID & " " _
& "AND ORDERS.PRODUCT_ID = PRODUCT.PRODUCT_ID)"
set CustOrder = Connection.Execute(SQL)
End If
SQL = "SELECT ORDERS.PRODUCT_ID, " _
& "ORDERS.PRICE, ORDERS.ATTRIBUTEA, ORDERS.ATTRIBUTEB, ORDERS.ATTRIBUTEC, " _
& "ORDERS.TOTAL, PRODUCT.WEIGHT, " _
& "ORDERS.QUANTITY, ORDERS.ID, ORDERS.DESCRIPTION " _
& "FROM ORDERS, PRODUCT " _
& "WHERE (ORDERS.ORDER_ID = " & ORDER_ID & " " _
& "AND ORDERS.PRODUCT_ID = PRODUCT.PRODUCT_ID)"
set RSOrder = Connection.Execute(SQL)
If NOT RSOrder.EOF Then
'****** GET COUNTRIES FOR SHIP TO LIST **********************
SQL = "SELECT country, country_abb FROM locales WHERE (active = '1' " _
& "AND country <> NULL)ORDER BY country ASC"
set RSCountry = Connection.Execute (SQL)
'****** GET STATES FOR SHIP TO LIST *************************
SQL = "SELECT state, state_abb FROM locales WHERE (active = '1' " _
& "AND state <> NULL)ORDER BY state ASC"
set RSState = Connection.Execute (SQL)
'***** CHECK FOR HANDLING CHARGE EXEMPT ORDER **************************
SQL = "SELECT Count(product.PRODUCT_ID) AS CntShipExempt FROM product, orders WHERE (orders.PRODUCT_ID = "_
& "product.PRODUCT_ID AND ORDERS.ORDER_ID = " & ORDER_ID & " AND product.SHIPSWITCH = '1')"
Set RSCheckShip = Connection.Execute(SQL)
'***** CHECK FOR SHIP EXEMPT ORDER **************************
If RSCheckShip("CntShipExempt") > 0 Then 'There are items to be shipped
ApplyShipping = 1 'Show Shipping
SQL = "SELECT METHODS, CODE from shipping WHERE ACTIVE = '1'"
set RSShipMeth = Connection.Execute (SQL)
Else 'There are NO items that are being shipped
ApplyShipping = 0 'Don't Show Shipping
End If
Set RSCheckShip = nothing
End If
%>
<%
If Request.Cookies("CustID") = "" Then
%>
>
bordercolor=<%=BorderColor%> cellpadding=<%=CellPadding%> cellspacing=<%=CellSpacing%> width=<%=TableWidth%> bgcolor=<%=TableBG%>>
| <%=CellFontStyle%> color=<%=CellFontColor%> size=<%=FontSize%>>There are no previous orders available. |
<%
ElseIf Request.Cookies("CustID") <> "" Then
If Not (RSOrder.EOF AND RSOrder.BOF) Then
RSID = RSOrder("ID")
End If
If Not (CustOrder.EOF AND CustOrder.BOF) Then
COID = CustOrder("ID")
End If
If RSID <> COID Then
%>
>
bordercolor=<%=BorderColor%> cellpadding=<%=CellPadding%> cellspacing=<%=CellSpacing%> width=<%=TableWidth%> bgcolor=<%=TableBG%>>
| <%=CellFontStyle%> color=<%=CellFontColor%> size=<%=FontSize%>>Your Last Order |
| <%=CellFontStyle%> color=<%=CellFontColor%> size=<%=FontSize%>><%If lblDescriptionActive = "1" Then%><%=lblDescription%><%Else%>Description<%End If%> |
<%=CellFontStyle%> color=<%=CellFontColor%> size=<%=FontSize%>><%If lblPriceActive = "1" Then%><%=lblPrice%><%Else%>Price<%End If%> |
<%=CellFontStyle%> color=<%=CellFontColor%> size=<%=FontSize%>>Quantity |
<%=CellFontStyle%> color=<%=CellFontColor%> size=<%=FontSize%>>Total |
<%=CellFontStyle%> color=<%=CellFontColor%> size=<%=FontSize%>>Re-Order |
<%
CurrentRecord = 0
Do While NOT CustOrder.EOF
%>
<% End If %>
<%
If Not (RSOrder.EOF and RSOrder.BOF) Then
%>
<%
If Not(RSOrder.EOF AND RSOrder.BOF) Then
RSOrder.MoveFirst
End If
If Not(CustOrder.EOF AND CustOrder.BOF) Then
CustOrder.MoveFirst
End If
%>
<%
ElseIf (RSOrder.EOF and RSOrder.BOF) Then
If Request.Cookies("CustID") <> "" Then
If (CustOrder.EOF AND CustOrder.BOF) Then
Set CustOrder = nothing
%>
>
bordercolor=<%=BorderColor%> cellpadding=<%=CellPadding%> cellspacing=<%=CellSpacing%> width=<%=TableWidth%> bgcolor=<%=TableBG%>>
| <%=CellFontStyle%> color=<%=CellFontColor%> size=<%=FontSize%>>There are no previous orders available. |
<%
End If
End If
End If
%>
<%
Connection.Close
Set Connection = Nothing %>