@extends('layouts/microfin_layout') @section('title', '| Auto Process') @section('content')

Samity Name: {{$samity->name.'('.$samity->code.')'}}
Samity Day: {{$samityDayName}}

{!! Form::open(['id'=>'autoProcessForm']) !!} {!! Form::hidden('samityId',$samity->id) !!} {!! Form::hidden('branchId',$samity->branchId) !!} {!! Form::hidden('softwareDate',$softwareDate) !!}
{{--Modify for member old code --}} {{-- ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// --}} @if($moneyRecNoType == 'manual') @else @endif {{-- ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// --}} @if($IS_ALLOW_MEMBER_OLD_CODE) @endif {{--Modify for member old code --}} {{-- ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// --}} @if($moneyRecNoType == 'manual') @endif {{-- ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// --}} {{-- ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// --}} @if($moneyRecNoType == 'manual') @endif {{-- ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// --}} @php $currentMemberId = isset($members[0]->id) ? $members[0]->id : 0; $isMemberChanged = 0; //Product Wise Summary(Start) foreach ($loanProducts as $loanProduct) { ${'installment_'.$loanProduct->id} = 0; ${'due_'.$loanProduct->id} = 0; ${'advance_'.$loanProduct->id} = 0; ${'recovery_'.$loanProduct->id} = 0; ${'outstanding_'.$loanProduct->id} = 0; } foreach ($savingsProducts as $savingsProduct) { ${'savings_'.$savingsProduct->id} = 0; ${'collection_'.$savingsProduct->id} = 0; ${'balance_'.$savingsProduct->id} = 0; } foreach ($primaryProducts as $primaryProduct){ foreach ($savingsProducts as $savingsProduct) { ${'savings_'.$primaryProduct->id.'_'.$savingsProduct->id} = 0; } } //Product Wise Summary(Start) @endphp @foreach ($members as $key => $member) @php $savingsAccounts = $dbSavingAccounts->where('memberIdFk',$member->id)->values(); $loanAccounts = $dbLoanAccounts->where('memberIdFk', $member->id)->values(); $numOfSavingsAcc = count($savingsAccounts); $numOfLoanAcc = count($loanAccounts); $rowSpan = max($numOfLoanAcc,$numOfSavingsAcc); if ($member->id!=$currentMemberId) { $currentMemberId = $member->id; $isMemberChanged = 1; } else{ $isMemberChanged = 0; } $spousename = ""; if ($member->maritalStatus == 1 ||$member->maritalStatus == 3 ||$member->maritalStatus == 4) { $spousename = $member->spouseName; }else { $spousename = $member->fatherName; } @endphp @if($key==0 || $isMemberChanged==1) @if($IS_ALLOW_MEMBER_OLD_CODE) @endif {{-- --}} @endif @if(count($loanAccounts)>0) @php $dueAmount = $dbSchedules->where('loanIdFk',$loanAccounts[0]->id)->where('scheduleDate','<',$softwareDate)->sum('installmentAmount') - $dbLoanCollections->where('loanIdFk',$loanAccounts[0]->id)->where('collectionDate','<',$softwareDate)->sum('amount'); $advnaceAmount = $dueAmount<0 ? -$dueAmount : 0; $dueAmount = $dueAmount<0 ? 0 : $dueAmount; $outstandingAmount = $loanAccounts[0]->totalRepayAmount - $dbLoanCollections->where('loanIdFk',$loanAccounts[0]->id)->sum('amount'); $installmentAmount = ($loanAccounts[0]->installmentAmount > $outstandingAmount) ? $outstandingAmount : $loanAccounts[0]->installmentAmount; //Product Wise Summary(Start) ${'installment_'.$loanAccounts[0]->productIdFk} += $installmentAmount; ${'due_'.$loanAccounts[0]->productIdFk} += $dueAmount; ${'advance_'.$loanAccounts[0]->productIdFk} += $advnaceAmount; ${'outstanding_'.$loanAccounts[0]->productIdFk} += $outstandingAmount; $productIdFk = $loanAccounts[0]->productIdFk; //Product Wise Summary(Start) @endphp {{-- /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// --}} @if($moneyRecNoType == 'manual') @endif {{-- /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// --}} @else {{-- /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// --}} @if($moneyRecNoType == 'manual') @endif {{-- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// --}} @endif @if (isset($savingsAccounts[0])) @php $savingsZeroId = 'savingsZero' . $savingsAccounts[0]->id . 'id'; //Product Wise Summary(Start) $balance = $deposits->where('accountIdFk', $savingsAccounts[0]->id)->sum('amount') - $withdraws->where('accountIdFk', $savingsAccounts[0]->id)->sum('amount'); ${'savings_'.$savingsAccounts[0]->savingsProductIdFk} += $savingsAccounts[0]->autoProcessAmount; ${'balance_'.$savingsAccounts[0]->savingsProductIdFk} += $balance; ${'savings_'.$member->primaryProductId.'_'.$savingsAccounts[0]->savingsProductIdFk} += $savingsAccounts[0]->autoProcessAmount; $productIdFk = $savingsAccounts[0]->savingsProductIdFk; //Product Wise Summary(Start) @endphp {{-- --}} {{-- --}} {{-- --}} {{-- /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// --}} @if($moneyRecNoType == 'manual') @endif {{-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// --}} @else {{-- /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// --}} @if($moneyRecNoType == 'manual') @endif {{-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// --}} @endif @for($i=1;$i<$rowSpan;$i++) {{-- loan accounts --}} @if(isset($loanAccounts[$i])) @php $dueAmount = $dbSchedules->where('loanIdFk',$loanAccounts[$i]->id)->where('scheduleDate','<',$softwareDate)->sum('installmentAmount') - $dbLoanCollections->where('loanIdFk',$loanAccounts[$i]->id)->where('collectionDate','<',$softwareDate)->sum('amount'); $advnaceAmount = $dueAmount<0 ? -$dueAmount : 0; $dueAmount = $dueAmount<0 ? 0 : $dueAmount; $outstandingAmount = $loanAccounts[$i]->totalRepayAmount - $dbLoanCollections->where('loanIdFk',$loanAccounts[$i]->id)->sum('amount'); $installmentAmount = ($loanAccounts[$i]->installmentAmount > $outstandingAmount) ? $outstandingAmount : $loanAccounts[$i]->installmentAmount; //Product Wise Summary(Start) ${'installment_'.$loanAccounts[$i]->productIdFk} += $installmentAmount; ${'due_'.$loanAccounts[$i]->productIdFk} += $dueAmount; ${'advance_'.$loanAccounts[$i]->productIdFk} += $advnaceAmount; ${'outstanding_'.$loanAccounts[$i]->productIdFk} += $outstandingAmount; $productIdFk = $loanAccounts[$i]->productIdFk; //Product Wise Summary(Start) @endphp {{-- /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// --}} @if($moneyRecNoType == 'manual') @endif {{-- /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// --}} @else {{-- /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// --}} @if($moneyRecNoType == 'manual') @endif {{--/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// --}} @endif {{-- end loan accounts --}} {{-- savings accounts --}} @if(isset($savingsAccounts[$i])) @php $savingsZeroId = 'savingsZero' . $savingsAccounts[$i]->id . 'id'; //Product Wise Summary(Start) $balance = $deposits->where('accountIdFk', $savingsAccounts[$i]->id)->sum('amount') - $withdraws->where('accountIdFk', $savingsAccounts[$i]->id)->sum('amount'); ${'savings_'.$savingsAccounts[$i]->savingsProductIdFk} += $savingsAccounts[$i]->autoProcessAmount; ${'balance_'.$savingsAccounts[$i]->savingsProductIdFk} += $balance; ${'savings_'.$member->primaryProductId.'_'.$savingsAccounts[$i]->savingsProductIdFk} += $savingsAccounts[$i]->autoProcessAmount; $productIdFk = $savingsAccounts[$i]->savingsProductIdFk; //Product Wise Summary(Start) @endphp {{-- --}} {{-- --}} {{-- --}} {{-- /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// --}} @if($moneyRecNoType == 'manual') @endif {{-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// --}} @else @endif {{-- end savings accounts --}} @endfor {{-- for multiple accounts --}} @endforeach {{-- member --}} {{-- ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// --}} @if($moneyRecNoType == 'manual') @else @endif {{-- ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// --}} {{-- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// --}} @if($moneyRecNoType == 'manual') @endif {{-- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// --}}
Member InformationLoan Information Saving InformationLoan Information Saving Information
SL# Member IDMEMBER OLD CODEMember Name Father/Spouse Name Is Present? Loan ID Installment Amount Due Advance Full Partial Zero AmountMoney Receipt NumberSavings ID Auto Pro. Amount Full Partial Zero AmountMoney Receipt Number
{!! Form::checkbox('isPresentAll', '0', true,['class'=>'isPresentAll']) !!} {!! Form::checkbox('loanFullAll', '0', true,['class'=>'loanFullAll']) !!} {!! Form::checkbox('loanPartialAll', '0', false,['class'=>'loanPartialAll']) !!} {!! Form::checkbox('loanZeroAll', '0', false,['class'=>'loanZeroAll']) !!} {!! Form::checkbox('savingsFullAll', '0', true,['class'=>'savingsFullAll']) !!} {!! Form::checkbox('savingsPartialAll', '0', false,['class'=>'savingsPartialAll']) !!} {!! Form::checkbox('savingsZeroAll', '0', false,['class'=>'savingsZeroAll']) !!}
{{$key+1}} {{$member->code}}{{$member->oldMemberCode}}{{$member->name}}{{$member->spouseFatherSonName}}{{$spousename}} {!! Form::hidden('presentMemberId[]',$member->id) !!} {!! Form::hidden('isPresentText[]',1,['class'=>'isPresentText']) !!} {!! Form::checkbox('isPresent[]', 1, true,['class'=>'isPresent']) !!}{{$loanAccounts[0]->loanCode}} {{number_format($loanAccounts[0]->installmentAmount,2)}} {{number_format($dueAmount,2)}} {{number_format($advnaceAmount,2)}} {!! Form::checkbox('loanFull', '0', true,['class'=>'loanFull', 'data-member'=> "$member->id"]) !!} {!! Form::checkbox('loanPartial', '0', false,['class'=>'loanPartial' , 'data-member'=> "$member->id"]) !!} {!! Form::checkbox('loanZero', '0', false,['class'=>'loanZero' , 'data-member'=> "$member->id"]) !!} {!! Form::hidden('loanMemberId[]', $member->id) !!} {!! Form::hidden('loanAccId[]', $loanAccounts[0]->id) !!} {!! Form::hidden('loanFullAmount', $installmentAmount,['class'=>'loanFullAmount']) !!} {!! Form::text('loanAmount[]', $installmentAmount,['class'=>"loanAmount loan_$member->id",'readonly', 'data-member'=> "$member->id", 'data-productIdFk'=> "$productIdFk", 'data-primaryProductId'=> "$member->primaryProductId"]) !!} {!! Form::text('loanMoneyRecNo[]', null, ['class' => 'loanMoneyRecNo', 'style' => 'width: 110px; text-align: left;']) !!} {{$savingsAccounts[0]->savingsCode}} {{$savingsAccounts[0]->autoProcessAmount}}{!! Form::checkbox('savingsFull', '0', true,['class'=>'savingsFull']) !!}{!! Form::checkbox('savingsPartial', '0', false,['class'=>'savingsPartial']) !!}{!! Form::checkbox('savingsZero', '0', false,['class'=>'savingsZero']) !!} {!! Form::hidden('savingsMemberId[]', $member->id) !!} {!! Form::hidden('savingsAccId[]', $savingsAccounts[0]->id) !!} {!! Form::hidden('savingsFullAmount', $savingsAccounts[0]->autoProcessAmount,['class'=>'savingsFullAmount']) !!} {!! Form::text('savingsAmount[]', $savingsAccounts[0]->autoProcessAmount,['class'=>"savingsAmount sav_$member->id",'readonly', 'data-member'=> "$member->id", 'data-productIdFk'=> "$productIdFk", 'data-primaryProductId'=> "$member->primaryProductId"]) !!} {!! Form::text('savingsMoneyRecNo[]', null, ['class'=>"savingsMoneyRecNo", 'style' => 'width: 110px; text-align: left;']) !!}
{{$loanAccounts[$i]->loanCode}} {{number_format($loanAccounts[$i]->installmentAmount,2)}} {{number_format($dueAmount,2)}} {{number_format($advnaceAmount,2)}} {!! Form::checkbox('loanFull', '0', true,['class'=>'loanFull', 'data-member'=> "$member->id"]) !!} {!! Form::checkbox('loanPartial', '0', false,['class'=>'loanPartial', 'data-member'=> "$member->id"]) !!} {!! Form::checkbox('loanZero', '0', false,['class'=>'loanZero', 'data-member'=> "$member->id"]) !!} {!! Form::hidden('loanMemberId[]', $member->id) !!} {!! Form::hidden('loanAccId[]', $loanAccounts[$i]->id) !!} {!! Form::hidden('loanFullAmount', $installmentAmount,['class'=>'loanFullAmount']) !!} {!! Form::text('loanAmount[]', $installmentAmount,['class'=>"loanAmount loan_$member->id",'readonly', 'data-member'=> "$member->id", 'data-productIdFk'=> "$productIdFk", 'data-primaryProductId'=> "$member->primaryProductId"]) !!} {!! Form::text('loanMoneyRecNo[]', null, ['class'=>"loanMoneyRecNo", 'style' => 'width: 110px; text-align: left;']) !!} {{$savingsAccounts[$i]->savingsCode}} {{$savingsAccounts[$i]->autoProcessAmount}}{!! Form::checkbox('savingsFull', '0', true,['class'=>'savingsFull']) !!}{!! Form::checkbox('savingsPartial', '0', false,['class'=>'savingsPartial']) !!}{!! Form::checkbox('savingsZero', '0', false,['class'=>'savingsZero']) !!} {!! Form::hidden('savingsMemberId[]', $member->id) !!} {!! Form::hidden('savingsAccId[]', $savingsAccounts[$i]->id) !!} {!! Form::hidden('savingsFullAmount', $savingsAccounts[$i]->autoProcessAmount,['class'=>'savingsFullAmount']) !!} {!! Form::text('savingsAmount[]', $savingsAccounts[$i]->autoProcessAmount,['class'=>"savingsAmount sav_$member->id",'readonly', 'data-member'=> "$member->id", 'data-productIdFk'=> "$productIdFk", 'data-primaryProductId'=> "$member->primaryProductId"]) !!} {!! Form::text('savingsMoneyRecNo[]', null, ['class'=>"savingsMoneyRecNo", 'style' => 'width: 110px; text-align: left;']) !!}
Total {!! Form::hidden('loanTotalAmount',0,['id'=>'loanTotalAmount']) !!} {!! Form::hidden('savingsTotalAmount',0,['id'=>'savingsTotalAmount']) !!}
Collection Type {!! Form::select('paymentType', ['Cash' => 'Cash', 'Bank' => 'Bank'], null, ['class' => 'form-control', 'id' => 'paymentType']) !!}
Select Bank

{!! Form::close() !!} {{-- Product Wise Summary(Start) --}}
@foreach($loanProducts as $key => $loanProduct) @endforeach
Loan Product Total Installment Amount Total Due Total Advance Total Recovery Total Outstanding Amount
{{$loanProduct->name}} {{number_format(${'installment_'.$loanProduct->id}, 2)}} {{number_format(${'due_'.$loanProduct->id}, 2)}} {{number_format(${'advance_'.$loanProduct->id}, 2)}} {{number_format(${'recovery_'.$loanProduct->id}, 2)}} {{number_format(${'outstanding_'.$loanProduct->id}, 2)}}
@foreach ($savingsProducts as $key => $savingsProduct) @endforeach
Saving Product Total Saving Total Collection Total Saving Balance
{{$savingsProduct->name}} {{number_format(${'savings_'.$savingsProduct->id}, 2)}} {{number_format(${'collection_'.$savingsProduct->id}, 2)}} {{number_format(${'balance_'.$savingsProduct->id}, 2)}}
@foreach ($primaryProducts as $primaryProduct) @php $sub_total_savings = 0; @endphp @foreach ($savingsProducts as $k => $savingsProduct) @if(array_keys($savingsProducts->pluck('id')->toArray())[0] == $k) @endif @php $sub_total_savings += ${'savings_'.$primaryProduct->id.'_'.$savingsProduct->id}; @endphp @endforeach @endforeach
Loan Product Saving Product Total Saving Total Collection
{{$primaryProduct->name}}{{$savingsProduct->name}} {{number_format(${'savings_'.$primaryProduct->id.'_'.$savingsProduct->id}, 2)}} {{number_format(0, 2)}}
Sub-Total {{number_format($sub_total_savings, 2)}} {{number_format(0, 2)}}
{{-- Product Wise Summary(End) --}}
{{-- preview modal --}} {{-- end preview modal --}} @endsection