<% const xDisplayorderfields="" '***************************************************************** ' call by shopthanks and numerous other places ' to format an order ' Version 6.50 ' Nov 10, 2005 fix hideprice logic ' The shop Configuration will override the values above ' Dec 31, 2005 added vblongtime to time to avoid duplication under SQL and MYSQL ' Nov 22, 2006 HK Support RMA for individual products '******************************************************************* dim hideprice dim totalprice dim quantity dim unitprice dim itemname Dim total Dim isubtotal Dim ForDualtotal Dim ForDualsubtotal dim Fordualproductprice dim Newcardno ' Dim Orders Dim Items Dim strSQL Dim lngOrderid Dim lngOcustomerid Dim datOdate Dim curOrderamount Dim strOfirstname 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 curOpst '6.5 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 StroDiscount Dim stroauthorization Dim stroaffid Dim strodualtotal Dim strodualshipping Dim strodualtaxes Dim strodualpst '6.5 'VP-ASP 6.50 - show currency and exchange rate ordered in dim strocurrency, strocurrencyrate Dim strodualdiscount dim strotime Dim strohandling dim strodualhandling dim stripaddress dim strocoupon, strocoupondiscount, strocoupondiscountdual dim strogiftcertificate, strogiftdiscount, strogiftdiscountdual 'VP-ASP 6.50 - add flag to order to say customer has agreed to terms dim strtermsagreed dim DeliveryAddress, DeliveryArray dim boolcustomercancel dim strovatnumber dim stropending dim stroshipmessage dim strodeliverydate, strodeliverytime dim strproducttotal dim oid dim rc Dim AdminFlag dim ydecimalpoint dim displayfields(50), displayfieldscount, displayorderfields, pconn hideprice = false If getconfig("XDisplayPrices")<>"Yes" then hideprice = true end if if getconfig("xpriceloggedinonly") = "Yes" then if Getsess ("login") = "" then hideprice= true end if end if '************************************************************ 'Format Order ' Version 6.50 '*********************************************************** Sub ShopFormatOrder (conn,orderid, iAdminflag) AdminFlag=iAdminflag ydecimalpoint=getconfig("xdecimalpoint") GetDisplayorderfields oid=orderid OpenOrder conn, oid ' pen orders and items FormatDetails FormatCustomer FormatPIns If AdminFlag<>"Admin" then GetCompanyInfo conn 'VP-ASP 6.50 - Show Canadian GST Registration Number where applicable if UCASE(getsess("country")) = "CA" then if getconfig("xcanadagstregno") > "" then response.write "GST Registration #: " & getconfig("xcanadagstregno") end if end if GetUPSMessage end if closerecordset orders closerecordset items CloseOrderfields end sub ' Sub OpenOrder (conn,oid) dim sql strsql = "select * from orders where orderid=" & oid Set Orders = Server.CreateObject("ADODB.Recordset") Orders.open strSQL, conn, adopenkeyset, adlockoptimistic if (Orders.BOF and Orders.EOF) then WriteInfo getlang("LangFormatNone") rc=4 exit sub else GetOrderData strSQL = "select * FROM oitems where orderid = " & Orders("orderid") Set Items = conn.Execute(strSQL) if Items.EOF then writeInfo getlang("LangFormatMissing") end if end if end sub Sub GetOrderData lngorderid = orders("orderid") lngocustomerid = orders("ocustomerid") datodate = orders("odate") curorderamount = orders("orderamount") strofirstname = orders("ofirstname") strolastname = orders("olastname") stroemail = orders("oemail") stroaddress = orders("oaddress") strocity = orders("ocity") stropostcode = orders("opostcode") strostate = orders("ostate") strocountry = orders("ocountry") strophone = orders("ophone") strofax = orders("ofax") strocompany = orders("ocompany") strocardtype = orders("ocardtype") strocardno = orders("ocardno") strocardname = orders("ocardname") strocardexpires = orders("ocardexpires") strocardaddress = orders("ocardaddress") boooprocessed = orders("oprocessed") strocomment = orders("ocomment") curotax = orders("otax") curopst = orders("opst") '6.5 datopromisedshipdate = orders("opromisedshipdate") datoshippeddate = orders("oshippeddate") lngoshipmethod = orders("oshipmethod") curoshipcost = orders("oshipcost") 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") strodiscount=orders("odiscount") stroauthorization=orders("oauthorization") stroaffid=orders("oaffid") if stroaffid=0 then stroaffid="" end if strotime=orders("otime") strodualtotal=orders("odualtotal") strodualshipping=orders("odualshipping") strodualtaxes=orders("odualtaxes") strodualpst=orders("odualpst") '6.5 strodualdiscount=orders("odualdiscount") strodualhandling=orders("odualhandling") strohandling=orders("ohandling") if isnull(strodualtotal) then strodualtotal=0 strodualshipping=0 strodualtaxes=0 strodualpst=0 '6.5 strodualdiscount=0 strodualhandling=0 end if strocoupon=orders("coupon") strocoupondiscount=orders("coupondiscount") strocoupondiscountdual=orders("coupondiscountdual") strogiftcertificate=orders("giftcertificate") strogiftdiscount=orders("giftamountused") strogiftdiscountdual=orders("giftamountuseddual") boolcustomercancel=orders("customercancel") if isnull(boolcustomercancel) then boolcustomercancel=0 end if strovatnumber=orders("vatnumber") stropending=orders("opending") stroshipmessage=orders("shipmessage") strhearaboutus=orders("hearaboutus") ' mods 5.10 straddress2 = orders("oaddress2") strshipaddress2 = orders("oshipaddress2") strodeliverydate=orders("deliverydate") strodeliverytime=orders("deliverytime") strproducttotal=orders("producttotal") stripaddress=orders("ipaddress") 'VP-ASP 6.50 - add flag to order to say customer has agreed to terms strtermsagreed=orders("otermsagreed") 'VP-ASP 6.50 - show currency and exchange rate ordered in strocurrency = orders("ocurrency") strocurrencyrate = orders("ocurrencyrate") end sub ' Format details Sub FormatDetails dim ordertime if boooprocessed<>0 then WriteInfo getlang("LangFormatProcessed") end if if boolcustomercancel<>0 then WriteInfo getlang("LangCancelCustomer") end if ordertime=formatdatetime(strotime,vblongtime) Response.write "
" & FOrderNumber & "" & getlang("LangProductOrderNumber") & " " & lngOrderid & "" & " - " & shopdateformat(datODate,getconfig("xdateformat")) & " " & ordertime & FOrderNumberEnd & "

" Response.write FOrdertable Response.write ForderRow FormatHeader getlang("LangProductProduct") 'VP-ASP 6.50 - allow customer to upload image to order if getconfig("xcustomerimages") = "Yes" then %><% FormatHeader getlang("langproductimage") end if FormatHeader getlang("LangProductQuantity") If hideprice=false then FormatHeader getlang("LangProductUnitPrice") FormatHeader getlang("LangProductTotal") if getconfig("xdualprice")="Yes" then FormatHeader getlang("LangDualPrice") FormatHeader getlang("LangDualTotal") end if end if response.write "" FormatItemDetails end sub ' Sub FormatHeader (title) Response.write CartTitleColumn & Title & CartTitleColumnEnd End sub Sub FormatItemDetails dim fordualprice dim fordualproducttotal dim catalogid Do While Not Items.EOF itemname= items("itemname") deliveryaddress=items("address") quantity=items("numitems") unitprice=items("unitprice") totalprice=quantity*unitprice fordualprice=items("dualprice") catalogid=items("catalogid") if isnull(fordualprice) then fordualprice=0 end if If getconfig("XdeliveryAddress")="Yes" then If not isnull(Deliveryaddress) and Deliveryaddress<>"" then ConvertDeliveryToArray DeliveryArray, Deliveryaddress GetDeliveryName Itemname, DeliveryArray end if end if fordualproducttotal=quantity*fordualprice AddDisplayfields itemname, catalogid AddRMALink itemname, items("orderitemid") ' see if we can return item response.write CartRow if getconfig("xcustomerimages") = "Yes" then if items("customerimage") > "" then itemname = itemname & "
Attachment: " & right(items("customerimage"), len(items("customerimage")) - instrrev(items("customerimage"), "/")) end if end if AddField "45%","left", CartFontDesc & itemname & CartFontEnd 'VP-ASP 6.50 - allow customer to upload image to order if getconfig("xcustomerimages") = "Yes" then if items("customerimage") > "" then AddField "15%","center", "
" & getlang("langcommonview") & "

" else response.write "" end if end if AddField "10%","center", CartFontQuantity & quantity & cartfontend If hideprice <> true then AddField "10%","right", CartFontUnitPrice & shopformatcurrency(UnitPrice,ydecimalpoint) & CartFontEnd AddField "10%","right", CartFontPriceTotal & shopformatcurrency(totalprice,ydecimalpoint)& CartFontEnd if getconfig("xDualPrice")="Yes" then AddField "10%","right",CartFontDualPrice & ShopFormatDualCurrency(fordualprice,ydecimalpoint)& CartFontEnd AddField "10%","right", cartFontDualTotal & ShopFormatDualCurrency(fordualproducttotal,ydecimalpoint)& cartfontEnd fordualsubtotal=fordualsubtotal + fordualproducttotal end if end if response.write "" isubtotal=isubtotal+totalprice Items.MoveNext Loop AddOtherItems isubtotal, fordualsubtotal Response.write "
" AddShippingMessage end sub Sub AddField (percent, alignment, fieldvalue) %> <%=fieldvalue%> <% end sub Sub FormatCustomer Dim Encryptkey Response.write ForderTable EncryptKey=GetEncryptKey DoHeader_Order getlang("LangFormatCustomerInformation") DoField_Order getlang("LangCustFirstName"), stroFirstName DoField_Order getlang("LangCustLastName"), stroLastName DoField_Order getlang("LangCustAddress") ,stroAddress DoField_Order getlang("LangCustAddress")& "2" ,strAddress2 DoField_Order getlang("LangCustCity"), stroCity DoField_Order getlang("LangCustState"), stroState DoField_Order getlang("LangCustPostCode"),stroPostCode DoField_Order getlang("LangCustCountry"),strocountry DoField_Order getlang("LangCustEmail"),stroemail DoField_Order getlang("LangCustPhone"),strophone DoField_Order getlang("LangCustFax"),strofax DoField_Order getlang("LangCustCompany"),strocompany DoField_Order getlang("Langhearaboutus"),strhearaboutus DoField_Order getlang("LangVatNumber"),strovatnumber FormatcustomerotherFields If hideprice = false then DoHeader_Order getlang("LangFormatPaymentInformation") DoField_Order getlang("LangCheckoutPaymentType"),strocardtype DoField_Order getlang("LangCoupon"),strocoupon DoField_Order getlang("LangGiftCertificate"),strogiftcertificate end if If AdminFlag="Admin" then DoField_Order getlang("LangCheckoutCardName"),strocardname If getconfig("XencryptCreditCard")="Yes" and EncryptKey<>"" and strocardno<>"" then if not Isnumeric(strocardno) then Newcardno=EnDecrypt(strocardno,encryptkey) strocardno=Newcardno end if end if DoField_Order getlang("LangCheckoutCardNumber"),strocardno DoField_Order getlang("LangCheckoutExpiry"),strocardexpires DoField_Order getlang("LangCheckoutAddress"),strocardaddress DoField_Order getlang("LangCheckoutAuthorization"),stroauthorization DoField_Order getlang("LangAff"),stroaffid DoField_Order getlang("LangstatusStatus"),stropending DoField_Order getlang("langipaddress"),stripaddress 'VP-ASP 6.50 - add flag to order to say customer has agreed to terms DoField_Order getlang("langlicenseagreementcheck"), strtermsagreed 'VP-ASP 6.50 - show currency and exchange rate ordered in DoField_Order "Selected Currency",strocurrency DoField_Order "Conversion Rate",strocurrencyrate end if DoHeader_Order getlang("LangFormatShippingInformation") DoField_Order getlang("LangShippingMethod"),stroshipmethodtype ' DoField_Order "Shipping Price", curoshipcost DoField_Order getlang("LangShipName"),stroshipname DoField_Order getlang("LangShipAddress"),stroshipaddress DoField_Order getlang("LangShipAddress") & "2",strshipaddress2 DoField_Order getlang("LangShipCity"),stroshiptown DoField_Order getlang("LangShipState"),stroshipstate DoField_Order getlang("LangShipPostcode"),stroshipzip DoField_Order getlang("LangShipCompany"),stroshipcompany DoField_Order getlang("LangShipCountry"),stroshipcountry DoField_Order getlang("LangDeliverydate"),strodeliverydate DoField_Order getlang("LangDeliverytime"),strodeliverytime FormatShippingotherFields %> <% If Orders("ocomment") <> "" then shopwriteheader getlang("LangOrderComments") response.write FOrderComment & Orders("ocomment") & "

" & Fordercommentend end if End Sub Sub WriteInfo (msg) Response.write FOrderInfo & msg & ForderInfoEnd end sub ' Sub DoHeader_Order (mytext) Response.write FOrderRow Response.write FOrderHeaderColumn & mytext & ForderHeaderColumnEnd Response.write ForderRowEnd end sub Sub DoField_Order (fieldname,fieldvalue) if fieldvalue="" or isNull(fieldvalue) then exit sub end if Response.write ForderFieldRow Response.write ForderFieldLeft & fieldname & FOrderFieldLeftEnd Response.write FOrderFieldRight & fieldvalue & Forderfieldrightend end sub '********************* Sub GetCompanyInfo (conn) Dim rsus Set rsus = Server.CreateObject ("ADODB.Recordset") rsus.Open "mycompany", conn, adOpenForwardOnly,adLockReadOnly, adCmdTable if rsus.eof then Closerecordset rsus exit sub end if response.write "

" response.write fordercompany & rsus("companyname") & fordercompanyend & "
" response.write fordercompany & rsus("address") & fordercompanyend & "
" response.write fordercompany & rsus("city") & " " & rsus("state") & " " & rsus("postalcode") & fordercompanyend & "
" response.write fordercompany & rsus("country") & "
" response.write fordercompany & getlang("langcustphone") & " " & rsus("phonenumber") & fordercompanyend & "
" response.write fordercompany & getlang("langcustfax") & " " & rsus("faxnumber") & fordercompanyend & "
" response.write fordercompany & getlang("langcustemail") & " " & rsus("myemail") & fordercompanyend & "

" 'VP-ASP 6.50 - show extra information if rsus("other1") > "" then response.write fordercompany & rsus("other1") & fordercompanyend & "
" end if if rsus("other2") > "" then response.write fordercompany & rsus("other2") & fordercompanyend & "
" end if if rsus("other3") > "" then response.write fordercompany & rsus("other3") & fordercompanyend & "
" end if if rsus("other4") > "" then response.write fordercompany & rsus("other4") & fordercompanyend & "
" end if Closerecordset rsus End Sub ' Sub AddOtherItems (isubtotal, dualsubtotal) If hideprice <> false then exit sub Dim total total=isubtotal ForDualtotal=dualsubtotal FormatProductTotal total FormatShipping total FormatHandling total FormatTax total FormatDiscount total FormatCouponDiscount total FormatGiftCertificate total FormatTotal total end sub Sub FormatTax (total) 'VP-ASP 6.50 - add handling for Canadian PST Dim Taxes, PST Taxes=curotax PST = curopst If IsNull(taxes) then exit sub if Taxes<>"" then If Taxes<>0 then DisplayRow getlang("LangProductTax"), taxes, strodualtaxes If getconfig("xtaxincludedinprice")="Yes" then else Total=Total+taxes fordualtotal=ForDualTotal+strodualtaxes end if end if end if if PST<>"" then If PST<>0 then DisplayRow "PST", pst, strodualpst If getconfig("xtaxincludedinprice")="Yes" then else Total=Total+pst fordualtotal=ForDualTotal+strodualpst end if end if end if end sub Sub FormatHandling (total) Dim Handling Handling=strohandling If IsNull(handling) then exit sub if handling<>"" then If handling<>0 then DisplayRow getlang("LangProductHandling"), handling, strodualhandling Total=Total+handling fordualtotal=ForDualTotal+strodualhandling end if end if end sub Sub FormatDiscount (total) ' cart discount is coming from database dim discount Discount=strodiscount If isnull(discount) then exit sub if discount<>"" then If stroDiscount<>0 then DisplayRow getlang("LangProductDiscount"), -Discount, -strodualdiscount Total=Total-discount fordualtotal=ForDualTotal-strodualdiscount end if end if end sub ' Sub DisplayRow (msg, amount, dualamount) response.write "" 'VP-ASP 6.50 - allow customer to upload image to order if getconfig("xcustomerimages") = "Yes" then response.write "" end if response.write CartSubTotalRowLeft & msg & carttotalrowleftend response.write CartSubTotalRowRight & shopformatcurrency(amount,ydecimalpoint)& carttotalrowRightend If getconfig("xdualprice")="Yes" then response.write "" response.write CartSubTotalRowRight & ShopFormatDualCurrency(dualamount,2) &cartTotalrowrightend end if response.write "" end Sub Sub FormatShipping (total) dim shipcost shipcost=curoshipcost if isnull(shipcost) then exit sub if shipcost<>"" then If shipcost> 0 then DisplayRow getlang("LangProductShippingCost"), shipcost, strodualshipping Total=Total+shipcost ForDualtotal=Fordualtotal+strodualshipping end if end if end sub Sub FormatProductTotal (isubtotal) DisplayRow getlang("langProductCost"), isubtotal, fordualsubtotal end sub Sub FormatTotal (total) FormatTotalRow getlang("langProductTotal"), total, fordualtotal End Sub ' Sub FormatTotalRow (title, total, dualtotal) Response.write "" 'VP-ASP 6.50 - allow customer to upload image to order if getconfig("xcustomerimages") = "Yes" then response.write "" end if Response.write CartTotalRowLeft & title & CartTotalRowLeftEnd Response.write CartTotalRowRight & shopformatcurrency(total,ydecimalpoint) & carttotalrowrightend If getconfig("xdualprice")="Yes" then response.write "" response.write CartTotalRowRight & ShopFormatDualCurrency(dualtotal,2) & Carttotalrowrightend end if response.write "" end sub Sub FormatCouponDiscount (total) ' cart discount is coming from database dim discount Discount=strocoupondiscount If isnull(discount) then exit sub if discount<>"" then If discount<>0 then DisplayRow getlang("LangCouponDiscount"), -Discount, -strocoupondiscountdual Total=Total-discount ForDualtotal=Fordualtotal-strocoupondiscountdual end if end if end sub Sub FormatGiftCertificate (total) ' cart discount is coming from database Dim Discount, discountdual discount=strogiftdiscount if isnull(discount) then exit sub if Discount <>"" then If Discount<>0 then DisplayRow getlang("LangGiftCertificate"), -Discount, -strogiftdiscountdual Total=Total-discount ForDualtotal=Fordualtotal-strogiftdiscountdual end if end if end sub Sub FormatCustomerOtherFields dim fieldvalue If getconfig("Xcustomerotherfieldsinorder")<>"Yes" then exit sub if Getconfig("xCustomerOtherFields")="" then exit sub dim words,wordcount, captions, capcount,customervalues,i redim words(Getconfig("xCustomerMaxotherfields")) redim captions(getconfig("xCustomerMaxotherfields")) Parserecord Getconfig("xcustomerOtherFields"), words, wordcount,"," Parserecord getconfig("xcustomerOtherCaptions"), captions, capcount,"," for i = 0 to wordcount-1 fieldvalue=orders(words(i)) DoField_Order captions(i),fieldvalue next end sub Sub FormatShippingOtherFields dim fieldvalue if Getconfig("xshippingOtherFields")="" then exit sub dim words,wordcount, captions, capcount,shippingvalues,i redim words(Getconfig("xCustomerMaxotherfields")) redim captions(getconfig("xCustomerMaxotherfields")) Parserecord Getconfig("xshippingOtherFields"), words, wordcount,"," Parserecord getconfig("xshippingOtherCaptions"), captions, capcount,"," for i = 0 to wordcount-1 if getconfig("xdebug")="Yes" then debugwrite "Shipping field=" & words(i) end if fieldvalue=orders(words(i)) DoField_Order captions(i),fieldvalue next end sub Sub AddShippingMessage if isnull(stroshipmessage) then exit sub If Getconfig("xgiftregistry")="Yes" and getsess("REGISTRANTID")<>"" Then exit sub if ucase(getconfig("xshippingcalc")) = "FIXED" then exit sub Response.write "

" response.write FOrderComment & stroshipmessage & "
" & Fordercommentend response.write "

" end sub sub FormatPIns If getconfig("Xpinnumber")<>"Yes" then exit sub Shoppinformat oid, orders, items, adminflag end sub Sub Getdisplayorderfields displayfieldscount=0 displayorderfields=getconfig("xdisplayorderfields") If displayorderfields="" then displayorderfields=xdisplayorderfields end if If displayorderfields="" then exit sub if adminflag<>"Admin" then exit sub parserecord displayorderfields, displayfields, displayfieldscount,"," shopopendatabasep pconn end sub Sub CloseOrderFields if displayfieldscount>0 then shopclosedatabase pconn end if end sub Sub AddDisplayfields (itemname, catalogid) dim i, prs, psql, fieldname, fieldvalue if displayfieldscount=0 then exit sub If isnull(catalogid) then exit sub if catalogid=0 then exit sub psql="select * from products where catalogid=" & catalogid set prs=pconn.execute(psql) if prs.eof then closerecordset prs exit sub end if for i = 0 to displayfieldscount-1 fieldname=displayfields(i) fieldvalue=prs(fieldname) itemname=itemname & "
" itemname=itemname & "" & fieldname & "=" & fieldvalue next closerecordset prs end sub Sub GetUPSMessage if getsess("ShipMethodType") = "UPS Real-Time" then %>
UPS NOTE: These fees do not necessarily represent UPS published rates and may include charges levied by the store owner.

UPS, UPS brandmark, and the Color Brown are trademarks of United Parcel Service of America, Inc. All Rights Reserved.
<% end if end sub '***************************************************************************** 'VP-ASP 6.50 'Put out rma link old if allowed and if this is not an administrator '**************************************************************************** Sub AddRMALink (Itemname, itemid) If getconfig("xrmaallowed")<>"Yes" then exit sub If adminflag<>"" then exit sub dim my_link, fieldvalue my_link="shoprma.asp?oid=" & oid & "&itemid=" & itemid fieldvalue="" & getlang("Langrma") & "" itemname=fieldvalue & "
" & itemname end sub %>