@extends('layouts/microfin_layout') @section('title', '| Savings Interest Calculation') @section('content') {!! Form::open([ 'url' => 'saveManualSavingsInterest', 'role' => 'form', 'id' => 'saveInterestForm', 'method' => 'post', ]) !!}
| SL# | Member Code | Member Name | F/S Name | Savings Code | @if ($route == 'viewManualInterestSavingsDetails') Monthly Balance @elseif ($route == 'viewManualInterestSavingsInterest') Monthly Interest @endif | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| {{ date('Y-m', strtotime($value)) }} | @endforeach||||||||||||||||
| {{ $sl++ }} | {{ $member->code }} | {{ $member->name }} | {{ $member->spouseFatherSonName }} | {{ $memberAccount[0]['savingsCode'] }} | @foreach ($closingBalance->where('memberId', $member->id)->where('savingsAccId', $accId) as $key => $value) {{-- balance info loop --}} @php // apply withdraw condition $memberInterestInfo = $monthAndInterest->where('memberId', $member->id)->first(); $memberMonthlyInterests = $memberInterestInfo ? collect($memberInterestInfo['monthWiseInterest']) : []; // dd($memberMonthlyInterests); if ($value['withdraw'] == 0) { if ($isSaved) { $monthsInterest = $memberMonthlyInterests ? $memberMonthlyInterests->where('month', $value['month'])->first()->interest : 0; } else { $monthsInterest = 0; } $averageBalance = $value['averageBalance']; } else { $monthsInterest = 0; $averageBalance = 0; } @endphp {{-- savings average balance view --}} @if ($route == 'viewManualInterestSavingsDetails') @if ($value['withdraw'] == 0) @if ($isSaved){{ number_format($averageBalance, 2) }} Interest: {{ number_format($monthsInterest, 2) }} | @else{{ number_format($averageBalance, 2) }} {{-- Interest: {{ number_format($monthsInterest, 2) }} --}} | @endif @else- Due to Savings Withdraw | @endif {{-- savings interest view --}} @elseif($route == 'viewManualInterestSavingsInterest') @if ($value['withdraw'] == 0) @if ($isSaved) {{-- Case of Update --}}{{-- {{ number_format($monthsInterest, 2) }} --}} {{ Form::number('interest' . $name++, $monthsInterest, ['class' => 'form-control intertest-qty', 'min' => 0, 'id' => 'interest-input-' . $id++, 'step' => '0.01', 'autocomplete' => 'off']) }} | @else {{----}} | {{ Form::number('interest' . $name++, 0, ['class' => 'form-control intertest-qty', 'min' => 0, 'id' => 'interest-input-' . $id++, 'step' => '0.01', 'autocomplete' => 'off']) }} | @endif @else @if ($isSaved) {{-- Case of Update --}}{{ Form::hidden('interest' . $name++, 0, ['class' => 'form-control intertest-qty', 'min' => 0, 'id' => 'interest-input-' . $id++, 'placeholder' => 0, 'readonly' => '']) }} - Due to Savings Withdraw | @else{{ Form::number('interest' . $name++, 0, ['class' => 'form-control intertest-qty', 'min' => 0, 'id' => 'interest-input-' . $id++, 'placeholder' => 0, 'readonly' => '']) }} {{-- - --}} Due to Savings Withdraw | @endif @endif @endif @php // members total interest $sumMemberInterest += $monthsInterest; @endphp @endforeach {{-- balance info loop close --}} @if ($isSaved) @else @endif||||
| Total | @foreach ($monthsArr as $key => $month) {{-- months loop --}} @php $sumMonthlyBalance = 0; $sumMonthlyInterest = 0; $monthsInterst = []; // interest total for ($i = 0; $i < $monthAndInterest->count(); $i++) { $monthsInterst[] = collect($monthAndInterest[$i]['monthWiseInterest']) ->where('month', $month) ->first()->interest; } // dd($monthsInterst); $sumMonthlyInterest = array_sum($monthsInterst); // dd($sumMonthlyInterest); @endphp @foreach ($closingBalance->where('month', $month) as $key => $value) {{-- balance info loop --}} @php // apply withdraw condition if ($value['withdraw'] == 0) { $averageBalance = $value['averageBalance']; } else { $averageBalance = 0; } // total Monthly balance $sumMonthlyBalance += $averageBalance; // $sumMonthlyInterest += $monthsInterest; @endphp @endforeach {{-- balance info loop close --}} {{-- checking route --}} @if ($route == 'viewManualInterestSavingsDetails'){{ number_format($sumMonthlyBalance, 2) }} | @elseif ($route == 'viewManualInterestSavingsInterest'){{ number_format($sumMonthlyInterest, 2) }} | @endif @endforeach {{-- months loop close --}} {{-- samity total interest --}} @if ($isSaved) @else @endif||||||||||||||