<% ' Copyright (C) 1998-2005 Cyberstrong Internet Services, Inc. All Rights Reserved ' ' This file has been seeded with unique information at point of sale and ' is traceable to its purchaser. ' ' Your license agreement forbids the removal of this notice. %> <% ' ' Finish.asp - All done, confirm order ... ' Dim OrderId, rstOrders, rstOrderDetails, rstCustomer Dim ErrorMsg, txtPaymentMethod, txtShippingMethod Dim iShipping, iPayment, iTax1, iTax2, iSubTotal, iGrandTotal Dim arySurvey, iSurvey, SQL, objDownload, pAdvTax Dim rstPaymentMethods, PaymentAuthTime Dim MerchantRequest ' True when page being reviewed for fullfillment Dim ReturnValue ' Used for returning from UserExit Dim PackingSlip ' True when in "packing list" mode ErrorMsg = "" MerchantRequest = False ' Main() - Main entry for this page ... Public Sub Main() ' Is this packing slip mode? PackingSlip = CBool(GetURLValue("PackSlip") = "1") ' Check for home button press which signals the end of this shopping session ... If (GetURLValue("Home") = "1") Then ' We are non-secure again, abandon the original session ... Session.Abandon Response.Redirect(NonSecureURL(cstHomeURL)) End If ' Linked from eMail notification? Get order ID from URL ... If (GetURLValue("OrderID") <> "") Then OrderID = GetURLValue("OrderID") - cstOrderStartNo Else ' No ... get order ID from session ... If (Session(sesInit) = "") Then ' No valid session in shopping cart mode, user may have used back button ' then resubmited ... ErrorMsg = "This order has already been submitted.

Thank you for shopping with us.


" Exit Sub Else ' Confirm no session timeout ... Call ConfirmSessionOk("OrderID") OrderID = Session("OrderID") End If End If If ((InStr(LCase(Session("ReturnTo")), LCase("mOrdRev.asp")) <> 0) OR _ (GetURLValue("OrderID") <> "")) Then MerchantRequest = True End If ' Create a database object and open ... ' Open the database ... Set Conn = dbOpen("rwl") ' Create record sets ... SQL = "SELECT * FROM Orders WHERE OrderId = " & CleanSQL(OrderId, "i") set rstOrders = Server.CreateObject("ADODB.Recordset") rstOrders.Open SQL, Conn, adOpenKeyset, adLockOptimistic ErrorMsg = "Problem: Order ID missing, duplicate, non-numeric or not on file.
Please try again.


" if (rstOrders.RecordCount <> 1) Then Exit Sub SQL = "select * from OrderDetails where OrderID = " & CleanSQL(rstOrders("OrderId"), "i") & " Order By OrderDetailID" set rstOrderDetails = Server.CreateObject("ADODB.Recordset") rstOrderDetails.Open SQL, Conn, adOpenKeyset, adLockOptimistic ErrorMsg = "Problem: No order details.
Please try again.


" if (rstOrderDetails.RecordCount = 0) Then Exit Sub SQL = "select * from Customers where CustomerID = " & CleanSQL(rstOrders("CustomerID"), "i") set rstCustomer = Server.CreateObject("ADODB.Recordset") rstCustomer.Open SQL, Conn, adOpenKeyset, adLockOptimistic ErrorMsg = "Problem: Customer not on file, possibly deleted.
Please try again.


" if (rstCustomer.RecordCount = 0) Then Exit Sub txtPaymentMethod = rstOrders("PaymentMethodDescription") txtShippingMethod = rstOrders("ShippingMethodDescription") & _ IIF(cstDisplayTransitTime And (Not strIsEmpty(rstOrders("TransitTime"))), " (" & Trim(rstOrders("TransitTime")) & ")", "") ' Validate credit card auth code for sale time authorizations... If (Not MerchantRequest) Then Set rstPaymentMethods = Server.CreateObject("ADODB.Recordset") SQL = "SELECT * FROM PaymentMethods WHERE PaymentMethod = '" & CleanSQL(txtPaymentMethod, "a") & "'" rstPaymentMethods.Open SQL, Conn, adOpenKeyset, adLockOptimistic PaymentAuthTime = IIF(rstPaymentMethods.RecordCount = 1, rstPaymentMethods("PaymentAuthTime"), "None") rstPaymentMethods.Close : Set rstPaymentMethods = Nothing If (LCase(PaymentAuthTime) = "sale") Then If (strIsEmpty(rstOrders("CreditCardAuthorizationNumber"))) Then Response.End End If End If End If ' URL request requires order password ... If (GetURLValue("OrderID") <> "") Then If (rstOrders("Password") <> GetURLValue("Password")) Then ErrorMsg = "Problem: Access denied.

" Exit Sub End If End If ' All's well if we got here ... ErrorMsg = "" End Sub ' dbCleanUp() - Clean up database ... Public Function dbCleanUp() Dim rs, SQL On Error Resume Next If (cstOrderDeleteDays > 0) Then set rs = Server.CreateObject("ADODB.Recordset") SQL = "SELECT * FROM Orders WHERE OrderDate < ({fn Now()} - " & CleanSQL(cstOrderDeleteDays, "i") & ")" rs.Open SQL, Conn, adOpenKeyset, adLockOptimistic Do While (Not rs.EOF) Conn.Execute("DELETE FROM OrderDetails WHERE OrderID = " & rs("OrderID")) rs.Delete rs.MoveNext Loop rs.Close set rs = Nothing End If If (cstCustomerDeleteDays > 0) Then Conn.Execute("DELETE FROM Customers Where LastUpdated < ({fn Now()} - " & cstCustomerDeleteDays & ")") End If End Function Call Main() wl("
") ' Page position table start ... ' Display the page header. This page is used in three different ways ... Select Case True Case (MerchantRequest) AND (GetURLValue("OrderID") <> "") Call DisplayPageHeader("", IIF(PackingSlip, "Packing Slip", "Receipt"), "tac") Case MerchantRequest Call DisplayPageHeader("", IIF(PackingSlip, "Packing Slip", "Receipt"), "ac") Case Else Call DisplayPageHeader("50", "", "") End Select ' If there was an error, display it If ErrorMsg <> "" Then wl("
") wl(ErrorMsg) If (Session("ReturnTo") = "") Then Call DisplayLink(cstHomeURL, ResourcePath & "custom/images/Home.gif", "Home") Else Response.Write("[ Back ]" & "
" & vbCrLf) End If wl("
") Response.End End If ' No errors, clean up database before continuing Call dbCleanUp() %>
<% If (Not MerchantRequest) Then wl("

Thank you for shopping at " & cstCatalogName & ".") wl("If you would like a hard copy of your order please use the "Print" button on") wl("your browser to print this page.

") ' Begin digital download support ------------------------------ If (cstDigitalDownloadEnabled And isInstalled("Feature:Download")) Then Set objDownload = FeatureInstalled.Item("Feature:Download") objDownload.OrderID = OrderId If (objDownload.OrderHasDownloads) Then objDownload.CreateDownloadFolder() wl("") wl("") wl("") wl("") wl("
This order contains downloadable products. Please click ") wl("here") wl(" to download your purchase.
 
") End If Set objDownload = Nothing End If ' End digital download support -------------------------------- End If %>
Date: <% =FormatDateTime(rstOrders("OrderDate"), vbShortDate) %> Order#: <% =(OrderId + cstOrderStartNo)%>
<% If (cstSuppressShipTo) Then %> <% Else %> <% End If %> <% If (MerchantRequest) Then %> <% Else %> <% End If %>
Bill To:    
  Bill To: Ship To:
Company:  <%=rstCustomer("CompanyName")%> <%=rstOrders("ShipCompanyName")%>
Organization:  <%=rstCustomer("Organization")%> <%=rstOrders("ShipOrganization")%>
First Name:  <%=rstCustomer("ContactFirstName")%> <%=rstOrders("ShipContactFirstName")%>
Last Name:  <%=rstCustomer("ContactLastName")%> <%=rstOrders("ShipContactLastName")%>
Address 1:  <%=rstCustomer("BillingAddress1")%> <%=rstOrders("ShipAddress1")%>
Address 2:  <%=rstCustomer("BillingAddress2")%> <%=rstOrders("ShipAddress2")%>
City:  <%=rstCustomer("City")%> <%=rstOrders("ShipCity")%>
State/Province:  <%=rstCustomer("StateOrProvince")%> <%=rstOrders("ShipStateOrProvince")%>
Postal Code:  <%=rstCustomer("PostalCode")%> <%=rstOrders("ShipPostalCode")%>
Country:  <%=rstCustomer("Country")%> <%=rstOrders("ShipCountry")%>
Phone:  <%=rstCustomer("PhoneNumber")%> <%=rstOrders("ShipPhoneNumber")%>
E-mail: <%=rstCustomer("EmailAddress")%><%=rstCustomer("EmailAddress")%> 
<% If (Not PackingSlip) Then %>
Payment/Shipping:
<% If (Trim(rstOrders("CreditCardNumber")) <> "") Then %> <% If (cstCSCEnabled) Then %> <% End If %> <% End If %> <% If (cstPONumberEnabled) Then %> <% End If %> <% If ((MerchantRequest) AND (Trim(cstSurveyQuestions) <> "")) Then wl("") wl("") wl("") arySurvey = GetParms(cstSurveyQuestions) For iSurvey = 0 To UBound(arySurvey) Step 1 wl("") wl("") wl("") wl("") wl("") Next End If %>
Payment Method:   <%=txtPaymentMethod%>
Credit Card #:   <%=GreekCCNum(FormatCC(Crypt(rstOrders("CreditCardNumber"), cstEncryptionKey, "dec")), "")%>
Card Holder Name:   <%=rstOrders("CardholdersName")%>
Expiration Date:   <%=Crypt(rstOrders("CreditCardExpDate"), cstEncryptionKey, "dec")%>
Card Security Code:   <%=Crypt(rstOrders("CVV2"), cstEncryptionKey, "dec")%>
Purchase Order #:   <%=rstOrders("PurchaseOrderNumber")%>
Shipping Method:   <%=txtShippingMethod%>
<%=cstShipNote%>:   <%=Replace(rstOrders("Notes") & "", "~", "
")%>
  " & arySurvey(iSurvey) & "
" & rstOrders("Survey" & (iSurvey + 1)) & "

<% End If ' If (Not PackingSlip) %> <% If (Not PackingSlip) Then %> <% End If %> <% iSubtotal = 0 Do While Not rstOrderDetails.EOF %> <% If (Not PackingSlip) Then %> <% End If %> <% iSubTotal = iSubtotal + rstOrderDetails("TotalPrice") rstOrderDetails.MoveNext Loop iSubTotal = IIF(iSubTotal < 0, 0, iSubTotal) '************coded inserted august 26,2005**********start %> <% Dim larrycart,arr,arr1,arr2,ilar,jlar,arr3 Dim larSQL,larrstOrders larSQL = "SELECT OrderDetailID,ProductCode,StampParams FROM OrderDetails WHERE OrderId = "& OrderId set larrstOrders = Server.CreateObject("ADODB.Recordset") larrstOrders.Open larSQL, Conn, adOpenKeyset, adLockOptimistic Do While not larrstOrders.EOF 'For ilar = 1 to iCount larrycart="" larrycart=Trim(larrstOrders("StampParams")) if larrycart<>"" then%> " id="frmlarry<%=larrstOrders("OrderDetailID")%>" method="post" action="popupstamp.asp?ProductCode=<%=larrstOrders("ProductCode")%>"><% larrycart=larrycart ' larrycart="LastForm:Continue" arr=Split(larrycart,"") arr1=Split(arr(0),";") Response.Write "" Response.Write "" Response.Write "" Response.Write "" Response.Write "" Response.Write "" Response.Write "" Response.Write "" Response.Write "" Response.Write "" arr1=Split(arr(1),";") for jlar=Lbound(arr1) to Ubound(arr1) arr2=Split(arr1(jlar),":") Response.Write "" Response.Write "" Response.Write "" Response.Write "" Response.Write "" Response.Write "" next Response.Write "" arr1=Split(arr(3),"") for jlar=Lbound(arr1) to Ubound(arr1) arr2=Split(arr1(jlar),"") Response.Write "" arr3=Split(arr2(1),":") Response.Write "" Response.Write "" Response.Write "" Response.Write "" Response.Write "" Response.Write "" next Response.Write "" end if %> <% 'Next larrstOrders.MoveNext loop '************coded inserted august 26,2005**********end %> <% If (Not PackingSlip) Then %> <% End If %> <% If ((Not cstHideSalesTax) And (Not PackingSlip)) Then iTax1 = IIF(isNullOrZero(rstOrders("SalesTax1")), 0, rstOrders("SalesTax1")) iTax2 = IIF(isNullOrZero(rstOrders("SalesTax2")), 0, rstOrders("SalesTax2")) If (isInstalled("Feature:Advanced Tax")) Then ' Advanced tax processing ... Set pAdvTax = FeatureInstalled("Feature:Advanced Tax") If (pAdvTax.Tax1InUse) Then wl("") wl("") wl("") wl("") End If If (pAdvTax.Tax2InUse) Then wl("") wl("") wl("") wl("") End If Else wl("") wl("") wl("") wl("") End If Else iTax1 = 0 iTax2 = 0 End If %> <% If (Not PackingSlip) Then %> <% iShipping = RoundCurrency(rstOrders("FreightCharge")) %> <% End If %> <% If (Not PackingSlip) Then%> <% iGrandTotal = iSubTotal + iShipping + iTax1 + iTax2%> <% Else %> <% End If %>
Code Description QtyPrice Total
<%=rstOrderDetails("ProductCode")%> <% response.write (rstOrderDetails("ProductName")) if rstOrderDetails("NSN") <> "" and rstOrderDetails("NSN") <> " " then %>
NSN: <% response.write(rstOrderDetails("NSN"))& "" end if if rstOrderDetails("SKU") <> "" and rstOrderDetails("SKU") <> " " then %>
SKU: <% response.write(rstOrderDetails("SKU"))& "" end if if rstOrderDetails("Packaging") <> "" and rstOrderDetails("Packaging") <> " " then %>
Packaging: <% response.write(rstOrderDetails("Packaging"))& "" end if %>
<%=GetShortDescription(rstOrderDetails("ProductDescription"), "") & "" & FormatOptions(rstOrderDetails("Options"))%>  <% '************coded inserted august 27,2005**********start dim tmplar tmplar="" 'Session("tequilaOrderID")=OrderID tmplar=Trim(rstOrderDetails("StampParams")) if tmplar<>"" then%>
View Your Stamp<% end if '************coded inserted august 27,2005**********end %>
<%=rstOrderDetails("Quantity")%><%=OurFormatCurrency(rstOrderDetails("UnitPrice"))%> <%=OurFormatCurrency(rstOrderDetails("TotalPrice"))%>
Subtotal: <%=OurFormatCurrency(iSubTotal)%>
" & _ " " & _ GetParmToken(cstSalesTaxName, 1, "Sales Tax 1") & ": " & _ "" & OurFormatCurrency(iTax1) & "
" & _ " " & _ GetParmToken(cstSalesTaxName, 2, "Sales Tax 2") & ": " & _ "" & OurFormatCurrency(iTax2) & "
" & _ " " & _ "Sales Tax: " & _ "" & OurFormatCurrency(iTax1) & "
Shipping and Handling: <%=IIF(rstOrders("FreeShipping") = "Yes", "Free!", OurFormatCurrency(iShipping))%>
Grand Total: <%=OurFormatCurrency(iGrandTotal)%>
 
<% ' Show on merchant and customer ... If ((Not strIsEmpty(cst50FooterMsg)) And (Not PackingSlip)) Then wl("

" & cst50FooterMsg & "

") End If %>

<% ' Decide how to end this shopping cart session ... Select Case True ' Suppress on merchant requests, allows for cleaner printing of receipts/packing lists Case MerchantRequest ' Pop-up from mTest ... Case Session("CartInPopUp") = "yes" wl("[ Close ]") ' No ReturnTo supplied ... Case Session("ReturnTo") = "" Call DisplayLink(NonSecureURL("50Finish.asp?Home=1"), ResourcePath & "custom/images/Home.gif", "Home") Case Else ' ReturnTo is supplied ... Call DisplayLink(Session("ReturnTo"), "", "Return") End Select %>

<% wl("
") ' Page position table end. ' Confirm order by e-mail while customer is viewing order. Don't ' send when order is viewed for fullfillment. ' If (Not MerchantRequest) Then Call eMailOrder(OrderID, "Vendor") Call eMailOrder(OrderID, "Customer") End If ' Call user exit on order completion ... Call UserExit(usrOrderComplete, Conn, _ OrderID, _ rstOrders("PaymentAmount"), _ rstOrders, _ ReturnValue) dbClose(Conn) If (Not (MerchantRequest Or (Session("CartInPopUp") = "yes"))) Then Session.Abandon Else Session(sesItemCount) = 0 Session("CartInPopUp") = "no" End If %>