@extends('layouts.app') @section('title', $bill->bill_number) @section('content') @php $bb = match ($bill->status) { 'Paid' => 'g', 'Overdue', 'Cancelled' => 'r', 'Partially Paid' => 'a', default => 'b', }; @endphp
Bills

{{ $bill->bill_number }}

{{ $bill->supplier?->company_name }}

{{ $bill->status }}
@if(! in_array($bill->status, ['Paid', 'Cancelled'], true)) Pay @endif
@if(session('success'))
{{ session('success') }}
@endif @if(session('toast'))
{{ session('toast') }}
@endif

Bill date

{{ $bill->bill_date?->format('Y-m-d') }}

Due

{{ $bill->due_date?->format('Y-m-d') ?? '—' }}

Linked PO

{{ $bill->inventoryPurchaseOrder?->po_number ?? '—' }}

Subtotal{{ \App\Support\Format::mwkDecimal($bill->subtotal) }}
VAT{{ \App\Support\Format::mwkDecimal($bill->vat_amount) }}
Total{{ \App\Support\Format::mwkDecimal($bill->total_amount) }}
Paid{{ \App\Support\Format::mwkDecimal($bill->paid_amount) }}
Balance{{ \App\Support\Format::mwkDecimal($bill->balance_due) }}
@if($bill->cashOutflow)

Cash outflow #{{ $bill->cashOutflow->id }} — {{ $bill->cashOutflow->is_paid ? 'Paid' : 'Pending' }}

@endif

Line items

@foreach($bill->items as $it) @endforeach
MaterialQtyUnitTotal
{{ $it->material?->name }} {{ rtrim(rtrim((string) $it->quantity, '0'), '.') }} {{ \App\Support\Format::mwkDecimal($it->unit_cost) }} {{ \App\Support\Format::mwkDecimal($it->total_cost) }}
@if(! in_array($bill->status, ['Paid', 'Cancelled'], true))

Record payment

Marks the linked cash outflow as paid and posts one finance expense transaction (full balance).

@csrf
@endif
@endsection