Consolidated Reports

Generate, inspect, and export multi-day consolidated shift & vehicle operational reports for municipal submission & fleet auditing.

@php $params = array_filter([ 'start_date' => $startDate, 'end_date' => $endDate, 'vehicle_id' => $selectedVehicle, 'employee_id' => $selectedEmployee, 'route_id' => $selectedRoute, 'shift_id' => $selectedShift, 'status' => $selectedStatus, 'search' => $search, ]); if ($activeTab === 'shift_wise_consolidated') { $pdfDownloadUrl = route('admin.reports.download.shift-wise-consolidated', $params); $pdfStreamUrl = route('admin.reports.download.shift-wise-consolidated', array_merge($params, ['stream' => '1'])); } else { $pdfDownloadUrl = route('admin.reports.download.vehicle-wise-consolidated', $params); $pdfStreamUrl = route('admin.reports.download.vehicle-wise-consolidated', array_merge($params, ['stream' => '1'])); } @endphp
Swept Distance
{{ $metrics['total_distance'] ?? '0.00' }} KM
Total Shifts
{{ $metrics['total_shifts'] ?? '0' }} Shifts
Operating Time
{{ $metrics['total_duration'] ?? '0h 00m' }}
{{ $activeTab === 'shift_wise_consolidated' ? 'Avg KM / Shift' : 'Avg KM / Vehicle' }}
{{ $metrics['avg_km_per_shift'] ?? ($metrics['avg_km_per_vehicle'] ?? '0.00') }} KM
@foreach([ 'today' => 'Today', 'yesterday' => 'Yesterday', 'this_week' => 'This Week', 'this_month' => 'This Month', 'last_30_days' => 'Last 30 Days', 'all' => 'All History', ] as $val => $lbl) @endforeach
to
@if($activeTab === 'shift_wise_consolidated')

Master Consolidated Summary by Shift

({{ count($data['summary'] ?? []) }} Shifts Recorded)
ISO 9001:2015 Print Ready
@forelse($data['summary'] ?? [] as $row) @empty @endforelse @if(!empty($data['grandTotals'])) @endif
Shift Name Timing Window Operating Days Active Machinery Total Shifts Distance Swept Operating Time Avg KM / Shift
{{ $row['shift_name'] }}
{{ $row['shift_window'] }} {{ $row['operating_days'] }} {{ $row['vehicles_count'] }} {{ $row['shifts_run'] }} {{ number_format($row['total_distance_km'], 2) }} KM {{ $row['formatted_duration'] }} {{ number_format($row['avg_km_per_tour'], 2) }} KM
No shift tour records found for selected criteria.
GRAND CONSOLIDATED TOTALS {{ $data['grandTotals']['unique_dates_count'] ?? '-' }} {{ $data['grandTotals']['unique_vehicles_count'] ?? '-' }} {{ $data['grandTotals']['total_tours'] ?? '-' }} {{ number_format($data['grandTotals']['total_distance_km'] ?? 0, 2) }} KM {{ $data['grandTotals']['formatted_duration'] ?? '-' }} {{ number_format($data['grandTotals']['avg_km_per_tour'] ?? 0, 2) }} KM

Detailed Shift Operations Breakdown

Individual tour records grouped under each municipal operational shift

@forelse($data['groups'] ?? [] as $shiftKey => $group) @php $resolvedShiftId = $group['shift_id'] ?? $shiftKey; @endphp
{{ $group['shift_name'] }} {{ $group['shift_window'] }}
{{ $group['operating_days_count'] ?? 1 }} Days Run • {{ count($group['tours']) }} Shifts • {{ number_format($group['total_distance_km'], 3) }} KM • {{ $group['formatted_duration'] }}
@foreach($group['tours'] as $tour) @endforeach
Tour / Duty Ref Date Machinery Driver / Operator Assigned Route Duration Distance Swept Status
Certificate All
{{ $tour->driverDuty?->duty_code ?? ('#TOUR-'.str_pad((string) $tour->id, 5, '0', STR_PAD_LEFT)) }}
{{ $tour->start_time ? $tour->start_time->format('d M Y') : 'N/A' }}
{{ $tour->start_time ? $tour->start_time->format('h:i A') : '' }} - {{ $tour->end_time ? $tour->end_time->format('h:i A') : 'Active' }}
{{ $tour->vehicle?->vehicle_number ?? 'N/A' }}
{{ $tour->vehicle?->category?->name ?? 'Sweeper' }}
{{ $tour->employee?->full_name ?? ($tour->user?->name ?? 'N/A') }}
{{ $tour->employee?->employee_code ?? 'EMP' }}
{{ $tour->route?->name ?? ($tour->driverDuty?->route?->name ?? 'N/A') }}
{{ $tour->formatted_duration }} {{ number_format($tour->total_distance_km, 3) }} KM @php $statusClasses = match(strtolower($tour->status)) { 'completed' => 'bg-emerald-100 text-emerald-800', 'in_progress' => 'bg-amber-100 text-amber-800', 'cancelled' => 'bg-rose-100 text-rose-800', default => 'bg-slate-100 text-slate-700', }; @endphp {{ ucfirst($tour->status) }} PDF
Subtotal for {{ $group['shift_name'] }}: {{ $group['operating_days_count'] ?? 1 }} Days Run {{ $group['formatted_duration'] }} {{ number_format($group['total_distance_km'], 3) }} KM Verified Combined
@empty
No shift operations records found.
@endforelse
@else

Master Fleet Utilization Summary by Vehicle

({{ count($data['summary'] ?? []) }} Fleet Units Active)
ISO 9001:2015 Print Ready
@forelse($data['summary'] ?? [] as $row) @empty @endforelse @if(!empty($data['grandTotals'])) @endif
Vehicle Number Category Assigned Operators Operating Days Total Shifts Distance Swept Operating Time Avg KM / Day
{{ $row['vehicle_number'] }}
{{ $row['category_name'] }} {{ $row['drivers'] ?: 'Unassigned' }} {{ $row['operating_days'] }} {{ $row['shifts_worked'] }} {{ number_format($row['total_distance_km'], 2) }} KM {{ $row['formatted_duration'] }} {{ number_format($row['avg_km_per_day'], 2) }} KM
No fleet vehicle tour records found for selected criteria.
GRAND CONSOLIDATED TOTALS ({{ $data['grandTotals']['total_vehicles'] ?? '-' }} Units) {{ $data['grandTotals']['unique_dates_count'] ?? '-' }} {{ $data['grandTotals']['total_tours'] ?? '-' }} {{ number_format($data['grandTotals']['total_distance_km'] ?? 0, 2) }} KM {{ $data['grandTotals']['formatted_duration'] ?? '-' }} {{ number_format($data['grandTotals']['avg_km_per_vehicle'] ?? 0, 2) }} KM

Detailed Tour Logs by Machinery Unit

Individual tour records grouped under each fleet vehicle

@forelse($data['groups'] ?? [] as $vehicleId => $group)
{{ $group['vehicle_number'] }} {{ $group['category_name'] }} ({{ $group['primary_function'] }})
{{ $group['operating_days_count'] }} Days Run • {{ count($group['tours']) }} Shifts • {{ number_format($group['total_distance_km'], 3) }} KM • {{ $group['formatted_duration'] }}
@foreach($group['tours'] as $tour) @php $shiftInfo = app(\App\Services\ConsolidatedReportService::class)->resolveShiftInfo($tour); @endphp @endforeach
Tour / Duty Ref Date Driver / Operator Assigned Route Shift Timing Duration Distance Swept Status
Certificate All
{{ $tour->driverDuty?->duty_code ?? ('#TOUR-'.str_pad((string) $tour->id, 5, '0', STR_PAD_LEFT)) }}
{{ $tour->start_time ? $tour->start_time->format('d M Y') : 'N/A' }}
{{ $tour->start_time ? $tour->start_time->format('h:i A') : '' }} - {{ $tour->end_time ? $tour->end_time->format('h:i A') : 'Active' }}
{{ $tour->employee?->full_name ?? ($tour->user?->name ?? 'N/A') }}
{{ $tour->employee?->employee_code ?? 'EMP' }}
{{ $tour->route?->name ?? ($tour->driverDuty?->route?->name ?? 'N/A') }}
{{ $shiftInfo['name'] }}
{{ $shiftInfo['window'] }}
{{ $tour->formatted_duration }} {{ number_format($tour->total_distance_km, 3) }} KM @php $statusClasses = match(strtolower($tour->status)) { 'completed' => 'bg-emerald-100 text-emerald-800', 'in_progress' => 'bg-amber-100 text-amber-800', 'cancelled' => 'bg-rose-100 text-rose-800', default => 'bg-slate-100 text-slate-700', }; @endphp {{ ucfirst($tour->status) }} PDF
Subtotal for {{ $group['vehicle_number'] }}: {{ $group['operating_days_count'] }} Days Run {{ $group['formatted_duration'] }} {{ number_format($group['total_distance_km'], 3) }} KM Verified Combined
@empty
No vehicle fleet operations records found.
@endforelse
@endif