{{ $stats['total_purchases'] ?? 0 }}
Total Purchases
{{ $stats['completed_purchases'] ?? 0 }}
Completed
{{ $stats['pending_purchases'] ?? 0 }}
Pending
KES {{ number_format($stats['total_amount'] ?? 0, 0) }}
Total Amount
KES {{ number_format($stats['total_paid'] ?? 0, 0) }}
Paid Amount
KES {{ number_format($stats['total_outstanding'] ?? 0, 0) }}
Outstanding
@forelse($purchases as $purchase)
@endforelse
@if($purchases->hasPages())
{{ ucfirst($purchase->status) }}
@empty
{{ $purchase->supplier->name ?? 'No Supplier' }}
{{ $purchase->invoice_no }}
@if($purchase->reference_number)
{{ $purchase->reference_number }}
@endif
Date
{{ $purchase->purchase_date->format('M d, Y') }}
Items
{{ $purchase->items_count ?? 0 }} items
Total
KES {{ number_format($purchase->grand_total, 2) }}
Payment
{{ ucfirst($purchase->payment_status) }}
@if($purchase->is_credit_purchase)
Credit
Enabled
@endif
Pending
Approved
Received
Inventory
@if($purchase->status == 'pending')
@elseif($purchase->status == 'approved')
@elseif($purchase->status == 'received')
@elseif($purchase->status == 'completed')
@php
$hasServices = $purchase->items()
->where(function($q) {
$q->where('item_type', 'service')
->orWhereHas('product', function($q) {
$q->where('is_service', true);
});
})
->exists();
@endphp
@if($hasServices)
@endif
@endif
@if($purchase->grand_total > $purchase->paid_amount)
@endif
@if(in_array($purchase->status, ['pending', 'draft', 'cancelled']) && $purchase->items()->where('added_to_stock', false)->count() == $purchase->items()->count())
@endif
Recent Suppliers
@foreach($recentSuppliers as $supplier)
@endforeach
{{ $supplier->name }}
{{ $supplier->phone }}
{{ $supplier->purchases_count }} purchases