{include file="$gentemplates/$header_tpl"}
<h2>{$lang.affiliate.razdel_name}</h2>
{include file="$aff_gentemplates/aff_menu.tpl"}

<form action="aff_stats.php" method="GET" name="select_form">
	<input type="hidden" name="action" value="Select">
	{$lang.affiliate.show_stat} 
	<select name="date" style="margin-top: 8px;">
		<option value='-1'>{$col_dates}
		{section name=num loop=$dates}
			<option value='{$dates[num].number}' {$dates[num].selected}>{$dates[num].month}</option>
		{/section}
	</select>
	<input type="button" class="button" onclick="javascript: document.select_form.submit();" value="{$lang.affiliate.select}">
</form>
{if $select}
	<h3 class="p-b5">{$last_months} {$lang.affiliate.statistics}</h3>
	<p>
		{$total_clicks}<br />
		{$unique_visitors}<br />
		{$total_products}<br />
		{$lang.affiliate.total_income}: {$total_income} 
	</p>
	<h3 class="p-b5">{$lang.affiliate.profit_stat}</h3>

	<table border='0' cellspacing='1' cellpadding='2' width="100%">
	{section name=num loop=$profits}
	<tr style="height: 25px;">
	   <td colspan='2' align='{$default_left}' width='120px'>{$profits[num].month}</td>
	   <td width='300px'>
		  <table border=0 cellpadding=0 cellspacing=0 height='7'>
		  <tr>
			 <td bgcolor='#78CC78' width="{$profits[num].width}">&nbsp;</td>
			 <td>{$profits[num].money}</td>
		  </tr>
		  </table>
	   </td>
	</tr>
	{/section}
	</table>
	
	<h3 class="p-b5">{$lang.affiliate.clickthrough_stat}</h3>
	<table border='0' cellspacing='1' cellpadding='2' width="100%">
		{section name=num loop=$clicks}
		<tr>
			<td align={$default_left} valign='middle' rowspan='3' width='120px'>{$clicks[num].month}</td>
			<td>{$lang.affiliate.sold_items}</td>
			<td width='300px'>
			   <table border='0' cellpadding='0' cellspacing='0' height='7'>
			   <tr>
				  <td bgcolor='#78CC78' width="{$clicks[num].sold_width}">&nbsp;</td>
				  <td>{$clicks[num].sold_count}</td>
			   </tr>
			   </table>
			</td>
		</tr>
		<tr>
			<td>{$lang.affiliate.unique_clicks}</td>
			<td width='300px'>
			   <table border=0 cellpadding=0 cellspacing=0 height='7'>
			   <tr>
				  <td bgcolor='#ed7878' width="{$clicks[num].unique_width}">&nbsp;</td>
				  <td>{$clicks[num].unique_count}</td>
			   </tr>
			   </table>
			</td>
		</tr>
		<tr>
		   <td>{$lang.affiliate.raw_clicks}</td>
		   <td width='300px'>
			  <table border='0' cellpadding='0' cellspacing='0' height='7'>
			  <tr>
				 <td bgcolor='#9a9cd3' width="{$clicks[num].raw_width}">&nbsp;</td>
				 <td>{$clicks[num].raw_count}</td>
			  </tr>
			  </table>
		   </td>
		</tr>
		<tr><td colspan="3" height="10px">&nbsp;</td></tr>
		{/section}
	</table>
{/if}

{include file="$gentemplates/$footer_tpl"}