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

<form action="aff_sales.php" method="GET" name="select_form">
	<input type="hidden" name="action" value="Select">
	{$lang.affiliate.show_sales} 
	<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">{$sel_date} {$lang.affiliate.sales}</h3>
	{if $sales}

		{if $page_links}
			<p>
				<b>{$lang.affiliate.pages}:</b>
				{section name=c loop=$page_links}
					<a href={$page_links[c].url}>{$page_links[c].text}</a>&nbsp;
				{/section}
			</p>
		{/if}

		<table width="100%" cellspacing=0 cellpadding=0 border=0>
		<tr>
			<td width="5%" class="text_head" align="center" style="padding-{$default_right}: 10px;">#</td>
			<td width="35%" class="text_head" style="padding-{$default_right}: 10px;">{$lang.affiliate.price}</td>
			<td width="35%" class="text_head" style="padding-{$default_right}: 10px;">{$lang.affiliate.commission}</td>
			<td width="25%" class="text_head">{$lang.affiliate.date}</td>
		</tr>
		{section name=num loop=$sales}
			<tr>
				<td align="center" style="padding-{$default_right}: 10px;">{$sales[num].number}</td>
				<td style="padding-{$default_right}: 10px;">{$sales[num].price} {$cost_unit}</td>
				<td style="padding-{$default_right}: 10px;">{$sales[num].commission} {$cost_unit}</td>
				<td>{$sales[num].date}</td>
			</tr>
		{/section}
		</table>

		<table width="100%" border=0 cellspacing=0 cellpadding=0>
			<tr>
				 <td align={$default_right} class="text">{$lang.affiliate.total_profit}: <b>{$tprofit}$</b></td>
			</tr>
		</table>
	{else}
		<p>{$lang.affiliate.no_sales}</p>
	{/if}
{/if}

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