@php $from_date = (request()->from_date)?? $active_year->from; @endphp
@php $to_date = (request()->to_date)?? $active_year->to; @endphp

@php $selected_receivable_types = request('receivable_types_ids')?? []; @endphp


@php $is_debit = request('is_debit')?? true; @endphp
@php $is_credit = request('is_credit')?? true; @endphp
@php $is_zero = request('is_zero')?? true; @endphp
@php $selected_show_way = request('show_way')?? 'total'; @endphp
@php $with_checks = request('with_checks') ?? false; $with_checks_type = request('with_checks_type') ?? 'total'; @endphp
@php $with_total_balance = (request('with_total_balance'))? true : false; @endphp

@lang('accounting/reports/receivables/detailed-statement.detailed_receivables_statement')

@lang('accounting/reports/receivables/detailed-statement.download_pdf') @php $query = (count(request()->all()) > 0)? '?' . explode('?', request()->fullUrl())[1] : "" @endphp @lang('accounting/reports/receivables/detailed-statement.export_excel')
@if(request()->from_date || request()->to_date)
@if(request()->from_date)

@lang('accounting/reports/accounts/trial-balance.from_date') {{ request()->from_date }}

@endif @if(request()->to_date)

@lang('accounting/reports/accounts/trial-balance.to_date') {{ request()->to_date }}

@endif
@endif @if ($selected_show_way == 'total') @if ($with_checks) @endif @foreach ($receivables_statements as $receivable_statement) @if ($with_total_balance) @else @endif @if ($with_checks) @endif @endforeach
@lang('accounting/reports/receivables/detailed-statement.receviable') @lang('accounting/reports/receivables/detailed-statement.balance')@lang('accounting/reports/receivables/detailed-statement.total_value_of_checks')
{{ $receivable_statement->name }}{{ dn($receivable_statement->statement_items->sum('amount') + $receivable_statement->initial_balance) }}{{ dn($receivable_statement->statement_items->sum('amount')) }} {{ dn($receivable_statement->receipt_checks->sum('amount')) }}
@else @foreach ($receivables_statements as $receivable_statement)
{{ $receivable_statement->name }}
@php $balance = $with_total_balance ? $receivable_statement->initial_balance : 0; @endphp @forelse ($receivable_statement->statement_items as $statement_item) @php $balance+= $statement_item->amount; @endphp @empty @endforelse @if ($with_checks && $with_checks_type == 'total') @endif
@lang('accounting/reports/receivables/detailed-statement.transaction_type') @lang('accounting/reports/receivables/detailed-statement.transaction_date') @lang('accounting/reports/receivables/detailed-statement.receviable') @lang('accounting/reports/receivables/detailed-statement.transactions_value') @lang('accounting/reports/receivables/detailed-statement.balance')
{{ $statement_item->title }} {{ $statement_item->parseDateToCarbon('date')->format('Y-m-d') }} {{ $receivable_statement->name }} {{ dn($statement_item->amount) }} {{ dn($balance) }}
@lang('accounting/reports/receivables/detailed-statement.there_are_no_transactions_for_this_account')
@lang('accounting/reports/receivables/detailed-statement.total_value_of_checks_unlocalled') {{ dn($receivable_statement->receipt_checks->sum('amount')) }}
@if ($with_checks && $with_checks_type == 'details')
@lang('accounting/reports/receivables/detailed-statement.uncollected_checks') :
@forelse ($receivable_statement->receipt_checks as $receipt_check) @empty @endforelse @if ($receivable_statement->receipt_checks->count() > 0) @endif
@lang('accounting/reports/receivables/detailed-statement.checke_number') @lang('accounting/reports/receivables/detailed-statement.check_date') @lang('accounting/reports/receivables/detailed-statement.bank') @lang('accounting/reports/receivables/detailed-statement.check_value') @lang('accounting/reports/receivables/detailed-statement.receipt_bond') @lang('accounting/reports/receivables/detailed-statement.status') @lang('accounting/reports/receivables/detailed-statement.statement')
{{ $receipt_check->number }} {{ $receipt_check->parseDateToCarbon('date')->format('Y-m-d') }} {{ $receipt_check->bank }} {{ dn($receipt_check->amount) }} {{ $receipt_check->receipt->bond_number }} {{ $receipt_check->status == 'in_box' ? 'في الصندوق' : 'برسم التحصيل' }} {{ $receipt_check->notice }}
@lang('accounting/reports/receivables/detailed-statement.there_are_no_uncollected_checks_for_this_account')
{{ dn($receivable_statement->receipt_checks->sum('amount')) }}
@endif @endforeach @endif
@push('script') @endpush