%@ LANGUAGE="VBSCRIPT" %> <% PageStrings = "355, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 386, 828, 355, 1032, 1033, 1034, 1035, 1036, 1037, 1067" 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. '=============================================== '----------------------------------------------- 'AFFILIATE PAYMENT PAGE 'This shows all the unpaid commissions for a 'specific affiliate, a list of all payments made 'and the ability to group together commissions 'in to one payment '----------------------------------------------- '----------------------------------------------- 'CHECK FOR VALID AFFILIATE ID 'Just check that the given details are all valid ' - if not, if the AF_ID is incorrect, direct to ' sales stats page, else set the month/year to ' today's month/year. '----------------------------------------------- AF_ID = request.querystring("AF_ID") If Not IsNumeric(AF_ID) Or AF_ID = "" Then response.redirect("_affiliate_list.asp") '------------------------------------------ 'GET THE AFFILIATE NAME '------------------------------------------ strQuery = "SELECT AF_Name FROM tblCActuShopAffiliates WHERE AF_ID = " & AF_ID Call ExecuteSQL(strQuery, numCursorType, objRecordSet) if objRecordSet.BOF and objRecordSet.EOF then response.Redirect("_affiliate_list.asp") else strAffiliateName = objRecordSet("AF_Name") end if objRecordSet.Close '------------------------------------------ 'FIND TOTAL OF UNPAID FROM THIS AFFILIATE '------------------------------------------ strQuery = "SELECT SUM(ROUND(ON_AffiliateTotalPrice * (ON_AffiliatePercentage/100) + 0.00000001 ,2)) AS Commission FROM (tblCactuShopAffiliates INNER JOIN tblCactuShopCardholderDetails ON tblCactuShopAffiliates.AF_ID = tblCactuShopCardholderDetails.CD_AffiliateID) INNER JOIN tblCactuShopOrderNumbers ON tblCactuShopOrderNumbers.ON_CardholderID = tblCactuShopCardholderDetails.CD_ID WHERE tblCactuShopCardholderDetails.CD_AffiliateID = " & AF_ID & " AND ON_Sent = 'y' AND tblCactuShopOrderNumbers.ON_AffiliatePaymentID = 0" Call ExecuteSQL(strQuery, numCursorType, objRecordSet) If objRecordSet.RecordCount = 0 Then numUnpaidCommission = 0 Else numUnpaidCommission = objRecordSet(0) If IsNull(numUnpaidCommission) Then numUnpaidCommission = 0 End If objRecordSet.Close '------------------------------------------ 'FIND TOTAL OF PAID FROM THIS AFFILIATE '------------------------------------------ strQuery = "SELECT SUM(ROUND(ON_AffiliateTotalPrice * (ON_AffiliatePercentage/100) + 0.00000001 ,2)) AS Commission, tblCactuShopAffiliates.AF_Name FROM (tblCactuShopAffiliates INNER JOIN tblCactuShopCardholderDetails ON tblCactuShopAffiliates.AF_ID = tblCactuShopCardholderDetails.CD_AffiliateID) INNER JOIN tblCactuShopOrderNumbers ON tblCactuShopOrderNumbers.ON_CardholderID = tblCactuShopCardholderDetails.CD_ID WHERE tblCactuShopCardholderDetails.CD_AffiliateID = " & AF_ID & " AND ON_Sent = 'y' AND tblCactuShopOrderNumbers.ON_AffiliatePaymentID <> 0 GROUP BY AF_Name" Call ExecuteSQL(strQuery, numCursorType, objRecordSet) If objRecordSet.RecordCount = 0 Then numPaidCommission = 0 Else numPaidCommission = objRecordSet(0) If IsNull(numPaidCommission) Then numPaidCommission = 0 End If objRecordSet.Close %>