@extends('admin.layout.master') @section('title','GORUP LEDGER DETAILS STATEMENT') @section('custom_style') @endsection @section ('content')
@include('admin.layout.title_header', ['title'=>'TRAIL BALANCE STATEMENT'])
@include('accounts.reports.search_form',['ledger'=>1]) {{--
Search
--}}
@if(Request()->ledger_id)
{{--

{{'GROUP LEDGER DETAILS'}}

{{ 'From '.(Request()->start_date?date('d-M-Y',strtotime(Request()->start_date)):date('d-M-Y')).' To '.(Request()->start_date?date('d-M-Y',strtotime(Request()->start_date)):date('d-M-Y'))}}
--}} @php $printData['start_date']=Request()->start_date?date('d-M-Y',strtotime(Request()->start_date)):date('d-M-Y'); $printData['end_date']=Request()->end_date?date('d-M-Y',strtotime(Request()->end_date)):date('d-M-Y'); $routeName=Route::currentRouteName(); $printData=getPrintData($routeName,[]); @endphp {!!$printData['head']!!}
{{-- --}} @php $lk=1; $grand_total_b_dr_amount=0; $grand_total_b_cr_amount=0; $grand_total_dr_amount=0; $grand_total_cr_amount=0; $grand_total_e_dr_amount=0; $grand_total_e_cr_amount=0; @endphp @forelse ($searchedLedger->child as $childledger) @php $total_b_dr_amount=0; $total_b_cr_amount=0; $total_dr_amount=0; $total_cr_amount=0; $total_e_dr_amount=0; $total_e_cr_amount=0; @endphp @php $pattern = "/".$childledger->auto_code."/i"; $searchedLedgers=collect($searchedLedgersChild)->filter(function ($item) use ($pattern) { return preg_match($pattern, $item->auto_code); }); @endphp @forelse ($searchedLedgers as $k=>$ledger) @if(array_key_exists($ledger->id,$ledgerWiseBeginningBalanced) || array_key_exists($ledger->id,$ledgerWiseBalance) || array_key_exists($ledger->id,$ledgerWiseEndingBalance)) @php $b_dr_amount=0; $b_cr_amount=0; $dr_amount=0; $cr_amount=0; $e_dr_amount=0; $e_cr_amount=0; if(array_key_exists($ledger->id,$ledgerWiseBeginningBalanced)){ $name=$ledgerWiseBeginningBalanced[$ledger->id]['name']; if($ledgerWiseBeginningBalanced[$ledger->id]['amount']>0){ $b_dr_amount=$ledgerWiseBeginningBalanced[$ledger->id]['amount']; }else{ $b_cr_amount=abs($ledgerWiseBeginningBalanced[$ledger->id]['amount']); } } if(array_key_exists($ledger->id,$ledgerWiseBalance)){ $name=$ledgerWiseBalance[$ledger->id]['name']; if($ledgerWiseBalance[$ledger->id]['amount']>0){ $dr_amount=$ledgerWiseBalance[$ledger->id]['amount']; }else{ $cr_amount=abs($ledgerWiseBalance[$ledger->id]['amount']); } } if(array_key_exists($ledger->id,$ledgerWiseEndingBalance)){ $name=$ledgerWiseEndingBalance[$ledger->id]['name']; if($ledgerWiseEndingBalance[$ledger->id]['amount']>0){ $e_dr_amount=$ledgerWiseEndingBalance[$ledger->id]['amount']; }else{ $e_cr_amount=abs($ledgerWiseEndingBalance[$ledger->id]['amount']); } } $total_b_dr_amount+=$b_dr_amount; $total_b_cr_amount+=$b_cr_amount; $total_dr_amount+=$dr_amount; $total_cr_amount+=$cr_amount; $total_e_dr_amount+=$e_dr_amount; $total_e_cr_amount+=$e_cr_amount; $grand_total_b_dr_amount+=$b_dr_amount; $grand_total_b_cr_amount+=$b_cr_amount; $grand_total_dr_amount+=$dr_amount; $grand_total_cr_amount+=$cr_amount; $grand_total_e_dr_amount+=$e_dr_amount; $grand_total_e_cr_amount+=$e_cr_amount; @endphp {{-- --}} {{-- --}} @endif @empty @endforelse {{-- @forelse ($searchedLedgers as $k=>$ledger) @if(array_key_exists($ledger->id,$ledgerWiseBeginningBalanced) || array_key_exists($ledger->id,$ledgerWiseBalance) || array_key_exists($ledger->id,$ledgerWiseEndingBalance)) @if($lk==1) @php $lk=0; @endphp @endif @php $b_dr_amount=0; $b_cr_amount=0; $dr_amount=0; $cr_amount=0; $e_dr_amount=0; $e_cr_amount=0; if(array_key_exists($ledger->id,$ledgerWiseBeginningBalanced)){ $name=$ledgerWiseBeginningBalanced[$ledger->id]['name']; if($ledgerWiseBeginningBalanced[$ledger->id]['amount']>0){ $b_dr_amount=$ledgerWiseBeginningBalanced[$ledger->id]['amount']; }else{ $b_cr_amount=abs($ledgerWiseBeginningBalanced[$ledger->id]['amount']); } //$b_cr_amount=($ledgerWiseBeginningBalanced[$ledger->id]['amount']<0)?abs($ledgerWiseBeginningBalanced[$ledger->id]['amount']):0; } if(array_key_exists($ledger->id,$ledgerWiseBalance)){ $name=$ledgerWiseBalance[$ledger->id]['name']; if($ledgerWiseBalance[$ledger->id]['amount']>0){ $dr_amount=$ledgerWiseBalance[$ledger->id]['amount']; }else{ $cr_amount=abs($ledgerWiseBalance[$ledger->id]['amount']); } } if(array_key_exists($ledger->id,$ledgerWiseEndingBalance)){ $name=$ledgerWiseEndingBalance[$ledger->id]['name']; if($ledgerWiseEndingBalance[$ledger->id]['amount']>0){ $e_dr_amount=$ledgerWiseEndingBalance[$ledger->id]['amount']; }else{ $e_cr_amount=abs($ledgerWiseEndingBalance[$ledger->id]['amount']); } } $total_b_dr_amount+=$b_dr_amount; $total_b_cr_amount+=$b_cr_amount; $total_dr_amount+=$dr_amount; $total_cr_amount+=$cr_amount; $total_e_dr_amount+=$e_dr_amount; $total_e_cr_amount+=$e_cr_amount; @endphp @endif @empty @endforelse --}} @empty @endforelse
{{date('d-M-Y h:i:s')}}
{{active_branch_info()->name}}
{{active_branch_info()->address}}
{{active_branch_info()->phone}}
GROUP LEDGER DETAILS
{{ 'From '.date('d-M-Y',strtotime(Request()->start_date)).' To '.date('d-M-Y',strtotime(Request()->end_date))}}

Perticulars Balance Before
{{ date('d-m-y',strtotime(Request()->start_date))}}
Transaction
{{ date('d-m-y',strtotime(Request()->start_date)).' To '.date('d-m-y',strtotime(Request()->end_date))}}
Balance
{{ 'AT '.date('d-m-y',strtotime(Request()->end_date))}}
SL Account No Account Name Debit Credit Debit Credit Debit Credit
@if(count($ledgers->where('id', Request()->ledger_id))>0) {{$ledgers->where('id', Request()->ledger_id)->first()->name}} @else {{'ledger not found'}} @endif
{{$lk++}} {{$childledger->auto_code}} {{$childledger->name}} {{ ($k+1) }} {{$ledger->auto_code}} {{$name}}{{ number_format($b_dr_amount??0,2) }} {{ number_format($b_cr_amount??0,2) }} {{ number_format($dr_amount??0,2) }} {{ number_format($cr_amount??0,2) }} {{ number_format($e_dr_amount??0,2) }} {{ number_format($e_cr_amount??0,2) }}{{ number_format($total_b_dr_amount??0,2) }} {{ number_format($total_b_cr_amount??0,2) }} {{ number_format($total_dr_amount??0,2) }} {{ number_format($total_cr_amount??0,2) }} {{ number_format($total_e_dr_amount??0,2) }} {{ number_format($total_e_cr_amount??0,2) }}
@if(count($ledgers->where('id', $parent_id))>0) {{$ledgers->where('id', $parent_id)->first()->name}} @else {{'ledger not found'}} @endif
{{ ($k+1) }} {{$ledger->auto_code}} {{$name}} {{ number_format($b_dr_amount??0,2) }} {{ number_format($b_cr_amount??0,2) }} {{ number_format($dr_amount??0,2) }} {{ number_format($cr_amount??0,2) }} {{ number_format($e_dr_amount??0,2) }} {{ number_format($e_cr_amount??0,2) }}
Total Transaction {{ number_format($grand_total_b_dr_amount??0,2) }} {{ number_format($grand_total_b_cr_amount??0,2) }} {{ number_format($grand_total_dr_amount??0,2) }} {{ number_format($grand_total_cr_amount??0,2) }} {{ number_format($grand_total_e_dr_amount??0,2) }} {{ number_format($grand_total_e_cr_amount??0,2) }}
{{-- --}}
{{-- --}}
@endif
@endsection @section('script') @stop