<%@ LANGUAGE="VBSCRIPT" %> <% PageStrings = "311, 361, 405, 445, 525, 697, 800, 801, 802, 803, 804, 805, 809, 810, 811, 812, 813, 814, 815, 816, 817, 818, 826, 830, 831, 913" 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. '=============================================== '----------------------------------------------- 'COUPONS LIST 'Shows a list of coupons by date. '----------------------------------------------- CP_CreatedTime = request.querystring("CP_CreatedTime") CP_CouponCode = request.querystring("CP_CouponCode") If CP_CreatedTime = "" then If CP_CouponCode = "" then strListType = "groupedbydate" '----------------------------------------------- 'GROUP BY DATE '----------------------------------------------- strQuery = "SELECT COUNT(tblCactuShopCoupons.CP_ID) AS CouponTotal, CP_CreatedTime FROM tblCactuShopCoupons GROUP BY CP_CreatedTime ORDER BY CP_CreatedTime DESC" else strListType = "specificcoupon" '----------------------------------------------- 'FIND SPECIFIC COUPON '----------------------------------------------- strQuery = "SELECT * FROM tblCactuShopCoupons WHERE CP_CouponCode LIKE '%" & sqlsafe(CP_CouponCode) & "%'" end if else strListType = "batchofcoupons" '----------------------------------------------- 'SELECT ALL COUPONS FOR GIVEN DATE '----------------------------------------------- strQuery = "SELECT * FROM tblCactuShopCoupons WHERE CP_CreatedTime=" & strDateDelimiter & ReverseFormatYear(CP_CreatedTime) & strDateDelimiter & " ORDER BY CP_CouponCode" end if Call ExecuteSQL(strQuery, numCursorType, objRecordSet) numRecordCount = objRecordSet.recordcount %> <% =GetString("Config_headtitle") %>
<% If strListType = "specificcoupon" then '----------------------------------------------- 'FIND ORDER(S) THAT USED THIS COUPON '----------------------------------------------- If numRecordCount = 0 then numRecordCount = -1 else strQuery2 = "SELECT * FROM tblCactuShopOrderNumbers WHERE ON_CouponCode = '" & objRecordSet("CP_CouponCode") & "'" Call ExecuteSQL(strQuery2, numCursorType, objRecordSet2) numRecordCount = objRecordSet2.recordcount If numRecordCount = 1 then %> <% elseif numRecordCount > 1 then %> <% end if objRecordSet2.close end if end if %>
<% WriteString("PageTitle_Coupons") %> <% WriteString("ContentText_New") %>
<% WriteString("ContentText_ShowOrder") %> "><% WriteSafeString(" title="<% WriteSafeString("ContentText_ShowOrder") %>" src="images_webshop/b_order.gif" border="0">

<% WriteString("ContentText_ListOrders") %> "><% WriteSafeString(" title="<% WriteSafeString("ContentText_ListOrders") %>" src="images_webshop/b_order.gif" border="0">

<% WriteString("ContentText_FindACoupon") %> ">
<% WriteString("ContentText_EnterCouponCode") %>
<% Select Case strListType Case "batchofcoupons" %>
<% if numRecordCount<>0 then do while NOT objRecordSet.EOF numBackgroundCounter = numBackgroundCounter + 1 If numBackgroundCounter mod 2 = 0 then strBGColour = "#EEEEEE" else strBGColour = "#DDDDDD" end if %> <% objRecordSet.moveNext loop else %> <% end if objRecordSet.Close %>
<% WriteString("ContentText_CouponCode") %> <% WriteString("FormLabel_CouponValue") %> <% WriteString("FormLabel_StartDate") %> <% WriteString("FormLabel_EndDate") %> <% WriteString("FormLabel_Used") %>  
<% =objRecordSet("CP_CouponCode") %> <% If objRecordSet("CP_DiscountType")="p" then response.write(objRecordSet("CP_DiscountValue") & "%") else response.write(strDefaultCurrencySymbol & " " & CurrencyDisplay(objRecordSet("CP_DiscountValue"), 1, blnDefaultCurrencyHasDecimals)) end if %> <% =FriendlyDate(objRecordSet("CP_StartDate"), "d") %> <% If objRecordSet("CP_EndDate") > Cdate("2999/12/30") then response.write("-") else response.write(FriendlyDate(objRecordSet("CP_EndDate"), "d")) end if %> <% If objRecordSet("CP_Used")="y" then %><% end if %> ">

<% WriteString("ContentText_NoCouponsWereFound") %>

<% Case "groupedbydate" %>
<% if numRecordCount<>0 then do while NOT objRecordSet.EOF numBackgroundCounter = numBackgroundCounter + 1 If numBackgroundCounter mod 2 = 0 then strBGColour = "#EEEEEE" else strBGColour = "#DDDDDD" end if %> <% objRecordSet.moveNext loop else %> <% end if objRecordSet.Close %>
<% WriteString("ContentText_DateTimeCreated") %> <% WriteString("ContentText_Qty") %>  
<% =FriendlyDate(objRecordSet("CP_CreatedTime"), "t") %> <% =objRecordSet("CouponTotal") %> "><% WriteSafeString(" title="<% WriteSafeString("ContentText_ListCoupons") %>">

<% WriteString("ContentText_NoCouponsWereFound") %>

<% Case "specificcoupon" if numRecordCount > -1 then %>
<% WriteString("ContentText_CouponCode") %> <% =objRecordSet("CP_CouponCode") %>
<% WriteString("FormLabel_CouponValue") %> <% If objRecordSet("CP_DiscountType")="p" then response.write(objRecordSet("CP_DiscountValue") & "%") else response.write(strDefaultCurrencySymbol & " " & CurrencyDisplay(objRecordSet("CP_DiscountValue"), 1, blnDefaultCurrencyHasDecimals)) end if %>
<% WriteString("FormLabel_StartDate") %> <% =FriendlyDate(objRecordSet("CP_StartDate"), "d") %>
<% WriteString("FormLabel_EndDate") %> <% If objRecordSet("CP_EndDate") > Cdate("2999/12/30") then response.write("-") else response.write(FriendlyDate(objRecordSet("CP_EndDate"), "d")) end if %>
<% WriteString("FormLabel_Used") %> <% =objRecordSet("CP_Used") %>
<% WriteString("FormLabel_Reusable") %> <% =objRecordSet("CP_Reusable") %>
<% WriteString("ContentText_Live") %> <% =objRecordSet("CP_Enabled") %> <% If objRecordSet("CP_Enabled") = "y" then %> &strCallMode=disable"><% WriteString("ContentText_DisableThisCoupon") %> <% else %> &strCallMode=enable"><% WriteString("ContentText_EnableThisCoupon") %> <% end if %>

<% If numRecordCount = 0 then %>
">
"> <% WriteString("ContentText_DeleteCoupon") %>
<% else %>
<% WriteString("ContentText_CantDeleteCoupon") %>
<% end if else %>
<% WriteString("ContentText_CouponNotFound") %>.
<% end if %> <% End Select %>
<% objDataConn.Close set objDataConn = nothing %>