@php $balance=0; $closing=0; @endphp @forelse ($cashBanks->where('type',1) as $cash) @empty @endforelse @forelse ($cashBanks->where('type',2) as $cash) @empty @endforelse {{-- --}} @php $accountsIds=$cashBanks->pluck('account_id')->toArray(); $total_receipt=0; $total_payment=0; @endphp @forelse ($ledgerWiseBalance->where('type',1)->where('amount','>',0) as $m=>$receipt) @php $total_receipt+=abs($receipt['amount']); @endphp @empty @endforelse @php $payments = $ledgerWiseBalance->where('type', 0)->where('amount', '>', 0)->map(function ($q) { return (object) [ 'ledger_id'=> $q->ledger_id, 'amount'=> $q->amount, 'ledger_name'=> $q->globalLedger->name ]; })->toArray(); $payments = collect(array_merge($payments, $ledgerWisePayments))->groupBy('ledger_id'); @endphp @forelse ($payments as $m=> $receipt) @php $amount = $receipt->sum('amount'); @endphp @php $total_payment += $amount; @endphp @empty @endforelse @forelse ($cashBanks->where('type',1) as $cash) @empty @endforelse @forelse ($cashBanks->where('type',2) 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'); $routeName=str_replace('_api','',Route::currentRouteName()); $printData=getPrintData($routeName,$printData); @endphp {!!$printData['head']!!}
{{__('obs.amount')}}
{{__('obs.opening_balance')}}: @ {{Request()->start_date?date('d-M-Y',strtotime(Request()->start_date)):''}}
{{__('obs.cash_and_cash_equivalents')}}
  {{__('obs.cash_list')}}:
  {{ $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).' '.__('obs.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.bank_list')}}
   {{$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).' '.__('obs.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_total')}} @if($r_type) {{($balance<0)?number_format(abs($balance),2).' '.__('obs.cr'):number_format($balance,2)}} @else {{($balance<0)?'('.number_format(abs($balance),2).')':number_format($balance,2)}} @endif
   Receipts:{{__('obs.receipt')}}
    {{count($ledgers->where('id',$receipt['ledger_id']))?$ledgers->where('id',$receipt['ledger_id'])->first()->name:'N/A'}} {{number_format(abs($receipt['amount']),2)}}
{{__('obs.total_receipt')}}: {{number_format($total_receipt,2)}}
{{__('obs.payment')}}:
    {{count($ledgers->where('id', $receipt->first()->ledger_id)) ? $ledgers->where('id', $receipt->first()->ledger_id)->first()->name : 'N/A'}} {{number_format($amount, 2)}}
{{__('obs.total_payment')}}: ( {{number_format($total_payment,2)}} )
{{__('obs.closing_balance')}}: @ {{Request()->end_date?date('d-M-Y',strtotime(Request()->end_date)):''}}
{{__('obs.cash_and_cash_equivalents')}}
  {{__('obs.cash_list')}}:
  {{$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).' '.__('obs.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.bank_list')}}:
  {{$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).' '.__('obs.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_total')}} @if($r_type) {{($closing<0)?number_format(abs($closing),2).' '.__('obs.cr'):number_format($closing,2)}} @else {{($closing<0)?'('.number_format(abs($closing),2).')':number_format($closing,2)}} @endif