@extends('admin.layout.master') @section('title','Ledger Report') @section('custom_style') @endsection @section ('content') @section ('content')
@include('admin.layout.title_header', ['title'=>'LEDGER REPORT'])
{{-- --}}
{{--
--}} {{--
--}}
TO
@if(Request()->ledger_id)
@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']=$ledger?$ledger->name:''; $routeName=Route::currentRouteName(); $printData=getPrintData($routeName,$printData); function ledgerReffName($jrV){ $str=''; if($jrV->voucher->reffParentVoucher){ $str.=' { '.getNameLedgerName($jrV->voucher->reffParentVoucher,$jrV->type,$jrV->reff_jr_id).'}'; }else{ $str.=((($jrV->refLedger && ($jrV->ledger_id!=$jrV->reff_no))? ' [ '.$jrV->refLedger->name.' ]':'')); } return $str; } @endphp {!!$printData['head']!!}
@php $c_amount=0; $d_amount=0; $amount=0; $show_multiple=0; $placed_id=[]; $code=$ledger?$ledger->auto_code:null; @endphp @if($code==null || $code[0]<3) @if($r_type==1) @else @endif @endif @forelse ($vouchers as $jr) @if($jr->amount>0) @php $reff=$jr->voucher->reffInvoice??$jr->voucher->reffFgInvoice; $printUrlArray=['','purchase-print?id=','purchase-print?id=','sell-print?id=','sell-print?id=','adjustment-print?id=','adjustment-print?id=','adjustment-print?id=','issue-print?id=','issue-print?id=','store_transfer-print?model=0&store_invoice_id=', 'store_transfer-print?model=1&store_invoice_id=', 'production-print?id=', 'opening-print?id=','','','adjustment-print?id=', 'purchase-contract-print?id=', 'sales-contract-print?id=']; @endphp @if($r_type==1) @else @endif @endif @empty @endforelse @if($r_type==1) @else @endif @if($r_type==1) @else @endif {{-- --}}
DATE VOUCHER NO PARTICULERS Reff NOTE DR CR BALANCE
{{ date('d-m-Y',strtotime(Request()->start_date)) }} {{'--'}} {{'Beginning Balance'}} @if($b_balance>=0) {{number_format($b_balance,2)}} @php //$d_amount+=$b_balance; $amount+=$b_balance; @endphp @endif @if($b_balance<0) @php $minusTrimedBalance=abs($b_balance); //$c_amount+=$minusTrimedBalance; $amount-=$minusTrimedBalance; @endphp {{-- {{ abs($b_balance) }} --}} {{number_format($minusTrimedBalance,2)}} @endif {{ $amount>=0?number_format($amount,2).'(dr)':(number_format(abs($amount),2)).' (cr)'}}{{ $amount>=0?number_format($amount,2):'('.(number_format(abs($amount),2)).')'}}
{{date('d-m-Y',strtotime($jr->date))}} @if(checkAuthPermission('voucher.voucher_edit')||checkAuthPermission('voucher.journal_vouchers')) @if($jr->voucher->reff_transaction_id==null) {{-- @elseif(($jr->voucher->reffParentVoucher==null)) --}} @endif @endif {{$jr->voucher->voucher_no}} {{-- @if($jr->type==0) --}} @php $creditLedger=$jr->opposite_posting->where('type',$jr->type==0?1:0);//->where('id','>',$jr->id); $drCounter=count($jr->opposite_posting->where('type',$jr->type)); $groupType=$creditLedger->where('group_type',$jr->group_type)->whereNotIn('id',$placed_id); $str=''; $noteStr=''; if(count($groupType)>0){ if($show_multiple || $drCounter==1){ foreach($groupType as $opp){ //$str.=$opp->ledger?$opp->ledger->name:'Ledger Missing'; $jrV=$opp; $str.=$jrV->globalLedger?$jrV->globalLedger->name:'Ledger Missing'; $str.=ledgerReffName($jrV); if(count($groupType)>1){ $str.=' - '.(number_format($opp->amount,2)).'
'; $noteStr.=$opp->note.'
'; } } }else{ $jrV=$groupType->first(); $str.=$jrV->globalLedger?$jrV->globalLedger->name:'Ledger Missing'; $str.=ledgerReffName($jrV); array_push($placed_id,$jrV->id); $noteStr.=$jrV->note; } }elseif(count($creditLedger)>0){ if($show_multiple || $drCounter==1){ foreach($creditLedger as $ocl){ //$str.=$ocl->ledger?$ocl->ledger->name:'Ledger Missing'; $jrV=$ocl; $str.=$jrV->globalLedger?$jrV->globalLedger->name:'Ledger Missing'; $str.=ledgerReffName($jrV); if(count($creditLedger)>1){ $str.=' - '.(number_format($ocl->amount,2)).'
'; $noteStr.=$ocl->note.'
'; } } }else{ $jrV=$creditLedger->first(); $str.=$jrV->globalLedger?$jrV->globalLedger->name:'Ledger Missing'; $str.=ledgerReffName($jrV); array_push($placed_id,$jrV->id); $noteStr.=$jrV->note; } } @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)->whereNotIn('id',$placed_id); $str=''; $noteStr=''; if(count($drGroupType)>0){ if($show_multiple || $crCounter==1){ foreach($drGroupType as $opp){ $str.=$opp->ledger?$opp->ledger->name:'Ledger Missing'; if(count($drGroupType)>1){ $str.=' - '.(number_format($opp->amount,2)).'
'; $noteStr.=$opp->note.'
'; } } }else{ // $str.=$drGroupType->first()->ledger?$drGroupType->first()->ledger->name:'Ledger Missing'; // array_push($placed_id,$drGroupType->first()->id); // $noteStr.=$drGroupType->first()->note; $jrV=$drGroupType->first(); $str.=$jrV->ledger?$jrV->ledger->name:'Ledger Missing'; if($jrV->voucher->reffParentVoucher){ $str.=' [ '.getNameLedgerName($jrV->voucher->reffParentVoucher,$jrV->type,$jrV->reff_jr_id).']'; }else{ $str.=((($jrV->refLedger && ($jrV->ledger_id!=$jrV->reff_no))? ' [ '.$jrV->refLedger->name.' ]':'')); } array_push($placed_id,$jrV->id); $noteStr.=$jrV->note; } }elseif(count($debitLedger)>0){ if($show_multiple || $crCounter==1){ foreach($debitLedger as $ocl){ $str.=$ocl->ledger?$ocl->ledger->name:'Ledger Missing'; if(count($debitLedger)>1){ $str.=' - '.$ocl->amount.'
'; $noteStr.=$ocl->note.'
'; } } }else{ // $str.=$debitLedger->first()->ledger?$debitLedger->first()->ledger->name:'Ledger Missing'; // array_push($placed_id,$debitLedger->first()->id); // $noteStr.=$debitLedger->first()->note; $jrV=$debitLedger->first(); $str.=$jrV->ledger?$jrV->ledger->name:'Ledger Missing'; if($jrV->voucher->reffParentVoucher){ $str.=' [ '.getNameLedgerName($jrV->voucher->reffParentVoucher,$jrV->type,$jrV->reff_jr_id).']'; }else{ $str.=((($jrV->refLedger && ($jrV->ledger_id!=$jrV->reff_no))? ' [ '.$jrV->refLedger->name.' ]':'')); } array_push($placed_id,$jrV->id); $noteStr.=$jrV->note; } } @endphp --}} {{-- @endif --}} {!!$str!!}
@if($reff) @if(!$reff->ref_type) @endif {{$reff->invoice_no}} @endif @if($jr->voucher->bill_date){{$jr->voucher->bill_date?'Bill Date : '.date('d-m-Y',strtotime($jr->voucher->bill_date)).'Bill No : '.$jr->voucher->bill_no:''}}
@endif @if($noteStr) {!!$noteStr!!} @else {{$jr->note??$jr->voucher->note}} @endif
@if($jr->type==0) {{number_format($jr->amount,2)}} @php $d_amount+=$jr->amount; $amount+=$jr->amount; @endphp @endif @if($jr->type==1) {{number_format($jr->amount,2)}} @php $c_amount+=$jr->amount; $amount-=$jr->amount; @endphp @endif {{ $amount>=0?number_format($amount,2).'(dr)':(number_format(abs($amount),2)).' (cr)'}}{{ $amount>=0?number_format($amount,2):'('.(number_format(abs($amount),2)).')'}}
{{'TOTAL'}} {{'OPENING'}} {{ $b_balance==0 ? '': ($b_balance > 0?number_format($b_balance,2).'(dr)':(number_format(abs($b_balance),2)).' (cr)')}}{{ $b_balance>=0?number_format($b_balance,2):'('.(number_format(abs($b_balance),2)).')'}} {{number_format($d_amount,2)}} {{number_format($c_amount,2)}} {{ $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)).')'}}{{ $amount>=0?number_format($amount,2):'('.(number_format(abs($amount),2)).')'}}
{{-- --}}
{!!$printData['foot']!!}
{{-- --}}
@endif
@endsection @section('script') @stop