{{-- --}} {{-- --}} @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 @forelse ($searchedLedgersChild->groupBy('parent_id') as $parent_id=>$searchedLedgers) @php $lk=1; $group_total_b_dr_amount=0; $group_total_b_cr_amount=0; $group_total_dr_amount=0; $group_total_cr_amount=0; $group_total_e_dr_amount=0; $group_total_e_cr_amount=0; $showGroupTotal=0; @endphp @forelse ($searchedLedgers as $k=>$ledger) @if(array_key_exists($ledger->id,$ledgerWiseBeginningBalanced) || array_key_exists($ledger->id,$ledgerWiseBalance['dr']) || array_key_exists($ledger->id,$ledgerWiseBalance['cr']) || array_key_exists($ledger->id,$ledgerWiseEndingBalance)) @if($lk==1) @php $lk=0;$showGroupTotal=1; @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['dr'])){ $name=$ledgerWiseBalance['dr'][$ledger->id]['name']; if($ledgerWiseBalance['dr'][$ledger->id]['amount']>0){ $dr_amount=$ledgerWiseBalance['dr'][$ledger->id]['amount']; } } if(array_key_exists($ledger->id,$ledgerWiseBalance['cr'])){ $name=$ledgerWiseBalance['cr'][$ledger->id]['name']; if($ledgerWiseBalance['cr'][$ledger->id]['amount']>0){ $cr_amount=($ledgerWiseBalance['cr'][$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; $group_total_b_dr_amount+=$b_dr_amount; $group_total_b_cr_amount+=$b_cr_amount; $group_total_dr_amount+=$dr_amount; $group_total_cr_amount+=$cr_amount; $group_total_e_dr_amount+=$e_dr_amount; $group_total_e_cr_amount+=$e_cr_amount; @endphp {{-- --}} {{-- --}} @endif @empty @endforelse @if($showGroupTotal==1) @endif @empty @endforelse {{-- --}} {{-- --}}
@php function getBalance($amount,$r=0){ if($r){ return ($amount<0)?number_format(abs($amount),2).' (cr)':number_format($amount,2).' (dr)'; }else{ return ($amount<0)?'('.number_format(abs($amount),2).')':number_format($amount,2); } } $r_type=env("JOURNAL_BALANCE_TYPE", 1); $printData['start_date']=Request()->start_date?date('d-M-Y',strtotime(Request()->start_date)):date('d-M-Y'); $printData['end_date']=(Request()->end_date && Request()->end_date!=null)?date('d-M-Y',strtotime(Request()->end_date)):date('d-M-Y'); $routeName=Route::currentRouteName(); $printData=getPrintData($routeName,$printData); @endphp {!!$printData['head']!!}
{{__('obs.particulars')}} {{__('obs.balance')}} {{__('obs.before')}}
{{ Request()->start_date?date('d-M-Y',strtotime(Request()->start_date)):date('d-M-Y') }}
{{__('obs.transaction')}}
{{ (Request()->start_date?date('d-M-Y',strtotime(Request()->start_date)):date('d-M-Y')).' To '.(Request()->end_date?date('d-M-Y',strtotime(Request()->end_date)):date('d-M-Y')) }}
{{__('obs.balance')}}
{{ 'AT '.(Request()->end_date?date('d-M-Y',strtotime(Request()->end_date)):date('d-M-Y'))}}
{{__('obs.sl')}} {{__('obs.account')}} {{__('obs.no')}} {{__('obs.account')}} {{__('obs.name')}}Debit Credit{{__('obs.debit')}} {{__('obs.credit')}}Debit Credit
@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) }}{{ getBalance(($b_dr_amount-$b_cr_amount),$r_type)}} {{ 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) }}{{ getBalance(($e_dr_amount-$e_cr_amount),$r_type)}}
{{__('obs.total')}} {{ getBalance(($group_total_b_dr_amount-$group_total_b_cr_amount),$r_type)}} {{ number_format($group_total_dr_amount??0,2) }} {{ number_format($group_total_cr_amount??0,2) }} {{ getBalance(($group_total_e_dr_amount-$group_total_e_cr_amount),$r_type) }}
{{__('obs.total')}} {{__('obs.transaction')}}{{ number_format($total_b_dr_amount??0,2) }} {{ number_format($total_b_cr_amount??0,2) }}{{ getBalance(($total_b_dr_amount-$total_b_cr_amount),$r_type) }} {{ 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) }}{{ getBalance(($total_e_dr_amount-$total_e_cr_amount),$r_type)}}