<%@ LANGUAGE="VBSCRIPT" %> <% 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. '=============================================== '----------------------------------------------- 'PURGE ABORTED ORDERS '----------------------------------------------- 'We have to loop through each order in turn 'because we have to delete the related invoice 'rows as well. If Request.Form("PurgeOrders") = "True" Then 'We add on one day and add the time of midnight. say we want to delete everything 'from the 8th and before - that means delete everything before 00:00 on the 9th datXDaysAgo = DateAdd("d", -Application(LICENSENUMBER & "purgeunfinisheddays") + 1, Now) datXDaysAgo = year(datXDaysAgo) & "/" & month(datXDaysAgo) & "/" & day(datXDaysAgo) & " 00:00" strQuery = "SELECT ON_ID FROM tblCactuShopOrderNumbers WHERE ON_Sent = 'n' AND ON_Date < " & strDateDelimiter & ReverseFormatYear(datXDaysAgo) & strDateDelimiter Call ExecuteSQL(strQuery, numCursorType, objRecordSet) strIDList = "" Do Until objRecordSet.EOF strIDList = strIDList & objRecordSet(0) & "," objRecordSet.MoveNext Loop objRecordSet.Close If Not strIDList = "" Then strIDList = Left(strIDList, Len(strIDList) - 1) strQuery = strDeleteStatementSyntax & " tblCactuShopInvoiceRows WHERE IR_OrderNumber IN (" & strIDList & ")" objDataConn.Execute(strQuery) strQuery = strDeleteStatementSyntax & " tblCactuShopOrderNumbers WHERE ON_Sent = 'n' AND ON_Date < " & strDateDelimiter & ReverseFormatYear(datXDaysAgo) & strDateDelimiter objDataConn.Execute(strQuery) End If End If Response.Redirect("_orders_list.asp?strCallMode=unfinished") %>