@extends('layouts/microfin_layout') @section('title', '| Regular Loan Transaction') @section('content') @php use \App\Http\Controllers\microfin\savings\MfnSavingsDepositTypeController as createForm; $pageNo = isset($_GET['page']) ? (int) $_GET['page']: 1; $branchSelected = isset($_GET['filBranch']) ? $_GET['filBranch'] : null; $samitySelected = isset($_GET['filSamity']) ? $_GET['filSamity'] : null; $memberCodeSelected = isset($_GET['filMemberCode']) ? $_GET['filMemberCode'] : null; $loanProductSelected = isset($_GET['filLoanProduct']) ? $_GET['filLoanProduct'] : null; $dateFromSelected = isset($_GET['filDateFrom']) ? $_GET['filDateFrom'] : null; $dateToSelected = isset($_GET['filDateTo']) ? $_GET['filDateTo'] : null; @endphp

REGULAR LOAN TRANSACTION LIST

{!! Form::open(array('url' => 'viewMfnRegularLoanTransaction', 'role' => 'form', 'class'=>'form-horizontal form-groups', 'id' => 'filterFormId', 'method'=>'get')) !!}
@if($userBranchId == 1)
{!! Form::label('', 'Branch:', ['class' => 'control-label pull-left']) !!}
{!! Form::select('filBranch', [''=>'--All--']+$branchList, $branchSelected ,['id'=>'filBranch','class'=>'form-control input-sm','autocomplete'=>'off']) !!}
@endif
{!! Form::label('', 'Samity:', ['class' => 'control-label pull-left']) !!}
{!! Form::select('filSamity', [''=>'--All--']+$samityList, $samitySelected ,['id'=>'filSamity','class'=>'form-control input-sm','autocomplete'=>'off']) !!}
{!! Form::label('', 'Member Code:', ['class' => 'control-label pull-left']) !!}
{!! Form::text('filMemberCode', $memberCodeSelected ,['id'=>'filMemberCode','class'=>'form-control input-sm','autocomplete'=>'off']) !!}
{!! Form::label('', 'Loan Product:', ['class' => 'control-label pull-left']) !!}
{!! Form::select('filLoanProduct', [''=>'--All--']+$loanProductList, $loanProductSelected ,['id'=>'filLoanProduct','class'=>'form-control input-sm','autocomplete'=>'off']) !!}
{!! Form::label('', 'Date From:', ['class' => 'control-label pull-left']) !!}
{!! Form::text('filDateFrom', $dateFromSelected,['id'=>'filDateFrom','class'=>'form-control input-sm', 'autocomplete'=>'off','readonly','style'=>'cursor:pointer']) !!}
{!! Form::label('', 'Date To:', ['class' => 'control-label pull-left']) !!}
{!! Form::text('filDateTo', $dateToSelected,['id'=>'filDateTo','class'=>'form-control input-sm', 'autocomplete'=>'off','readonly','style'=>'cursor:pointer']) !!}
{!! Form::label('', '', ['class' => 'control-label col-md-12']) !!}
{!! Form::submit('Search', ['id' => 'searchButton', 'class' => 'btn btn-primary btn-xs']); !!}
{!! Form::close() !!} @foreach($transactions as $key => $transaction) @php // dd($transactions, $transaction); $member = DB::table('mfn_member_information')->where('id',$transaction->memberIdFk)->select('name','code')->first(); // $loan = DB::table('mfn_loan')->where('id',$transaction->loanIdFk)->select('loanCode','totalRepayAmount')->first(); $loan = $loans->where('id',$transaction->loanIdFk)->first(); $paidAmount = $transactions->where('loanIdFk',$transaction->loanIdFk)->where('collectionDate','<=',$transaction->collectionDate)->sum('amount'); $paidAmount += $openingBalances->where('loanIdFk',$transaction->loanIdFk)->sum('paidLoanAmountOB'); $outstandingAmount = $loan->totalRepayAmount - $paidAmount; $entryBy = DB::table('hr_emp_general_info')->where('id',$transaction->entryByEmployeeIdFk)->select('emp_id','emp_name_english')->first(); $otherCollections = $loanRebates->where('loanIdFk',$transaction->loanIdFk)->where('date','<=',$transaction->collectionDate)->sum('amount'); $otherCollections += $loanWaivers->where('loanIdFk',$transaction->loanIdFk)->where('date','<=',$transaction->collectionDate)->sum('amount'); $otherCollections += $loanWriteOffs->where('loanIdFk',$transaction->loanIdFk)->where('date','<=',$transaction->collectionDate)->sum('amount'); $outstandingAmount = $outstandingAmount - $otherCollections; //dd($transaction); @endphp @endforeach
SL# Member Name Member Code Loan Code Date Transaction Amount Mode Of
Payment
Entry By Status Action
P I P+I Paid Outstanding
{{($pageNo-1)*100+($key+1)}} {{$member->name}} {{$member->code}} {{$loan->loanCode}} {{date('d-m-Y',strtotime($transaction->collectionDate))}} {{number_format($transaction->principalAmount,2)}} {{number_format($transaction->interestAmount,2)}} {{number_format($transaction->amount,2)}} {{number_format($paidAmount,2)}} {{number_format($outstandingAmount,2)}} {{$transaction->paymentType}} {{@$entryBy->emp_name_english}} @if ($transaction->isAuthorized==1) @else @endif @php // if this loan follows reducing method then only last transaction can be edited. //$loan = DB::table('mfn_loan')->where('id',$transaction->loanIdFk)->select('id','interestRateIndex','productIdFk','totalRepayAmount','loanAmount','disbursementDate')->first(); $loan = $loans->where('id',$transaction->loanIdFk)->first(); $interestCalMethodId = DB::table('mfn_loan_product_interest_rate') ->where('loanProductId',$loan->productIdFk) ->value('interestCalculationMethodId'); if ($interestCalMethodId==4) { $maxCollectionId = DB::table('mfn_loan_collection')->where('softDel',0)->where('amount', '>' ,0)->where('loanIdFk',$transaction->loanIdFk)->orderBy('collectionDate','desc')->value('id'); if ($maxCollectionId!=$transaction->id) { $canDeleteOrEdit = 0; } else{ $canDeleteOrEdit = 1; } } else{ $canDeleteOrEdit = 1; } if($softDate!=$transaction->collectionDate || $transaction->isAuthorized==1){ $canDeleteOrEdit = 0; } @endphp
@if (!isset($_GET['filDateFrom']))
{{ $transactions->appends(request()->input())->links() }}
@endif
{{-- View Modal --}} {{-- End View Modal --}} {{-- Edit Modal --}} {{-- End Edit Modal --}} {{-- Delete Modal --}} {{-- End Delete Modal --}} @endsection