WEB-265: Loan deferred income data rounding issue

This commit is contained in:
Jose Alberto Hernandez
2025-08-05 21:41:56 -05:00
parent a29cda7e3c
commit a2db1ea1c4
3 changed files with 20 additions and 21 deletions
@@ -3,30 +3,30 @@
<table mat-table [dataSource]="capitalizedIncomeData" *ngIf="capitalizedIncomeData.length > 0"> <table mat-table [dataSource]="capitalizedIncomeData" *ngIf="capitalizedIncomeData.length > 0">
<ng-container matColumnDef="amount"> <ng-container matColumnDef="amount">
<th mat-header-cell *matHeaderCellDef>{{ 'labels.inputs.Amount' | translate }}</th> <th mat-header-cell class="center" *matHeaderCellDef>{{ 'labels.inputs.Amount' | translate }}</th>
<td mat-cell *matCellDef="let item"> <td mat-cell class="r-amount" *matCellDef="let item">
{{ item.amount | formatNumber }} {{ item.amount | formatNumber }}
</td> </td>
</ng-container> </ng-container>
<ng-container matColumnDef="amortizedAmount"> <ng-container matColumnDef="amortizedAmount">
<th mat-header-cell *matHeaderCellDef>{{ 'labels.inputs.Amortized Amount' | translate }}</th> <th mat-header-cell class="center" *matHeaderCellDef>{{ 'labels.inputs.Amortized Amount' | translate }}</th>
<td mat-cell *matCellDef="let item"> <td mat-cell class="r-amount" *matCellDef="let item">
{{ item.amortizedAmount | formatNumber: '0.00' }} {{ item.amortizedAmount | formatNumber }}
</td> </td>
</ng-container> </ng-container>
<ng-container matColumnDef="unrecognizedAmount"> <ng-container matColumnDef="unrecognizedAmount">
<th mat-header-cell *matHeaderCellDef>{{ 'labels.inputs.Unrecognized Amount' | translate }}</th> <th mat-header-cell class="center" *matHeaderCellDef>{{ 'labels.inputs.Unrecognized Amount' | translate }}</th>
<td mat-cell *matCellDef="let item"> <td mat-cell class="r-amount" *matCellDef="let item">
{{ item.unrecognizedAmount | formatNumber: '0.00' }} {{ item.unrecognizedAmount | formatNumber }}
</td> </td>
</ng-container> </ng-container>
<ng-container matColumnDef="amountAdjustment"> <ng-container matColumnDef="amountAdjustment">
<th mat-header-cell *matHeaderCellDef>{{ 'labels.inputs.Adjustment Amount' | translate }}</th> <th mat-header-cell class="center" *matHeaderCellDef>{{ 'labels.inputs.Adjustment Amount' | translate }}</th>
<td mat-cell *matCellDef="let item"> <td mat-cell class="r-amount" *matCellDef="let item">
{{ item.amountAdjustment | formatNumber: '0.00' }} {{ item.amountAdjustment | formatNumber: '-' }}
</td> </td>
</ng-container> </ng-container>
@@ -1,4 +1,3 @@
import { NgClass } from '@angular/common';
import { Component } from '@angular/core'; import { Component } from '@angular/core';
import { import {
MatCell, MatCell,
@@ -51,16 +50,16 @@ export class LoanDeferredIncomeTabComponent {
constructor(private route: ActivatedRoute) { constructor(private route: ActivatedRoute) {
this.loanId = this.route.parent.parent.snapshot.params['loanId']; this.loanId = this.route.parent.parent.snapshot.params['loanId'];
let capitalizedIncomeData: LoanCapitalizedIncomeData[] = []; this.capitalizedIncomeData = [];
this.route.parent.data.subscribe((data: { loanDeferredIncomeData: LoanDeferredIncomeData }) => { this.route.parent.data.subscribe((data: { loanDeferredIncomeData: LoanDeferredIncomeData }) => {
capitalizedIncomeData = data.loanDeferredIncomeData.capitalizedIncomeData || []; data.loanDeferredIncomeData.capitalizedIncomeData.forEach((item: LoanCapitalizedIncomeData) => {
capitalizedIncomeData.forEach((item: LoanCapitalizedIncomeData) => { this.capitalizedIncomeData.push({
item.amortizedAmount = item.amortizedAmount | 0; amount: item.amount,
item.unrecognizedAmount = item.unrecognizedAmount | 0; amortizedAmount: item.amortizedAmount ?? 0,
item.amountAdjustment = item.amountAdjustment | 0; unrecognizedAmount: item.unrecognizedAmount ?? 0,
this.capitalizedIncomeData.push(item); amountAdjustment: item.amountAdjustment ?? 0
});
}); });
console.log(this.capitalizedIncomeData);
}); });
} }
} }
+1 -1
View File
@@ -10,7 +10,7 @@ export class FormatNumberPipe implements PipeTransform {
) {} ) {}
transform(value: string | number, defaultValue: any): string { transform(value: string | number, defaultValue: any): string {
if (!value) { if (value === undefined) {
return defaultValue ? defaultValue : ''; return defaultValue ? defaultValue : '';
} }
const decimals = this.settingsService.decimals; const decimals = this.settingsService.decimals;