{{function name="selectOptions" aOptions=0 mOption=0}}
	{{foreach from=$aOptions item=sOption}}
		<option value="{{$sOption@key}}" {{if ( is_array( $mOption ) && in_array( $sOption@key, $mOption ) ) || ( $sOption@key == $mOption )}}selected="selected"{{/if}}>{{$sOption}}</option>
	{{/foreach}}
{{/function}}

<h1>{{$lang.Orders_customers}}</h1>
<div class="filter">
	<form action="" method="get">
		<fieldset>
			<input type="hidden" name="p" value="{{$_GET.p}}" />
			<label for="stats-date-from">{{$lang.Date_from}}</label><input id="stats-date-from" type="text" name="sDateFrom" value="{{$aStatsInfo.sDateFrom}}" class="input date" maxlength="10" />
			<label for="stats-date-to">{{$lang.Date_to}}</label><input id="stats-date-to" type="text" name="sDateTo" value="{{$aStatsInfo.sDateTo}}" class="input date" maxlength="10" />
			<label for="stats-status-1">{{$lang.Status_from}}</label><select name="iStatus1" id="stats-status-1">{{selectOptions aOptions=$aStatuses mOption=$aStatsInfo.iStatus1}}</select>
			<label for="stats-status-2">{{$lang.Status_to}}</label><select name="iStatus2" id="stats-status-2">{{selectOptions aOptions=$aStatuses mOption=$aStatsInfo.iStatus2}}</select>
			<input type="submit" value="{{$lang.search}} &raquo;" class="submit" />
		</fieldset>
	</form>
</div>
{{if count( $aStatsInfo.aCustomers ) > 0}}
	<table class="list" id="stats-table">
		<thead>
			<tr>
				<th class="name">{{$lang.Name}}</th>
				<th class="quantity">{{$lang.Quantity}}</th>
				<th class="summary">{{$lang.Summary}}</th>
			</tr>
		</thead>
		<tfoot>
			<tr class="save">
				<td>{{$lang.Sum}}</td>
				<td class="center">{{$aStatsInfo.iQuantitySum}}</td>
				<td class="center">{{$aStatsInfo.sSummarySum}}</td>
			</tr>
		</tfoot>
		<tbody>
			{{foreach from=$aStatsInfo.aCustomers item=aCustomer}}	
				<tr>
					<td class="left">{{$aCustomer.sName}}</td><td>{{$aCustomer.iQuantity}}</td><td>{{$aCustomer.sSummary}}</td>
				</tr>
			{{/foreach}}
		</tbody>
	</table>
{{else}}
	<div class="msg" id="error">
		<img src="{{$config.dir_templates}}admin/images/ico/msg_error.png" class="imgv" alt="" /> {{$lang.Data_not_found}}
	</div>
{{/if}}