::use 'contractadmin/design.mtt'::

		<div>
			<a href="/contractAdmin/stats/::c.id::/?stat=0">
				::_("Seniority of subscribers")::
			</a> | 
			<a href="/contractAdmin/stats/::c.id::/?stat=1">
				::_("Sharing between orders")::
			</a><br/>
			
		</div>
		
		::if stat==0::
			<h3>
				::__("Seniority of subscribers of ::contract::",{contract:c.name}):: 
				
			</h3>
			<table class="table" style="width:50%;">
				<tr>
					<th>::_("Number")::</th>
					<th>::_("Year")::</th>
				</tr>
				 ::foreach a anciennete::
				 <tr>
					 <td>::a.cnt::</td>
					 <td>::a.uyear::</td>
				 </tr>
				 ::end::
			</table>
		::end::
			
		::if stat==1::
			<h3>::_("Sharing between orders of"):: "::c.name::"</h3>
			
			<table class="table">
				<tr>
					<th>::_("Quantity")::</th>
					<th>::_("Product")::</th>
					<th>::_("Total price")::</th>
					<th>::_("% of orders")::</th>
				</tr>
				::foreach r repartition::
					<tr>
						<td>::r.quantity::</td>
						<td>::r.name::</td>
						<td>::r.quantity*r.price:: ::currency()::</td>
						<td>::r.percent:: %</td>
						
					</tr>
					
				::end::
				<tr>
					<th colspan="2">Total: ::totalQuantity:: ::_("products")::</th>
					
					<th>::totalPrice:: ::currency()::</th>
					<th></th>
				</tr>
			</table>


			$$export(/contractAdmin/stats/::c.id::?csv=1&stat=1)
		::end::	
::end::