{!! $print['head'] !!} @php $grand_tot_qty = $results->sum('tot_qty'); $grand_tot = $results->sum('tot'); $grand_tot_dc = $results->sum('tot_dc'); @endphp @foreach ($results->groupBy('cat_code') as $items) @php $tot_qty = $items->sum('tot_qty'); $net = $items->sum('tot'); @endphp @endforeach
Sales By Category
Name Qty % Tot Qty Net % Total
{{ $items->first()->cat_name }} {{ number_format(($tot_qty/$grand_tot_qty)*100, 2) }}% {{ number_format($tot_qty, 2) }} {{ number_format(($net/$grand_tot)*100, 2) }}% {{ number_format($net, 2) }}
Gross {{ number_format($grand_tot, 2) }}
DC {{ number_format($grand_tot_dc, 2) }}
Net {{ number_format($grand_tot-$grand_tot_dc, 2) }}
@foreach ($results as $item) @endforeach
Category Product Price Qty Total
{{ $item->cat_name }} {{ $item->name_eng }} {{ number_format($item->price, 2) }} {{ number_format($item->tot_qty, 2) }} {{ number_format($item->tot, 2) }}
Gross {{ number_format($grand_tot, 2) }}
DC {{ number_format($grand_tot_dc, 2) }}
Net {{ number_format($grand_tot-$grand_tot_dc, 2) }}
{!! $print['foot'] !!}