@extends('admin.layout.master') @section('title','Cash Ledger Report') @section('custom_style') @endsection @section ('content') @section ('content')
@include('admin.layout.title_header', ['title'=>'LEDGER REPORT'])
{{-- --}}
TO
@php $r_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?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); @endphp {!!$printData['head']!!} {{--

@if(count($ledgers->where('id',Request()->ledger_id))>0) {{$ledgers->where('id',Request()->ledger_id)->first()->name}} @else {{'ledger not found'}} @endif

{{ 'From '.date('d-M-Y',strtotime(Request()->start_date)).' To '.date('d-M-Y',strtotime(Request()->end_date))}}
--}}
@php $amount=0; $recieveVoucher=$vouchers->where('type',0); $pmtVoucher=$vouchers->where('type',1); $types=[0,1]; @endphp @forelse ($types as $type)
@php $c_amount=0; $d_amount=0; $show_multiple=0; //$code=$ledgers->where('id',Request()->ledger_id)->first()->auto_code; @endphp @if($b_balance>=0 && $type==0) @endif @forelse ($type==0?$recieveVoucher:$pmtVoucher as $jr) @empty @endforelse {{-- --}} @if($type==1) {{-- --}} @if($r_type==1) @else @endif @endif
{{$type==0?'Receive':'Payment'}}
DATE VCR NO PARTICULERS NOTE Amount
{{ date('d-m-Y',strtotime(Request()->start_date)) }} - {{'Opening Balance'}} @if($b_balance>=0) {{number_format($b_balance,2)}} @php $d_amount+=$b_balance; $amount+=$b_balance; @endphp @else @php $minusTrimedBalance=abs($b_balance); $c_amount+=$minusTrimedBalance; $amount-=$minusTrimedBalance; @endphp {{number_format($minusTrimedBalance,2)}} @endif
{{date('d-m-Y',strtotime($jr->date))}} @if(checkAuthPermission('voucher.voucher_edit') && $jr->voucher->reff_voucher_id==null) @endif {{$jr->voucher->voucher_no}} @if($jr->type==0) @php $creditLedger=$jr->opposite_posting->where('type',1); $drCounter=count($jr->opposite_posting->where('type',0)); $groupType=$creditLedger->where('group_type',$jr->group_type); $str=''; if(count($groupType)>0){ // if($show_multiple==1){ if($show_multiple && $drCounter==1){ foreach($groupType as $opp){ $str.=$opp->globalLedger?$opp->globalLedger->name:'Ledger Missing'; if(count($groupType)>1){ $str.=' - '.$opp->amount.'
'; } } }else{ $str.=$groupType->first()->globalLedger?$groupType->first()->globalLedger->name:'Ledger Missing'; } }elseif(count($creditLedger)>0){ // if($show_multiple==1){ if($show_multiple && $drCounter==1){ foreach($creditLedger as $ocl){ $str.=$ocl->globalLedger?$ocl->globalLedger->name:'Ledger Missing'; if(count($creditLedger)>1){ $str.=' - '.(number_format($ocl->amount,2)).'
'; } } }else{ $str.=$creditLedger->first()->globalLedger?$creditLedger->first()->globalLedger->name:'Ledger Missing'; } } @endphp @else @php $debitLedger=$jr->opposite_posting->where('type',0); $crCounter=count($jr->opposite_posting->where('type',1)); $drGroupType=$debitLedger->where('group_type',$jr->group_type); $str=''; if(count($drGroupType)>0){ // if($show_multiple==1){ if($show_multiple && $crCounter==1){ foreach($drGroupType as $opp){ $str.=$opp->globalLedger?$opp->globalLedger->name:'Ledger Missing'; if(count($drGroupType)>1){ $str.=' - '.(number_format($opp->amount,2)).'
'; } } }else{ $str.=$drGroupType->first()->globalLedger?$drGroupType->first()->globalLedger->name:'Ledger Missing'; } }elseif(count($debitLedger)>0){ // if($show_multiple==1){ if($show_multiple && $crCounter==1){ foreach($debitLedger as $ocl){ $str.=$ocl->globalLedger?$ocl->globalLedger->name:'Ledger Missing'; if(count($debitLedger)>1){ $str.=' - '.$ocl->amount.'
'; } } }else{ $str.=$debitLedger->first()->globalLedger?$debitLedger->first()->globalLedger->name:'Ledger Missing'; } } @endphp @endif {!!$str!!}
{{$jr->note??$jr->voucher->note}} @if($jr->type==0) {{number_format($jr->amount,2)}} @php $d_amount+=$jr->amount; $amount+=$jr->amount; @endphp @elseif($jr->type==1) {{number_format($jr->amount,2)}} @php $c_amount+=$jr->amount; $amount-=$jr->amount; @endphp @endif
{{'TOTAL '}} {{number_format(($type==0?$d_amount:$c_amount),2)}}
{{'Closing Balance'}}{{ $amount=0 ? '': ($amount > 0?number_format($amount,2).' (dr)':(number_format(abs($amount),2)).' (cr)')}}{{ $amount>=0?number_format($amount,2):'('.(number_format(abs($amount),2)).')'}}
@empty @endforelse
{{-- --}}
{!!$printData['foot']!!}
@endsection @section('script') @stop