@props(['vehicle', 'costs', 'summary'])

Acquisition & preparation ledger

Recorded actual costs

KES {{ number_format((float) $summary['actual'], 2) }}

Outstanding estimates · excluded from profit

KES {{ number_format((float) $summary['estimated'], 2) }}

{{ $summary['finalised'] ? 'Profit on finalised costs' : 'Provisional profit on recorded actual costs' }}

{{ $summary['recorded_profit'] !== null ? 'KES '.number_format((float) $summary['recorded_profit'], 2) : 'Not yet calculable' }}

@if(!$summary['has_acquisition'])Record an actual acquisition cost before calculating profit.@elseif($vehicle->final_selling_price === null)No final sale is recorded. Asking-price margin is an estimate, not realised profit.@elseif(!$summary['finalised'])Late costs may change this provisional profit. Finance can finalise the ledger after all actual costs are recorded.@elseActual costs are finalised. Reopening the ledger is recorded in the history.@endif

@if($summary['asking_margin'] !== null && !$vehicle->final_selling_price)

Estimated asking-price margin, after actual costs and outstanding estimates: KES {{ number_format((float) $summary['asking_margin'], 2) }}

@endif
@forelse($costs as $cost)@empty@endforelse
Cost / categoryBasisOriginal / recorded rateCost · KES
{{ $cost->description }}

{{ ucfirst($cost->category) }} · {{ $cost->incurred_at->format('d M Y') }}

@if($cost->voided_at)

Voided: {{ $cost->void_reason }}

@endif
{{ $cost->currency }} {{ number_format((float) $cost->amount, 2) }}

1 {{ $cost->currency }} = {{ $cost->exchange_rate }} KES

@if($cost->exchange_rate_recorded_at)

{{ $cost->exchange_rate_recorded_at->format('d M Y H:i') }} EAT

@endif
{{ number_format((float) $cost->amount_kes, 2) }}@php($owed = $cost->basis === 'committed' && ! $cost->voided_at ? max(0, (float) $cost->amount_kes - (float) $costs->where('commitment_id', $cost->id)->whereNull('voided_at')->sum('amount_kes')) : 0)@if($owed > 0)

Owed KES {{ number_format($owed, 2) }}

@elseif($cost->basis === 'committed' && ! $cost->voided_at)

Paid in full

@endif @if($cost->commitment_id)

Payment against #{{ $cost->commitment_id }}

@endif @can('cost', $vehicle)@if($owed > 0 && !$vehicle->costs_finalised_at)
Record payment
@csrf
@endif @endcan @can('cost', $vehicle)@if(!$cost->voided_at && !$vehicle->costs_finalised_at)
Void
@csrf
@endif @endcan
No costs recorded yet.
@can('cost', $vehicle)@if(!$vehicle->costs_finalised_at)
+ Record a cost or estimate
@csrf

Choose "not yet paid" when you owe the seller; it appears in supplier payables until you record payment.

@endif @if(app(\App\Services\TenantContext::class)->allows('finance'))
{{ $vehicle->costs_finalised_at ? 'Reopen cost ledger' : 'Finalise actual costs' }}
@csrf
@endif @endcan