@extends('layouts.app') @section('main')
| Sale ID | Date | Total Amount | Paid Amount | Due Amount | Exchange Amount | Payment Status | Payment Method |
|---|---|---|---|---|---|---|---|
| {{ $sale->id }} | {{ $sale->created_at->format('Y-m-d') }} | {{ number_format($sale->total_amount, 2) }} | {{ number_format($sale->paid_amount, 2) }} | @php $dueAmount = $sale->due_amount; $duePayments = \App\Models\CustomerPayment::where( 'customer_id', $customer->id, ) ->where('type', 'due_payment') ->whereJsonContains('sale_ids', $sale->id) ->sum('amount'); $netDue = $dueAmount - $duePayments; @endphp {{ number_format(max(0, $netDue), 2) }} | {{ $sale->exchanges->sum('price') }} | {{ $netDue <= 0 ? 'Paid' : ucfirst($sale->payment_status) }} |
@if ($sale->payment_method == 'multiple')
@foreach ($sale->payments as $payment)
{{ ucfirst($payment->payment_type) }}:
{{ number_format($payment->amount, 2) }} @endforeach @else {{ ucfirst($sale->payment_method) }} @endif |
| Payment ID | Date | Type | Amount | Notes |
|---|---|---|---|---|
| {{ $payment->id }} | {{ $payment->created_at->format('Y-m-d') }} | {{ ucfirst(str_replace('_', ' ', $payment->type)) }} | {{ number_format($payment->amount, 2) }} | {{ $payment->notes ?? '-' }} |