@php $balance=0; $closing=0; $cost_centers = App\Models\Admin\CostCenter::where('status', 1)->get(); @endphp @forelse ($cashBanks->sortBy('type') as $cash) @empty @endforelse @php $accountsIds=$cashBanks->pluck('account_id')->toArray(); $total_receipt=0; $total_payment=0; $rBalance=$balance; $receiptHtml=[]; $paymentHtml=[]; @endphp @forelse ($ledgerWiseBalanceSplited as $cost_center_id=>$ledgerWiseBalance) @php $c=count($cost_centers->where('id',$cost_center_id))?$cost_centers->where('id',$cost_center_id)->first():null; $camount=0; $html=''; foreach ($ledgerWiseBalance->where('type',1)->where('amount','>',0) as $m=>$receipt){ if(true){ $l=count($ledgers->where('id',$receipt['ledger_id']))?$ledgers->where('id',$receipt['ledger_id'])->first():null; $html.=' '; $html.=''; $total_receipt+=abs($receipt['amount']); $camount+=abs($receipt['amount']); } } @endphp @if($camount) @php $rBalance+=($camount); @endphp {!!$html!!} @endif @empty @endforelse @forelse ($ledgerWiseBalanceSplited as $cost_center_id=>$ledgerWiseBalance) @php $c=count($cost_centers->where('id',$cost_center_id))?$cost_centers->where('id',$cost_center_id)->first():null; $camount=0; $html=''; foreach ($ledgerWiseBalance->where('type',0)->where('amount','>',0) as $m=>$receipt){ if(true){ $l=count($ledgers->where('id',$receipt['ledger_id']))?$ledgers->where('id',$receipt['ledger_id'])->first():null; $html.=' '; $total_payment+=($receipt['amount']); $html.=''; $camount+=($receipt['amount']); } } @endphp @if($camount) @php $rBalance-=($camount); @endphp {!!$html!!} @endif @empty @endforelse @forelse ($cashBanks->sortBy('type') as $cash) @empty @endforelse
@php $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?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=str_replace('_api','',Route::currentRouteName()); $printData=getPrintData($routeName,$printData); @endphp {!!$printData['head']!!}
{{__('obs.code')}} {{__('obs.name')}} {{__('obs.amount')}} {{__('obs.balance')}}
{{__('obs.opening')}} {{__('obs.balance')}} {{-- @ {{Request()->start_date?date('d-M-Y',strtotime(Request()->start_date)):''}} --}}
{{ $cash->ledger?$cash->ledger->auto_code:'' }} {{ $cash->name_eng }} @if(array_key_exists($cash->account_id,$ledgerWiseBeginningBalanced)) @if($r_type) {{($ledgerWiseBeginningBalanced[$cash->account_id]['amount']<0)?number_format(abs($ledgerWiseBeginningBalanced[$cash->account_id]['amount']),2).' (cr)':number_format($ledgerWiseBeginningBalanced[$cash->account_id]['amount'],2)}} @else {{($ledgerWiseBeginningBalanced[$cash->account_id]['amount']<0)?'('.number_format(abs($ledgerWiseBeginningBalanced[$cash->account_id]['amount']),2).')':number_format($ledgerWiseBeginningBalanced[$cash->account_id]['amount'],2)}} @endif @php $balance+=$ledgerWiseBeginningBalanced[$cash->account_id]['amount']; @endphp @else {{number_format(0,2)}} @endif
{{__('obs.opening')}} {{__('obs.balance')}} @if($r_type) {{($balance<0)?number_format(abs($balance),2).' (cr)':number_format($balance,2)}} @else {{($balance<0)?'('.number_format(abs($balance),2).')':number_format($balance,2)}} @endif
{{__('obs.receipt')}}
{{$c?$c->name:'Central'}} {{number_format($camount,2)}} @if($r_type) {{($rBalance<0)?number_format(abs($rBalance),2).' (cr)':number_format($rBalance,2)}} @else {{($rBalance<0)?'('.number_format(abs($rBalance),2).')':number_format($rBalance,2)}} @endif
{{__('obs.totat')}} {{__('obs.receipt')}} {{number_format($total_receipt,2)}}
{{__('obs.payments')}}
{{$c?$c->name:'Central'}} {{number_format($camount,2)}} @if($r_type) {{($rBalance<0)?number_format(abs($rBalance),2).' (cr)':number_format($rBalance,2)}} @else {{($rBalance<0)?'('.number_format(abs($rBalance),2).')':number_format($rBalance,2)}} @endif
{{__('obs.totat')}} {{__('obs.payments')}} ( {{number_format($total_payment,2)}} )
{{__('obs.closing')}} {{__('obs.balance')}}
{{ $cash->ledger?$cash->ledger->auto_code:'' }} {{ $cash->name_eng }} @if(array_key_exists($cash->account_id,$ledgerWiseEndingBalance)) @if($r_type) {{($ledgerWiseEndingBalance[$cash->account_id]['amount']<0)?number_format(abs($ledgerWiseEndingBalance[$cash->account_id]['amount']),2).' (cr)':number_format($ledgerWiseEndingBalance[$cash->account_id]['amount'],2)}} @else {{($ledgerWiseEndingBalance[$cash->account_id]['amount']<0)?'('.number_format(abs($ledgerWiseEndingBalance[$cash->account_id]['amount']),2).')':number_format($ledgerWiseEndingBalance[$cash->account_id]['amount'],2)}} @endif @php $closing+=$ledgerWiseEndingBalance[$cash->account_id]['amount']; @endphp @else {{number_format(0,2)}} @endif
{{__('obs.closing')}} {{__('obs.balance')}} @if($r_type) {{($closing<0)?number_format(abs($closing),2).' (cr)':number_format($closing,2)}} @else {{($closing<0)?'('.number_format(abs($closing),2).')':number_format($closing,2)}} @endif
{!!$printData['foot']!!}