@php $selected_action_types = request('action_types') ?? []; $action_types = [ ['label' => 'سند القيد', 'value' => 'entry'], ['label' => 'سند القبض', 'value' => 'receipt'], ['label' => 'سند الصرف', 'value' => 'exchange'], ['label' => 'فاتورة بيع الخدمات ', 'value' => 'service-invoice'], ['label' => 'فاتورة شراء', 'value' => 'purchase-invoice'], ['label' => 'فاتورة بيع', 'value' => 'sales-invoice'], ['label' => 'إشعار مدين ', 'value' => 'debit-note'], ['label' => 'إشعار دائن ', 'value' => 'credit-note'], ['label' => 'مردود مشتريات', 'value' => 'returned-purchase-bond'], ['label' => 'مردود مبيعات', 'value' => 'returned-sales-bond'], ]; @endphp

@php $selected_show_way = request('show_way')?? 'total'; @endphp

@lang('accounting/reports/accounts/detailed-cost-centers-statement.detailed_cost_centers_statement')

@lang('accounting/reports/accounts/detailed-cost-centers-statement.download_pdf') @php $query = count(request()->all()) > 0 ? '?' . explode('?', request()->fullUrl())[1] : ''; @endphp @lang('accounting/reports/accounts/detailed-cost-centers-statement.export_excel')
@if ($selected_cost_center)

@lang('accounting/reports/accounts/detailed-cost-centers-statement.account') {{ $selected_cost_center->ar_name . ' - (' . $selected_cost_center->id . ')' }}

@endif
@php $table_options = [ 'enableSumValuesOnColumns' => [2, 3], 'lang' => ['noAvailableData' => __('noAvailableData.no_data')], 'sumValuesCell' => 'b', 'columnResizer' => false, 'hideColumn' => false, ]; $diff_sum_data = [ 'target_col_index' => 0, 'first_col_index' => 1, 'second_col_index' => 2, ]; $from_date = request('from_date') ?? $active_year->from; $to_date = request('to_date') ?? $active_year->to; @endphp
@if (request()->from_date)

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

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

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

@endif
@if ($selected_show_way == 'total') @foreach ($statement_items_grouped_by_account as $item) @endforeach @php $total_balance = $statement_items_grouped_by_account ? $statement_items_grouped_by_account->sum('total_amount') : 0; @endphp
@lang('accounting/reports/accounts/detailed-cost-centers-statement.accounts') @lang('accounting/reports/accounts/detailed-cost-centers-statement.balance')
{{ $item->account_name ?? '--' }} {{ dn($item->total_amount) }}
@lang('accounting/reports/accounts/detailed-cost-centers-statement.total_amount') {{ dn($total_balance) }} {{ $total_balance < 0 ? 'دائن' : ($total_balance > 0 ? 'مدين' : '') }}
@else @php $balance = $initial_balance ?? 0; $debit_sum = 0; $credit_sum = 0; @endphp @foreach ($statement_items as $statement_item) @php $balance += $statement_item->amount; $debit_sum += $statement_item->amount > 0 ? $statement_item->amount : 0; $credit_sum += $statement_item->amount < 0 ? abs($statement_item->amount) : 0; @endphp @endforeach
@lang('accounting/reports/accounts/detailed-cost-centers-statement.accounts') @lang('accounting/reports/accounts/detailed-cost-centers-statement.balance') @lang('accounting/reports/accounts/detailed-cost-centers-statement.debit') @lang('accounting/reports/accounts/detailed-cost-centers-statement.credit') @lang('accounting/reports/accounts/detailed-cost-centers-statement.item_description') @lang('accounting/reports/accounts/detailed-cost-centers-statement.family') @lang('accounting/reports/accounts/detailed-cost-centers-statement.quantity') @lang('accounting/reports/accounts/detailed-cost-centers-statement.cost') @lang('accounting/reports/accounts/detailed-cost-centers-statement.total_cost') @lang('accounting/reports/accounts/detailed-cost-centers-statement.transaction_type') @lang('accounting/reports/accounts/detailed-cost-centers-statement.transaction_number') @lang('accounting/reports/accounts/detailed-cost-centers-statement.date') @lang('accounting/reports/accounts/detailed-cost-centers-statement.statement')
{{ $statement_item->account->name ?? '--' }} {{ dn($balance) }} {{ $statement_item->amount > 0 ? dn($statement_item->amount) : '--' }} {{ $statement_item->amount < 0 ? dn(abs($statement_item->amount)) : '--' }} @if (!empty($statement_item->items)) @foreach ($statement_item->items as $item)
{{ optional($item->barcode)->ar_name }}
@endforeach @else -- @endif
@if ($statement_item->families->isNotEmpty()) @foreach ($statement_item->families as $family)
{{ $family }}
@endforeach @else -- @endif
@if (!empty($statement_item->items)) @foreach ($statement_item->items as $item)
{{ isset($item->quantity) ? $item->quantity : '--' }}
@endforeach @else -- @endif
@if (!empty($statement_item->items)) @foreach ($statement_item->items as $item)
{{ isset($item->quantity) ? $item->final_cost : '--' }}
@endforeach @else -- @endif
@if (!empty($statement_item->items)) @foreach ($statement_item->items as $item)
{{ isset($item->quantity) && isset($item->final_cost) ? $item->quantity * $item->final_cost : '--' }}
@endforeach @else -- @endif
{{ $statement_item['title'] }} @if ($statement_item->action_type === 'automated-entry' && $statement_item->builder_model == 'OutBond') @elseif ($statement_item->action_type === 'automated-entry') @else {{ $statement_item->resource_title ?? $statement_item->statement_item_id }} @endif {{ $statement_item['date'] }} @if ($statement_item->action_type == 'automated-entry' && $statement_item->builder_model == 'OutBond') {{-- for automated entry notice -> type out bond --}} @foreach ($statement_item->items as $item)
{{ $item->notice ?? '--' }}
@endforeach @else {{-- for other bonds notice --}}
{{ $statement_item->notice ?? '--' }}
@endif
{{ dn($balance) }} {{ $balance < 0 ? 'دائن' : ($balance > 0 ? 'مدين' : '') }} {{ dn($debit_sum) }} {{ dn($credit_sum) }}
@endif