@php $data = $param['data']; $idx = 1; $user = Auth::guard('admin')->user()->full_name; $total_sales = 0; $total_profit = 0; $total_trx = 0; if ($data) { foreach ($data as $v) { $total_sales += $v->gross_sales; $total_profit += $v->gross_profit; $total_trx += $v->count_trx; $idx++; } $avg_sales = $total_sales / $total_trx; $avg_profit = $total_profit / $total_trx; $avg_trx = $total_trx / $idx; }else{ $avg_sales = 0; $avg_profit = 0; $avg_trx = 0; } @endphp
Tanggal Cetak User Cetak Average Sales Average Profit Average Trx
{{date('d/m/Y H:i:s')}} {{$user}} {{$avg_sales}} {{$avg_profit}} {{$avg_trx}}

@foreach ($data as $v) @endforeach
Tanggal Company Agent Gross Sales Gross Profit Trx
{{date('d/m/Y H:i:s',strtotime($v->crtdt))}} {{$v->merchant_nm}} {{$v->outlet_nm}} {{$v->gross_sales}} {{$v->gross_profit}} {{$v->count_trx}}