@extends('layout.app') @section('title', 'Trip Sheet #' . $tripSheet->trip_sheet_no) @push('header_script') @endpush @section('content')
{{-- ======================== TRIP INFO CARD ======================== --}}
Trip Sheet #{{ $tripSheet->trip_sheet_no }}
@php $badges = ['Draft' => 'secondary', 'In Progress' => 'warning', 'Completed' => 'success']; $badge = $badges[$tripSheet->status] ?? 'secondary'; @endphp {{ $tripSheet->status }}
Date
{{ \Carbon\Carbon::parse($tripSheet->date)->format('d-M-Y') }}
Vehicle No.
{{ $tripSheet->vehicle->vehicle_no ?? 'N/A' }}
Driver
{{ $tripSheet->driver->employee_name ?? $tripSheet->driver_name ?? 'N/A' }}
Linked LR No.
@if($tripSheet->freightEntry) LR-{{ $tripSheet->freightEntry->lr_no }} @else N/A @endif
Route
{{ $tripSheet->from_location }} → {{ $tripSheet->to_location }}
@if($tripSheet->start_km || $tripSheet->end_km)
KM Reading
{{ $tripSheet->start_km ?? '-' }} → {{ $tripSheet->end_km ?? '-' }} @if($tripSheet->total_km) ({{ $tripSheet->total_km }} km) @endif
@endif @if($tripSheet->start_time)
Start Time
{{ $tripSheet->start_time->format('d-M-Y h:i A') }}
@endif @if($tripSheet->end_time)
End Time
{{ $tripSheet->end_time->format('d-M-Y h:i A') }}
@endif
{{-- ======================== EXPENSES TABLE ======================== --}}
Trip Expenses
@forelse($tripSheet->expenses as $index => $expense) @empty @endforelse
# Expense Type Amount (₹) Date Remarks
{{ $index + 1 }} {{ $expense->expense_type }} {{ number_format($expense->amount, 2) }} {{ \Carbon\Carbon::parse($expense->expense_date)->format('d-M-Y') }} {{ $expense->remarks ?? '-' }}
No expenses recorded yet.
Total: ₹ {{ number_format($tripSheet->total_expense, 2) }}
{{-- ======================== PROFIT / LOSS CARD ======================== --}}
Profitability Summary
Freight Income ₹ {{ number_format($tripSheet->freight_amount, 2) }}
Total Expenses ₹ {{ number_format($tripSheet->total_expense, 2) }}
Net Profit/Loss @php $pl = $tripSheet->profit_loss; @endphp {{ $pl >= 0 ? '+' : '' }}₹ {{ number_format(abs($pl), 2) }}
@if($tripSheet->freight_amount > 0)
@php $margin = ($pl / $tripSheet->freight_amount) * 100; @endphp
Profit Margin {{ number_format($margin, 1) }}%
@endif @if($tripSheet->total_km)
Cost Per KM ₹ {{ $tripSheet->total_km > 0 ? number_format($tripSheet->total_expense / $tripSheet->total_km, 2) : '0.00' }}
Income Per KM ₹ {{ $tripSheet->total_km > 0 ? number_format($tripSheet->freight_amount / $tripSheet->total_km, 2) : '0.00' }}
@endif
@if($tripSheet->remarks)
Remarks

{{ $tripSheet->remarks }}

@endif
@endsection