{if $ajax!=1}
{literal}

<SCRIPT LANGUAGE="JavaScript">
<!-- //hide
function Profile(id){
   window.open('affiliate/aff_profile.php?id=' + id, 'blank_', 'resizable=yes,scrollbars=yes,location=no,directories=no,status=no,toolbar=no,menubar=no,width=700,height=550,left=0,top=0');
}
function SetPercent(  ) {
    switch ( form1.affiliateid3.value )
    {
{/literal}

{section name=num loop=$affiliates}
       case '{$affiliates[num].id}':
        form1.product_percent.value='{$affiliates[num].commission}';
        break;
{/section}

{literal}
       default:
        form1.product_percent.value = '0.00';
        break;
    }
}
//-->
</SCRIPT>

{/literal}
<div class="panel">
	<div class="panel_section">
		<div class="panel_content" style="width:95%">		
<form action="admin_affilate.php" method="GET" name="form1" style="margin:0px">
	<input type="hidden" name="ref" value="5">
<table border="0" cellspacing="0" cellpadding="5">
<tr>
  <td>
    <b>{$lang.affiliate.reg_sale}:</b>
	{$lang.affiliate.price}: <input type="text" name="product_price" value="00.00" size=5 maxlength=11>
	{$cur} {$lang.affiliate.percent}: <input type="text" name="product_percent" value="0.00" size=4 maxlength=11>%
	{$lang.affiliate.to} <select name="affiliateid3" onChange="javascript:SetPercent();">
		<option value="-1">{$lang.affiliate.select_affiliate}</option>
		{section name=num loop=$affiliates}
		<option value='{$affiliates[num].id}'>{$affiliates[num].login} - {$affiliates[num].fullname}</option>
		{/section}
	</select>
	<input type="hidden" name="RegisterCustomSale">
  </td>
  <td>
	<div class="fl" style="text-align:left;">
		<a href="#" class="admin_button_major" style="margin:0px;" id="" onclick="document.form1.submit();">{$lang.button.submit}<span>&nbsp;</span></a>
	</div>
  </td>
</tr>
</table>
</form>

<br>

<form action="admin_affilate.php" method="GET" name="form2" style="margin:0px">
	<input type="hidden" name="ref" value="5">
<table border="0" cellspacing="0" cellpadding="5">
<tr>
  <td >
    <b>{$lang.affiliate.show_sales}:</b> <select name="status">
		<option value="either">{$lang.affiliate.approved} & {$lang.affiliate.pending}
		<option value="approved">{$lang.affiliate.approved}
		<option value="pending">{$lang.affiliate.pending}
	</select> <select name="affiliateid2">
		<option value="-1">{$lang.affiliate.all_affiliates}</option>
		{section name=num loop=$affiliates}
		<option value='{$affiliates[num].id}'>{$affiliates[num].login} - {$affiliates[num].fullname}</option>
		{/section}
	</select>
	{$lang.affiliate.from} <select name='date1_year'>
		{section name=num loop=$dates_year}
		<option value='{$dates_year[num].values}' {if ($dates_year[num].values == $date1_year)}selected{/if}>{$dates_year[num].names}</option>
		{/section}
	</select> <select name='date1_month'>
		{section name=num loop=$dates_month}
		<option value='{$dates_month[num].values}' {if ($dates_month[num].values == $date1_month)}selected{/if}>{$dates_month[num].names}</option>
		{/section}
	</select> <select name='date1_day'>
		{section name=num loop=$dates_day}
		<option value='{$dates_day[num].values}' {if ($dates_day[num].values == $date1_day)}selected{/if}>{$dates_day[num].names}</option>
		{/section}
	</select>
	to <select name='date2_year'>
		{section name=num loop=$dates_year}
		<option value='{$dates_year[num].values}' {if ($dates_year[num].values == $date2_year)}selected{/if}>{$dates_year[num].names}</option>
		{/section}
	</select> <select name='date2_month'>
		{section name=num loop=$dates_month}
		<option value='{$dates_month[num].values}' {if ($dates_month[num].values == $date2_month)}selected{/if}>{$dates_month[num].names}</option>
		{/section}
	</select> <select name='date2_day'>
		{section name=num loop=$dates_day}
		<option value='{$dates_day[num].values}' {if ($dates_day[num].values == $date2_day)}selected{/if}>{$dates_day[num].names}</option>
		{/section}
	</select>
	{$lang.affiliate.order} <select name="orderby">
		<option value="DateDescending">{$lang.affiliate.date} {$lang.affiliate.desc}
		<option value="DateAscending">{$lang.affiliate.date} {$lang.affiliate.asc}
		<option value="Affiliate">{$lang.affiliate.affiliate}
	</select>
	<input type="hidden" name="ShowSales" value="">
  </td>
  </tr>
  <tr>
  <td valign="bottom">
	<div class="fl" style="text-align:left;">
		<a href="#" class="admin_button" style="margin:0px;" id="" onclick="document.form2.submit();">{$lang.button.select}<span>&nbsp;</span></a>
	</div>
  </td>
</tr>
</table>
</form>
{/if}
{if (isset($sales) && ($sales))}

	<br>
{if $page_links && $ajax!=1}
	<b>{$lang.affiliate.pages}:</b>
	{section name=c loop=$page_links}
		<a {*href={$page_links[c].url}*} onclick="ShowBlock('show_block', '{$page_links[c].url}');" class="page_link">{$page_links[c].text}</a>&nbsp;
	{/section}
	<br><br>
{/if}
<div id="show_block">
<table border="0" cellspacing="0" cellpadding="5" width="100%">
<tr class="table_header">
  <td align="left" width="5%">#</td>
  <td align="left" width="30%">{$lang.affiliate.affiliate}</td>
  <td align="left" width="15%">{$lang.affiliate.price}</td>
  <td align="left" width="15%">{$lang.affiliate.commission}</td>
  <td align="left" width="10%">{$lang.affiliate.status}</td>
  <td align="left" width="20%">{$lang.affiliate.date}</td>
  <td align="left" width="5%">&nbsp;</td>
</tr>

{section name=num loop=$sales}

<tr {if $smarty.section.num.index mod 2 eq 1}class="table_row even"{else}class="table_row odd"{/if}>
  <td valign="top" align="center">{$sales[num].number}</td>
  <td valign="top"><a href="javascript:Profile('{$sales[num].uid}')">{$sales[num].login}</a></td>
  <td valign="top">{$sales[num].price} {$cur}</td>
  <td valign="top">{$sales[num].comission} {$cur}</td>
  <td valign="top">{$sales[num].status}</td>
  <td valign="top">{$sales[num].date}</td>
  <td><a href="affiliate/aff_sales.php?DeleteSale=delete&which={$sales[num].id}&QueryString=ShowSales%3DSelect%26date1_year%3D1993%26date1_month%3D1%26date1_day%3D1%26status%3Deither%26date2_year%3D2003%26date2_month%3D4%26date2_day%3D16%26orderby%3DDateDescending%26affiliateid2%3D-1">{$lang.button.delete}</a></td>
</tr>

{sectionelse}

<tr>
    <td align=center colspan="6">{$lang.affiliate.no_sales}</td>
</tr>

{/section}

</table>
<div>
{/if}
{if $ajax!=1}
		</div>
	</div>
</div>
{/if}