@extends('layouts/acc_layout') @section('title', '| Register Report') @section('content')

OTS Balance Report

{{--
kxghixd
--}}
{!! Form::open(['url' => 'viewOtsRegisterBalanceReport','method' => 'get']) !!} {!! Form::hidden('firstRequest',1) !!}
{!! Form::label('', 'Branch Location:', ['class' => 'control-label pull-left']) !!}
{!! Form::label('searchAccNature', 'Account Nature:', ['class' => 'control-label pull-left']) !!}
@php $accNature = array(''=>'All') + DB::table('acc_ots_period')->pluck('name','id')->toArray(); @endphp {!! Form::select('searchAccNature',$accNature,$accNatureSelected,['id'=>'searchAccNature','class'=>'form-control']) !!}
{!! Form::label('searchAccId', 'Account Id:', ['class' => 'control-label pull-left']) !!}
{!! Form::select('searchAccId',$searchAccId,$accIdSelected,['id'=>'searchAccId','class'=>'form-control']) !!}
{!! 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) @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 $gTinterestPrevious = 0; $gTinterestCurrent = 0; $gTinterestTotal = 0; $gTpaymentPrevious = 0; $gTpaymentCurrent = 0; $gTpaymentTotal = 0; $gTsavings = 0; $gTdueInterest = 0; $gTtotal = 0; @endphp @foreach($accounts as $key => $account) @php $memberName = DB::table('acc_ots_member')->where('id',$account->memberId_fk)->value('name'); $branchName = DB::table('gnr_branch')->where('id',$account->branchId_fk)->value('name'); $paymentNatureName = DB::table('acc_ots_period')->where('id',$account->periodId_fk)->value('name'); $memberName = DB::table('acc_ots_member')->where('id',$account->memberId_fk)->value('name'); $lastPaidInterestRate = DB::table('acc_ots_payment_details')->where('accId_fk',$account->id)->orderBy('id','desc')->value('interestRate'); if ($lastPaidInterestRate==null) { $lastPaidInterestRate = DB::table('acc_ots_period')->where('id',$account->periodId_fk)->value('interestRate'); } $interestPrevious = DB::table('acc_ots_interest_details')->where('accId_fk',$account->id)->where('generateDate','<',$startDate)->sum('amount') + (float) DB::table('acc_ots_account')->where('id',$account->id)->where('openingBalanceDate','<',$startDate)->value('openingBalance'); $interestCurrent = DB::table('acc_ots_interest_details')->where('accId_fk',$account->id)->where('generateDate','>=',$startDate)->where('generateDate','<=',$endDate)->sum('amount') + (float) DB::table('acc_ots_account')->where('id',$account->id)->where('openingBalanceDate','>=',$startDate)->where('openingBalanceDate','<=',$endDate)->value('openingBalance'); $interestTotal = $interestPrevious + $interestCurrent; $paymentPrevious = DB::table('acc_ots_payment_details')->where('accId_fk',$account->id)->where('paymentDate','<',$startDate)->sum('amount'); $paymentCurrent = DB::table('acc_ots_payment_details')->where('accId_fk',$account->id)->where('paymentDate','>=',$startDate)->where('paymentDate','<=',$endDate)->sum('amount'); $paymentTotal = $paymentPrevious + $paymentCurrent; $dueInterest = $interestTotal - $paymentTotal; $total = $account->amount + $dueInterest; @endphp @php $gTinterestPrevious = $gTinterestPrevious + $interestPrevious; $gTinterestCurrent = $gTinterestCurrent + $interestCurrent; $gTinterestTotal = $gTinterestTotal + $interestTotal; $gTpaymentPrevious = $gTpaymentPrevious + $paymentPrevious; $gTpaymentCurrent = $gTpaymentCurrent + $paymentCurrent; $gTpaymentTotal = $gTpaymentTotal + $paymentTotal; $gTsavings = $gTsavings + $account->amount; $gTdueInterest = $gTdueInterest + $dueInterest; $gTtotal = $gTtotal + $total; @endphp @endforeach
SL# Opening Date Account Name Account Number Branch Payment Nature Interest Rate (%) Principal Amount (Tk) Interest Generated Amount (Tk) Interest Payment Amount (Tk) Closing Balance (Pri. + Int.)
Up to Last Period Current Period Total Up to Last Period Current Period Total Principal Interest Total
{{$key+1}} {{date('d-m-Y',strtotime($account->openingDate))}} {{$memberName}} {{$account->accNo}} {{$branchName}} {{$paymentNatureName}} {{number_format($lastPaidInterestRate,2)}} {{number_format($account->amount,2,'.',',')}} {{number_format($interestPrevious,2,'.',',')}} {{number_format($interestCurrent,2,'.',',')}} {{number_format($interestTotal,2,'.',',')}} {{number_format($paymentPrevious,2,'.',',')}} {{number_format($paymentCurrent,2,'.',',')}} {{number_format($paymentTotal,2,'.',',')}} {{number_format($account->amount,2,'.',',')}} {{number_format($dueInterest,2,'.',',')}} {{number_format($total,2,'.',',')}}
Total {{number_format($gTsavings,2,'.',',')}} {{number_format($gTinterestPrevious,2,'.',',')}} {{number_format($gTinterestCurrent,2,'.',',')}} {{number_format($gTinterestTotal,2,'.',',')}} {{number_format($gTpaymentPrevious,2,'.',',')}} {{number_format($gTpaymentCurrent,2,'.',',')}} {{number_format($gTpaymentTotal,2,'.',',')}} {{number_format($gTsavings,2,'.',',')}} {{number_format($gTdueInterest,2,'.',',')}} {{number_format($gTtotal,2,'.',',')}}
@endif
{{-- Filtering --}}