Merge pull request #2578 from alberto-art3ch/WEB-265/loan-deferred-income-rounding-issue
WEB-265: Loan deferred income data rounding issue
This commit is contained in:
+11
-11
@@ -3,30 +3,30 @@
|
||||
|
||||
<table mat-table [dataSource]="capitalizedIncomeData" *ngIf="capitalizedIncomeData.length > 0">
|
||||
<ng-container matColumnDef="amount">
|
||||
<th mat-header-cell *matHeaderCellDef>{{ 'labels.inputs.Amount' | translate }}</th>
|
||||
<td mat-cell *matCellDef="let item">
|
||||
<th mat-header-cell class="center" *matHeaderCellDef>{{ 'labels.inputs.Amount' | translate }}</th>
|
||||
<td mat-cell class="r-amount" *matCellDef="let item">
|
||||
{{ item.amount | formatNumber }}
|
||||
</td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="amortizedAmount">
|
||||
<th mat-header-cell *matHeaderCellDef>{{ 'labels.inputs.Amortized Amount' | translate }}</th>
|
||||
<td mat-cell *matCellDef="let item">
|
||||
{{ item.amortizedAmount | formatNumber: '0.00' }}
|
||||
<th mat-header-cell class="center" *matHeaderCellDef>{{ 'labels.inputs.Amortized Amount' | translate }}</th>
|
||||
<td mat-cell class="r-amount" *matCellDef="let item">
|
||||
{{ item.amortizedAmount | formatNumber }}
|
||||
</td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="unrecognizedAmount">
|
||||
<th mat-header-cell *matHeaderCellDef>{{ 'labels.inputs.Unrecognized Amount' | translate }}</th>
|
||||
<td mat-cell *matCellDef="let item">
|
||||
{{ item.unrecognizedAmount | formatNumber: '0.00' }}
|
||||
<th mat-header-cell class="center" *matHeaderCellDef>{{ 'labels.inputs.Unrecognized Amount' | translate }}</th>
|
||||
<td mat-cell class="r-amount" *matCellDef="let item">
|
||||
{{ item.unrecognizedAmount | formatNumber }}
|
||||
</td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="amountAdjustment">
|
||||
<th mat-header-cell *matHeaderCellDef>{{ 'labels.inputs.Adjustment Amount' | translate }}</th>
|
||||
<td mat-cell *matCellDef="let item">
|
||||
{{ item.amountAdjustment | formatNumber: '0.00' }}
|
||||
<th mat-header-cell class="center" *matHeaderCellDef>{{ 'labels.inputs.Adjustment Amount' | translate }}</th>
|
||||
<td mat-cell class="r-amount" *matCellDef="let item">
|
||||
{{ item.amountAdjustment | formatNumber: '-' }}
|
||||
</td>
|
||||
</ng-container>
|
||||
|
||||
|
||||
+8
-9
@@ -1,4 +1,3 @@
|
||||
import { NgClass } from '@angular/common';
|
||||
import { Component } from '@angular/core';
|
||||
import {
|
||||
MatCell,
|
||||
@@ -51,16 +50,16 @@ export class LoanDeferredIncomeTabComponent {
|
||||
constructor(private route: ActivatedRoute) {
|
||||
this.loanId = this.route.parent.parent.snapshot.params['loanId'];
|
||||
|
||||
let capitalizedIncomeData: LoanCapitalizedIncomeData[] = [];
|
||||
this.capitalizedIncomeData = [];
|
||||
this.route.parent.data.subscribe((data: { loanDeferredIncomeData: LoanDeferredIncomeData }) => {
|
||||
capitalizedIncomeData = data.loanDeferredIncomeData.capitalizedIncomeData || [];
|
||||
capitalizedIncomeData.forEach((item: LoanCapitalizedIncomeData) => {
|
||||
item.amortizedAmount = item.amortizedAmount | 0;
|
||||
item.unrecognizedAmount = item.unrecognizedAmount | 0;
|
||||
item.amountAdjustment = item.amountAdjustment | 0;
|
||||
this.capitalizedIncomeData.push(item);
|
||||
data.loanDeferredIncomeData.capitalizedIncomeData.forEach((item: LoanCapitalizedIncomeData) => {
|
||||
this.capitalizedIncomeData.push({
|
||||
amount: item.amount,
|
||||
amortizedAmount: item.amortizedAmount ?? 0,
|
||||
unrecognizedAmount: item.unrecognizedAmount ?? 0,
|
||||
amountAdjustment: item.amountAdjustment ?? 0
|
||||
});
|
||||
});
|
||||
console.log(this.capitalizedIncomeData);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ export class FormatNumberPipe implements PipeTransform {
|
||||
) {}
|
||||
|
||||
transform(value: string | number, defaultValue: any): string {
|
||||
if (!value) {
|
||||
if (value === undefined) {
|
||||
return defaultValue ? defaultValue : '';
|
||||
}
|
||||
const decimals = this.settingsService.decimals;
|
||||
|
||||
Reference in New Issue
Block a user