%@ LANGUAGE="VBSCRIPT" %>
<% PageStrings = "339, 361, 470, 496, 503, 508, 509, 545, 634, 635, 641, 642, 653, 665, 666, 680, 827, 837, 1186"
strThisBackPage = "orders" %>
<%
'===============================================
' CactuShop ASP Shopping Cart
' ©1999-2004 Cactusoft Ltd. www.cactusoft.com
'===============================================
' All rights reserved.
' Use of this code is covered by the terms and
' conditions in the license agreement. No
' unauthorized duplication or distribution is
' permitted. Cactusoft's copyright notices must
' remain in the ASP sections of the code.
'===============================================
'-----------------------------------------------
'CREATE INVOICE
'-----------------------------------------------
numOrderID = request.querystring("ON_ID")*1
numLangID = request.querystring("LANG_ID")*1
'-----------------------------------------------
'LOOKUP LANGUAGE AND ITS INVOICE TEMPLATE FILE
'-----------------------------------------------
strQuery = "SELECT * FROM tblCactuShopLanguages WHERE LANG_ID = " & numLangID
Call ExecuteSQL(strQuery, numCursorType, objRecordSet)
strPathToInvoice = server.mappath(objRecordSet("LANG_SkinLocation") & "invoice.htm")
Set objFileSystem = CreateObject("Scripting.FileSystemObject")
'Now we know where to look for skin, check it exists
If objFileSystem.FileExists(strPathToInvoice) then
'read file and store as string
Set objFile = objFileSystem.GetFile(strPathToInvoice)
Set objTextStream = objFile.OpenAsTextStream(1,0)
strPageBaseText = objTextStream.ReadAll
set objTextStream = nothing
set objFile = nothing
Else
'no template found - display error and stop
response.write("No invoice.htm template found at " & strPathToInvoice & "
" & vbcrlf)
response.end
End if
set objFileSystem = nothing
objRecordSet.close
'-----------------------------------------------
'LOOKUP THIS ORDER RECORD
'-----------------------------------------------
strQuery = "SELECT * FROM (((tblCactuShopInvoiceRows INNER JOIN tblCactuShopOrderNumbers ON tblCactuShopInvoiceRows.IR_OrderNumber = tblCactuShopOrderNumbers.ON_ID) INNER JOIN tblCactuShopCurrencies ON tblCactuShopCurrencies.CUR_ID = tblCactuShopOrderNumbers.ON_CurrencyID) INNER JOIN tblCactuShopCardholderDetails ON tblCactuShopOrderNumbers.ON_CardholderID = tblCactuShopCardholderDetails.CD_ID) INNER JOIN tblCactuShopLanguages ON tblCactuShopOrderNumbers.ON_Language = tblCactuShopLanguages.LANG_ID WHERE ON_ID = " & numOrderID
Call ExecuteSQL(strQuery, numCursorType, objRecordSet)
numRecordCount = objRecordSet.recordcount
If numRecordCount>0 then
CD_ID = objRecordSet("CD_ID")
CD_CardholderEUVATNum = objRecordSet("CD_CardholderEUVATNum")
CD_CardholderName = SafeHTMLEncode(objRecordSet("CD_CardholderName"))
CD_CardholderCompany = SafeHTMLEncode(objRecordSet("CD_CardholderCompany"))
CD_CardholderStreetAddress = SafeHTMLEncode(objRecordSet("CD_CardholderStreetAddress"))
CD_CardholderTownCity = SafeHTMLEncode(objRecordSet("CD_CardholderTownCity"))
CD_CardholderCounty = SafeHTMLEncode(objRecordSet("CD_CardholderCounty"))
CD_CardholderPostCode = SafeHTMLEncode(objRecordSet("CD_CardholderPostCode"))
CD_CardholderCountry = GetCountryString(objRecordSet("CD_CardholderCountry"), numLangID)
CD_ShippingName = SafeHTMLEncode(objRecordSet("CD_ShippingName"))
CD_ShippingStreetAddress = SafeHTMLEncode(objRecordSet("CD_ShippingStreetAddress"))
CD_ShippingTownCity = SafeHTMLEncode(objRecordSet("CD_ShippingTownCity"))
CD_ShippingCounty = SafeHTMLEncode(objRecordSet("CD_ShippingCounty"))
CD_ShippingPostCode = SafeHTMLEncode(objRecordSet("CD_ShippingPostCode"))
CD_ShippingCountry = GetCountryString(objRecordSet("CD_ShippingCountry"), numLangID)
ON_Details = objRecordSet("ON_Details")
ON_TotalPrice = objRecordSet("ON_TotalPrice")
ON_Date = objRecordSet("ON_Date")
ON_Status = objRecordSet("ON_Status")
ON_Details = objRecordSet("ON_Details")
ON_LastModified = objRecordSet("ON_LastModified")
ON_Sent = objRecordSet("ON_Sent")
ON_Invoiced = objRecordSet("ON_Invoiced")
ON_Shipped = objRecordSet("ON_Shipped")
ON_Paid = objRecordSet("ON_Paid")
ON_CouponCode = objRecordSet("ON_CouponCode")
ON_CouponDiscountTotal = objRecordSet("ON_CouponDiscountTotal")
ON_PricesIncTax = objRecordSet("ON_PricesIncTax")
ON_TaxDue = objRecordSet("ON_TaxDue")
ON_Language = objRecordSet("ON_Language")
numShippingPriceExTax = objRecordSet("ON_ShippingPrice")
numShippingPriceIncTax = objRecordSet("ON_ShippingPrice") + objRecordSet("ON_ShippingTax")
numOrderHandlingPriceExTax = objRecordSet("ON_OrderHandlingCharge")
numOrderHandlingPriceIncTax = numOrderHandlingPriceExTax + objRecordSet("ON_OrderHandlingChargeTax")
numTotal = objRecordSet("ON_TotalPrice")
numDiscountPercentage = objRecordSet("ON_DiscountPercentage")
CUR_Symbol = objRecordSet("CUR_Symbol")
CUR_HasDecimals = objRecordSet("CUR_HasDecimals")
CD_ID = objRecordSet("CD_ID")
End if
'-----------------------------------------------
'LOOKUP COUPON IF THERE IS ONE
'-----------------------------------------------
If ON_CouponCode<>"" then
strQuery2 = "SELECT * FROM tblCactuShopCoupons WHERE CP_CouponCode='" & ON_CouponCode & "'"
Call ExecuteSQL(strQuery2, numCursorType, objRecordSet2)
CP_DiscountValue = objRecordSet2("CP_DiscountValue")
CP_DiscountType = objRecordSet2("CP_DiscountType")
If CP_DiscountType = "f" then CP_DiscountValue = ON_CouponDiscountTotal
CP_CouponCode = objRecordSet2("CP_CouponCode")
objRecordSet2.close
End if
'-----------------------------------------------
'REPLACE TAGS WITH VALUES
'-----------------------------------------------
strBillingAddress = replace(CD_CardholderName & "
" & CD_CardholderCompany & "
" & CD_CardholderStreetAddress & "
" & CD_CardholderTownCity & "
" & CD_CardholderCounty & "
" & CD_CardholderPostcode & "
" & CD_CardholderCountry, "
", "
")
strShippingAddress = replace(CD_ShippingName & "
" & CD_ShippingStreetAddress & "
" & CD_ShippingTownCity & "
" & CD_ShippingCounty & "
" & CD_ShippingPostcode & "
" & CD_ShippingCountry, "
", "
")
strPageBaseText = replace(strPageBaseText, "xxxBILLINGxxx", strBillingAddress)
strPageBaseText = replace(strPageBaseText, "xxxSHIPPINGxxx", strShippingAddress)
strPageBaseText = replace(strPageBaseText, "xxxON_IDxxx", numOrderID)
strPageBaseText = replace(strPageBaseText, "xxxPOxxx", ON_PONumber)
strPageBaseText = replace(strPageBaseText, "xxxCD_IDxxx", CD_ID)
strPageBaseText = replace(strPageBaseText, "xxxDATExxx", FriendlyDate(ON_Date, "d"))
strPageBaseText = replace(strPageBaseText, "xxxVATNUMxxx", CD_CardholderEUVATNum)
aryTemplate = split(strPageBaseText, "xxxINVOICEROWSxxx", -1)
response.write(aryTemplate(0)) %>
| <% '----------------------------------------- 'PRICES INCLUDING TAX '----------------------------------------- If ON_PricesIncTax = "y" then If Application(LICENSENUMBER & "showtaxdisplay") = "y" then %> | <% WriteString("ContentText_ExTax") %> | <% WriteString("ContentText_IncTax") %> | <% Else %><% WriteString("ContentText_Price") %> | <% End if Else '----------------------------------------- 'PRICES EXCLUDING TAX '----------------------------------------- %><% WriteString("ContentText_Price") %> | <% WriteString("ContentText_Tax") %> (%) | <% End if %><% WriteString("ContentText_Qty") %> | <% WriteString("ContentText_Total") %> | |||
| <% response.write(objRecordSet("IR_VersionName")) %> | ||||||||||
| <% response.write(objRecordSet("IR_VersionCode")) %> | <% '----------------------------------------- 'PRICES INCLUDING TAX '----------------------------------------- If ON_PricesIncTax = "y" then If Application(LICENSENUMBER & "showtaxdisplay") = "y" then %><% response.write(CUR_Symbol & " " & CurrencyDisplay(objRecordSet("IR_PricePerItem") - objRecordSet("IR_TaxPerItem"), 1, objRecordSet("CUR_HasDecimals"))) %> | <% response.write(CUR_Symbol & " " & CurrencyDisplay(objRecordSet("IR_TaxPerItem"), 1, objRecordSet("CUR_HasDecimals"))) %> | <% Else %><% response.write(CUR_Symbol & " " & CurrencyDisplay(objRecordSet("IR_PricePerItem"), 1, objRecordSet("CUR_HasDecimals"))) %> | <% End if %><% response.write(objRecordSet("IR_Quantity")) %> | <% response.write(CUR_Symbol & " " & CurrencyDisplay(objRecordSet("IR_PricePerItem") * objRecordSet("IR_Quantity"), 1, objRecordSet("CUR_HasDecimals"))) %> | <% Else '----------------------------------------- 'PRICES EXCLUDING TAX '----------------------------------------- %><% response.write(CUR_Symbol & " " & CurrencyDisplay(objRecordSet("IR_PricePerItem"), 1, objRecordSet("CUR_HasDecimals"))) %> | <% response.write(objRecordSet("IR_TaxPerItem")*100) %> | <% response.write(objRecordSet("IR_Quantity")) %> | <% response.write(CUR_Symbol & " " & CurrencyDisplay(0.0001 + (objRecordSet("IR_PricePerItem") * objRecordSet("IR_Quantity") * (1 + objRecordSet("IR_TaxPerItem"))), 1, objRecordSet("CUR_HasDecimals"))) %> | <% End if %>|