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