@extends('layouts/microfin_layout') @section('title', '| Auto Savings Interest Calculation') @section('content')

Samity: {{ $samityName }}

@foreach ($monthsArr as $key => $value) @endforeach @php $sl = 1; $totalInterest = 0; $sumMonthlybalance = 0; $sumMonthsInterest = 0; @endphp @foreach ($members as $key => $member) {{-- member loop --}} @php $savAccIds = $closingBalance->where('memberId', $member->id)->unique('savingsAccId')->pluck('savingsAccId')->toArray(); // dd($savAccIds); @endphp @foreach ($savAccIds as $savAccId) @php $sumAccountInterest = 0; @endphp @foreach ($closingBalance->where('memberId', $member->id)->where('savingsAccId', $savAccId) as $key => $value) {{-- balance info loop --}} @php // apply withdraw condition if ($value['withdraw'] == 0) { $monthsInterest = $value['monthsInterest']; $averageBalance = $value['averageBalance']; } else { $monthsInterest = 0; $averageBalance = 0; } @endphp {{-- savings average balance view --}} @if ($route == 'viewAutoInterestSavingsDetails') @if ($value['withdraw'] == 0) @else @endif {{-- savings interest view --}} @elseif($route == 'viewAutoInterestSavingsInterest') @if ($value['withdraw'] == 0) @else @endif @endif @php // members total interest $sumAccountInterest += $monthsInterest; @endphp @endforeach {{-- balance info loop close --}} @php // all members total interest $totalInterest += $sumAccountInterest; @endphp @endforeach @endforeach {{-- member loop close --}} {{-- total informations row --}} @foreach ($monthsArr as $key => $month) {{-- months loop --}} @php $sumMonthlyBalance = 0; $sumMonthlyInterest = 0; @endphp @foreach ($closingBalance->where('month', $month) as $key => $value) {{-- balance info loop --}} @php // apply withdraw condition if ($value['withdraw'] == 0) { $averageBalance = $value['averageBalance']; $monthsInterest = $value['monthsInterest']; } else { $averageBalance = 0; $monthsInterest = 0; } // total Monthly balance and interest $sumMonthlyBalance += $averageBalance; $sumMonthlyInterest += $monthsInterest; @endphp @endforeach {{-- balance info loop close --}} {{-- checking route --}} @if ($route == 'viewAutoInterestSavingsDetails') @elseif ($route == 'viewAutoInterestSavingsInterest') @endif @endforeach {{-- months loop close --}} {{-- samity total interest --}}
SL# Member Code Member Name F/S Name Savings Code @if ($route == 'viewAutoInterestSavingsDetails') Monthly Balance @elseif ($route == 'viewAutoInterestSavingsInterest') Monthly Interest @endif Total
{{ date('Y-m', strtotime($value)) }}
{{ $sl++ }} {{ $member->code }} {{ $member->name }} {{ $member->spouseFatherSonName }} {{ $savingsProduct->shortName }}{{ number_format($averageBalance, 2) }} Interest: {{ number_format($monthsInterest, 2) }} - Due to Savings Withdraw {{ number_format($monthsInterest, 2) }} - Due to Savings Withdraw {{ number_format($sumAccountInterest, 2) }}
Total{{ number_format($sumMonthlyBalance, 2) }}{{ number_format($sumMonthlyInterest, 2) }} {{ number_format($totalInterest, 2) }}
{{-- buttons --}}
@if ($route == 'viewAutoInterestSavingsDetails') Preview Back @elseif ($route == 'viewAutoInterestSavingsInterest') {!! Form::open(array('url' => '', 'role' => 'form', 'id' => 'saveInterestForm', 'method'=>'post')) !!} {{-- {{ Form::hidden('interestData', implode(' ', $dataForTable)) }} --}} {!! Form::submit('Save', ['id' => 'saveInterest', 'class' => 'btn btn-danger saveButton', ]); !!} Back Back to Samity {!! Form::close() !!} @endif
@endsection