<% '************************************************************ ' Affiliate Formatting ' For each affiliate we get number of links and number of orders ' VP-ASP 6.50 Jan 3, 2003 '************************************************************* Sub ProduceAllDetail (rs, orderdbc) dim total dim nopayment count=0 totalorders=0 totalamount=0 totallogins=0 nopayment=0 FormatTableStart limit=clng(mypagesize) While Not rs.EOF and count" count=count+1 rs.movenext wend FormattableEnd Call PageNavBar (SQL) ProduceAllSummaryReport end sub '************************************************************ ' For each affiliate we get number of links and number of orders '************************************************************* Sub ProduceAllSummary (rs, orderdbc) dim total dim nopayment count=0 totalorders=0 totalamount=0 totallogins=0 nopayment=0 While Not rs.EOF affid=rs("affid") AllGetOrderInfo orderdbc, affid afflogincount=rs("logincount") afflogindate=rs("logindate") affname=rs("firstname") & " " & rs("lastname") affcommrate=rs("commissionrate") count=count+1 TotalOrders=Totalorders+Ordercount Totalamount=Totalamount+Orderamount Totallogins=Totallogins+afflogincount rs.movenext wend closerecordset rs ProduceAllSummaryReport end sub Sub GetAffiliateInfo (affid) '**************************************************** ' we need to get something from affilaites table '***************************************************** affsql="select * from affiliates where affid=" & affid set affrs=affdbc.execute(affsql) If affrs.eof then affname="" afflogincount=0 afflogindate="" affrs.close set affrs=nothing exit sub end if afflogincount=affrs("logincount") afflogindate=affrs("logindate") affname=affrs("firstname") & " " & affrs("lastname") affcommrate=affrs("commissionrate") affrs.close set affrs=nothing end sub Sub FormatAffid (affid) dim my_link scriptresponder="shopa_affformataffiliate.asp" my_link=scriptresponder & "?affid=" & affid fieldvalue="" & affid & "" writecolumn fieldvalue end sub Sub FormatView (affid) dim my_link scriptresponder="shopa_affdisplayorders.asp" my_link=scriptresponder & "?affid=" & affid fieldvalue="" & "View Orders" & "" writecolumn fieldvalue end sub Sub FormatAccounts (affid) dim my_link scriptresponder="shopa_affaccounts.asp" my_link=scriptresponder & "?affid=" & affid fieldvalue="" & "Account Reports" & "" writecolumn fieldvalue end sub Sub FormatLogins (afflogincount, totallogins) fieldvalue=AffLoginCount Totallogins=Totallogins+fieldvalue Writecolumn fieldvalue end sub Sub FormatLoginDate (afflogindate) fieldvalue=AffLoginDate Writecolumn fieldvalue end sub Sub FormatOrders (ordercount, totalorders) fieldvalue=OrderCount 'VP-ASP 6.50 - convert values below to doubles before calculating TotalOrders=cdbl(Totalorders)+cdbl(OrderCount) Writecolumn fieldvalue end sub Sub FormatOrderAmount(orderamount, totalamount) fieldvalue=shopformatcurrency(Orderamount,getconfig("xdecimalpoint")) Writecolumn fieldvalue Totalamount=Totalamount+Orderamount end sub Sub FormatName (affname) fieldvalue=affname Writecolumn fieldvalue end sub Sub WriteColumn (fieldvalue) response.write ReportDEtailColumn & fieldvalue & ReportDEtailColumnEnd end sub Sub FormattableStart dim i CapFields(0)= getlang("LangAffReportId") Capfields(1)= getlang("LangaffReport") Capfields(2)= getlang("LangaffVieworders") CapFields(3)= getlang("LangAffLinks") CapFields(4)= getlang("LangaffLinkCount") CapFields(5)= getlang("LangAffLastdate") CapFields(6)= getlang("LangAffNumOrders") CapFields(7)= getlang("LangAffAmount") CapFields(8)= getlang("LangAffName") fieldcount=8 If getconfig("affmultilevel")="Yes" then CapFields(9)= getlang("LangSubaffiliate") fieldcount=fieldcount+1 end if %><% response.write "" for i = 0 to fieldcount response.write ReportHeadColumn & capfields(i) & ReportHeadColumnEnd next response.write ReportRowEnd end sub Sub FormatTableEnd response.write ReportTableEnd end sub Sub FormatSubAccounts If getconfig("AffMultilevel")<>"Yes" then exit sub dim my_link scriptresponder="shopa_affmaster.asp" my_link=scriptresponder & "?affid=" & affid fieldvalue="" & getlang("LangCommonView") & "" writecolumn fieldvalue end sub Sub FormatLinks (affid) dim my_link Setsess "affregister",affid scriptresponder="shopa_afflogreport.asp" my_link=scriptresponder & "?affid=" & affid fieldvalue="" & getlang("LangAffLinks") & "" writecolumn fieldvalue end sub Sub AllGetOrderInfo (orderdbc, affid) dim orders ordercount=0 orderamount=0 sql="select orders.oaffid, count(orders.orderid) as countoforderid, sum(orders.orderamount) as sumoforderamount from orders" sql=sql & " where oaffid=" & affid sql=sql & " group by orders.oaffid " sql=sql & " having orders.oaffid>0 order by orders.oaffid" set orders=orderdbc.execute(sql) if not orders.eof then ordercount=orders("countoforderid") orderamount=orders("sumoforderamount") If isnull(ordercount) then ordercount=0 end if If isnull(orderamount) then orderamount=0 end if end if orders.close set orders=nothing end sub Sub ProduceAllSummaryReport %>

<%=ReportInfoFont%>
<%=getlang("LangReportTotalsales") & shopformatcurrency(totalamount,getconfig("xdecimalpoint"))%>
<%=getlang("LangReportNumSales") & totalOrders%>
<%=getlang("LangAffLogins") & TotalLogins %>
<%=getlang("LangAffNumber") & count %>

<%end sub '********************************************************** ' Summary of orders and links '*********************************************************** Sub ProduceSummary (rs) dim count dim total dim nopayment count=0 totalorders=0 totalamount=0 totallogins=0 nopayment=0 While Not rs.EOF affid=rs("oaffid") GetOrderDetails rs GetAffiliateInfo affid count=count+1 TotalOrders=Totalorders+Ordercount Totalamount=Totalamount+Orderamount Totallogins=Totallogins+afflogincount rs.movenext wend %>

<%=getlang("LangReportTotalsales") & shopformatcurrency(totalamount,getconfig("xdecimalpoint"))%>
<%=getlang("LangReportNumSales") & totalOrders %>
<%=getlang("LangAffLogins") & TotalLogins %>
<%=getlang("LangAffNumber") & count %>

<% rs.close set rs=nothing end sub '******************************************************* ' just get stanard order information '******************************************************** Sub GetOrderDetails (orders) ordercount=orders("countoforderid") orderamount=orders("sumoforderamount") If isnull(ordercount) then ordercount=0 end if If isnull(orderamount) then orderamount=0 end if If allflag="ALL" then orders.close set orders=nothing end if end sub '**************************************************** ' detail for date only report. '**************************************************** Sub ProduceDetail (rs) dim count dim total dim nopayment count=0 total=0 Totallogins=0 nopayment=0 FormatTableStart limit=clng(mypagesize) While Not rs.EOF and count" affid=rs("oaffid") GetOrderDetails rs GetAffiliateInfo affid FormatAffid affid FormatAccounts affid FormatView affid Formatlinks affid FormatLogins afflogincount, totallogins FormatLogindate afflogindate FormatOrders ordercount, totalorders FormatOrderamount orderamount, totalamount FormatName affname FormatSubAccounts count=count+1 rs.movenext wend FormattableEnd Call PageNavBar (SQL) rs.close set rs=nothing %>
<%=getlang("LangReportTotalsales") %> <%=Shopformatcurrency(totalamount,getconfig("xdecimalpoint"))%>
<%=getlang("LangReportNumSales") %> <%=totalOrders%>
<%=getlang("LangAffLogins") %> <%=TotalLogins%>
<%=getlang("LangAffNumber") %> <%=count%>
<% end sub '********************************************************** ' Summary of orders and links '*********************************************************** Sub ProduceSummary (rs) dim count dim total dim nopayment count=0 totalorders=0 totalamount=0 totallogins=0 nopayment=0 While Not rs.EOF affid=rs("oaffid") GetOrderDetails rs GetAffiliateInfo affid count=count+1 TotalOrders=Totalorders+Ordercount Totalamount=Totalamount+Orderamount Totallogins=Totallogins+afflogincount rs.movenext wend %>
<%=getlang("LangReportTotalsales") %> <%=Shopformatcurrency(totalamount,getconfig("xdecimalpoint"))%>
<%=getlang("LangReportNumSales") %> <%=totalOrders%>
<%=getlang("LangAffLogins") %> <%=TotalLogins%>
<%=getlang("LangAffNumber") %> <%=count%>
<% rs.close set rs=nothing end sub %>