@extends('layouts.admin') @section('title', $purchase->reference) @section('content') @php $input = 'w-full h-11 px-3 rounded-xl border border-slate-300 dark:border-slate-700 bg-slate-50 dark:bg-slate-800 text-sm outline-none focus:ring-2 ring-brand-500 focus:bg-white dark:focus:bg-slate-900'; $label = 'block text-sm font-semibold mb-2'; $badge = [ 'paid' => 'bg-emerald-500/10 text-emerald-600 dark:text-emerald-400', 'partial' => 'bg-amber-500/10 text-amber-600 dark:text-amber-400', 'due' => 'bg-red-500/10 text-red-500', ]; $methods = ['cash' => 'Cash', 'card' => 'Card', 'bank' => 'Bank Transfer', 'cheque' => 'Cheque / PDC']; $pendingPdc = round((float) $purchase->payments->where('status', 'pending')->sum('amount'), 2); $available = round((float) $purchase->due_amount - $pendingPdc, 2); $stBadge = [ 'pending' => 'bg-amber-500/10 text-amber-600 dark:text-amber-400', 'cleared' => 'bg-emerald-500/10 text-emerald-600 dark:text-emerald-400', 'bounced' => 'bg-red-500/10 text-red-500', ]; $rate = rtrim(rtrim(number_format($purchase->vat_rate, 2), '0'), '.'); @endphp {{-- Breadcrumb --}}
All Purchases/ {{ $purchase->reference }}
@if (session('success'))
{{ session('success') }}
@endif @if ($errors->any())
@endif {{-- Info --}}
{{ $purchase->reference }}
{{ $purchase->payment_status }}
Supplier
{{ $purchase->supplier->name }}
@if ($purchase->supplier->phone)
{{ $purchase->supplier->phone }}
@endif
Date
{{ $purchase->date->format('d M Y') }}
Supplier invoice no
{{ $purchase->supplier_invoice_no ?: '—' }}
Note
{{ $purchase->note ?: '—' }}
{{-- Items --}}
Products
@foreach ($purchase->items as $item) @endforeach
Product Net Unit Cost Qty Unit Discount Tax Subtotal
{{ $item->product_name }}
{{ $item->product_code }}
{{ number_format($item->unit_cost, 2) }} {{ $item->quantity }} {{ $item->unit ?: '—' }} {{ $item->unit ?: '—' }} {{ number_format($item->discount, 2) }} {{ number_format($item->vat_amount, 2) }} {{ number_format($item->line_total, 2) }}
Subtotal (before VAT)AED {{ number_format($purchase->subtotal, 2) }}
Tax ({{ $rate }}%)AED {{ number_format($purchase->vat_amount, 2) }}
Grand TotalAED {{ number_format($purchase->total, 2) }}
PaidAED {{ number_format($purchase->paid_amount, 2) }}
DueAED {{ number_format($purchase->due_amount, 2) }}
@if ($pendingPdc > 0)
PDC pendingAED {{ number_format($pendingPdc, 2) }}
Still to scheduleAED {{ number_format($available, 2) }}
@endif
{{-- Pay supplier --}} @if ($available > 0)
@csrf

Make a payment to supplier

Due: AED {{ number_format($purchase->due_amount, 2) }} @if ($pendingPdc > 0) · PDC pending: AED {{ number_format($pendingPdc, 2) }} @endif · Available to pay: AED {{ number_format($available, 2) }}

{{-- Cheque / PDC fields --}}
@endif {{-- Payment history --}}
Payment history
@forelse ($purchase->payments as $pay) @empty @endforelse
Voucher Date Method Cheque details Status Amount Action
#{{ $pay->voucher_no }} {{ $pay->date->format('d M Y') }} {{ $methods[$pay->method] ?? $pay->method }} @if ($pay->is_pdc)PDC@endif @if ($pay->method === 'cheque')
No: {{ $pay->cheque_no }} · {{ $pay->bank_name }}
Cheque date: {{ $pay->cheque_date?->format('d M Y') }}
@else {{ $pay->note ?: '—' }} @endif
{{ $pay->status }} {{ number_format($pay->amount, 2) }} Voucher @if ($pay->status === 'pending')
@csrf
@csrf
@endif
No payments have been made yet
← Back
@endsection @push('scripts') @endpush