@extends('layouts.master') @section('css') @endsection @section('title') Day Book Summary @endsection @section('content')

Day Book Summary

@foreach ($ledgers as $ledger) @if($ledger->openingBalance != 0) @endif @endforeach
Opening Balance
{{ $ledger->name }} {{ $ledger->openingBalance }}
{{--
--}} {{--
--}} {{--
--}}
Receipt
@php $debit = clone($inwards); // dd($credit); @endphp @foreach($ledgers as $ledger) @php $exists = $debit ->where('debit_ledger_id', $ledger->id); if ($exists) { $exists = $exists->groupBy('credit_ledger_id'); } @endphp @if($exists->count() > 0)

{{ $ledger->name }}

@php $total=0; @endphp @foreach($exists as $exist) @php $total +=$exist->sum('amount'); @endphp @endforeach
@php $creditLedgerName = \App\Models\Ledger::find($exist[0]->credit_ledger_id)->name; @endphp {{ $creditLedgerName }} {{ $exist->sum('amount') }}
Total {{ $total }}
@endif @endforeach
Payment
@php $credit = clone($outwards); @endphp @foreach($ledgers as $ledger) @php $exists = $credit ->where('credit_ledger_id', $ledger->id); if ($exists) { $exists = $exists->groupBy('debit_ledger_id'); } @endphp @if($exists->count() > 0)

{{ $ledger->name }}

@php $total=0; @endphp @foreach($exists as $exist) @php $total +=$exist->sum('amount'); @endphp @endforeach
@php $debitLedgerName = \App\Models\Ledger::find($exist[0]->debit_ledger_id)->name; @endphp {{ $debitLedgerName }} {{ $exist->sum('amount') }}
Total {{ $total }}
@endif @endforeach
@foreach ($ledgers as $ledger) @if($ledger->closingBalance != 0) @endif @endforeach
Closing Balance
{{ $ledger->name }} {{ $ledger->closingBalance }}
{{-- Print Modal --}} @endsection @section('script') @endsection