{if $smarty.session.user.power_elite_author  == 'true' || $smarty.session.user.elite_author  == 'true'}
<div class="{if $smarty.session.user.power_elite_author  == 'true'}power-elite-author{/if}{if $smarty.session.user.elite_author  == 'true'}elite-author{/if}">
  <div class="page-info">
    <div class="container">
      <div id="breadcrumbs">
        <a href='/' class="first">صفحه اصلی </a> /<a href="/{$languageURL}users/{$smarty.session.user.username}/">داشبورد</a> /</div>
       <h2 class="page-title">درآمد شما </h2>
    </div>
	{include file="$root_path/zipmarket/apps/users/views/tabsy.html"}
  </div>
</div>  
{else}
  <div class="page-info">  
    <div class="container">
      <div id="breadcrumbs">
        <a href='/' class="first">صفحه اصلی</a> /<a href="/{$languageURL}users/{$smarty.session.user.username}/">داشبورد</a> /</div>
       <h1 class="page-title">درآمد شما </h1>
    </div>
	{include file="$root_path/zipmarket/apps/users/views/tabsy.html"}
  </div>
{/if}
<div id="content">
      <div class="container">
	  		{$errorMessage}
	<div class="content-s">
	
		<h2 class="underlined">فروش ها</h2>
		
		<div class="general_table_border">
		<table id="sales_table" class="general_table" cellspacing="0" cellpadding="0">
	    <thead>
	      <tr>
	       <td>{$lang.month}</td>
	        <td>{$lang.sales}</td>
	       <td>{$lang.earnings}</td>
	      </tr>
	    </thead>
	    <tbody>
			{foreach from=$sales item=r key=year}
	    	{foreach from=$r item=rr key=month} 
	      <tr id="month_{$month}_{$year}" class="{$year}">
	        <td id="month_{$month}_{$year}_show"><a href="#" id="link_{$month}_{$year}" {literal}onclick="$.ajax({complete:function(request){ hideLoading(); jQuery(&quot;#ajax-feedback&quot;).animate({&quot;height&quot;: &quot;toggle&quot;, &quot;opacity&quot;: &quot;toggle&quot;}, &quot;slow&quot;); }, beforeStart: function() { showLoading(); }, data:'ajax=ok', dataType:'script', type:'post', url:'/{/literal}{$languageURL}users/earnings/{$month}/{$year}{literal}'}); jQuery(&quot;#ajax-feedback&quot;).hide(); jQuery(&quot;#ajax-feedback&quot;).animate({&quot;height&quot;: &quot;toggle&quot;, &quot;opacity&quot;: &quot;toggle&quot;}, &quot;slow&quot;);; return false;"{/literal}>{$lang.monthArr[$month]|date_format:"F Y"}</a></td>
	        <td id="month_{$month}_{$year}_hide" style="display: none;"><a href="#" onclick="$('#month_{$month}_{$year}_details').empty(); $('#month_{$month}_{$year}_hide').hide(); $('#month_{$month}_{$year}_show').show(); return false;">{$lang.monthArr[$month]|date_format:"F Y"} </a></td>
	        <td>{$rr.buy} {$lang.sales}</td>
	        <td class="earningsVal">{$rr.total|string_format:"%.0f"} {$currency.symbol}</td>
	      </tr>
		    <tbody id="month_{$month}_{$year}_details">
		    </tbody>
	    	{/foreach}
	    {/foreach}
	    </tbody>
		  <tfoot>
		    <tr>
		      <td>{$lang.total_sales}</td>
		      <td>{$earnings.sales} {$lang.sales}</td>
		      <td class="earningsTotal">{$earnings.sales_earning|string_format:"%.0f"} {$currency.symbol}</td>
		    </tr>
	    </tfoot>
	  </table>
	  </div>
      <h2 class="underlined">{$lang.sales_graph}</h2>
	  
	  <div id="sales_graph" class="graph mt10">
	    {foreach from=$sales item=r key=year}
	    	{foreach from=$r item=rr key=month} 
	      <div class="bar 2010">
	        <strong>{$lang.monthArr[$month]|date_format:"F Y"}</strong>
	        <div style="width:{math equation="x * y" x=$saleIndex y=$rr.buy}px;" class="graph_1"></div>
	        <div class="value">{$rr.buy} {$lang.sales}</div>
	      </div>
	    	{/foreach}
	    {/foreach}  
		</div>
		
		<h2 class="underlined">{$lang.earnings_graph}</h2>
		
		<div id="earnings_graph" class="graph mt10">
	  	{foreach from=$earningArr item=r key=year}
	    	{foreach from=$r item=rr key=month} 
	      <div class="bar 2010">
	        <strong>{$lang.monthArr[$month]|date_format:"F Y"}</strong>
	        <div style="width:{math equation="x * y" x=$earningIndex y=$rr}px;" class="graph_1"></div>
	        <div class="value">{$rr|string_format:"%.0f"} {$currency.symbol}</div>
	      </div>
	    	{/foreach}
	    {/foreach} 
		</div>
		
		<h2 class="underlined">{$lang.referals}</h2>
		
		{if $referals}
	  	<div class="general_table_border">
		  <table id="referrals_table" class="general_table" cellpadding="0" cellspacing="0">
		    <thead>
		      <tr>
		         <td>{$lang.month}</td>
		         <td>{$lang.buy_items}</td>
		         <td>{$lang.deposit}</td>
		         <td>{$lang.earnings}</td>
		      </tr>
		    </thead>
		    <tbody>
		    {foreach from=$referals item=r key=year}
		    	{foreach from=$r item=rr key=month} 
		      <tr class="{$year}">
		    	  <td><strong>{$lang.monthArr[$month]} {$year}</strong></td>
		    	  <td>{$rr.buy}</td>
		    	  <td>{$rr.deposit}</td>
		    	  <td class="earningsVal">{$rr.total|string_format:"%.0f"} {$currency.symbol}</td>
		    	</tr>
		    	{/foreach}
		    {/foreach}
		    </tbody>
		    <tfoot>
		      <tr>
		        <td>{$lang.total_referal_earning}:</td>
		        <td></td>
		        <td></td>            
		        <td class="earningsTotal">{$earnings.referal|string_format:"%.0f"} {$currency.symbol}</td>
		      </tr>
		      </tfoot>
		  </table>
	  </div>
	  {else}
	  	<div class="content-box vertical-space">هیچ رکوردی ثبت نشده است .</div>
	  {/if}
	
	  <h2 class="underlined"> {$lang.total_earning}: {$earnings.total|string_format:"%.0f"} {$currency.symbol}</h2>
	
	</div>

	<div class="sidebar-l sidebar-right">

		<h2 class="box-heading">فروش محصول شما و کسب در آمد</h2>
	<div class="content-box">
      <p style="text-align:justify;font-size:13px;line-height:23px;">شما می توانید به 2 صورت در سایت ویترین فا کسب درآمد کنید .</p>
      <p style="font-family:BBCNassim;font-size:18px;">1 - از طریق <a href="/make_money/become_an_author">ارسال محصول</a></p>
      <p>2 - از طریق <a href="/make_money/affiliate_program">بازار یابی</a></br>
	  </p>
    </div>

	</div> 

</div> 
</div> 