@extends('layouts.master') @section('css') @endsection @section('title') {{ __('home.customer_supplier_account') }} @stop @section('page-header')

{{ __('home.customer_supplier_account') }}

{{ __('home.comprehensive_financial_statement') }}
@php $currentType = request()->get('type', '1'); @endphp
{{ __('home.period') }}: {{ date('Y') }}-01-01 {{ __('home.to') }} {{ date('Y-m-d') }}
@endsection @section('content') @if (session('success')) @endif @php $filteredCustomers = $customers->filter(function($item) use ($currentType) { return isset($item->orginal_type) && $item->orginal_type == $currentType; }); $totalAllCredit = 0; $totalAllDebit = 0; $activeCount = 0; foreach($filteredCustomers as $customer) { $c = $customer->total_credit ?? 0; $d = $customer->total_debit ?? 0; if(($d - $c) != 0) { $totalAllCredit += $c; $totalAllDebit += $d; $activeCount++; } } $netBalance = $totalAllDebit - $totalAllCredit; $reportTitle = $currentType == '1' ? __('home.certified_customer_statement_report') : __('home.certified_supplier_statement_report'); $nameColumnTitle = $currentType == '1' ? __('home.clietName') : __('home.supplier_name'); $activeCountTitle = $currentType == '1' ? __('home.active_customers_with_transactions') : __('home.active_suppliers_with_transactions'); @endphp
{{ __('home.total_debit') }}

{{ number_format($totalAllDebit, 2) }}

{{ __('home.total_credit') }}

{{ number_format($totalAllCredit, 2) }}

{{ __('home.net_balances') }}

{{ number_format(abs($netBalance), 2) }} {{ $netBalance >= 0 ? __('home.debit_status') : __('home.credit_status') }}

{{ $activeCountTitle }}

{{ $activeCount }} {{ __('home.account_unit') }}

{{ $reportTitle }}

@php $i = 1; @endphp @foreach($filteredCustomers as $customer) @php $credit = $customer->total_credit ?? 0; $debit = $customer->total_debit ?? 0; $balance = $debit - $credit; @endphp @if($debit - $credit != 0) @endif @endforeach
# {{ $nameColumnTitle }} {{ __('home.tax_number') }} {{ __('home.debit') }} {{ __('home.credit') }} {{ __('home.current balance') }}
{{ $i++ }} {{ $customer->name }} #{{ $customer->id ?? __('home.not_available_abbr') }} {{ $customer->tax_no ?? __('home.not_available') }} {{ number_format($debit, 2) }} {{ number_format($credit, 2) }} @if($balance > 0) {{ __('home.debit') }} ({{ number_format($balance, 2) }}) @elseif($balance < 0) {{ __('home.credit') }} ({{ number_format(abs($balance), 2) }}) @else {{ __('home.Balanced') }} @endif
{{ __('home.general_total_visible_results') }} {{ number_format($totalAllDebit, 2) }} {{ number_format($totalAllCredit, 2) }} @php $final = $totalAllDebit - $totalAllCredit; @endphp @if($final > 0) {{ number_format($final, 2) }} ({{ __('home.debit_status') }}) @else {{ number_format(abs($final), 2) }} ({{ __('home.credit_status') }}) @endif
@endsection @section('js') @endsection