%
'*****************************************************************
' call by shopthanks and numerous other places
' to format an order
' Version 5.00
' May 3, 2003
'*******************************************************************
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 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 strodualdiscount
dim strotime
Dim strohandling
dim strodualhandling
dim strocoupon, strocoupondiscount, strocoupondiscountdual
dim strogiftcertificate, strogiftdiscount, strogiftdiscountdual
dim DeliveryAddress, DeliveryArray
dim boolcustomercancel
dim strovatnumber
dim stropending
dim stroshipmessage
dim oid
dim rc
Dim AdminFlag
dim ydecimalpoint
'************************************************************
'Format Order
' Version 4.0
'***********************************************************
Sub ShopFormatOrder (conn,orderid, iAdminflag)
AdminFlag=iAdminflag
ydecimalpoint=getconfig("xdecimalpoint")
oid=orderid
OpenOrder conn, oid ' pen orders and items
FormatDetails
FormatCustomer
If AdminFlag<>"Admin" then
GetCompanyInfo conn
end if
closerecordset orders
closerecordset items
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")
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")
strodualdiscount=orders("odualdiscount")
strodualhandling=orders("odualhandling")
strohandling=orders("ohandling")
if isnull(strodualtotal) then
strodualtotal=0
strodualshipping=0
strodualtaxes=0
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")
end sub
' Format details
Sub FormatDetails
if boooprocessed<>0 then
WriteInfo getlang("LangFormatProcessed")
end if
if boolcustomercancel<>0 then
WriteInfo getlang("LangCancelCustomer")
end if
Response.write FOrderNumber & "" & getlang("LangProductOrderNumber") & " " & lngOrderid & "" & " - " & shopdateformat(datODate,getconfig("xdateformat")) & " " & strotime & FOrderNumberEnd & "
"
Response.write FOrdertable
Response.write ForderRow
FormatHeader getlang("LangProductProduct")
FormatHeader getlang("LangProductQuantity")
If getconfig("xDisplayPrices")<>"No" 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
Do While Not Items.EOF
itemname= items("itemname")
deliveryaddress=items("address")
quantity=items("numitems")
unitprice=items("unitprice")
totalprice=quantity*unitprice
fordualprice=items("dualprice")
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
response.write CartRow
AddField "50%","left", CartFontDesc & itemname & CartFontEnd
AddField "10%","center", CartFontQuantity & quantity & cartfontend
If getconfig("XDisplayPrices")<>"No" 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 & FormatNumber(fordualprice,ydecimalpoint)& CartFontEnd
AddField "10%","right", cartFontDualTotal & FormatNumber(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)
%>
"
response.write FOrderComment & stroshipmessage & "
" & Fordercommentend
response.write "