@extends('documents.procurement._layout', [ 'documentTitle' => 'Customs Clearance Summary', 'reference' => $shipment->shipment_reference, 'documentDate' => now()->format('d M Y'), ]) @section('header-meta')
Status: {{ ucwords(str_replace('_', ' ', $shipment->status)) }}
@php $tcr = $shipment->taxClearanceRecord; @endphp @if($tcr?->clearance_date)
Cleared: {{ \Carbon\Carbon::parse($tcr->clearance_date)->format('d M Y') }}
@endif @endsection @section('content') @php $tcr = $shipment->taxClearanceRecord; @endphp @if(!$tcr)

No tax clearance record has been created for this shipment yet.

@else {{-- Clearance details --}} @if($tcr->tax_authority_reference) @endif @if($tcr->clearingForwardingAgent) @endif @if($tcr->clearance_date) @endif
Tax Authority Reference {{ $tcr->tax_authority_reference }}
Clearing & Forwarding Agent {{ $tcr->clearingForwardingAgent->name }}
Status {{ ucwords($tcr->status) }}
Clearance Date {{ \Carbon\Carbon::parse($tcr->clearance_date)->format('d M Y') }}
{{-- Tax amounts --}}

Government Tax

@php $taxOutstanding = ($tcr->total_tax_assessed_base ?? 0) - ($tcr->total_tax_paid_base ?? 0); @endphp
Description Source Currency Base Currency Date
Tax Assessed @if($tcr->total_tax_assessed) {{ number_format($tcr->total_tax_assessed, 2) }} {{ $tcr->source_currency_code ?? '' }} @else — @endif {{ $tcr->total_tax_assessed_base ? number_format($tcr->total_tax_assessed_base, 2) : '—' }}
Tax Paid @if($tcr->total_tax_paid) {{ number_format($tcr->total_tax_paid, 2) }} {{ $tcr->source_currency_code ?? '' }} @else — @endif {{ $tcr->total_tax_paid_base ? number_format($tcr->total_tax_paid_base, 2) : '—' }} {{ $tcr->tax_payment_date ? \Carbon\Carbon::parse($tcr->tax_payment_date)->format('d M Y') : '—' }}
Outstanding Tax {{ $taxOutstanding > 0 ? number_format($taxOutstanding, 2) : '0.00' }}
{{-- CFA fees --}}

CFA Service Fees

@php $cfaOutstanding = ($tcr->cfa_service_fee_base ?? 0) - ($tcr->cfa_service_fee_paid_base ?? 0); @endphp
Description Source Currency Base Currency Date
CFA Fee Charged {{ $tcr->cfa_service_fee ? number_format($tcr->cfa_service_fee, 2).' '.($tcr->source_currency_code ?? '') : '—' }} {{ $tcr->cfa_service_fee_base ? number_format($tcr->cfa_service_fee_base, 2) : '—' }}
CFA Fee Paid {{ $tcr->cfa_service_fee_paid ? number_format($tcr->cfa_service_fee_paid, 2).' '.($tcr->source_currency_code ?? '') : '—' }} {{ $tcr->cfa_service_fee_paid_base ? number_format($tcr->cfa_service_fee_paid_base, 2) : '—' }} {{ $tcr->cfa_fee_payment_date ? \Carbon\Carbon::parse($tcr->cfa_fee_payment_date)->format('d M Y') : '—' }}
Outstanding CFA Fee {{ $cfaOutstanding > 0 ? number_format($cfaOutstanding, 2) : '0.00' }}
{{-- Total clearance cost --}}
Total Clearance Cost (Base) {{ number_format(($tcr->total_tax_paid_base ?? 0) + ($tcr->cfa_service_fee_paid_base ?? 0), 2) }}
@endif @endsection