<%option explicit%> <% ShopCheckAdmin "" '*********************************************************** ' VP-ASP Affiliate Reports ' Affiliate Reports ' inputs are table, database ' Version 6.50 Feb 4, 2003 '************************************************************* dim allflag Dim dbtable Dim Capfields(10) dim fieldcount Dim File Dim ScriptResponder Dim Dbc Dim orderdbc dim Action dim fromdate dim todate dim datedelim Dim rs Dim Limit Dim Month Dim Year Dim affid, affdbc, orders Dim affsql, affrs Dim affname, afflogincount, afflogindate, affcommrate Dim ordercount dim orderamount Dim totalorders, totalamount, Totallogins dim fieldvalue dim followonurl dim count dim linksflag dim fromdatex, todatex dim infomsg followonurl=Request("task") if followonurl="" then followonurl="shopa_afflist.asp" end if setsess "followonurl",followonurl SetSess "CurrentURL","shopa_affdates.asp" GetInput If Action = "" or Serror<>"" Then DisplayForm Else WriteReport End If '*********************************************** '* see what merchant wants '********************************************** Sub GetInput Serror="" allflag="" affid=request("affid") 'VP-ASP 6.09 - Precautionary security fix if affid > "" then if not isnumeric(affid) Then shoperror "Affiliate ID must be numeric" end if end if dbtable="affiliates" limit=request("Limit") if limit="" then limit=100 end if mypage=1 SetSess "ReportLimit",limit mypagesize=limit action="" GetActionValues If action<> "" then GetDateValues Validatedates end if 'Debugwrite "fromdate=" & Getsess("fromdate") & " todate=" & getsess("todate") end sub ' '******************************************************* ' Which report do we want detailed or summary '******************************************************** Sub WriteReport Debugwrite "duoing report" dim url url=getsess("followonurl") url=url & "?affid=" & affid &"&action=" & action responseredirect url end sub ' '************************************************** ' could be summary or detail '************************************************* Sub GetActionValues action=request("summary") if action<>"" then action="SUMMARY" else action=request("Details") if action<>"" then action="DETAILS" end if end if end Sub ' '***************************************************** ' Determine date ranges '************************************************** Sub GetDateValues dim datevalue fromdate=request("fromdate") todate=request("todate") If fromdate<>"" then if todate="" then todate=date() end if ValidateDates exit sub end if ' Try month Month=Request("month") Year=Request("Year") If month>"0" then FormatMonth exit sub end if If Year>"0" then FormatYear exit sub end if '****************************************************** ' Try Radio Buttons '*************************************************** datevalue=request("DateSelect") datevalue=ucase(datevalue) 'debugwrite "datevalue=" & datevalue If datevalue="TODAY" then fromdate=date() todate=date() exit sub end if If datevalue="YESTERDAY" then fromdate=dateadd("d",-1, date()) todate=fromdate exit sub end if end sub Sub FormatMonth If lcase(getconfig("xenvironment"))="chillisoft" then formatmonthchilli exit sub end if month=cint(month) if Year="0" then Year=Datepart("yyyy",date()) else Year=clng(year) end if fromdate= month & "/" & Year month=month+1 if month = 13 then month=1 Year=Year+1 end if Todate= month & "/" & Year fromdate=cdate(fromdate) todate=cdate(todate) todate = dateadd("d",-1, todate) end sub ' Sub formatYear If lcase(getconfig("xenvironment"))="chillisoft" then formatyearchilli exit sub end if Year=clng(year) month=1 fromdate= month & "/" & Year Year=Year+1 Todate= month & "/" & Year fromdate=cdate(fromdate) todate=cdate(todate) todate=dateadd("d",-1,todate) end sub ' Sub ValidateDates If not Isdate(fromdate) then Serror="
" & getlang("LangReportInvalidDate") & fromdate end if If not Isdate(todate) then Serror="
" & getlang("LangReportInvalidDate") & todate end if If fromdate="" and todate="" then Serror= getlang("LangReportDate") end if If serror="" then SetSess "Fromdate",fromdate SetSess "todate",Todate end if end sub Sub DisplayForm AdminPageHeader if sError<> "" then shopwriteError SError Serror="" end if generatedisplayheader "Affiliate Links" generatedisplaybodyheader %>
" name="reportform"><% shopdateform getlang("LangAffHeader") AddHiddenFields %>
<% GenerateDisplayBodyFooter gethelp AdminPageTrailer end sub ' Sub AddHiddenFields Formathiddenfield "affid",affid Formathiddenfield "task",followonurl end sub Sub FormatHiddenField (fieldname, fieldvalue) response.write "" & vbcrlf end sub %>