{*{include file="$admingentemplates/admin_top.tpl"}
<div class="back">
    <a href="{$site_url}{$site_root}/admin/affiliate/aff_summary.php">{$lang.button.back}</a>
</div>
<div class="cr"></div>
<div class="show_help" style="display: none;">&nbsp;</div>
<div class="red_header">{$lang.affiliate.razdel_name}</div>
<div class="cr">&nbsp;</div>
<div class="cr">&nbsp;</div>
<div class="help_text" style="display:block;">
    <div class="close_help">
        <img src="{$site_root}{$template_root}/images/close_help.png" alt="">
    </div>
    <div class="help_body">
        <span class="help_title">{$lang.help}:</span>{$lang.admin_help.aff_statistics}
    </div>
</div>
<div class="cr">&nbsp;</div>

<ul class="tabs" style="width:100.5%">
    <li>
        <a href="aff_summary.php">{$lang.aff.tab_1}</a>
    </li>
    <li>
        <a href="aff_sales.php">{$lang.aff.tab_2}</a>
    </li>
	<li>
        <a href="aff_affiliates.php">{$lang.aff.tab_3}</a>
    </li>
	<li>
        <a href="aff_ads.php">{$lang.aff.tab_4}</a>
    </li>
	<li>
        <a class="current" href="#">{$lang.aff.tab_5}</a>
    </li>
	<li>
        <a href="aff_editsettings.php">{$lang.aff.tab_6}</a>
    </li>
</ul>*}

{literal}

<SCRIPT LANGUAGE="JavaScript">
<!-- //hide
function Profile(id){
   window.open('affiliate/aff_urls.php?b=' + id, 'blank_', 'resizable=yes,scrollbars=yes,location=no,directories=no,status=no,toolbar=no,menubar=no,width=500,height=450,left=0,top=0');
}
//-->
</SCRIPT>

{/literal}
<div class="user_operation_line" style="height:4px;">&nbsp;</div>
<div class="cr"></div>
<div class="panel">
		
<div style="width:50%;float:right;" id="form_select">
<form action="admin_affilate.php" method="GET" name="form1" style="margin:0px">
<input type="hidden" name="ref" value="3">
<input type="hidden" name="action" value="Select">
<table border="0" cellspacing="0" cellpadding="5" width="100%">
<tr>
  <td align="right">
	<table>
      <tr><td>
			<select name="AffiliateID">
			<option value='-1'>{$lang.affiliate.all_affiliates}</option>
			{section name=num loop=$affiliates}
			<option value='{$affiliates[num].id}' {$affiliates[num].selected}>{$affiliates[num].login}</option>
			{/section}
			</select>&nbsp;&nbsp;<select name="date">
			<option value='-1'>{$last_months}</option>
			{section name=num loop=$dates}
			<option value='{$dates[num].value}' {$dates[num].selected}>{$dates[num].month}</option>
			{/section}
			</select>
      </td>
      <td>
		<div class="fl" style="text-align:left;">
			<a href="#" class="admin_button" style="margin:0px;" id="" onclick="javascript:document.form1.submit();">{$lang.button.select}<span>&nbsp;</span></a>
		</div>
	  </td>
      </tr>
	</table>
  </td>
</tr>
</table>
</form>
</div>
{if ($select)}
<div style="width:50%;float:left;" id="stat_text">
<font class="section_header">{$sel_date} {$lang.affiliate.statistics}</font>
<br><br>

<table border="0" cellspacing="0" cellpadding="5" width="100%">
<tr>
  <td style="padding-left:0px;">
    {$total_clicks}<br>
	{$unique_visitors}<br>
	{$total_products}<br>
	{$lang.affiliate.total_commissions}: {$total_commissions}{$cur_symbol}<br>
  </td>
</tr>
</table>
</div>
<br>

<table border="0" cellspacing="0" cellpadding="5" width="100%">
<tr class="table_header">
  <td width="40%">{$lang.affiliate.title}</td>
  <td width="15%">{$lang.affiliate.urls}</th>
  <td width="15%">{$lang.affiliate.shows}</td>
  <td width="15%">{$lang.affiliate.clicks}</td>
  <td width="15%">{$lang.affiliate.ctr}</td>
</tr>

{section name=num loop=$urls}

<tr {if $smarty.section.num.index mod 2 eq 1}class="table_row even"{else}class="table_row odd"{/if}>
  <td valign="top">{$urls[num].title}</td>
  <td valign="top"><a href="javascript:Profile('{$urls[num].id}')">{$lang.affiliate.urls}</a></td>
  <td valign="top">{$urls[num].shows}</td>
  <td valign="top">{$urls[num].clicks}</td>
  <td valign="top">{$urls[num].ctr}</td>
</tr>
{sectionelse}
<tr height="40">
	<td class="main_error_text" align="left" colspan="5" bgcolor="#FFFFFF">{$lang.interests_spr.empty}</td>
</tr>
{/section}
<tr class="table_header"><td colspan="5">&nbsp;</td></tr>
</table>

<font class="section_header">{$lang.affiliate.commission_stat}</font>
<br>

<table border="0" cellspacing="0" cellpadding="5" width="100%">
<tr class="table_header">
  <td width="110px" style="padding-left:20px;">{$lang.affiliate.months}</td><td>{$lang.affiliate.statistics}</td>
</tr>

{section name=num loop=$commissions}

<tr {if $smarty.section.num.index mod 2 eq 1}class="table_row even"{else}class="table_row odd"{/if}>
  <td valign="top" colspan="2">
	<table border=0 cellspacing=0 cellpadding=0 width="100%">
	  <tr>
	   <td colspan=2 align=left>{$commissions[num].month}</td>
	   <td width=500>
		  <table border=0 cellpadding=0 cellspacing=0 height='7'>
		  <tr>
			 <td bgcolor='#78CC78' width="{$commissions[num].width}">&nbsp;</td>
			 <td>{$cur_symbol} {$commissions[num].money}</td>
		  </tr>
		  </table>
	   </td>
	  </tr>
    </table>
  </td>
</tr>

{/section}
<tr class="table_header"><td colspan="2">&nbsp;</td></tr>
</table>

<font class="section_header">{$lang.affiliate.clickthrough_stat}</font>
<br>

<table border="0" cellspacing="0" cellpadding="5" width="100%">
<tr class="table_header">
  <td width="110px" style="padding-left:20px;">{$lang.affiliate.months}</td><td>{$lang.affiliate.statistics}</td>
</tr>

{section name=num loop=$clicks}

<tr {if $smarty.section.num.index mod 2 eq 1}class="table_row even"{else}class="table_row odd"{/if}>
  <td valign="top" colspan="2">
	<table border="0" cellspacing="0" cellpadding="5" width="100%">
		<tr>
		   <td align=left valign=middle rowspan=4 width="110">{$clicks[num].month}&nbsp;&nbsp;&nbsp;</td>
		   <td>{$lang.affiliate.sold_items}</td>
		   <td width=500>
			  <table border="0" cellpadding="0" cellspacing="0" height="7">
			  <tr>
				 <td bgcolor='#78CC78' width="{$clicks[num].sold_width}">&nbsp;</td>
				 <td>&nbsp;{$clicks[num].sold_count}</td>
			  </tr>
			  </table>
		   </td>
		</tr>
		<tr>
		    <td>{$lang.affiliate.unique_clicks}</td>
		    <td width=500>
			    <table border="0" cellpadding="0" cellspacing="0" height="7">
			    <tr>
				   <td bgcolor='#ed7878' width="{$clicks[num].unique_width}">&nbsp;</td>
				   <td>&nbsp;{$clicks[num].unique_count}</td>
			    </tr>
			    </table>
		    </td>
		</tr>
		<tr>
			<td>{$lang.affiliate.raw_clicks}</td>
			<td width=500>
				<table border="0" cellpadding="0" cellspacing="0" height="7">
					<tr>
						<td bgcolor='#9a9cd3' width="{$clicks[num].raw_width}">&nbsp;</td>
						<td>&nbsp;{$clicks[num].raw_count}</td>
					</tr>
				</table>
			</td>
		</tr>
		<tr>
			<td>{$lang.affiliate.ctr}</td>
			<td width=500>
				<table border="0" cellpadding="0" cellspacing="0" height="7">
					<tr>
						<td bgcolor='#9a9cd3' width="{$clicks[num].ctr_width}">&nbsp;</td>
						<td>&nbsp;{$clicks[num].ctr_count}&nbsp;({$clicks[num].ctr_percent}%)</td>
					</tr>
				</table>
			</td>
		</tr>
  </table></td>
</tr>

{/section}
<tr class="table_header"><td colspan="2">&nbsp;</td></tr>
</table>

<font class="section_header">{$lang.affiliate.banners_stat}</font>
<br>

<table border="0" cellspacing="0" cellpadding="5" width="100%">
<tr class="table_header">
  <td width="110px" style="padding-left:20px;">{$lang.affiliate.months}</td><td>{$lang.affiliate.statistics}</td>
</tr>

{section name=num loop=$shows}

<tr {if $smarty.section.num.index mod 2 eq 1}class="table_row even"{else}class="table_row odd"{/if} >
	<td valign="top" colspan="2">
		<table border="0" cellspacing="0" cellpadding="0" width="100%">
			<tr>
				<td align=left valign=middle rowspan=2 width="110">{$shows[num].month}&nbsp;&nbsp;&nbsp;</td>
				<td>{$lang.affiliate.unique_shows}</td>
				<td width="500">
					<table border="0" cellpadding="0" cellspacing="0" height="7">
						<tr>
							<td bgcolor='#ed7878' width="{$shows[num].unique_width}">&nbsp;</td>
							<td>&nbsp;{$shows[num].unique_count}</td>
						</tr>
					</table>
				</td>
			</tr>
			<tr>
				<td>{$lang.affiliate.total_shows}</td>
				<td width="500">
					<table border="0" cellpadding="0" cellspacing="0" height="7">
						<tr>
							<td bgcolor='#9a9cd3' width="{$shows[num].total_width}">&nbsp;</td>
							<td>&nbsp;{$shows[num].total_count}</td>
						</tr>
					</table>
				</td>
			</tr>
		</table>
	</td>
</tr>

{/section}
<tr class="table_header"><td colspan="2">&nbsp;</td></tr>
</table>

{/if}
		</div>
	</div>
</div>
{literal}
<script type="text/javascript">
$(document).ready(function(){
	var select = '{/literal}{$select}{literal}';
	if (select!=''){
		$('#form_select').css('margin-top', $('#stat_text').height() - $('#form_select').height());
	}
});
</script>
{/literal}
{*{include file="$admingentemplates/admin_bottom.tpl"}*}
