@extends('layouts.finance') @section('title', 'In Transit Detail') @section('subtitle', 'Supplier invoices currently marked as transit') @section('content') @php $displayCurrency = 'PKR'; $fmt = fn($usd) => $metrics->moneyIn($usd, 'USD', $displayCurrency); $breakdownLabels = array_keys($breakdown); $breakdownValues = array_values($breakdown); $largestSupplier = $breakdownLabels[0] ?? 'No supplier'; $largestAmount = count($breakdownValues) ? max($breakdownValues) : 0; $paidCurrencyRates = $effectiveRatesByPaidCurrency ?? []; $selectedPaidCurrency = $selectedPaidCurrency ?? null; $paidCurrencyCards = $paidCurrencyCards ?? []; $invoiceTotal = $invoiceTotal ?? $transitInvoices->sum(fn($invoice) => $metrics->invoiceUsd($invoice)); $bankTransferTotal = $bankTransferTotal ?? 0; $pendingBankTransfers = $pendingBankTransfers ?? collect(); $transitRecordCount = $transitInvoices->count() + $pendingBankTransfers->count(); $dateFilter = $dateFilter ?? ['active' => false, 'from' => null, 'to' => null, 'label' => null]; $dashboardRouteParams = ($dateFilter['active'] ?? false) ? ['from' => $dateFilter['from'], 'to' => $dateFilter['to']] : []; @endphp
Back to Dashboard
@include('dashboard.cards._date-filter', ['dateFilter' => $dateFilter, 'filterRoute' => 'dashboard.cards.transit'])
Total In Transit
{{ $fmt($total) }}
{{ number_format($transitRecordCount) }} record{{ $transitRecordCount === 1 ? '' : 's' }} awaiting completion
Bank Transfer In Transit
{{ $fmt($bankTransferTotal) }}
{{ number_format($pendingBankTransfers->count()) }} pending / partial transfer{{ $pendingBankTransfers->count() === 1 ? '' : 's' }}
@foreach(['USD' => 'ico-bg-green', 'AUD' => 'ico-bg-teal'] as $currency => $iconClass) @php $card = $paidCurrencyCards[$currency] ?? ['count' => 0, 'paid_amount' => 0, 'pkr_amount' => 0, 'rate' => null]; $isActiveCurrency = $selectedPaidCurrency === $currency; @endphp
{{ $currency }} Transit
{{ $metrics->money($card['paid_amount'], $currency) }}
{{ number_format($card['count']) }} invoice{{ $card['count'] === 1 ? '' : 's' }}{{ $card['rate'] ? ' - '.$currency.'->PKR '.number_format($card['rate'], 4) : '' }}
@endforeach
{{ $selectedPaidCurrency ? $selectedPaidCurrency.' Invoice Count' : 'Invoice Count' }}
{{ number_format($transitInvoices->count()) }}
Status: transit

Breakdown

By supplier
@if($invoiceTotal > 0)
@else
No transit invoices.
@endif

Revenue vs. Expenses Trend

6 months

Pending Bank Transfers

@forelse($pendingBankTransfers as $transfer) @empty @endforelse
Date Reference From To Original Approved Remaining In Transit PKR Equivalent
{{ $transfer['date']?->format('d M Y') ?? '-' }} {{ $transfer['reference'] ?: 'TR-'.$transfer['id'] }} {{ $transfer['from'] }} {{ $transfer['to'] }} {{ $metrics->money($transfer['original_amount'], $transfer['currency']) }} {{ $metrics->money($transfer['approved_amount'], $transfer['currency']) }} {{ $metrics->money($transfer['remaining_amount'], $transfer['currency']) }} {{ $metrics->money($transfer['pkr_amount'], 'PKR') }}
No pending or partially approved bank transfers.
Bank Transfer Total {{ $fmt($bankTransferTotal) }}

{{ $selectedPaidCurrency ? $selectedPaidCurrency.' Transit Invoices' : 'Transit Invoices' }}

@forelse($transitInvoices as $invoice) @php $lineInvoiceTotal = $metrics->invoiceTotal($invoice); $invoicePkrEquivalent = $metrics->invoicePkrEquivalent($invoice); $rate = $metrics->invoiceAppliedRate($invoice); $paidCurrency = $metrics->invoicePaidCurrency($invoice); $paidCurrencyRate = $metrics->invoicePaidCurrencyRate($invoice); @endphp @empty @endforelse
Invoice Supplier Bank Amount Paid Rate Effective Rate PKR Equivalent Status
{{ $invoice->invoice_number }} {{ $invoice->supplier_name ?: $invoice->client_name }} {{ $invoice->bankAccount ? trim($invoice->bankAccount->name.' - '.$invoice->bankAccount->bank_name) : '-' }} {{ $metrics->money($lineInvoiceTotal, $invoice->currency) }} {{ $paidCurrency && $paidCurrencyRate ? $paidCurrency.'->PKR '.number_format($paidCurrencyRate, 4) : '-' }} {{ $rate ? number_format($rate, 4) : '-' }} {{ $invoicePkrEquivalent !== null ? $metrics->money($invoicePkrEquivalent, 'PKR') : 'Missing paid rate' }} In Transit
No transit invoices.
Invoice Transit Total {{ $fmt($invoiceTotal) }}

Insights

Paid FX Rate
{{ ! $selectedPaidCurrency && count($paidCurrencyRates) > 1 ? 'Mixed' : ($effectiveRate !== null ? number_format($effectiveRate, 4) : '-') }}
@if($selectedPaidCurrency) {{ $selectedPaidCurrency }}->PKR weighted rate @elseif(count($paidCurrencyRates) > 1) @foreach($paidCurrencyRates as $currency => $currencyRate) {{ $currency }}->PKR {{ number_format($currencyRate, 4) }}{{ ! $loop->last ? ' ยท ' : '' }} @endforeach @else Weighted from paid invoice currency @endif
Largest Share
{{ $invoiceTotal > 0 && $largestAmount > 0 ? number_format(($largestAmount / $invoiceTotal) * 100, 1) : '0.0' }}%
Largest supplier share
Transit Records
{{ number_format($transitRecordCount) }}
Invoices and bank transfers awaiting completion

Transit includes supplier invoices with status transit plus bank-to-bank transfer credit legs that are pending. For partial approvals, only the remaining unapproved amount is counted.

@push('scripts') @endpush @endsection