%Option explicit%>
<%
'*******************************************************
' allows user to check the status of their order
' VP-ASP 6.50
' Support Multilevel Affiliates and new format
' Mar 1, 2003
'*******************************************************
dim customerid, cid, affid
affid=Getsess("AffRegister")
If affid="" then
responseredirect "shopafflogin.asp"
end if
dim UsePassword
Dim Fieldname
Dim fieldvalue
dim fields(10)
dim captions(10)
dim fieldcount
Dim strpassword
Dim rc
Dim ordercount
dim lastorderdate, ordertotal, shippingtotal, commissiontotal
Dim sAction
SetSess "CurrentUrl","shopaffstatus.asp"
Shoppageheader
if getconfig("xbreadcrumbs") = "Yes" then
response.write "
"
end if
Response.Write "" & getlang("LangAffReport01") & "
"
Getaffdetails
GetOrderdetails
Displayreport
ShopPagetrailer
'**********************************************************
' Get order details
'************************************************************
Sub GetOrderdetails
dim rc, commission
dim orderamount, shippingamount, calculated
OpenOrderDB dbc
cid = clng(customerid)
SQL= "Select * from orders where oaffid=" & affid
Sql=SQL & " order by odate DESC"
'debugwrite sql
set objrs=dbc.execute(sql)
ordercount=0
commission=0
shippingtotal=0
ordertotal=0
dim forceflag
forceflag=false
While Not objRS.EOF
shopaffcommission dbc,objrs, affid, affstrCommissionrate, commission, calculated, forceflag
If calculated=TRue then
If lastorderdate="" then
lastorderdate=objrs("odate")
end if
orderamount=objrs("orderamount")
shippingamount=objrs("oshipcost")
addtottotal shippingtotal, shippingamount
addtottotal ordertotal, orderamount
addtottotal commissiontotal, commission
ordercount=ordercount+1
end if
objRS.MoveNext
Wend
Closerecordset objRS
ShopCloseDatabase dbc
End Sub
Sub Addtottotal (total, amount)
if isnull(amount) then exit sub
total=total+amount
end sub
'**************************************************************
' Get affiliate Details
'***************************************************************
Sub GetAffDetails
dim lastname, password
lastname=""
password=""
ReadAffRecord affid, lastname, password
closerecordset objrs
End Sub
Sub Displayreport
Response.write FoRderTable
DoHeader getlang("LangAffId") & " " & lngAffid
Dofield getlang("LangCustFirstName"), affstrFirstName
DoField getlang("LangCustLastName"), affstrLastName
DoHeader getlang("langaffNumOrders")
DoField getlang("LangAffNumOrders"), Ordercount
DoField getlang("LangAffAmount"), shopformatcurrency(ordertotal,getconfig("xdecimalpoint"))
DoField getlang("LangAffCommission"), shopformatcurrency(Commissiontotal,getconfig("xdecimalpoint"))
DoField getlang("LangAffLastDate"), lastOrderdate
DoHeader getlang("langafflinks")
DoField getlang("LangAffLinks"), afflogincount
DoField getlang("LangAffLastDate"), datlogindate
Response.write ""
AddSubaffiliateLink
AddDetailedOrders
end sub
Sub AddSubAffiliateLink
If Getconfig("Affmultilevel")="Yes" then
%>
<%= getlang("LangAffSelectAll")%>
<%
end if
end sub
Sub AddDetailedOrders
%>
<%=getlang("LangCustAdminStatus")%>
<%
end sub
%>
%>