<%option explicit%> <% '*********************************************************** ' Version 6.50 ' Affiliate reports by date ' May 26, 2003 ' Octover 26, 2005 Detailed order report '************************************************************* Dim dbtable Dim fields(10) Dim CapFields(10) dim fieldcount Dim File Dim Dbc dim Action dim fromdate dim todate dim datedelim Dim rs Dim Limit Dim Month Dim Year dim affid affid=Getsess("AffRegister") If affid="" then responseredirect "shopafflogin.asp" end if 'dim database mypagesize=GetSess("ReportLimit") mypage=request("Page") 'VP-ASP 6.50 - precautionary security fix if not isnumeric(mypage) then mypage = "" end if if mypage<>"" then sql=GetSess("affSqlquery") ' on recursive calls we stored sql in sessikon variable fromdate=GetSess("Fromdate") todate=GetSess("Todate") WriteReport else GetInput If Action = "" or Serror<>"" Then DisplayForm Else WriteReport end if End If '******************************** Sub GetInput Serror="" dbtable="Orders" limit=request("Limit") 'VP-ASP 6.50 - precautionary security fix if not isnumeric(limit) then limit = "" end if if limit="" then limit=100 end if SetSess "ReportLimit",limit mypagesize=limit action="" GetActionValues If action<> "" then GetDateValues end if setsess "fromdate",fromdate setsess "todate",todate end sub ' 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 ' 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="" then Serror= getlang("langReportDate") exit sub end if 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 end sub '*********************************************************************** ' Details '********************************************************************** Sub WriteReport shoppageheader if getconfig("xbreadcrumbs") = "Yes" then response.write "" end if Response.Write "

Order Report

" openorderdb dbc dim displayfromdate, displaytodate displayfromdate = datepart("d", fromdate) & " " & monthname(datepart("m", fromdate)) & " " & datepart("yyyy", fromdate) displaytodate = datepart("d", todate) & " " & monthname(datepart("m", todate)) & " " & datepart("yyyy", todate ) Response.write "
" & ReportinfoFont & getlang("LangReport01") & " " & displayfromdate & " to " & displaytodate & "
" & reportinfofontend & "
" If action="DETAILS" then affiliateOrderReport dbc,fromdate, todate, affid, "DETAILS" else affiliateOrderReport dbc,fromdate, todate, affid,"SUMMARY" end if shopclosedatabase dbc GenerateGrandTotals shoppagetrailer end sub ' ' Sub Displayform shopPageHeader if getconfig("xbreadcrumbs") = "Yes" then response.write "" end if Response.Write "

Order Report

" if sError<> "" then response.write "
" & errorfontstart & "" & SError & "" & errorfontend Serror="" end if %>
<% shopdateform getlang("langadmindisplayorders") Response.write "
" shopPageTrailer end sub '***************************************************************** ' VP-ASP date form Used in many places ' VP-ASP 6.50 March 26, 2004 '***************************************************************** Sub Shopdateform_OLD (header) %>
<%=header%>

<%=getlang("langReportFromdate")%>

<%=getlang("langReportToDate")%>

<%=getlang("langReportMonth")%>

<%=getlang("langReportYear")%>

<%=getlang("langReportToday")%>

<%=getlang("langReportYesterday")%>

" name="Summary" />
" class="submitbtn" name="B2" />

" name="Details" />

<%addwebsessform%> <% end sub Sub Shopdateform (header) dim dateprompt dateprompt=getlang("langcommonselect") dateprompt="" & getlang("LangDisplayDate") & "" %> <% dim dateformat ' if (Session.LCID > "") or (getconfig("xlcid") > "") then ' dateformat = 'else if getconfig("xdateformat") > "" then dateformat = replace(getconfig("xdateformat"), " ", "/") dateformat = replace(dateformat, "m", "M") dateformat = replace(dateformat, ".", "/") dateformat = replace(dateformat, "-", "/") else 'default to American format if not otherwise specified dateformat = "mm/dd/yyyy" end if '============================================== %>
<%=getlang("langReportFromdate")%>
<%=dateprompt%>
<%=getlang("langReportToDate")%>
<%=dateprompt%>
<%=getlang("langReportMonth")%>
 
<%=getlang("langReportYear")%>

<%=getlang("langReportToday")%>

<%=getlang("langReportYesterday")%>

<%=getlang("langReportMaxRows")%>

" name="Summary" />

" class='submitbtn' name="B2" />

" name="Details" />

<%addwebsessform end sub%>