{{ __('Supplier Account Statement') }}

{{ $supplier->name }}

{{ __('From Date') }} : {{ $from }}

{{ __('To Date') }} : {{ $to }}

@php $total_debit = 0; $total_credit = 0; $current_balance = 0; // عكس الرصيد الافتتاحي ليعكس أن المورد دائن if(isset($opening_balance) && $opening_balance != 0) { $current_balance = -$opening_balance; @endphp @php } $grouped_items = collect($items_details)->groupBy('invoice_number'); @endphp @foreach ($grouped_items as $invoice_number => $invoice_items) @php $invoice_total = $invoice_items->sum('total'); $invoice_date = $invoice_items->first()['date']; $total_credit += $invoice_total; // الفواتير في الدائن $current_balance += $invoice_total; // زيادة في الدائن (المطلوب للمورد) @endphp @endforeach @if(isset($payments) && count($payments) > 0) @foreach($payments as $payment) @php $total_debit += $payment->amount; // المدفوعات في المدين $current_balance -= $payment->amount; // تقليل الدائن (تسديد للمورد) @endphp @endforeach @endif
{{ __('Debit') }} {{ __('Credit') }} {{ __('Debit Balance') }} {{ __('Credit Balance') }} {{ __('Statement') }} {{ __('Date') }} {{ __('Document Number') }}
{{ $opening_balance < 0 ? number_format(abs($opening_balance), 2) : '' }} {{ $opening_balance > 0 ? number_format($opening_balance, 2) : '' }} {{ __('Opening Balance') }} {{ $from }}
0 {{ number_format($invoice_total, 2) }} {{ $current_balance < 0 ? number_format(abs($current_balance), 2) : '' }} {{ $current_balance > 0 ? number_format($current_balance, 2) : '' }} {{ __('Purchase Invoice') }} #{{ $invoice_number }} @foreach ($invoice_items as $item) @endforeach
{{ __('Item Name') }} {{ __('Quantity') }} {{ __('Unit Price') }} {{ __('Total') }}
{{ $item['item_name'] }} {{ number_format($item['quantity'], 2) }} {{ number_format($item['price'], 2) }} {{ number_format($item['total'], 2) }}
{{ \Carbon\Carbon::parse($invoice_date)->format('Y-m-d') }} {{ $invoice_number }}
{{ number_format($payment->amount, 2) }} 0 {{ $current_balance < 0 ? number_format(abs($current_balance), 2) : '' }} {{ $current_balance > 0 ? number_format($current_balance, 2) : '' }} {{ __('Payment Voucher') }} #{{ $payment->voucher_number }}
{{ __('Payment Method') }}: {{ $payment->payment_method }}
{{ __('Reference') }}: {{ $payment->reference }}
{{ \Carbon\Carbon::parse($payment->date)->format('Y-m-d') }} {{ $payment->voucher_number }}
{{ number_format($total_debit, 2) }} {{ number_format($total_credit, 2) }} {{ __('Total') }}
@if($current_balance < 0) {{ number_format(abs($current_balance), 2) }} @endif @if($current_balance > 0) {{ number_format($current_balance, 2) }} @endif {{ __('Final Balance') }}: {{ $current_balance > 0 ? __('Credit Balance') : __('Debit Balance') }}