<%@ 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 strCallMode = "gateway" then %> <% else %> <% end if %>
<% WriteString("PageTitle_Orders") %> - <%= strPageSubTitle %>
<%= strPageText %>
Gateway:   <% WriteString("ContentText_TransID") %>:  ">
<% WriteString("ContentText_FindAnOrder") %> ">
<% WriteString("ContentText_EnterDate") %>
<% If numErrorNo = 0 then If strCallMode = "unfinished" Then %>
<% Response.Write(FriendlyDate(DateAdd("d", -Application(LICENSENUMBER & "purgeunfinisheddays") + 1, Now),"d")) %>">
<% End If %> <% if blnLimitDate then datValue2 = datValue1 - 2 %> <% end if %> <% If CD_EmailAddress="" AND CP_CouponCode="" AND strCallMode="" then %> <% datValue2 = datValue2-3 end if %>
<< <% 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 %>
<% '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") %>
<% if numRecordCount<>0 then do while not objRecordSet.EOF numBackgroundCounter = numBackgroundCounter + 1 If numBackgroundCounter mod 2 = 0 then strBgColourNorm="#EEEEEE" strBgColourRed="#FFAAAA" strBgColourGreen="#99CC99" else strBgColourNorm="#DDDDDD" strBgColourRed="#FFBBBB" strBgColourGreen="#99DD99" end if strThisBgColour = strBgColourNorm If objRecordSet("ON_Invoiced") = "y" AND objRecordSet("ON_Paid")="n" AND (objRecordSet("ON_Date") + CInt(Application(LICENSENUMBER & "invoiceduedays"))) < now() then strThisBgColour = strBgColourRed If objRecordSet("ON_Paid") = "y" then strThisBgColour = strBgColourGreen %> <% If objRecordSet("CUR_HasDecimals") = "n" then CUR_HasDecimals = false else CUR_HasDecimals = true %> <% objRecordSet.moveNext loop%> <% else if strCallMode = "gateway" then %> <% else %> <% end if end if objRecordSet.Close %>
<% WriteString("ContentText_ID") %> <% WriteString("ContentText_DateTime") %> <% WriteString("ContentText_Value") %>     <% WriteString("ContentText_CustomerName") %>  
<% =objRecordSet("ON_ID") %> <% =FriendlyDate(objRecordSet("ON_Date"),"d") %><% =objRecordSet("CUR_Symbol") & " " & CurrencyDisplay(objRecordSet("ON_TotalPrice"), 1, CUR_HasDecimals) %>     <% =objRecordSet("CD_CardholderName") %> "><% WriteSafeString(" title="<% WriteSafeString("ImageLabel_ViewThisCustomer") %>" src="images_webshop/b_customer.gif" border=0> &datValue1=<%=server.URLEncode(ReverseFormatYear(datValue1))%>&strCallMode=<%=strCallMode%>&CD_EmailAddress=<%=CD_EmailAddress%>&CP_CouponCode=<%=CP_CouponCode%>&AFP_ID=<%=AFP_ID%>"><% WriteSafeString(" title="<% WriteSafeString("ImageLabel_ViewThisOrder") %>">
<% WriteString("ContentText_OrdersListIndicates") %>

<% WriteString("ContentText_SelectGateWay") %>

<% WriteString("ContentText_NoOrdersMadeOnThisDay") %>

<% else %>
<% WriteString("ContentText_TheDateEnteredWasInvalid") %>
<< <% WriteString("ContentText_BackLink") %>
<% end if %>
<% objDataConn.Close set objDataConn = nothing %>