@extends('layouts/acc_layout') @section('title', '| FDR Report') @section('content') @php use Carbon\Carbon; $projectSelected = isset($_GET['searchProject']) ? $_GET['searchProject'] : null; $projectTypeSelected = isset($_GET['searchProjectType']) ? $_GET['searchProjectType'] : null; $branchSelected = isset($_GET['searchBranch']) ? $_GET['searchBranch'] : null; $fdrTypeSelected = isset($_GET['searchFdrType']) ? $_GET['searchFdrType'] : null; $bankSelected = isset($_GET['searchBank']) ? $_GET['searchBank'] : null; $bankBranchSelected = isset($_GET['searchBankBranch']) ? $_GET['searchBankBranch'] : null; $dateFromSelected = isset($_GET['dateFrom']) ? $_GET['dateFrom'] : $softwareStartDate; $dateToSelected = isset($_GET['dateTo']) ? $_GET['dateTo'] : $softwareDate; $firstRequest = isset($_GET['firstRequest']) ? '1' : null; $userBranchId = Auth::user()->branchId; @endphp

FDR Register Report

{{--
kxghixd
--}}
{!! Form::open(['url' => 'viewFdrRegisterReport','method' => 'get']) !!} {!! Form::hidden('firstRequest',0) !!}
{!! Form::label('', 'Project:', ['class' => 'control-label pull-left']) !!}
{!! Form::label('', 'Project Type:', ['class' => 'control-label pull-left']) !!}
{!! Form::label('searchBranch', 'Branch:', ['class' => 'control-label pull-left']) !!}
{!! Form::label('searchFdrType', 'FDR Type:', ['class' => 'control-label pull-left']) !!}
@php $fdrTypes = array(''=>'All') + $fdrTypes; @endphp {!! Form::select('searchFdrType',$fdrTypes,$fdrTypeSelected,['id'=>'searchFdrType','class'=>'form-control input-sm']) !!}
{!! Form::label('searchBank', 'Bank Name:', ['class' => 'control-label pull-left']) !!}
@php $banks = array(''=>'All') + $banks; @endphp
{!! Form::select('searchBank',$banks,$bankSelected,['id'=>'searchBank','class'=>'form-control input-sm']) !!}
{!! Form::label('searchBankBranch', 'Location:', ['class' => 'control-label pull-left']) !!}
@php //$bankBranches = array(''=>'All') + $bankBranches; @endphp
{{-- {!! Form::select('searchBankBranch',$bankBranches,$bankBranchSelected,['id'=>'searchBankBranch','class'=>'form-control input-sm']) !!} --}}
{!! Form::label('', ' ', ['class' => 'control-label']) !!}
{!! Form::text('dateFrom',$dateFromSelected,['id'=>'dateFrom','placeholder'=>'From','class'=>'form-control input-sm','readonly','style'=>'cursor:pointer']) !!}
{!! Form::text('dateTo',$dateToSelected,['id'=>'dateTo','placeholder'=>'To','class'=>'form-control input-sm','readonly','style'=>'cursor:pointer']) !!}
{!! Form::submit('Search',['id'=>'search','class'=>'btn btn-primary btn-xs','style'=>'font-size:15px;']) !!}
{!! Form::close() !!}
{{-- End Filtering Group --}} @if($firstRequest!=null) @php if($branchSelected=='0'){ $selectedBranchName = "All Branches"; } else{ $selectedBranchName = DB::table('gnr_branch')->where('id',$branchSelected)->value('name'); } $selectedProjectName = DB::table('gnr_project')->where('id',$projectSelected)->value('name'); @endphp

{{-- --}} @php $gtFDRAmount = 0; $gtOpeningBalance = 0; $gtPrincipal = 0; $gtInterest = 0; $gtTaxAmount = 0; $gtBankCharge = 0; $gtEncashmentAmount = 0; $gtClosingBalance = 0; $rowNumbers = 0; $bankBranchHavingAccount = DB::table('gnr_bank_branch')->whereIn('id',$bankBranchList)->get(); @endphp @foreach($bankBranchHavingAccount as $branch) @php $bankName = DB::table('gnr_bank')->where('id',$branch->bankId_fk)->value('name'); @endphp @php $index = 1; $tFDRAmount = 0; $tOpeingBalance = 0; $tPrincipal = 0; $tInterest = 0; $tTaxAmount = 0; $tBankCharge = 0; $tEncashmentAmount = 0; $tClosingBalance = 0; @endphp @foreach($fdrAccounts as $fdrAccount) @if($fdrAccount->bankBranchId_fk==$branch->id) @php $interest = DB::table('acc_fdr_interest')->where('fdrAccId_fk',$fdrAccount->id)->where('receiveDate','>=',$startDate)->where('receiveDate','<=',$endDate)->sum('interestAmount'); $bankChange = DB::table('acc_fdr_interest')->where('fdrAccId_fk',$fdrAccount->id)->where('receiveDate','>=',$startDate)->where('receiveDate','<=',$endDate)->sum('bankCharge'); $taxAmount = DB::table('acc_fdr_interest')->where('fdrAccId_fk',$fdrAccount->id)->where('receiveDate','>=',$startDate)->where('receiveDate','<=',$endDate)->sum('taxAmount'); $netInterest = DB::table('acc_fdr_interest')->where('fdrAccId_fk',$fdrAccount->id)->where('receiveDate','>=',$startDate)->where('receiveDate','<=',$endDate)->sum('netInterestAmount'); $receiveAbleAmount = $fdrAccount->principalAmount + $netInterest; $closingDate = DB::table('acc_fdr_close')->where('accId_fk',$fdrAccount->id)->where('closingDate','<=',$endDate)->value('closingDate'); if ($closingDate!=null && $closingDate!='') { $interestTillNow = DB::table('acc_fdr_interest')->where('fdrAccId_fk',$fdrAccount->id)->sum('netInterestAmount'); $closingAmount = $fdrAccount->principalAmount + $interestTillNow; } else{ $closingAmount = 0; } //////// $principaAmount = 0; $accOpeningDate = Carbon::parse($fdrAccount->openingDate); if ($accOpeningDate->gte($startDate)) { $principaAmount = $fdrAccount->principalAmount; } $openingNetInterest = DB::table('acc_fdr_interest')->where('fdrAccId_fk',$fdrAccount->id)->where('receiveDate','<',$startDate)->sum('netInterestAmount'); $openingBalance = 0; if ($accOpeningDate->lt($startDate)) { $openingBalance = $fdrAccount->principalAmount; } $openingBalance = $openingBalance + $openingNetInterest; $balance = $openingBalance + $principaAmount + $interest - $bankChange - $taxAmount - $closingAmount; @endphp {{-- --}} {{-- --}} @php $tFDRAmount = $tFDRAmount + $fdrAccount->principalAmount; $tOpeingBalance = $tOpeingBalance + $openingBalance; $tPrincipal = $tPrincipal + $principaAmount; $tInterest = $tInterest + $interest; $tTaxAmount = $tTaxAmount + $taxAmount; $tBankCharge = $tBankCharge + $bankChange; $tEncashmentAmount = $tEncashmentAmount + $closingAmount; $tClosingBalance = $tClosingBalance + $balance; $rowNumbers++; $index++; @endphp @endif @endforeach {{-- Account --}} @php $gtFDRAmount = $gtFDRAmount + $tFDRAmount; $gtOpeningBalance = $gtOpeningBalance + $tOpeingBalance; $gtPrincipal = $gtPrincipal + $tPrincipal; $gtInterest = $gtInterest + $tInterest; $gtTaxAmount = $gtTaxAmount + $tTaxAmount; $gtBankCharge = $gtBankCharge + $tBankCharge; $gtEncashmentAmount = $gtEncashmentAmount + $tEncashmentAmount; $gtClosingBalance = $gtClosingBalance + $tClosingBalance; @endphp @endforeach {{-- Branch --}}
SL# Opening
Date
Account No Account Name Duration
(Months)
Mature Date Interest
Rate (%)
FDR Amount (Tk) Opening Balance Addition Deduction Encashment Closing BalanceInterest Bank Charge Tax Net Interest Receiveable Amount Closing Date Closing Amount Balance
Principal Interest Tax Bank Charge Date Amount (TK)
{{$bankName.', '.$branch->name}}
{{$index}} {{date('d-m-Y',strtotime($fdrAccount->openingDate))}} {{$fdrAccount->accNo}} {{$fdrAccount->accName}} {{str_pad($fdrAccount->duration,2,'0',STR_PAD_LEFT)}}{{-- @if($fdrAccount->duration>1){{' Months'}}@else{{' Month'}} @endif --}} {{date('d-m-Y',strtotime($fdrAccount->matureDate))}} {{number_format($fdrAccount->interestRate,2)}} {{number_format($fdrAccount->principalAmount,2,'.',',')}}{{number_format($interest,2,'.',',')}}{{number_format($openingBalance,2)}}{{number_format($receiveAbleAmount,2,'.',',')}}{{number_format($principaAmount,2,'.',',')}} {{number_format($interest,2,'.',',')}} {{number_format($taxAmount,2,'.',',')}} {{number_format($bankChange,2,'.',',')}} @if($closingDate==null) {{"-"}} @else {{date('d-m-Y',strtotime($closingDate))}} @endif @if($closingDate==null) {{"-"}} @else {{number_format($closingAmount,2,'.',',')}} @endif {{number_format($balance,2,'.',',')}}
Sub Total {{number_format($tFDRAmount,2,'.',',')}} {{number_format($tOpeingBalance,2,'.',',')}} {{number_format($tPrincipal,2,'.',',')}} {{number_format($tInterest,2,'.',',')}} {{number_format($tTaxAmount,2,'.',',')}} {{number_format($tBankCharge,2,'.',',')}} @if($closingDate!=null) {{number_format($tEncashmentAmount,2,'.',',')}} @else {{"-"}} @endif {{number_format($tClosingBalance,2,'.',',')}}
Total {{'('.$rowNumbers.')'}} {{number_format($gtFDRAmount,2,'.',',')}} {{number_format($gtOpeningBalance,2,'.',',')}} {{number_format($gtPrincipal,2,'.',',')}} {{number_format($gtInterest,2,'.',',')}} {{number_format($gtTaxAmount,2,'.',',')}} {{number_format($gtBankCharge,2,'.',',')}} {{number_format($gtEncashmentAmount,2,'.',',')}} {{number_format($gtClosingBalance,2,'.',',')}}
@endif {{-- End First Request --}}
{{-- Filtering --}}