77 lines
2.8 KiB
PHP
77 lines
2.8 KiB
PHP
@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
|
|
<table>
|
|
<tr>
|
|
<th style="border: 1px solid black; font-weight: bold; text-align: center">Tanggal Cetak</th>
|
|
<th style="border: 1px solid black; font-weight: bold; text-align: center">User Cetak</th>
|
|
<th style="border: 1px solid black; font-weight: bold; text-align: center">Average Sales</th>
|
|
<th style="border: 1px solid black; font-weight: bold; text-align: center">Average Profit</th>
|
|
<th style="border: 1px solid black; font-weight: bold; text-align: center">Average Trx</th>
|
|
</tr>
|
|
<tr>
|
|
<td style="border: 1px solid black;">{{date('d/m/Y H:i:s')}}</td>
|
|
<td style="border: 1px solid black;">{{$user}}</td>
|
|
<td style="border: 1px solid black;">{{$avg_sales}}</td>
|
|
<td style="border: 1px solid black;">{{$avg_profit}}</td>
|
|
<td style="border: 1px solid black;">{{$avg_trx}}</td>
|
|
|
|
</tr>
|
|
</table>
|
|
<br>
|
|
<table style="width:100%;">
|
|
<thead>
|
|
<tr>
|
|
<th style="border: 1px solid black; font-weight: bold; text-align: center">Tanggal</th>
|
|
<th style="border: 1px solid black; font-weight: bold; text-align: center">Company</th>
|
|
<th style="border: 1px solid black; font-weight: bold; text-align: center">Agent</th>
|
|
<th style="border: 1px solid black; font-weight: bold; text-align: center">Gross Sales</th>
|
|
<th style="border: 1px solid black; font-weight: bold; text-align: center">Gross Profit</th>
|
|
<th style="border: 1px solid black; font-weight: bold; text-align: center">Trx</th>
|
|
</tr>
|
|
</thead>
|
|
|
|
<tbody>
|
|
@foreach ($data as $v)
|
|
|
|
<tr>
|
|
<td style="border: 1px solid black;">{{date('d/m/Y H:i:s',strtotime($v->crtdt))}}</td>
|
|
<td style="border: 1px solid black;">{{$v->merchant_nm}}</td>
|
|
<td style="border: 1px solid black;">{{$v->outlet_nm}}</td>
|
|
<td style="border: 1px solid black;">{{$v->gross_sales}}</td>
|
|
<td style="border: 1px solid black;">{{$v->gross_profit}}</td>
|
|
<td style="border: 1px solid black;">{{$v->count_trx}}</td>
|
|
|
|
</tr>
|
|
|
|
@endforeach
|
|
</tbody>
|
|
|
|
|
|
|
|
</table>
|