@extends('pdf.layouts.app') @section('title', 'Ledger Report') @section('styles') @endsection @section('content') @php $ShowByDefault = $ShowByDefault ?? false; $isRtl = ($direction ?? 'rtl') === 'rtl'; @endphp
@if(isset($data) && count($data) > 0) @foreach($data as $account)
{{-- Account header --}} {{-- Opening / Period / Final balance summary --}}
{{ $isRtl ? 'الرصيد الافتتاحي' : 'Opening Balance' }} {{ $isRtl ? 'حركات الفترة' : 'Period Movements' }} {{ $isRtl ? 'الرصيد النهائي' : 'Final Balance' }}
{{ $isRtl ? 'مدين' : 'Debit' }} {{ $isRtl ? 'دائن' : 'Credit' }} {{ $isRtl ? 'الرصيد' : 'Balance' }} {{ $isRtl ? 'مدين' : 'Debit' }} {{ $isRtl ? 'دائن' : 'Credit' }} {{ $isRtl ? 'الرصيد' : 'Balance' }}
{{ number_format($account['initial_debit'] ?? 0, 2) }} {{ number_format($account['initial_credit'] ?? 0, 2) }} @php $initialBalance = $account['initial_balance'] ?? 0; @endphp {{ number_format($initialBalance, 2) }} {{ number_format($account['period_debit'] ?? 0, 2) }} {{ number_format($account['period_credit'] ?? 0, 2) }} @php $periodBalance = $account['period_balance'] ?? 0; @endphp {{ number_format($periodBalance, 2) }} @php $finalBalance = $account['final_balance'] ?? 0; @endphp {{ number_format($finalBalance, 2) }}
{{-- Transactions table --}} @if(isset($account['transactions']) && count($account['transactions']) > 0) @if(!$ShowByDefault) @endif @foreach($account['transactions'] as $transaction) @if(!$ShowByDefault) @endif @endforeach
{{ $isRtl ? 'التاريخ' : 'Date' }} {{ $isRtl ? 'القيد' : 'Constraint' }} {{ $isRtl ? 'رقم القيد' : 'Constraint Number' }} {{ $isRtl ? 'مركز التكلفة' : 'Cost Center' }} {{ $isRtl ? 'مدين' : 'Debit' }} {{ $isRtl ? 'دائن' : 'Credit' }} {{ $isRtl ? 'الرصيد' : 'Balance' }} {{ $isRtl ? 'العملة' : 'Currency' }}{{ $isRtl ? 'سعر التحويل' : 'Transfer Rate' }}
{{ $transaction['date'] ?? '-' }} {{ $transaction['constraint_name'] ?? '-' }} {{ $transaction['number_doc'] ?? '-' }} {{ $transaction['cost_center_name'] ?? '-' }} {{ number_format($transaction['debit'] ?? 0, 2) }} @if(isset($transaction['debit_other']) && $transaction['debit_other'] > 0 && $transaction['debit'] != $transaction['debit_other'])
({{ number_format($transaction['debit_other'], 2) }} {{ $transaction['currency_symbol'] ?? '' }})
{{ $isRtl ? 'سعر الصرف:' : 'Rate:' }} {{ $transaction['rate'] ?? $transaction['transfer_rate'] ?? 1 }}
@endif
{{ number_format($transaction['credit'] ?? 0, 2) }} @if(isset($transaction['creditor_other']) && $transaction['creditor_other'] > 0 && $transaction['credit'] != $transaction['creditor_other'])
({{ number_format($transaction['creditor_other'], 2) }} {{ $transaction['currency_symbol'] ?? '' }})
{{ $isRtl ? 'سعر الصرف:' : 'Rate:' }} {{ $transaction['rate'] ?? $transaction['transfer_rate'] ?? 1 }}
@endif
@php $runningBalance = $transaction['running_balance'] ?? 0; @endphp {{ number_format($runningBalance, 2) }} {{ $transaction['currency_name'] ?? '-' }}{{ number_format($transaction['transfer_rate'] ?? $transaction['rate'] ?? 0, 2) }}
@else

{{ $isRtl ? 'لا توجد معاملات لهذا الحساب' : 'No transactions available for this account' }}

@endif
@endforeach @else

{{ $isRtl ? 'لا توجد بيانات للعرض' : 'No data available to display' }}

@endif
@endsection