{{-- resources/views/suppliers/show.blade.php --}} @extends('layouts.app') @section('title', $supplier->name) @section('content') @php // Opening balance $opening = (float) ($supplier->opening_balance ?? 0); // সব purchase controller থেকে $purchases হিসেবে আসছে (DESC order) $totalPurchases = isset($purchases) ? (float) $purchases->sum('total') : 0; $totalPaid = isset($purchases) ? (float) $purchases->sum('paid') : 0; // supplier returns $totalReturns = (float) $returns->sum('total'); // Final হিসাব: // Opening + Total purchase - Total paid - supplier returns $currentDue = $opening + $totalPurchases - $totalPaid - $totalReturns; @endphp
No purchases from this supplier yet.
@else| Date | Invoice | Total | Paid | Due | Status | Next Due | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| {{ $purchase->date ? \Carbon\Carbon::parse($purchase->date)->format('d-m-Y') : '-' }} | {{ $purchase->invoice_no }} | {{ number_format($purchase->total ?? 0, 2) }} | {{ number_format($purchase->paid ?? 0, 2) }} | {{ number_format($purchase->due ?? 0, 2) }} | @if($purchase->status === 'paid') Paid @else Due @endif | {{ $purchase->next_due_date ? \Carbon\Carbon::parse($purchase->next_due_date)->format('d-m-Y') : '-' }} | ||||||||||||
|
||||||||||||||||||
No payments to this supplier yet.
@else| Date | Method | Amount | Ref No | Note |
|---|---|---|---|---|
| {{ $pay->date ? \Carbon\Carbon::parse($pay->date)->format('d-m-Y') : '-' }} | {{ $pay->method }} | {{ number_format($pay->amount ?? 0, 2) }} | {{ $pay->ref_no ?? '-' }} | {{ $pay->note ?? '-' }} |
No return entries for this supplier.
@else| Date | Product | Qty | Unit Price | Total | Note |
|---|---|---|---|---|---|
| {{ $r->date ? $r->date->format('d-m-Y') : '-' }} | {{ optional($r->product)->name ?? '—' }} | {{ $r->qty }} | {{ number_format($r->unit_price, 2) }} | {{ number_format($r->total, 2) }} | {{ $r->note ?? '-' }} |