@extends('layouts.master') @section('css') @endsection @section('title') Extraction Of ({{ $voucherType->name }}) @endsection @section('content')

Extraction Of ({{ $voucherType->name }})

Go Back
@php $debitTotal = 0; $creditTotal = 0; @endphp @foreach ($groups as $group) @php $group->drAmount = 0; $group->crAmount = 0; @endphp @foreach ($group->descendantsAndSelf as $subGroup) @php $subGroup->drAmount = 0; $subGroup->crAmount = 0; $subLedgers = $subGroup->ledgers->pluck('id'); $exists = $transactions->whereIn('ledger_id', $subLedgers); if ($exists->count() > 0) { $drExists = $exists->where('debitAmtTotal', '>', 0); $crExists = $exists->where('creditAmtTotal', '>', 0); if ($drExists->count() > 0 || $crExists->count() > 0) { foreach ($subGroup->ledgers as $subLedger) { $subLedger->drAmount = 0; $subLedger->crAmount = 0; $subDrExists = clone $drExists; $subDrExists = $drExists->where('ledger_id', $subLedger->id); $subCrExists = clone $crExists; $subCrExists = $crExists->where('ledger_id', $subLedger->id); if ($subDrExists->count() > 0) { $subLedger->drAmount = $subDrExists->sum('debitAmtTotal'); $subGroup->drAmount += $subLedger->drAmount; $group->drAmount += $subLedger->drAmount; $debitTotal += $subDrExists->sum('debitAmtTotal'); } if ($subCrExists->count() > 0) { $subLedger->crAmount = $subCrExists->sum('creditAmtTotal'); $subGroup->crAmount += $subLedger->crAmount; $group->crAmount += $subLedger->crAmount; $creditTotal += $subCrExists->sum('creditAmtTotal'); } } } } @endphp @endforeach @if ($group->drAmount > 0 || $group->crAmount > 0) @foreach ($group->descendantsAndSelf as $subGroup) @if ($group->id != $subGroup->id) @if ($subGroup->drAmount > 0 || $subGroup->crAmount > 0) @foreach ($subGroup->ledgers as $subLedger) @if ($subLedger->drAmount > 0 || $subLedger->crAmount > 0) @endif @endforeach @endif @else @if ($group->id == $subGroup->id) @foreach ($subGroup->ledgers as $subLedger) @if ($subLedger->drAmount > 0 || $subLedger->crAmount > 0) @endif @endforeach @endif @endif @endforeach @endif @endforeach
Particulars Debit Credit
{{ $group->name }} {{ $group->drAmount == 0 ? '' : number_format($group->drAmount, 2) }} {{ $group->crAmount == 0 ? '' : number_format($group->crAmount, 2) }}
Total {{ number_format($debitTotal, 2) }} {{ number_format($creditTotal, 2) }}
@endsection @section('script') @endsection