Top 10 Customer Report
{{ getAuthCompanyName() }}
{{ getAuthCarrierInfo()->BILL_TO }}
@php
$monthlyTotals = array_fill(1, 12, 0);
$gtotal = 0;
@endphp
|
{{ date('m/d/Y h:i A') }}
|
Grand Total:
${{ number_format($grandRates, 2) }}
|
| NAME |
TOTAL LOADS |
TOTAL RATES |
DATE |
@foreach ($customers as $row)
|
{{ $row->NAME }}
|
{{ $row->loads_count }} |
${{ number_format($row->load_rate_sum, 2) }} |
@if($row->ADDITION_DATE)
{{ \Carbon\Carbon::parse($row->ADDITION_DATE)->diffForHumans() }}
@endif
|
@endforeach
| GRAND TOTAL |
{{ $grandLoads }} |
${{ number_format($grandRates, 2) }} |
|
@php
$revenueData = [];
$loadData = [];
foreach ($customers as $row) {
$revenueData[] = [
'label' => strtoupper($row->NAME),
'y' => round($row->load_rate_sum, 2)
];
$loadData[] = [
'label' => strtoupper($row->NAME),
'y' => (int) $row->loads_count
];
}
@endphp
@php
// Get max revenue value
$maxRevenue = collect($revenueData)->max('y') ?? 0;
// Add headroom (10–15%) so bars & labels never touch top
$yAxisMax = ceil($maxRevenue * 1.15);
// Optional: round to a clean number (thousands)
$yAxisMax = ceil($yAxisMax / 1000) * 1000;
// Get max load count
$maxLoads = collect($loadData)->max('y') ?? 0;
$y2AxisMax = ceil($maxLoads * 1.15);
@endphp