<!--#include file="../../../owFunctions/I_GeneralFunctions.asp"-->
<!--#include file="../../header.asp"-->
<%
	'************************************************************************************
	'*																					*
	'*	MODIFICATION TO THIS SCRIPT OR ANY FILES INCLUDED WITH 							*
	'*		ONEWORLDSTORE IS DONE AT YOUR OWN RISK!										*
	'*	Product  : OneWorldStore														*
	'*	Version  : 9.0000																*
	'*	Modified : June 2004															*
	'*	Copyright:	Copyright (C) 2004 OneWorldStore.Com								*
	'*				Registration Number: 1024507										*
	'*				http://strategis.ic.gc.ca/											*
	'*																					*
	'************************************************************************************
	
	dim sSort, bRefresh, sSearch, sSearchText
	
	sAccountUnq		= CONVERSION_SQLEncode2(Request("sAccountUnq"),10)
	bRefresh		= Trim(Request("bRefresh"))
	sSort			= Trim(Request("sSort"))
	sSearch			= Trim(Request("sSearch"))
	sSearchText		= Trim(Request("sSearchText"))
	If ( sAccountUnq = "" ) Then sAccountUnq = 0 End If
	
	sSQLText = "SELECT * FROM owAccounts A, CustAltBill CAB WHERE A.AccountUnq = CAB.AccountUnq AND CAB.AccountUnq = " & sAccountUnq
	Call DB_getFromDatabase(sSQLText, rsStoreData, "") 
	If ( NOT rsStoreData.EOF ) Then
		sCustomerCompany	= ACCNT_ReturnADV("OW_CUSTCOMPANY", "V", sAccountUnq, C_OVERRIDE_ADV)
		sCountryCode 		= rsStoreData("BillingCountryCode")
		%>
		<body style="font-family: Arial; font-size: 11px;" topmargin="0" leftmargin="0" bgcolor=C3DAF9>
		<table border="0" cellpadding="0" cellspacing="0" width="100%" style="padding:5px; FONT-WEIGHT: bold; FONT-SIZE: 11px; COLOR: #808080" bgcolor="#ffffff">
			<tr>
				<td colspan=4 style='padding-bottom: 2px; padding-top: 2px;'>
					<table width=100% border="0" cellpadding="0" cellspacing="0" style="FONT-WEIGHT: bold; FONT-SIZE: 11px; COLOR: #808080" bgcolor="#FFFFFF">
						<tr>
							<td>
				            	<table border="0" cellpadding="5" cellspacing="0" style="border-left: 1px solid C3DAF9; FONT-WEIGHT: bold; FONT-SIZE: 11px; COLOR: #808080" bgcolor="#EAF1F9">
				            		<tr>
				            			<td align=right style='border-top: 1px solid C3DAF9; border-right: 1px solid C3DAF9;' nowrap><b><font size=+1 color=2A5CB2><%=sCustomerCompany%></font></b></td>
				            			<td width=100% bgcolor=FFFFFF style='border-bottom: 1px solid C3DAF9;'></td>
				             		</tr>
				            	</table>
				            </td>
						</tr>
						<tr bgcolor="#EAF1F9">
							<td>
				            	<table width=100% border="0" cellpadding="5" cellspacing="0" style="border-left: 1px solid C3DAF9; border-right: 1px solid C3DAF9; border-bottom: 1px solid C3DAF9; FONT-WEIGHT: bold; FONT-SIZE: 11px; COLOR: #808080" bgcolor="#EAF1F9">
				            		<tr>
										<td style='padding-bottom: 2px; padding-top: 6px;' valign=top>
											<%=rsStoreData("BillingAddress")%><br>
											<%=rsStoreData("BillingCity")%>, <%=rsStoreData("BillingStateCode")%>&nbsp;<%=rsStoreData("BillingZip")%><br>
											<%=sCountryCode%>
										</td>
										<td>
											<%=LANG_DT( "AFFILIATE_CONTACT", "Affiliate Contact" )%>:<br>
											<%=ACCNT_ReturnADV("OW_CUSTFNAME", "V", sAccountUnq, C_OVERRIDE_ADV)%>&nbsp;<%=ACCNT_ReturnADV("OW_CUSTLNAME", "V", sAccountUnq, C_OVERRIDE_ADV)%><br>
											<%=ACCNT_ReturnADV("OW_CUSTEMAIL", "V", sAccountUnq, C_OVERRIDE_ADV)%><br>
											<%=ACCNT_ReturnADV("OW_CUSTPHONE", "V", sAccountUnq, C_OVERRIDE_ADV)%>
										</td>
										<td>
											<table width=100% border="0" cellpadding="0" cellspacing="0" style="FONT-WEIGHT: bold; FONT-SIZE: 11px; COLOR: #808080">
												<tr>
													<td><%=LANG_DT( "AFFILIATE_JOINED", "Affiliate Since" )%>: </td>
													<td><%=rsStoreData("AddDate")%></td>
												</tr>
												<tr>
													<td><%=LANG_DT( "AFFILIATE_SALES", "Total Affiliate Sales" )%>*: </td>
													<td>
														<%
														sSQLText = "SELECT Sum(Total) FROM Orders WHERE OrderStatus = " & C_PAID & " OR OrderStatus = " & C_DELIVERED & " AND idAffiliate = " & sAccountUnq
														Call DB_getFromDatabase(sSQLText, rsStoreData2, "")
														If ( NOT rsStoreData2.EOF ) Then
															Response.Write CONVERSION_Currency(rsStoreData2(0))
														Else
															Response.Write CONVERSION_Currency("0")
														End If
														Call DB_closeRecordset(rsStoreData2)
														%>
													</td>
												</tr>
												<tr>
													<td><%=LANG_DT( "AFFILIATE_NUMORDERS", "Total # Affiliate Orders" )%>*: </td>
													<td>
														<%
														sSQLText = "SELECT Sum(Total) FROM Orders WHERE OrderStatus = " & C_PAID & " OR OrderStatus = " & C_DELIVERED & " AND idAffiliate = " & sAccountUnq
														Call DB_getFromDatabase(sSQLText, rsStoreData2, "")
														If ( NOT rsStoreData2.EOF ) Then
															If ( rsStoreData2(0) > 0 ) Then
																Response.Write CONVERSION_Currency(rsStoreData2(0))
															Else
																Response.Write CONVERSION_Currency("0")
															End If
														Else
															Response.Write "0"
														End If
														Call DB_closeRecordset(rsStoreData2)
														%>
													</td>
												</tr>
												<tr>
													<td colspan=2>* <%=LANG_DT( "AFFILIATE_ONLYINCLUDES", "only includes Delivered and Paid orders" )%></td>
												</tr>
											</table>
										</td>
				             		</tr>
				            	</table>
				            </td>
						</tr>
					</table>
				</td>
			</tr>
		</table>
	<%
	Else
		Call owMessage("Unable to find affiliate record.", C_ERROR)
	End If
	Call DB_closeRecordset(rsStoreData)
	%>      
<!--#include file="../../footer.asp"-->