@if (isset($statistics) && $statistics && isset($statistics->items) && $statistics->items)
@t('Order Date') @t('Order Created')
@if (is_array($date))

@date($date[0]) - @date($date[1])

@else

@t('Statistics for') @date($date)

@endif
{!! Form::select( 'method', [ 'manual' => __('Manual Orders'), 'automatic' => __('Automatic Orders') ], $method, [ 'empty' => __('All'), 'class' => 'method ajax-select form-control', 'data-name' => 'method', 'data-target' => '.modal-body', 'data-url' => Router::removeVar(Router::url(), 'method'), 'data-target-class' => 'done' ] ) !!}
@php $total = 0; $qty_total = 0; @endphp @if ($category_groups)
@foreach ($category_groups as $key => $value) @if (count(array_intersect(oa($value->categories), array_keys(oa($statistics->items)))) == 0) @continue @endif

{{ $value->name }}

@php $group_total = 0; $group_qty_total = 0; @endphp @foreach ($statistics->items as $category_id => $products) @if (!in_array($category_id, $value->categories)) @continue @endif @php $category_total = 0; $category_qty_total = 0; @endphp @foreach ($products as $product) @php $total += $product->total; $category_total += $product->total; $category_qty_total += $product->qty; $qty_total += $product->qty; @endphp @endforeach @php $group_total += $category_total; $group_qty_total += $category_qty_total; @endphp @endforeach
@t('Category') @t('Qty') @t('Total')
{{ $categories->{$category_id}->name }} {{ $category_qty_total }} {{ amount($category_total, ['Currency' => oa($currency)]) }}
{{ $group_qty_total }} {{ amount($group_total, ['Currency' => oa($currency)]) }}
@endforeach
@else @foreach ($statistics->items as $category_id => $products) @php $category_total = 0; $category_qty_total = 0; @endphp @foreach ($products as $product) @php $total += $product->total; $category_total += $product->total; $category_qty_total += $product->qty; $qty_total += $product->qty; @endphp @endforeach @endforeach
@t('Category') @t('Qty') @t('Total')
{{ $categories->{$category_id}->name }} {{ $category_qty_total }} {{ amount($category_total, ['Currency' => oa($currency)]) }}
@endif @if (isset($statistics->totals->discount) && $statistics->totals->discount) @endif @if (isset($statistics->totals->remainder_total) && $statistics->totals->remainder_total) @endif
@t('Total') {{ amount($statistics->totals->amount, ['Currency' => oa($currency)]) }}
@t('Paid Total') {{ amount($statistics->totals->paid_amount, ['Currency' => oa($currency)]) }}
@t('Net Total') {{ amount($statistics->totals->net_amount, ['Currency' => oa($currency)]) }}
@t('Discounts') {{ amount($statistics->totals->discount, ['Currency' => oa($currency)]) }}
@t('Remaining balance') {{ amount($statistics->totals->remainder_total, ['Currency' => oa($currency)]) }}
@t('Potential Net Total *') {{ amount( $statistics->totals->net_amount + $statistics->totals->remainder_total - $statistics->totals->remainder_fees, ['Currency' => oa($currency)] ) }}
@endif