@extends('admin.layout.master') @section('title','DEALER BALANCE STATEMENT') @section('custom_style') @endsection @section ('content')
@include('admin.layout.title_header', ['title'=>'TRAIL BALANCE STATEMENT'])
TO
@if(count($groups) && Request()->start_date)
{{--

{{ 'From '.date('d-M-Y',strtotime(Request()->start_date)).' To '.date('d-M-Y',strtotime(Request()->end_date))}}
--}}
@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 && Request()->end_date!=null)?date('d-M-Y',strtotime(Request()->end_date)):date('d-M-Y'); // $printData['ledger_name']=count($ledgers->where('id',Request()->ledger_id))>0?$ledgers->where('id',Request()->ledger_id)->first()->name:'ledger not found'; $routeName=Route::currentRouteName(); $printData=getPrintData($routeName,$printData); $opening=0; $closing=0; $drSum=0; $crSum=0; @endphp {!!$printData['head']!!} @forelse (Request()->group_ids && Request()->group_ids!=0?$groups->where('id',Request()->group_ids):$groups as $group_details) @php $header='
'; $body=''; $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; $showroom_accs = $group_details->parties()->pluck('account_id')->toArray(); $lk=1; @endphp @forelse ($showroom_accs as $searchedLedger) @php $b_dr_amount=0; $b_cr_amount=0; $dr_amount=0; $cr_amount=0; $e_dr_amount=0; $e_cr_amount=0; @endphp {{-- @if((array_key_exists($searchedLedger,$ledgerWiseBalance['dr']) && abs($ledgerWiseBalance['dr'][$searchedLedger]['amount'])>0) || (array_key_exists($searchedLedger,$ledgerWiseBalance['cr']) && abs($ledgerWiseBalance['cr'][$searchedLedger]['amount'])>0)) --}} @if(array_key_exists($searchedLedger,$ledgerWiseBeginningBalanced) || array_key_exists($searchedLedger,$ledgerWiseBalance['dr']) || array_key_exists($searchedLedger,$ledgerWiseBalance['cr']) || array_key_exists($searchedLedger,$ledgerWiseEndingBalance)) @php if(array_key_exists($searchedLedger,$ledgerWiseBeginningBalanced)){ $name=$ledgerWiseBeginningBalanced[$searchedLedger]['name']; if($ledgerWiseBeginningBalanced[$searchedLedger]['amount']>0){ $b_dr_amount=$ledgerWiseBeginningBalanced[$searchedLedger]['amount']; }else{ $b_cr_amount=abs($ledgerWiseBeginningBalanced[$searchedLedger]['amount']); } //$b_cr_amount=($ledgerWiseBeginningBalanced[$searchedLedger]['amount']<0)?abs($ledgerWiseBeginningBalanced[$searchedLedger]['amount']):0; } if(array_key_exists($searchedLedger,$ledgerWiseBalance['dr'])){ $name=$ledgerWiseBalance['dr'][$searchedLedger]['name']; if($ledgerWiseBalance['dr'][$searchedLedger]['amount']>0){ $dr_amount=$ledgerWiseBalance['dr'][$searchedLedger]['amount']; } } if(array_key_exists($searchedLedger,$ledgerWiseBalance['cr'])){ $name=$ledgerWiseBalance['cr'][$searchedLedger]['name']; if($ledgerWiseBalance['cr'][$searchedLedger]['amount']>0){ $cr_amount=($ledgerWiseBalance['cr'][$searchedLedger]['amount']); } } if(array_key_exists($searchedLedger,$ledgerWiseEndingBalance)){ $name=$ledgerWiseEndingBalance[$searchedLedger]['name']; if($ledgerWiseEndingBalance[$searchedLedger]['amount']>0){ $e_dr_amount=$ledgerWiseEndingBalance[$searchedLedger]['amount']; }else{ $e_cr_amount=abs($ledgerWiseEndingBalance[$searchedLedger]['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 @php $party=$partiesDetails->where('account_id',$searchedLedger)->first(); @endphp @if($party && ($e_dr_amount>0||$e_cr_amount>0||$dr_amount>0||$cr_amount>0||$b_dr_amount>0||$b_cr_amount>0)) @php $url=route('reports.ledger_view',['dealer_balance'=>1,'ledger_id'=>$searchedLedger,'cost_center_id'=>request()->cost_center_id,'start_date'=>request()->start_date??'2021-01-01','end_date'=>request()->end_date]); $body.=''; @endphp @endif @empty @endforelse {{-- showroom_accs foreach --}} @if($total_e_dr_amount>0||$total_e_cr_amount>0) {!!$header!!} {!!$body!!}
'.($group_details->name_eng).'
Perticulars Opening
'.( Request()->start_date?date('d-M-Y',strtotime(Request()->start_date)):date('d-M-Y') ).'
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')) ).'
Closing
'.( (Request()->end_date?date('d-M-Y',strtotime(Request()->end_date)):date('d-M-Y'))).'
Limit
Apply
Limit
SL Account No Account Name Commission(%) Debit Credit
'.( ($lk++) ).' '.($searchedLedger).' '.($party->name_eng).' '.($party->commission).' '.( number_format(abs($b_dr_amount-$b_cr_amount)??0,2).(($b_dr_amount-$b_cr_amount)>0?' (dr)':' (cr)') ).' '.( number_format($dr_amount??0,2) ).' '.( number_format($cr_amount??0,2) ).' '.( number_format(abs($e_dr_amount-$e_cr_amount)??0,2).(($e_dr_amount-$e_cr_amount)>0?' (dr)':' (cr)') ).' '.(($party->limit_apply?'Yes':'No')).' '.($party->credit_limit_amount??'').'
Total Transaction {{ number_format(abs($total_b_dr_amount-$total_b_cr_amount)??0,2).(($total_b_dr_amount-$total_b_cr_amount)>0?' (dr)':' (cr)') }} {{ number_format($total_dr_amount??0,2) }} {{ number_format($total_cr_amount??0,2) }} {{ number_format(abs($total_e_dr_amount-$total_e_cr_amount)??0,2).(($total_e_dr_amount-$total_e_cr_amount)>0?' (dr)':' (cr)') }}
@php $opening+=($total_b_dr_amount-$total_b_cr_amount); $closing+=($total_e_dr_amount-$total_e_cr_amount); $drSum+=$total_dr_amount; $crSum+=$total_cr_amount; @endphp @endif @empty @endforelse {{-- group foreach --}} {{-- --}} {{-- --}} @endif @endsection @section('script') @stop
TOTAL SUMMERY
Opening Balance Debit Balance Credit Balance Closing Balance
{{ number_format(abs($opening)??0,2).(($opening)>0?' (dr)':' (cr)') }} {{ number_format(($drSum)??0,2) }} {{ number_format(($crSum)??0,2) }} {{ number_format(abs($closing)??0,2).(($closing)>0?' (dr)':' (cr)') }}