%
' Comersus Shopping Cart
' Comersus Open Technologies
' United States
' Software License can be found at License.txt
' http://www.comersus.com
' Details: show order details for one customer
%>
<%
on error resume next
dim mySQL, connTemp, rsTemp, rsTemp2, rsTemp3
redim fileNameList(19)
redim saveAsList(19)
' get settings
pStoreFrontDemoMode = getSettingKey("pStoreFrontDemoMode")
pCurrencySign = getSettingKey("pCurrencySign")
pDecimalSign = getSettingKey("pDecimalSign")
pCompany = getSettingKey("pCompany")
pCompanySlogan = getSettingKey("pCompanySlogan")
pAboutUsLink = getSettingKey("pAboutUsLink")
pMoneyDontRound = getSettingKey("pMoneyDontRound")
pHeaderKeywords = getSettingKey("pHeaderKeywords")
pAffiliatesStoreFront = getSettingKey("pAffiliatesStoreFront")
pAuctions = getSettingKey("pAuctions")
pListBestSellers = getSettingKey("pListBestSellers")
pNewsLetter = getSettingKey("pNewsLetter")
pPriceList = getSettingKey("pPriceList")
pStoreNews = getSettingKey("pStoreNews")
pOneStepCheckout = getSettingKey("pOneStepCheckout")
pDownloadDigitalGoods = getSettingKey("pDownloadDigitalGoods")
pDateSwitch = getSettingKey("pDateSwitch")
pOrderPrefix = getSettingKey("pOrderPrefix")
pIdRmaPrefix = getSettingKey("pIdRmaPrefix")
pAllowDelayPayment = getSettingKey("pAllowDelayPayment")
pByPassShipping = getSettingKey("pByPassShipping")
pDownloadGoodsType = UCase(getSettingKey("pDownloadGoodsType"))
pDaysToDownloadGoods = Cdbl(getSettingKey("pDaysToDownloadGoods"))
' session
pIdCustomer = getSessionVariable("idCustomer",0)
' form
pIdOrder = getUserInput(request("idOrder"),12)
' extract real idorder (without prefix)
pIdOrder = removePrefix(pIdOrder,pOrderPrefix)
if trim(pIdOrder)="" then
response.redirect "comersus_message.asp?message="&Server.Urlencode(getMsg(517,"Missing order number"))
end if
call customerTracking("comersus_customerShowOrderDetails.asp", request.querystring)
' get order data and check if the order belongs to that customer
mySQL="SELECT orders.idOrder, name, lastName, orderstatus, phone, email, viewed, orders.address AS address, orders.state AS state, orders.stateCode as stateCode, orders.zip AS zip, orders.city AS city, orders.countryCode AS countryCode, taxAmount, orderDate, shipmentDetails, paymentDetails, discountDetails, obs, total, details, orders.shippingAddress, orders.shippingCity, orders.shippingState, orders.shippingStateCode, orders.shippingZip, orders.shippingCountryCode, orders.idCustomerType, shipmentTracking, transactionResults FROM orders, customers WHERE orders.idcustomer=customers.idcustomer AND orders.idOrder=" &pIdOrder&" AND customers.idCustomer="&pIdCustomer
call getFromDatabase(mySQL, rstemp, "customerShowOrderDetails")
if rstemp.eof then
response.redirect "comersus_message.asp?message="&Server.Urlencode(getMsg(518,"Cannot locate the order inside your history"))
end if
' Today
pToday=Date
' contact
pName = rstemp("name")
pLastName = rstemp("lastName")
pEmail = rstemp("email")
pPhone = rstemp("phone")
' order
pOrderDate = rstemp("orderDate")
pDetails = rstemp("details")
pTotal = rstemp("total")
pPaymentDetails = rstemp("paymentDetails")
pShipmentDetails = rstemp("ShipmentDetails")
pDiscountDetails = rstemp("discountDetails")
pTaxAmount = rstemp("taxAmount")
pAddress = rstemp("address")
pZip = rstemp("zip")
pState = rstemp("state")
pStateCode = rstemp("stateCode")
pCity = rstemp("city")
pCountryCode = rstemp("countryCode")
pShippingaddress = rstemp("shippingAddress")
pShippingzip = rstemp("shippingzip")
pShippingstate = rstemp("shippingstate")
pShippingstateCode = rstemp("shippingstateCode")
pShippingcity = rstemp("shippingcity")
pShippingcountryCode = rstemp("shippingCountryCode")
pOrderStatus = rstemp("orderStatus")
pIdCustomerType = rstemp("idCustomerType")
pShipmentTracking = rstemp("shipmentTracking")
pTransactionResults = rstemp("transactionResults")
' init download array
for f=0 to 19
fileNameList(f) = ""
saveAsList(f) = ""
next
' remove 0 amount for payment method
pPaymentDetails=replace(pPaymentDetails,"$0.00","")
%>
<%=getMsg(519,"details")%>
|
<%=getMsg(520,"order")%> <%=pOrderPrefix&pIdOrder%>, <%=getMsg(521,"date")%>: <%=formatDate(pOrderDate)%> |
| <%=getMsg(522,"name")%> |
<%=pName&" "&pLastName%> |
| <%=getMsg(523,"email")%> |
<%=pEmail%> |
| <%=getMsg(524,"phone")%> |
<%=pPhone%> |
| <%=getMsg(525,"bill add")%> |
<%=pAddress& ", " &pCity& " " &pState&pStateCode& " " &pZip& " " &getCountryName(pCountryCode)%>
|
| <%=getMsg(526,"ship add")%> |
<%if pShippingAddress<>"" then%>
<%=pShippingaddress &", " &pShippingCity& " " &pShippingState&pShippingStateCode& " " &pShippingZip& " " & getCountryName(pShippingcountryCode)%>
<%else%>
<%=getMsg(527,"same")%>
<%end if%>
|
| <%=getMsg(528,"payment")%> |
<%=pPaymentDetails%>
<%if pTransactionResults<>"" then%>
(<%=pTransactionResults%>)
<%end if%>
|
<%if pShipmentTracking<>"" then%>
| <%=getMsg(529,"ship track")%> |
<%=pShipmentTracking%>
|
<%end if%>
<%if pDiscountDetails<>"" then%>
| <%=getMsg(530,"discounts")%> |
<%=pDiscountDetails%> |
<%end if%>
| <%=getMsg(531,"status")%> |
<%select case pOrderStatus
case 1
response.write getMsg(549,"pending")
if pAllowDelayPayment="-1" then
' shows link to pay if CC has not been entered for off line payment
mySQL="SELECT * FROM creditCards WHERE idOrder=" &pIdOrder
call getFromDatabase(mySQL, rstemp2, "customerShowOrderDetails")
if rstemp2.eof then
%> <%=getMsg(532,"pay")%><%
end if
end if
%> <%=getMsg(533,"cancel")%><%
case 2
response.write getMsg(534,"delivered")
case 3
response.write getMsg(535,"cancelled")
case 4
response.write getMsg(536,"paid")
case 5
response.write getMsg(537,"cback")
case 6
response.write getMsg(538,"rfund")
end select%>
|
| |
|
| <%=getMsg(539,"sku")%> |
<%=getMsg(540,"desc")%> |
<%=getMsg(541,"qty")%> |
<%=getMsg(542,"variation")%> |
<%=getMsg(543,"price")%> |
<%
' get cartRow contents
mySQL="SELECT cartRows.idCartRow, products.idProduct, products.sku, products.description, cartRows.quantity, cartRows.unitPrice, emailText, personalizationDesc FROM cartRows, dbSessionCart, products WHERE dbSessionCart.idDbSessionCart=cartRows.idDbSessionCart AND cartRows.idProduct=products.idProduct AND dbSessionCart.idOrder=" &pIdOrder
call getFromDatabase(mySQL, rstemp2, "customerShowOrderDetails")
pSubTotal = 0
i = 0
do while not rstemp2.eof
pIdCartRow = rstemp2("idCartRow")
pDescription = rstemp2("description")
pDigitalGoodsFile = rstemp2("emailText")
pPersonalizationDesc = rstemp2("personalizationDesc")
%>
| "><%=rstemp2("sku")%> |
<%=left(pDescription,30)%>
<%if pPersonalizationDesc<>"" then response.write " (" &pPersonalizationDesc& ")"%>
<%
' if the order is paid/delivered, setting is enabled and the field has a zip file
if (pOrderStatus=2 or pOrderStatus=4) and pDownloadDigitalGoods="-1" and isDownloadFile(pDigitalGoodsFile) and pDownloadGoodsType<>"ZIP" then
' set the file origin and destination name
i=i+1
fileNameList(i) ="../digitalGoods/"& trim(pDigitalGoodsFile)
' compile file name as order name + file name
saveAsList(i) =pOrderPrefix&pIdOrder&"_"&trim(pDigitalGoodsFile)
' verify expiration
if datediff("d",pOrderDate,pToday)>pDaysToDownloadGoods then
%> <%=getMsg(544,"expired")%><%
else
%> <%=getMsg(545,"dload")%><%
end if ' digital goods
end if%>
<%if (pOrderStatus=2 or pOrderStatus=4) and pDownloadDigitalGoods="-1" and trim(pDigitalGoodsFile)<>"" and pDownloadGoodsType="ZIP" then
' set the file origin and destination name
i=i+1
fileNameList(i) ="../digitalGoods/"& trim(pDigitalGoodsFile)
' compile file name as order name + file name
saveAsList(i) =pOrderPrefix&pIdOrder&"_"&trim(pDigitalGoodsFile)
if datediff("d",pOrderDate,pToday)>pDaysToDownloadGoods then
%> <%=getMsg(544,"expired")%><%
else
%><%=getMsg(545,"dload")%><%
end if
end if%>
|
<%=rstemp2("quantity")%> |
<%=getCartRowOptionals(pIdCartRow)%> |
<%=pCurrencySign & money(getCartRowPrice(pIdCartRow))%> |
<%rstemp2.movenext
loop
session("fileName") =filenameList
session("saveAs") =saveAsList
%>
|
| |
|
<%if pByPassShipping="0" then%>
| <%=getMsg(546,"ship")%> |
<%=pShipmentDetails%> |
<%end if%>
| <%=getMsg(547,"tax")%> |
<%=pCurrencySign & money(pTaxAmount)%> |
| <%=getMsg(548,"total")%> |
<%=pCurrencySign & money(pTotal)%> |
| |
<%
' check RMA
mySQL="SELECT idRma, rmaDate, rmaStatus, customerReasons, adminReasons FROM RMA WHERE idOrder=" &pIdOrder
call getFromDatabase (mySql, rsTemp2,"customerShowOrderDetails")
if not rstemp2.eof then
%>
| <%=getMsg(738,"rma")%>
|
| Date |
<%=formatDate(rstemp2("rmaDate"))%> |
| Status |
<%
select case rstemp2("rmaStatus")
case 1
response.write getMsg(739,"pending")
case 2
response.write getMsg(740,"approved") &" (" &pIdRmaPrefix&rstemp2("idRma")&")"
case 3
response.write getMsg(741,"rejected")
end select
%> |
| Customer reasons |
<%=rstemp2("customerReasons")%> |
| Admin reasons |
<%=rstemp2("adminReasons")%> |
<%if rstemp2("rmaStatus")=2 then%>
| Shipping Label |
">Generate |
<%end if%>
<%end if%>
<%call closeDb()%>