%@ LANGUAGE="VBSCRIPT" %>
<% PageStrings = "311, 333, 350, 351, 352, 354, 355, 357, 358, 359, 380, 408, 414, 986, 987, 989, 1088, 1089, 1090, 1091, 1092, 1093, 1094, 1095, 1096, 1097, 1098, 1099, 1100, 1101, 1102, 1103, 1104, 1105, 1106, 1107, 1108, 1123, 1215, 1216, 1217, 1218, 1219, 1220, 1221"
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.
'===============================================
'-----------------------------------------------
'ORDERS LIST
'Shows recent orders, lets the site owner view
'text of any order, search for orders and mark
'those orders that have been actioned. Customers
'can view the status of their order from the web
'shop front end.
'-----------------------------------------------
'All the following values can effect the search
'based on what page is calling it
datValue1 = request.querystring("datValue1")
strCallMode = request.querystring("strCallMode")
CD_EmailAddress = SqlSafe(request.querystring("CD_EmailAddress"))
CP_CouponCode = SqlSafe(request.querystring("CP_CouponCode"))
AFP_ID = request.QueryString("AFP_ID")
strGateway = request.QueryString("strGateway")
strGatewayID = request.QueryString("strGatewayID")
If not datValue1 = "" then
'If we're searching by date, then reset the callmode
'so we view by day.
strCallMode = ""
if NOT IsDate(datValue1) then
numErrorNo = 1
strPageSubTitle = GetString("PageTitle_OrdersByDay")
else
datValue1 = cdate(formatdatetime(datValue1))
if datValue1 > now then datValue1 = CDate(formatdatetime(now))
end if
End if
If numErrorNo = 0 then
if strCallMode = "gateway" then
If strGateway = "" then
If strGatewayID = "" then
'If nothing selected yet, don't get any records
strSearchClause = "1=0"
Else
strSearchClause = "ON_ReferenceCode LIKE '%" & strGatewayID & "%'"
End If
Else
If strGatewayID = "" then
strSearchClause = "ON_PaymentGateway = '" & strGateway & "'"
Else
strSearchClause = "ON_PaymentGateway = '" & strGateway & "' AND ON_ReferenceCode LIKE '%" & strGatewayID & "%'"
End If
End If
numLimitClause = 50
blnLimitDate = false
strPageSubTitle = GetString("PageTitle_OrdersByPaymentGateway")
strPageText = GetString("ContentText_OrdersByPaymentGatewayText")
Else
If CD_EmailAddress = "" Then
If CP_CouponCode = "" then
Select Case strCallMode
case "affpayment"
If not isnumeric(AFP_ID) or AFP_ID = "" then response.Redirect("_default.asp")
strSearchClause = "ON_AffiliatePaymentID = " & AFP_ID
numLimitClause = 0
blnLimitDate = false
strPageSubTitle = GetString("PageTitle_OrdersAffiliatePayments")
strPageText = GetString("ContentText_OrdersAffiliatePaymentsText")
Case "recent"
strSearchClause = "ON_Sent = 'y'"
numLimitClause = 25
blnLimitDate = false
strPageSubTitle = GetString("PageTitle_OrdersRecent")
strPageText = GetString("ContentText_OrdersRecentText")
Case "invoice"
strSearchClause = "ON_Sent = 'y' AND ON_Invoiced='n' AND ON_Paid='n'"
numLimitClause = 50
blnLimitDate = false
strPageSubTitle = GetString("PageTitle_OrdersAwaitingInvoice")
strPageText = GetString("ContentText_OrdersAwaitingInvoiceText")
Case "dispatch"
strSearchClause = "ON_Sent = 'y' AND ON_Shipped='n' AND ON_Paid='y'"
numLimitClause = 50
blnLimitDate = false
strPageSubTitle = GetString("PageTitle_OrdersAwaitingDispatch")
strPageText = GetString("ContentText_OrdersAwaitingDispatchText")
Case "payment"
strSearchClause = "ON_Sent = 'y' AND ON_Invoiced='y' AND ON_Paid='n'"
numLimitClause = 50
blnLimitDate = false
strPageSubTitle = GetString("PageTitle_OrdersAwaitingPayment")
strPageText = GetString("ContentText_OrdersAwaitingPaymentText")
Case "unfinished"
strSearchClause = "ON_Sent='n'"
numLimitClause = 50
blnLimitDate = false
strPageSubTitle = GetString("PageTitle_OrdersUnfinished")
strPageText = GetString("ContentText_OrdersUnfinishedText")
Case Else
If datValue1 = "" then datValue1 = cdate(formatdatetime(now(), 2))
strSearchClause = "ON_Sent = 'y' AND ON_Date>" & strDateDelimiter & ReverseFormatYear(datValue1) & strDateDelimiter & " AND ON_Date<" & strDateDelimiter & ReverseFormatYear(datValue1 + 1) & strDateDelimiter
numLimitClause = 0
blnLimitDate = true
strPageSubTitle = GetString("PageTitle_OrdersByDay")
strPageText = GetString("ContentText_OrdersByDayText")
End Select
else
strSearchClause = "ON_CouponCode='" & CP_CouponCode & "'"
numLimitClause = 0
strPageSubTitle = GetString("PageTitle_OrdersCoupons")
strPageText = GetString("ContentText_OrdersCouponsText")
end if
Else
numLimitClause = 0
strSearchClause = "CD_EmailAddress='" & CD_EmailAddress & "'"
strPageSubTitle = GetString("PageTitle_OrdersCustomerEmail")
strPageText = GetString("ContentText_OrdersCustomerEmailText")
End If
End If
datValue2 = now()
If numLimitClause = 0 Then
strQuery = "SELECT * FROM (tblCactuShopCardholderDetails INNER JOIN tblCactuShopOrderNumbers ON tblCactuShopCardholderDetails.CD_ID = tblCactuShopOrderNumbers.ON_CardholderID) INNER JOIN tblCactuShopCurrencies ON tblCactuShopOrderNumbers.ON_CurrencyID = tblCactuShopCurrencies.CUR_ID WHERE " & strSearchClause & " ORDER BY ON_Date DESC"
Else
If strDatabaseType = "mysql" Then
strQuery = "SELECT * FROM (tblCactuShopCardholderDetails INNER JOIN tblCactuShopOrderNumbers ON tblCactuShopCardholderDetails.CD_ID = tblCactuShopOrderNumbers.ON_CardholderID) INNER JOIN tblCactuShopCurrencies ON tblCactuShopOrderNumbers.ON_CurrencyID = tblCactuShopCurrencies.CUR_ID WHERE " & strSearchClause & " ORDER BY ON_Date DESC LIMIT 0, " & numLimitClause
Else
strQuery = "SELECT TOP " & numLimitClause & " * FROM (tblCactuShopCardholderDetails INNER JOIN tblCactuShopOrderNumbers ON tblCactuShopCardholderDetails.CD_ID = tblCactuShopOrderNumbers.ON_CardholderID) INNER JOIN tblCactuShopCurrencies ON tblCactuShopOrderNumbers.ON_CurrencyID = tblCactuShopCurrencies.CUR_ID WHERE " & strSearchClause & " ORDER BY ON_Date DESC"
End If
End If
Call ExecuteSQL(strQuery, numCursorType, objRecordSet)
numRecordCount = objRecordSet.recordcount
End if
%>
<% =GetString("Config_headtitle") %>
<% If numErrorNo = 0 then
If strCallMode = "unfinished" Then
%>
<% End If %>
<% if blnLimitDate then
datValue2 = datValue1 - 2 %>
<< <%
response.write(FriendlyDate(datValue2 + 1, "d"))
%> | <% =FriendlyDate(datValue2 + 2, "d") %>
<% datValue2 = datValue2 + 2
If datValue2 < now() - 1 then
%>| <%
response.write(FriendlyDate(datValue2 + 1, "d"))
%> >> <% end if %>
<% end if %>
<% If CD_EmailAddress="" AND CP_CouponCode="" AND strCallMode="" then %>
<%
'Write out the date, along with the day of the week
Select Case WeekDay(datValue1)
Case 1: WriteString("WeekDay_Sunday")
Case 2: WriteString("WeekDay_Monday")
Case 3: WriteString("WeekDay_Tuesday")
Case 4: WriteString("WeekDay_Wednesday")
Case 5: WriteString("WeekDay_Thursday")
Case 6: WriteString("WeekDay_Friday")
Case 7: WriteString("WeekDay_Saturday")
End Select
response.Write ", " & FriendlyDate(datValue1,"d") %>
<% datValue2 = datValue2-3
end if
%>
<% else %>
<% end if %>
<%
objDataConn.Close
set objDataConn = nothing
%>