@php $fmt = fn ($v, $d = 2) => $v === null || $v === '' || (float) $v == 0.0 ? '' : number_format((float) $v, $d); $money = fn ($v) => $v === null || (float) $v == 0.0 ? '' : '$'.number_format((float) $v, 2); $st = fn ($code) => $states[$code] ?? null; // Left-side rows next to the 21 state rows (paper layout) $leftRows = []; $leftRows[] = ['shipper', 0]; $leftRows[] = ['shipper', 1]; $leftRows[] = ['shipper', 2]; $leftRows[] = ['consignee_head', null]; for ($i = 0; $i < 7; $i++) { $leftRows[] = ['consignee', $i]; } foreach ($lines as $line) { $leftRows[] = ['expense', $line]; } @endphp {{ $trip->trip_no }}
@if($logo)@else
{{ $company?->name }}
@endif
{{ $company?->city }}{{ $company?->state ? ', '.$company->state : '' }}
{{ $company?->address }}
{{ strtoupper(trim(($company?->city ?? '').', '.($company?->state ?? '').' '.($company?->zip ?? ''), ', ')) }}
Tel : {{ collect([$company?->phone_1, $company?->phone_2])->filter()->implode(', ') }}
TRIP SHEET
{{ $trip->trip_no }} · {{ strtoupper($trip->status) }}
Driver{{ strtoupper($driverName ?? '') }} @foreach(($teamLines ?? []) as $line)
{{ $line }} @endforeach
Date{{ $trip->trip_date?->format('m/d/Y') }}@if($trip->end_date && $trip->end_date->ne($trip->trip_date)) – {{ $trip->end_date->format('m/d/Y') }}@endif Load No.
{{ $trip->load_no }}
Truck No.{{ $trip->truck?->truck_no }} Trailer No.{{ $trip->trailer?->trailer_no }}
@foreach($left as $i => $code) @php [$kind, $ref] = $leftRows[$i]; $r = $right[$i]; $ls = $st($code); $rs = $st($r); @endphp @if($kind === 'shipper') @elseif($kind === 'consignee_head') @elseif($kind === 'consignee') @else @endif @endforeach @if((float) $trip->repairs_total > 0) @endif
ShipperCity GallonsMiles GallonsMiles
{{ $shippers[$ref]->name ?? '' }} {{ isset($shippers[$ref]) ? trim($shippers[$ref]->city.', '.$shippers[$ref]->state, ', ') : '' }}ConsigneeCity{{ $consignees[$ref]->name ?? '' }} {{ isset($consignees[$ref]) ? trim($consignees[$ref]->city.', '.$consignees[$ref]->state, ', ') : '' }}{{ $ref['label'] }}{{ $money($ref['amount']) }}{{ $code }} {{ $ls ? $fmt($ls->gallons, 1) : '' }} {{ $ls ? $fmt($ls->miles, 0) : '' }} {{ $r }} {{ $rs ? $fmt($rs->gallons, 1) : '' }} {{ $rs ? $fmt($rs->miles, 0) : '' }}
Misc.{!! $miscNote ? ' ('.e($miscNote).')' : '' !!} Total Gallons {{ $fmt($trip->total_gallons, 1) }} @if($misc){{ $money($misc) }}@endif
Repairs ({{ $repairs->count() }} on road — details below){{ $money($trip->repairs_total) }}
Total{{ '$'.number_format((float) $trip->expenses_total, 2) }}
@if($extras->isNotEmpty()) @foreach($extras as $code => $row) @endforeach
Other states / provinces driven
{{ $code }}{{ $fmt($row->gallons, 1) }} gal{{ $fmt($row->miles, 0) }} mi
@endif
Load From City {{ strtoupper(trim($trip->load_from_city.', '.$trip->load_from_state, ', ')) }} Destination {{ strtoupper(trim($trip->destination_city.', '.$trip->destination_state, ', ')) }}
Driver's Signature
@if($signature)@endif @if($trip->signed_at)
Signed {{ $trip->signed_at->format('m/d/Y H:i') }}
@endif
Starting MilesEnding MilesTotal Miles
{{ $trip->starting_miles !== null ? number_format($trip->starting_miles, 0) : '' }} {{ $trip->ending_miles !== null ? number_format($trip->ending_miles, 0) : '' }} {{ $trip->total_miles ? number_format($trip->total_miles, 0) : '' }}@if($trip->empty_miles) ({{ number_format($trip->empty_miles, 0) }} empty)@endif
@php($routes = $trip->stateMileages->filter(fn ($s) => $s->route || $s->odometer_in)) @if($routes->isNotEmpty()) @foreach($routes->sortBy(fn ($s) => $s->odometer_in ?? PHP_INT_MAX) as $s) @endforeach
Route of travel (IFTA)
StateHighwaysOdometer enteringMiles
{{ $s->jurisdiction_code }}{{ $s->route }}{{ $s->odometer_in ? number_format($s->odometer_in) : '' }}{{ number_format($s->miles, 0) }}
@endif @if(($fuelStops ?? collect())->isNotEmpty()) @foreach($fuelStops as $f) @endforeach
Fuel purchases during this trip
DateFuel stop · invoiceFuelOdometerGallonsCostPrice / gal
{{ ($f->purchased_on ?? $trip->trip_date)?->format('m/d/Y') }} {{ $f->name }}@if($f->city || $f->state) · {{ trim($f->city.', '.$f->state, ', ') }}@endif @if($f->invoice_no)
Inv. {{ $f->invoice_no }}@endif
{{ ucfirst($f->fuel_type ?? 'diesel') }} {{ $f->odometer ? number_format($f->odometer) : '' }} {{ $f->gallons !== null ? number_format($f->gallons, 1) : '' }} {{ $f->cost !== null ? $money($f->cost) : '' }} {{ $f->gallons > 0 && $f->cost !== null ? '$'.number_format($f->cost / $f->gallons, 3) : '' }}
Total{{ number_format($fuelStops->sum('gallons'), 1) }}{{ $money($fuelStops->sum('cost')) }}
@endif @if($repairs->isNotEmpty()) @foreach($repairs as $r) @endforeach
Repairs & breakdowns during this trip
#{{ $loop->iteration }} · {{ $r->repair_date?->format('m/d/Y') }}
{{ strtoupper(trim($r->location_city.', '.$r->location_state, ', ')) }}@if($r->odometer)
Odo {{ number_format($r->odometer) }}@endif
Shop {{ $r->shop_name }}
{{ $r->shop_phone }}
{{ $r->shop_address }}
Mechanic {{ $r->mechanic_name }}
{{ $r->mechanic_phone }}
Problem {{ $r->problem }}
Work done {{ $r->work_done }}@if($r->notes)
{{ $r->notes }}@endif
@foreach($r->parts as $p){{ ucfirst($p->action) }}: {{ $p->name }}{{ (float) $p->qty != 1.0 ? ' ×'.rtrim(rtrim(number_format($p->qty, 2), '0'), '.') : '' }}
@endforeach
Parts {{ $money($r->parts_cost) ?: '$0.00' }}
Labor {{ $money($r->labor_cost) ?: '$0.00' }}

{{ $money($r->total_cost) }}
{{ str_replace('_', ' ', $r->payment_method) }}{{ $r->invoice_no ? ' · '.$r->invoice_no : '' }}
@endif @if($showRevenue) @if(($teamDrivers ?? collect())->count() > 1) @foreach($teamDrivers as $d) @endforeach @endif
Office copy — revenue
Load rate{{ $trip->load_rate !== null ? '$'.number_format($trip->load_rate, 2) : '—' }}
Expenses (TOTAL){{ '$'.number_format((float) $trip->expenses_total, 2) }}
Driver pay{{ $trip->driver_pay !== null ? '$'.number_format($trip->driver_pay, 2) : '—' }}
{{ $d['name'] }}${{ number_format($d['pay'], 2) }}
Net profit{{ $trip->net_profit !== null ? '$'.number_format($trip->net_profit, 2) : '—' }}
MPG · Cost / mile{{ $trip->mpg ?? '—' }} · {{ $trip->cost_per_mile !== null ? '$'.number_format($trip->cost_per_mile, 2) : '—' }}
@endif
Generated {{ now()->format('m/d/Y H:i') }} · {{ $trip->trip_no }} · State gallons/miles support IFTA record-keeping; confirm official filing requirements.