@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; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// $moneyRecNoSelected = isset($_GET['filMoneyRecNo']) ? $_GET['filMoneyRecNo'] : null; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @endphp
Import Transaction {{-- @php dd($userRoleId); @endphp --}} @if(in_array($userRoleId, Config('services.branch_level_user_roles'))) Add Transaction @endif

REGULAR LOAN TRANSACTION LIST

{!! Form::open(array('url' => 'viewMfnRegularLoanTransaction', 'role' => 'form', 'class'=>'form-horizontal form-groups', 'id' => 'filterFormId', 'method'=>'get')) !!}
@if(!in_array($userRoleId, Config('services.branch_level_user_roles')))
{!! 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/Loan Code:', ['class' => 'control-label pull-left']) !!}
{!! Form::text('filMemberCode', $memberCodeSelected ,['id'=>'filMemberCode','class'=>'form-control input-sm','autocomplete'=>'off']) !!}
{{-- --------//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////--------- --}} @if($moneyRecNoType != null)
{!! Form::label('', 'Money Receipt No:', ['class' => 'control-label pull-left']) !!}
{!! Form::text('filMoneyRecNo', $moneyRecNoSelected,['id'=>'filMoneyRecNo','class'=>'form-control input-sm','autocomplete'=>'off']) !!}
@endif {{-- --------//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////--------- --}}
{!! 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() !!} @if($transactions->count()>0) {{-- --------//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////--------- --}} @if($moneyRecNoType != null) @endif {{-- ------------////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////----- --}} @php $sl = 0; @endphp @foreach($transactions as $key => $transaction) @php $paidAmount = $transactions->where('loanIdFk', $transaction->loanIdFk)->where('collectionDate','<=',$transaction->collectionDate)->sum('amount'); $paidAmount += $openingBalances->where('loanIdFk',$transaction->loanIdFk)->sum('paidLoanAmountOB'); if ($transaction->paymentType == 'Waiver') { $loanWaiverss = DB::table('mfn_loan_waivers')->where('loanIdFk', $transaction->loanIdFk)->where('softDel', 0)->where('date','=',$transaction->collectionDate)->orderBy('date','desc')->get(); foreach($loanWaiverss as $loanWaiver){ if($loanWaiver->date == $transaction->collectionDate){ $paidAmountBydate = DB::table('mfn_loan_collection')->where('loanIdFk', $transaction->loanIdFk)->where('collectionDate','=',$transaction->collectionDate)->where('softDel', 0)->sum('amount'); $paidAmount += DB::table('mfn_loan_waivers')->where('loanIdFk', $transaction->loanIdFk)->where('date','=',$transaction->collectionDate)->where('softDel', 0)->sum('amount'); $paidAmountWaiver = DB::table('mfn_loan_waivers')->where('loanIdFk', $transaction->loanIdFk)->where('date','=',$transaction->collectionDate)->where('softDel', 0)->sum('amount'); $paidAmount = $paidAmount - $paidAmountBydate - $paidAmountWaiver; } } $outstandingAmount = $transaction->totalRepayAmount - $paidAmount; } else if ($transaction->paymentType == 'Write Off') { $loanWriteOffs = DB::table('mfn_loan_write_off')->where('loanIdFk', $transaction->loanIdFk)->where('softDel', 0)->where('date','=',$transaction->collectionDate)->orderBy('date','desc')->get(); foreach($loanWriteOffs as $loanWriteOff){ if($loanWriteOff->date == $transaction->collectionDate){ $paidAmountBydateWriteOff = DB::table('mfn_loan_collection')->where('loanIdFk', $transaction->loanIdFk)->where('collectionDate','=',$transaction->collectionDate)->where('softDel', 0)->sum('amount'); $paidAmount += DB::table('mfn_loan_write_off')->where('loanIdFk', $transaction->loanIdFk)->where('date','=',$transaction->collectionDate)->where('softDel', 0)->sum('amount'); $paidAmountWriteOff = DB::table('mfn_loan_write_off')->where('loanIdFk', $transaction->loanIdFk)->where('date','=',$transaction->collectionDate)->where('softDel', 0)->sum('amount'); $paidAmount = $paidAmount - $paidAmountBydateWriteOff - $paidAmountWriteOff; } } $outstandingAmount = $transaction->totalRepayAmount - $paidAmount; } else if ($transaction->paymentType == 'Rebate') { $loanRebates = DB::table('mfn_loan_rebates')->where('loanIdFk', $transaction->loanIdFk)->where('softDel', 0)->where('date','=',$transaction->collectionDate)->orderBy('date','desc')->get(); foreach($loanRebates as $loanRebate){ if($loanRebate->date == $transaction->collectionDate){ $paidAmountBydateRebate = DB::table('mfn_loan_collection')->where('loanIdFk', $transaction->loanIdFk)->where('collectionDate','=',$transaction->collectionDate)->where('softDel', 0)->sum('amount'); $paidAmount += DB::table('mfn_loan_rebates')->where('loanIdFk', $transaction->loanIdFk)->where('date','=',$transaction->collectionDate)->where('softDel', 0)->sum('amount'); $paidAmountRebate = DB::table('mfn_loan_rebates')->where('loanIdFk', $transaction->loanIdFk)->where('date','=',$transaction->collectionDate)->where('softDel', 0)->sum('amount'); $paidAmount = $paidAmount - $paidAmountBydateRebate - $paidAmountRebate; if(Auth::user()->id == 1){ //dd($paidAmount, $paidAmountBydateRebate, $paidAmountRebate, $transaction->loanIdFk, $transaction->collectionDate); } } } $outstandingAmount = $transaction->totalRepayAmount - $paidAmount; } else if ($transaction->paymentType == 'Adjustment') { $loanAdjustments = DB::table('mfn_loan_collection')->where('loanIdFk', $transaction->loanIdFk)->where('softDel', 0)->where('collectionDate','=',$transaction->collectionDate)->orderBy('collectionDate','desc')->get(); foreach($loanAdjustments as $loanAdjustment){ if($loanAdjustment->collectionDate == $transaction->collectionDate){ $paidAmounBydateAdjustment = DB::table('mfn_loan_collection')->where('loanIdFk', $transaction->loanIdFk)->where('collectionDate','=',$transaction->collectionDate)->where('softDel', 0)->sum('amount'); $paidAmount += DB::table('mfn_loan_collection')->where('loanIdFk', $transaction->loanIdFk)->where('collectionDate','=',$transaction->collectionDate)->where('softDel', 0)->sum('amount'); $paidAmountAdjustment = DB::table('mfn_loan_collection')->where('loanIdFk', $transaction->loanIdFk)->where('collectionDate','=',$transaction->collectionDate)->where('softDel', 0)->sum('amount'); $paidAmount = $paidAmount - $paidAmounBydateAdjustment ; } } $outstandingAmount = $transaction->totalRepayAmount - $paidAmount; } else if ($transaction->paymentType == 'Cash') { $loanAdjustments = DB::table('mfn_loan_collection')->where('loanIdFk', $transaction->loanIdFk)->where('softDel', 0)->where('paymentType','=','Cash')->where('collectionDate','=',$transaction->collectionDate)->orderBy('collectionDate','desc')->get(); foreach($loanAdjustments as $loanAdjustment){ if($loanAdjustment->collectionDate == $transaction->collectionDate){ $paidAmounBydateAdjustment = DB::table('mfn_loan_collection')->where('loanIdFk', $transaction->loanIdFk)->where('collectionDate','=',$transaction->collectionDate)->where('softDel', 0)->sum('amount'); $paidAmount += DB::table('mfn_loan_collection')->where('loanIdFk', $transaction->loanIdFk)->where('paymentType','=','Cash')->where('collectionDate','=',$transaction->collectionDate)->where('softDel', 0)->sum('amount'); $paidAmountAdjustment = DB::table('mfn_loan_collection')->where('loanIdFk', $transaction->loanIdFk)->where('paymentType','=','Cash')->where('collectionDate','=',$transaction->collectionDate)->where('softDel', 0)->sum('amount'); $paidAmount = $paidAmount - $paidAmounBydateAdjustment ; } } $outstandingAmount = $transaction->totalRepayAmount - $paidAmount; } else { $outstandingAmount = $transaction->totalRepayAmount - $paidAmount; } @endphp {{-- --}} {{-- ------------------/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////------------- --}} @if($moneyRecNoType != null) @endif {{-- ---------------------///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////---------- --}} @endforeach
SL# Member Name Member Code Loan Code Date Transaction AmountMoney Receipt NoMode Of
Payment
Entry By Status Action
P I P+I Paid Outstanding
{{($pageNo-1)*50+($key+1)}}{{$sl+1}} {{$transaction->memberName}} {{$transaction->memberCode}} {{$transaction->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->moneyReceiptNo ?? null}}{{$transaction->moneyReceiptAutoSerialNo ?? null}}{{$transaction->paymentType}} {{$transaction->entryBy}} @if ($transaction->isAuthorized==1) @else @endif @if($transaction->paymentType != 'Waiver' && $transaction->paymentType != 'Rebate' && $transaction->paymentType != 'Write Off') {{-- --------------//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////----------------- --}} @if($isMoneyReceiptPrintAllow == 1) @endif {{-- -------------------////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////------------ --}} @php // if this loan follows reducing method then only last transaction can be edited. $sl++; @endphp @if($transaction->paymentType != 'Adjustment') @if($transaction->canDeleteOrEdit==1) @endif @endif @else

Not Applicable

@endif
@endif {{-- @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