%Option explicit%>
<%
'*******************************************************
' Version 6.50
' allows viewing of previous order and restore of orders
' allows user to check the status of their order
' add points logic
' Oct 2, 2004 case on orderid
' Nov 22, 2006 HK Support RMA
'*******************************************************
dim customerid
CustCheckAdmin customerid
dim dbc
dim UsePassword
Dim Fieldname
Dim fieldvalue
dim fields(20)
dim captions(20)
dim fieldcount
Dim strpassword
Dim rc
Dim sAction
Dim Ordernumber
SetSess "CurrentUrl","shopstatus.asp"
Customerid=Getsess("Customerlogincid")
ordernumber=request("ordernumber")
'VP-ASP 6.09 Security Fix
If not isnumeric(ordernumber) then
shoperror "Order Number must be numeric"
end if
if getconfig("xallowReviewOrders")<>"Yes" then
responseredirect "shopcustadmin.asp?msg=" & Server.URLEncode (getlang("LangCustNotAllowed"))
end if
'
sAction=Request.form("Action")
if saction="" then
sAction=Request.form("Action.x")
end if
mypage=Request("page")
'VP-ASP 6.50 - precautionary security fix
if not isnumeric(mypage) then
mypage = ""
end if
shoppageheader
if getconfig("xbreadcrumbs") = "Yes" then
response.write "
" & vbCrLf
end if
Response.Write "" & getlang("langcustadminstatus") & "
" & vbCrLf
if mypage<>"" then
'VP-ASP 6.09 Security Fix
If not isnumeric(mypage) then
shoperror "Page size must be numeric"
end if
sql=GetSess("sqlStatus") ' on recursive calls we stored sql in sessikon variable
displayOrders
else
mypage=1
DisplayOrders
end if
ShopPagetrailer
Sub DisplayOrders
dim maxrecs, cid
dim recordcount
mypagesize=getconfig("xeditdisplaymaxrecords")
maxrecs=mypagesize
OpenOrderDB dbc
cid = clng(customerid)
If ordernumber<>"" then
If not Isnumeric(ordernumber) then
Serror=getlang("LangStatusError01")
displayErrors
exit sub
end if
end if
SQL= "Select * from orders where ocustomerid=" & cid
sql=sql & " and ( canceled is null or canceled=0 )"
If ordernumber="" then
Sql=SQL & " order by odate DESC"
else
sql=sql & " AND orderid=" & ordernumber & " ORDER BY orderid DESC"
end if
SetSess "sqlstatus",SQL
ShopOpenRecordSet SQL,objRS, mypagesize, mypage
if objRS.eof then
Serror=getlang("LangNoOrders") & " " & ordernumber
DisplayErrors
objRS.Close
set objRS=nothing
ShopCloseDatabase dbc
exit sub
end if
recordcount=0
Response.write "" & smallinfofont & getlang("LangCommonPage") & " " & mypage & " " & getlang("LangCommonOf") & " " & maxpages & smallinfoend & "
"
'VP-ASP 6.50 - add scroller if content too wide
'Response.Write "" & vbCrLf
OrderTableHeader
While Not objRS.EOF and recordcount < maxrecs
OrderFormatRow ' actual row is formatted
objRS.MoveNext
recordcount=recordcount+1
Wend
response.write "" & vbCrLf
'VP-ASP 6.50 - add scroller if content too wide
'Response.Write "
" & vbCrLf
If Ordernumber="" then
Call PageNavBar (SQL)
end if
objRS.Close
set objRS=nothing
ShopCloseDatabase dbc
If getconfig("xpoints")="Yes" then
PointsDisplay cid
end if
End Sub
'
Sub OrderFormatRow
dim i
dim fieldvalue
response.write ""
for i = 0 to fieldcount
Select Case fields(i)
Case "RESTORE"
CreateRestoreLink fieldvalue, objrs("orderid")
Case "TRACK"
CreateTrackLink fieldvalue, objrs("orderid")
Case "PRINT"
CreatePrintLink fieldvalue, objrs("orderid")
case "ORDERAMOUNT"
fieldvalue=objrs(fields(i))
fieldvalue=shopformatcurrency(fieldvalue,Getconfig("xdecimalpoint"))
Case "OPROCESSED"
fieldvalue=objrs(fields(i))
DisplayProcessed fieldvalue
case "ORDERID"
CreateViewLink fieldvalue, objrs("orderid")
case "OSTATUS"
fieldvalue=objrs(fields(i))
DisplayStatus fieldvalue
case "OPOINTS"
fieldvalue=objrs(fields(i))
if isnull(fieldvalue) then
fieldvalue=getlang("langcommonNo")
end if
' VP-ASP 6.50
Case "RMA"
CreateRMALink fieldvalue, objrs("orderid")
Case Else
fieldvalue=objrs(fields(i))
end select
response.write ReportDetailColumn & fieldvalue & ReportDetailcolumnEnd
next
response.write "
"
end sub
'
Sub CreateRestoreLink (fieldvalue, oid)
dim my_link
my_link="shoprestoreorder.asp?Restore=Yes&oid=" & oid
fieldvalue="" & getlang("LangCommonYes") & ""
end sub
Sub CreateTrackLink (fieldvalue, oid)
dim my_link
my_link="shopcusttracking.asp?oid=" & oid
fieldvalue="" & getlang("LangCommonYes") & ""
end sub
Sub CreatePrintLink (fieldvalue, oid)
dim my_link
my_link="shoporderprint.asp?oid=" & oid
fieldvalue="Print"
end sub
Sub CreateViewLink (fieldvalue, oid)
dim my_link
my_link="shoprestoreorder.asp?View=Yes&oid=" & oid
fieldvalue="" & Oid & ""
end sub
Sub DisplayProcessed (fieldvalue)
'VP-ASP 6.50 - broadened defintion of IF statement to cover cases where xmysql hasn't been set
if ucase(xdatabasetype) = "MYSQL" OR ucase(xdatabasetype) = "MYSQL351" OR getconfig("xMYSQL")="Yes" then
If fieldvalue then
fieldvalue=1
else
fieldvalue=0
end if
end if
if fieldvalue<>0 then
fieldvalue=getlang("LangcommonYes")
else
fieldvalue=getlang("LangCommonNo")
end if
end sub
Sub DisplayStatus (fieldvalue)
dim ocardtype
If isnull(fieldvalue) then
ocardtype=objrs("ocardtype")
end if
end sub
'
Sub OrderTableHeader
dim i
Fields(0)="ORDERID"
Fields(1)="ORDERAMOUNT"
Fields(2)="Odate"
Fields(3)="ofirstname"
Fields(4)="olastname"
Fields(5)="OSTATUS"
Fields(6)="OPROCESSED"
Fields(7)="" ' keyword
Fields(8)="" ' keyword
Fields(9)="" ' keyword
Captions(0)=getlang("langStatusOrderNum")
Captions(1)=getlang("LangStatusAmount")
Captions(2)=getlang("LangStatusDate")
Captions(3)=getlang("LangCustFirstName")
Captions(4)=getlang("LangCustLastName")
Captions(5)=getlang("LangStatusStatus")
Captions(6)=getlang("LangStatusProcessed")
fieldcount=6
If getconfig("xAllowRestoreOrder")="Yes" Then
fieldcount=fieldcount+1
Captions(fieldcount)=getlang("LangRestoreOrder")
Fields(fieldcount)="RESTORE" ' keyword
end if
If getconfig("xtrackingcustomerread")="Yes" or getconfig("xtrackingcustomerwrite")="Yes" Then
fieldcount=fieldcount+1
Captions(fieldcount)=getlang("Langtracking")
Fields(fieldcount)="TRACK" ' keyword
end if
If getconfig("xPoints")="Yes" Then
fieldcount=fieldcount+1
Captions(fieldcount)=getlang("langpoints")
Fields(fieldcount)="OPOINTS" ' keyword
end if
if getconfig("xprinterfriendlypage") = "Yes" then
fieldcount=fieldcount+1
Captions(fieldcount)="Print"
Fields(fieldcount)="PRINT" ' keyword
end if
' VP-ASP 6.50
if getconfig("xrmaallowed") = "Yes" then
fieldcount=fieldcount+1
Captions(fieldcount)=getlang("langrma")
Fields(fieldcount)="RMA" ' keyword
end if
shopwriteheader getlang("LangStatus02")
'
DisplayForm
response.write ""
response.write ReportHeadRow
for i = 0 to fieldcount
Response.write ReportHeadColumn & Captions(i) & ReportHeadColumnEnd
next
response.write ReportRowEnd
end sub
'
Sub DisplayForm
Response.Write("")
End sub
Sub DisplayErrors
shopwriteerror Serror
Displayform
End Sub
'*************************************************************************
' VP-ASP 6.50
' create a link to allow returns of either an order or specific item
'*************************************************************************
Sub CreateRMALink (fieldvalue, oid)
dim my_link
my_link="shoprma.asp?oid=" & oid
fieldvalue="" & getlang("Langrma") & ""
end sub
%>