@extends('layouts.app') @section('title', "Purchase #{$purchase->id}") @section('content')

Purchase #{{ $purchase->id }}

{{ $purchase->purchase_date->format('d M Y') }} — {{ $purchase->supplier->name }}

Back
Total Bill
৳{{ number_format((float) $purchase->total_bill, 2) }}
Paid
৳{{ number_format((float) $purchase->paid_amount, 2) }}
Due
৳{{ number_format((float) $purchase->due_amount, 2) }}
Status
@php $stColors = ['draft' => 'secondary', 'posted' => 'primary', 'settled' => 'success']; @endphp
{{ ucfirst($purchase->status) }}
Details
@if($purchase->payment_method) @endif @if($purchase->invoice_attachment) @endif
Supplier {{ $purchase->supplier->name }}
Invoice # {{ $purchase->invoice_number ?? '—' }}
Project {{ $purchase->project->project_name ?? '—' }}
Notes {{ $purchase->notes ?? '—' }}
Payment Method @php $pmLabels = ['cash' => 'Cash', 'bank' => 'Bank', 'mobile_banking' => 'Mobile Banking']; @endphp {{ $pmLabels[$purchase->payment_method] ?? ucfirst($purchase->payment_method) }}
Attachment View
Line Items
@foreach($purchase->items as $item) @endforeach
Material Qty Unit Rate Total
{{ $item->material->material_name }} {{ number_format((float) $item->quantity, 2) }} {{ $item->material->unit }} ৳{{ number_format((float) $item->unit_price, 2) }} ৳{{ number_format((float) $item->total_price, 2) }}
Total: ৳{{ number_format((float) $purchase->total_bill, 2) }}
Payment History @if((float) $purchase->due_amount > 0) @endif
@forelse($purchase->payments as $pm) @empty @endforelse
Date Amount Method Reference Narration
{{ $pm->payment_date->format('d M Y') }} {{ $pm->is_reversal ? '-' : '' }}৳{{ number_format((float) $pm->amount, 2) }} {{ $pm->paymentMethod->name ?? 'Cash' }} {{ $pm->reference_number ?? '—' }} {{ $pm->narration ?? '—' }}
No payments recorded yet.
@if((float) $purchase->due_amount > 0) @endif @endsection