@extends('layouts.master') @section('title', 'Trial Balance') @section('page-header') Trial Balance @stop @push('style') @endpush @section('content')
@include('partials._alert_message') @php $from = request('from', date('Y-m-d')); $to = request('to', date('Y-m-d')); @endphp

@yield('page-header')

{{--

TRIAL BALANCE

--}} {{--
As On {{ fdate(request('from') ?? today(), 'd/m/Y') }}
--}}
{{-- @include('includes.input-groups.date-field', ['date' => $from, 'is_read_only' => true])--}} {{-- OLD CODE --}} {{-- @include('includes.input-groups.date-range', ['date' => $from, 'is_read_only' => true])--}} {{-- New CODE --}} @php $date1 = isset($from) ? $from : ''; $date2 = isset($to) ? $to : ''; $isReadOnly = isset($is_read_only) ? $is_read_only : false; @endphp
Date

TRIAL BALANCE

@if(request('to') && request('from'))

From : {{ fdate(request('from'), 'd/m/Y') }}

To : {{ fdate(request('to'), 'd/m/Y') }}

@elseif(fdate(request('to') ?? today(), 'd/m/Y'))

As On {{ fdate(request('to') ?? today(), 'd/m/Y') }}

@endif
{{-- OLD CODE PLEASE DON'T DELETE --}} {{-- --}} {{-- --}} {{-- --}} {{-- --}} {{-- --}} {{-- --}} {{-- --}} {{-- --}} {{-- --}} {{-- @if ($accountGroups->count() == 0)--}} {{-- --}} {{-- --}} {{-- --}} {{-- @endif--}} {{-- @php--}} {{-- $totalDebit = 0;--}} {{-- $totalCredit = 0;--}} {{-- $totalTrialAmountDebit = 0;--}} {{-- $totalTrialAmountCredit = 0;--}} {{-- @endphp--}} {{-- @foreach ($accountGroups as $accountGroup)--}} {{-- @php--}} {{-- $debitAccountGroup = $accountGroup->accountControls->sum(function ($control) {--}} {{-- return $control->accountSubsidiaries->sum(function ($item) {--}} {{-- return $item->accounts->sum('debit');--}} {{-- });--}} {{-- });--}} {{-- $creditAccountGroup = $accountGroup->accountControls->sum(function ($control) {--}} {{-- return $control->accountSubsidiaries->sum(function ($item) {--}} {{-- return $item->accounts->sum('credit');--}} {{-- });--}} {{-- });--}} {{-- if ($accountGroup->balance_type == 'Debit') {--}} {{-- $totalTrialAmountDebit += ($debitAccountGroup - $creditAccountGroup);--}} {{-- } else {--}} {{-- $totalTrialAmountCredit += ($creditAccountGroup - $debitAccountGroup);--}} {{-- }--}} {{-- @endphp--}} {{-- @if(number_format($debitAccountGroup - $creditAccountGroup, 2) > 0 || number_format($creditAccountGroup - $debitAccountGroup, 2) > 0)--}} {{-- --}} {{-- --}} {{-- @if ($accountGroup->balance_type == 'Debit')--}} {{-- --}} {{-- --}} {{-- @else--}} {{-- --}} {{-- --}} {{-- @endif--}} {{-- @php--}} {{-- $totalDebit += $creditAccountGroup;--}} {{-- $totalCredit += $creditAccountGroup;--}} {{-- @endphp--}} {{-- --}} {{-- @endif--}} {{-- @foreach ($accountGroup->accountControls as $accountControl)--}} {{-- @php--}} {{-- $debitAccountControl = $accountControl->accountSubsidiaries->sum(function ($item) {--}} {{-- return $item->accounts->sum('debit');--}} {{-- });--}} {{-- $creditAccountControl = $accountControl->accountSubsidiaries->sum(function ($item) {--}} {{-- return $item->accounts->sum('credit');--}} {{-- });--}} {{-- @endphp--}} {{-- @if(number_format($debitAccountControl - $creditAccountControl, 2) > 0 || number_format($creditAccountControl - $debitAccountControl, 2) > 0 )--}} {{-- --}} {{-- --}} {{-- --}} {{-- @if ($accountGroup->balance_type == 'Debit')--}} {{-- --}} {{-- --}} {{-- @else--}} {{-- --}} {{-- --}} {{-- @endif--}} {{-- --}} {{-- @endif--}} {{-- @foreach ($accountControl->accountSubsidiaries as $accountSubsidiary)--}} {{-- @if(number_format($accountSubsidiary->accounts->sum('debit') - $accountSubsidiary->accounts->sum('credit'), 2) > 0 || number_format($accountSubsidiary->accounts->sum('credit') - $accountSubsidiary->accounts->sum('debit'), 2) > 0)--}} {{-- --}} {{-- --}} {{-- --}} {{-- --}} {{-- @if ($accountGroup->balance_type == 'Debit')--}} {{-- --}} {{-- --}} {{-- @else--}} {{-- --}} {{-- --}} {{-- @endif--}} {{-- --}} {{-- @endif--}} {{-- @foreach ($accountSubsidiary->accounts as $account)--}} {{-- @if(number_format($account->debit - $account->credit ?? 0, 2) > 0 || number_format($account->credit - $account->debit ?? 0, 2) > 0 )--}} {{-- --}} {{-- --}} {{-- --}} {{-- --}} {{-- --}} {{-- @if ($accountGroup->balance_type == 'Debit')--}} {{-- --}} {{-- --}} {{-- --}} {{-- @else--}} {{-- --}} {{-- --}} {{-- --}} {{-- @endif--}} {{-- --}} {{-- --}} {{-- @endif--}} {{-- @endforeach--}} {{-- @endforeach--}} {{-- @endforeach--}} {{-- @endforeach--}} {{-- --}} {{-- --}} {{-- --}} {{-- --}} {{-- --}} {{-- --}} {{-- --}} {{-- --}} {{--
Account DescriptionDr.Cr.
NO RECORDS--}} {{-- FOUND!
--}} {{-- {{ $accountGroup->name }}--}} {{-- --}} {{-- {{ number_format($debitAccountGroup - $creditAccountGroup, 2) }}--}} {{-- --}} {{-- 0.00--}} {{-- --}} {{-- --}} {{-- 0.00--}} {{-- --}} {{-- --}} {{-- {{ number_format($creditAccountGroup - $debitAccountGroup, 2) }}--}} {{--
--}} {{-- {{ $accountControl->name }}--}} {{-- --}} {{-- --}} {{-- --}} {{-- 0.00--}} {{-- --}} {{-- --}} {{-- 0.00--}} {{-- --}} {{-- --}} {{-- --}} {{--
--}} {{-- --}} {{-- {{ $accountSubsidiary->name }}--}} {{-- --}} {{-- --}} {{-- --}} {{-- 0.00--}} {{-- --}} {{-- --}} {{-- 0.00--}} {{-- --}} {{-- --}} {{--
{{ $account->name }}0.000.00{{ $account->credit . '-' . $account->debit }}
Trail--}} {{-- {{ number_format($totalTrialAmountDebit, 0) }}--}} {{-- --}} {{-- {{ number_format($totalTrialAmountCredit, 0) }}--}} {{--
--}} {{-- --------------------------------------------------------------------------------------------- --}} @if ($accountGroups->count() == 0) @endif @php $totalTrialAmountDebit = 0; $totalTrialAmountCredit = 0; @endphp @foreach ($accountGroups as $accountGroup) @php $debitAccountGroup = $accountGroup->accountControls->sum(function ($control) { return $control->accountSubsidiaries->sum(function ($item) { return $item->accounts->sum('debit'); }); }); $creditAccountGroup = $accountGroup->accountControls->sum(function ($control) { return $control->accountSubsidiaries->sum(function ($item) { return $item->accounts->sum('credit'); }); }); if ($accountGroup->balance_type == 'Debit') { $totalTrialAmountDebit += ($debitAccountGroup - $creditAccountGroup); } else { $totalTrialAmountCredit += ($creditAccountGroup - $debitAccountGroup); } @endphp @if(number_format($debitAccountGroup - $creditAccountGroup, 2) > 0 || number_format($creditAccountGroup - $debitAccountGroup, 2) > 0) @if ($accountGroup->balance_type == 'Debit') @else @endif @foreach ($accountGroup->accountControls as $accountControl) @php $debitAccountControl = $accountControl->accountSubsidiaries->sum(function ($subsidiary) { return $subsidiary->accounts->sum('debit'); }); $creditAccountControl = $accountControl->accountSubsidiaries->sum(function ($subsidiary) { return $subsidiary->accounts->sum('credit'); }); @endphp @if(number_format($debitAccountControl - $creditAccountControl, 2) > 0 || number_format($creditAccountControl - $debitAccountControl, 2) > 0 ) @if ($accountGroup->balance_type == 'Debit') @else @endif @endif @endforeach @endif @endforeach
Account Description Dr. Cr.
NO RECORDS FOUND!
{{ $accountGroup->name }} {{ number_format($debitAccountGroup - $creditAccountGroup, 2) }} {{ number_format($creditAccountGroup - $debitAccountGroup , 2) }}
{{ number_format($debitAccountControl - $creditAccountControl, 2) }} {{ number_format($creditAccountControl - $debitAccountControl, 2) }}
@foreach($accountControl->accountSubsidiaries as $subsidiary) @php $debitSubsidiary = $subsidiary->accounts->sum('debit'); $creditSubsidiary = $subsidiary->accounts->sum('credit'); @endphp @if(number_format($subsidiary->accounts->sum('debit') - $subsidiary->accounts->sum('credit'), 2) > 0 || number_format($subsidiary->accounts->sum('credit') - $subsidiary->accounts->sum('debit'), 2) > 0) @if ($accountGroup->balance_type == 'Debit') @else @endif @endif @endforeach
{{ number_format($debitSubsidiary - $creditSubsidiary, 2) }}{{ number_format($creditSubsidiary - $debitSubsidiary , 2) }}
@foreach($subsidiary->accounts as $account) @if(number_format($account->debit - $account->credit ?? 0, 2) > 0 || number_format($account->credit - $account->debit ?? 0, 2) > 0 ) @if ($accountGroup->balance_type == 'Debit') @else @endif @endif @endforeach
{{ $account->name }}{{ number_format($account->debit - $account->credit, 2) }}{{ number_format($account->credit - $account->debit, 2) }}
Trial Balance {{ number_format($totalTrialAmountDebit, 0) }} {{ number_format($totalTrialAmountCredit, 0) }}

{{auth()->user()->name}}


@endsection @section('js') @endsection