Truck Maintenance & Expense Report ({{!empty($selectedYear) ? $selectedYear : date('Y') }})
{{ getAuthCompanyName() }}
{{ getAuthCarrierInfo()->BILL_TO }}
|
{{ date('m/d/Y h:i A') }}
|
Grand Total:
${{ number_format($gtotal, 2) }}
|
| Unit Id |
@for ($month = 1; $month <= 12; $month++)
{{ \Carbon\Carbon::createFromDate($cur_year, $month, 1)->format('M') }} |
@endfor
Total |
@php
$monthlyTotals = array_fill(1, 12, 0);
$gtotal = 0;
@endphp
@foreach ($trucks as $truck)
@php $total = 0; @endphp
| {{ $truck->UNIT_ID }} |
@for ($month = 1; $month <= 12; $month++)
@php
$repairAmount = $repairAmounts[$truck->TRUCK_ID][$month] ?? 0;
$expenseAmount = $expenseAmounts[$truck->TRUCK_ID][$month] ?? 0;
$totalAmount = $repairAmount + $expenseAmount;
$monthlyTotals[$month] += $totalAmount;
$total += $totalAmount;
@endphp
${{ number_format($totalAmount, 2) }}
|
@endfor
${{ number_format($total, 2) }}
|
@endforeach
| Total |
@for ($month = 1; $month <= 12; $month++)
@php $gtotal += $monthlyTotals[$month]; @endphp
${{ number_format($monthlyTotals[$month], 2) }}
|
@endfor
${{ number_format($gtotal, 2) }}
|
Grand Total: ${{ number_format($gtotal, 2) }}
|
@php
$monthLabels = [];
for ($m = 1; $m <= 12; $m++) {
$monthLabels[] = \Carbon\Carbon::createFromDate($cur_year, $m, 1)->format('M');
}
$chartSeries = [];
foreach ($trucks as $truck) {
$dataPoints = [];
for ($m = 1; $m <= 12; $m++) {
$repair = $repairAmounts[$truck->TRUCK_ID][$m] ?? 0;
$expense = $expenseAmounts[$truck->TRUCK_ID][$m] ?? 0;
$total = round($repair + $expense, 2);
$dataPoints[] = [
'label' => $monthLabels[$m - 1],
'y' => $total
];
}
$chartSeries[] = [
'type' => 'stackedColumn',
'name' => $truck->UNIT_ID,
'showInLegend' => true,
'dataPoints' => $dataPoints
];
}
@endphp