Sales by Brand

@if($from || $to)

Period: {{ $from ? \Carbon\Carbon::parse($from)->format('d M Y') : 'All' }} {{ ($from && $to) ? ' — ' : '' }} {{ $to ? \Carbon\Carbon::parse($to)->format('d M Y') : '' }}

@endif @php $grandTotal = 0; $grandCount = 0; @endphp @foreach($byBrand as $brandName => $jobs) @php $brandTotal = $jobs->sum('job_value'); $grandTotal += $brandTotal; $grandCount += $jobs->count(); @endphp
{{ $brandName ?: 'Unassigned' }}
@foreach($jobs as $job) @endforeach
File # Sale Date Customer Suburb Consultant Designer Showroom Value
{{ $job->job_number ?? '' }} {{ $job->sale_date?->format('d/m/Y') ?? '' }} {{ $job->contact ? strtoupper($job->contact->last_name) . (($job->contact->first_name ?? '') ? ', ' . strtoupper($job->contact->first_name) : '') : '' }} {{ strtoupper($job->site_suburb ?? $job->contact?->suburb ?? '') }} {{ $job->consultant?->name ?? '' }} {{ $job->designer?->name ?? '' }} {{$job->contact?->leads->first()?->showroom?->name ?? '—' }} {{ number_format($job->job_value ?? 0) }}
Summary for "Kitchen Company" = {{ $brandName ?: 'Unassigned' }} ({{ $jobs->count() }} detail record{{ $jobs->count() !== 1 ? 's' : '' }}) {{ number_format($brandTotal) }}
Sum {{ number_format($brandTotal) }}
@endforeach
Grand Total   ({{ $grandCount }} record{{ $grandCount !== 1 ? 's' : '' }}) {{ number_format($grandTotal) }}