Skip to content

Commit 9e47ba2

Browse files
author
Jose Alberto Hernandez
committed
WEB-316: Advance Accounting rule can be set for each classification type
1 parent e845a45 commit 9e47ba2

24 files changed

+639
-14
lines changed

src/app/products/loan-products/common/loan-product-summary/loan-product-summary.component.html

Lines changed: 68 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -722,7 +722,7 @@ <h3 class="mat-h3 flex-fill">{{ 'labels.heading.Loan Tranche Details' | translat
722722
<span class="flex-60">{{ loanProduct.multiDisburseLoan | yesNo }}</span>
723723
</div>
724724

725-
<div class="flex-fill layout-row-wrap responsive-column" *ngIf="loanProduct.multiDisburseLoan">
725+
<div class="flex-100 layout-row-wrap responsive-column" *ngIf="loanProduct.multiDisburseLoan">
726726
<span class="flex-40">{{ 'labels.inputs.Maximum Tranche count' | translate }}:</span>
727727
<span class="flex-60">{{ loanProduct.maxTrancheCount }}</span>
728728
<div class="flex-fill layout-row" *ngIf="loanProduct.outstandingLoanBalance">
@@ -737,7 +737,7 @@ <h3 class="mat-h3 flex-fill">{{ 'labels.heading.Loan Tranche Details' | translat
737737

738738
<h3 class="mat-h3 flex-fill">{{ 'labels.heading.Event Settings' | translate }}</h3>
739739

740-
<div class="flex-fill">
740+
<div class="flex-100">
741741
<span class="flex-40"
742742
>{{
743743
'labels.inputs.Use the Global Configurations values to the Repayment Event (notifications)' | translate
@@ -1252,6 +1252,72 @@ <h4 class="mat-h4 flex-100">
12521252
<tr mat-row *matRowDef="let row; columns: chargeOffReasonExpenseDisplayedColumns"></tr>
12531253
</table>
12541254
</div>
1255+
1256+
<div
1257+
*ngIf="buydownFeeClassificationToIncomeAccountMappings?.length > 0"
1258+
class="flex-100 layout-row-wrap responsive-column"
1259+
>
1260+
<h4 class="mat-h4 flex-100">
1261+
{{ 'labels.heading.Buydown Fee classifications to Income accounts' | translate }}
1262+
</h4>
1263+
1264+
<table
1265+
class="mat-elevation-z1 flex-100"
1266+
mat-table
1267+
[dataSource]="buydownFeeClassificationToIncomeAccountMappings"
1268+
>
1269+
<ng-container matColumnDef="chargeOffReasonCodeValueId">
1270+
<th mat-header-cell *matHeaderCellDef>{{ 'labels.inputs.Classification' | translate }}</th>
1271+
<td mat-cell *matCellDef="let classificationToIncomeAccountMapping">
1272+
{{ classificationToIncomeAccountMapping.classificationCodeValue.name }}
1273+
</td>
1274+
</ng-container>
1275+
1276+
<ng-container matColumnDef="expenseAccountId">
1277+
<th mat-header-cell *matHeaderCellDef>{{ 'labels.inputs.Income Account' | translate }}</th>
1278+
<td mat-cell *matCellDef="let classificationToIncomeAccountMapping">
1279+
({{ classificationToIncomeAccountMapping.incomeAccount.glCode }})
1280+
{{ classificationToIncomeAccountMapping.incomeAccount.name }}
1281+
</td>
1282+
</ng-container>
1283+
1284+
<tr mat-header-row *matHeaderRowDef="chargeOffReasonExpenseDisplayedColumns"></tr>
1285+
<tr mat-row *matRowDef="let row; columns: chargeOffReasonExpenseDisplayedColumns"></tr>
1286+
</table>
1287+
</div>
1288+
1289+
<div
1290+
*ngIf="capitalizedIncomeClassificationToIncomeAccountMappings?.length > 0"
1291+
class="flex-100 layout-row-wrap responsive-column"
1292+
>
1293+
<h4 class="mat-h4 flex-100">
1294+
{{ 'labels.heading.Capitalized Income classifications to Income accounts' | translate }}
1295+
</h4>
1296+
1297+
<table
1298+
class="mat-elevation-z1 flex-100"
1299+
mat-table
1300+
[dataSource]="capitalizedIncomeClassificationToIncomeAccountMappings"
1301+
>
1302+
<ng-container matColumnDef="chargeOffReasonCodeValueId">
1303+
<th mat-header-cell *matHeaderCellDef>{{ 'labels.inputs.Classification' | translate }}</th>
1304+
<td mat-cell *matCellDef="let capitalizedIncomeClassificationToIncomeAccountMapping">
1305+
{{ capitalizedIncomeClassificationToIncomeAccountMapping.classificationCodeValue.name }}
1306+
</td>
1307+
</ng-container>
1308+
1309+
<ng-container matColumnDef="expenseAccountId">
1310+
<th mat-header-cell *matHeaderCellDef>{{ 'labels.inputs.Income Account' | translate }}</th>
1311+
<td mat-cell *matCellDef="let capitalizedIncomeClassificationToIncomeAccountMapping">
1312+
({{ capitalizedIncomeClassificationToIncomeAccountMapping.incomeAccount.glCode }})
1313+
{{ capitalizedIncomeClassificationToIncomeAccountMapping.incomeAccount.name }}
1314+
</td>
1315+
</ng-container>
1316+
1317+
<tr mat-header-row *matHeaderRowDef="chargeOffReasonExpenseDisplayedColumns"></tr>
1318+
<tr mat-row *matRowDef="let row; columns: chargeOffReasonExpenseDisplayedColumns"></tr>
1319+
</table>
1320+
</div>
12551321
</div>
12561322
</div>
12571323
</div>

src/app/products/loan-products/common/loan-product-summary/loan-product-summary.component.ts

Lines changed: 48 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
import { Component, Input, OnChanges, OnInit, SimpleChanges } from '@angular/core';
2-
import { DelinquencyBucket, LoanProduct } from '../../models/loan-product.model';
2+
import { AccountingMappingDTO, DelinquencyBucket, LoanProduct } from '../../models/loan-product.model';
33
import {
44
AccountingMapping,
55
Charge,
6-
ChargeOffReasonCodeValue,
6+
CodeValue,
77
ChargeOffReasonToExpenseAccountMapping,
88
ChargeToIncomeAccountMapping,
9+
ClassificationToIncomeAccountMapping,
910
GLAccount,
1011
PaymentChannelToFundSourceMapping,
1112
PaymentType,
@@ -114,6 +115,8 @@ export class LoanProductSummaryComponent implements OnInit, OnChanges {
114115
feeToIncomeAccountMappings: ChargeToIncomeAccountMapping[] = [];
115116
penaltyToIncomeAccountMappings: ChargeToIncomeAccountMapping[] = [];
116117
chargeOffReasonToExpenseAccountMappings: ChargeOffReasonToExpenseAccountMapping[] = [];
118+
buydownFeeClassificationToIncomeAccountMappings: ClassificationToIncomeAccountMapping[] = [];
119+
capitalizedIncomeClassificationToIncomeAccountMappings: ClassificationToIncomeAccountMapping[] = [];
117120

118121
constructor(private accounting: Accounting) {}
119122

@@ -145,6 +148,10 @@ export class LoanProductSummaryComponent implements OnInit, OnChanges {
145148
this.feeToIncomeAccountMappings = this.loanProduct.feeToIncomeAccountMappings || [];
146149
this.penaltyToIncomeAccountMappings = this.loanProduct.penaltyToIncomeAccountMappings || [];
147150
this.chargeOffReasonToExpenseAccountMappings = this.loanProduct.chargeOffReasonToExpenseAccountMappings || [];
151+
this.buydownFeeClassificationToIncomeAccountMappings =
152+
this.loanProduct.buydownFeeClassificationToIncomeAccountMappings || [];
153+
this.capitalizedIncomeClassificationToIncomeAccountMappings =
154+
this.loanProduct.capitalizedIncomeClassificationToIncomeAccountMappings || [];
148155
} else {
149156
this.accountingMappings = {};
150157

@@ -159,6 +166,9 @@ export class LoanProductSummaryComponent implements OnInit, OnChanges {
159166
const assetAndLiabilityAccountData =
160167
this.loanProductsTemplate.accountingMappingOptions.assetAndLiabilityAccountOptions || [];
161168
const chargeOffReasonOptions: any = this.loanProductsTemplate.chargeOffReasonOptions || [];
169+
const buydownFeeClassificationOptions: any = this.loanProductsTemplate.buydownFeeClassificationOptions || [];
170+
const capitalizedIncomeClassificationOptions: any =
171+
this.loanProductsTemplate.capitalizedIncomeClassificationOptions || [];
162172

163173
this.accountingMappings = {
164174
fundSourceAccount: this.glAccountLookUp(this.loanProduct.fundSourceAccountId, assetAndLiabilityAccountData),
@@ -262,11 +272,42 @@ export class LoanProductSummaryComponent implements OnInit, OnChanges {
262272
chargeOffReasonCodeValue: {
263273
id: optionData.id,
264274
name: optionData.value
265-
} as ChargeOffReasonCodeValue
275+
} as CodeValue
266276
});
267277
}
268278
);
269279
}
280+
281+
this.buydownFeeClassificationToIncomeAccountMappings = [];
282+
if (this.loanProduct.buydownFeeClassificationToIncomeAccountMappings?.length > 0) {
283+
this.loanProduct.buydownFeeClassificationToIncomeAccountMappings.forEach((m: any) => {
284+
let optionData = this.optionDataLookUp(m.classificationCodeValueId, buydownFeeClassificationOptions);
285+
if (optionData !== null) {
286+
this.buydownFeeClassificationToIncomeAccountMappings.push({
287+
incomeAccount: this.glAccountLookUp(m.incomeAccountId, incomeAccountData),
288+
classificationCodeValue: {
289+
id: optionData.id,
290+
name: optionData.value
291+
} as CodeValue
292+
});
293+
}
294+
});
295+
}
296+
this.capitalizedIncomeClassificationToIncomeAccountMappings = [];
297+
if (this.loanProduct.capitalizedIncomeClassificationToIncomeAccountMappings?.length > 0) {
298+
this.loanProduct.capitalizedIncomeClassificationToIncomeAccountMappings.forEach((m: any) => {
299+
let optionData = this.optionDataLookUp(m.classificationCodeValueId, capitalizedIncomeClassificationOptions);
300+
if (optionData !== null) {
301+
this.capitalizedIncomeClassificationToIncomeAccountMappings.push({
302+
incomeAccount: this.glAccountLookUp(m.incomeAccountId, incomeAccountData),
303+
classificationCodeValue: {
304+
id: optionData.id,
305+
name: optionData.value
306+
} as CodeValue
307+
});
308+
}
309+
});
310+
}
270311
}
271312

272313
if (this.loanProduct.isInterestRecalculationEnabled) {
@@ -453,7 +494,7 @@ export class LoanProductSummaryComponent implements OnInit, OnChanges {
453494
}
454495

455496
optionDataLookUp(itemId: any, optionsData: any[]): OptionData {
456-
let optionData: OptionData | null;
497+
let optionData: OptionData | null = null;
457498
optionsData.some((o: any) => {
458499
if (o.id === itemId) {
459500
optionData = {
@@ -576,7 +617,9 @@ export class LoanProductSummaryComponent implements OnInit, OnChanges {
576617
this.loanProduct.paymentChannelToFundSourceMappings?.length > 0 ||
577618
this.loanProduct.feeToIncomeAccountMappings?.length > 0 ||
578619
this.loanProduct.penaltyToIncomeAccountMappings?.length > 0 ||
579-
this.loanProduct.chargeOffReasonToExpenseAccountMappings?.length > 0
620+
this.loanProduct.chargeOffReasonToExpenseAccountMappings?.length > 0 ||
621+
this.loanProduct.buydownFeeClassificationToIncomeAccountMappings?.length > 0 ||
622+
this.loanProduct.capitalizedIncomeClassificationToIncomeAccountMappings?.length > 0
580623
);
581624
}
582625

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<div class="flex-100 layout-row-wrap responsive-column">
2+
<h4 class="mat-h4 flex-33">
3+
{{ textHeading | translateKey: 'heading' }}
4+
</h4>
5+
6+
<div class="flex-63">
7+
<button type="button" mat-raised-button color="primary" [disabled]="!allowAddAccountingMapping" (click)="add()">
8+
<fa-icon icon="plus" class="m-r-10"></fa-icon>
9+
{{ 'labels.buttons.Add' | translate }}
10+
</button>
11+
</div>
12+
<table class="flex-98 mat-elevation-z1" mat-table [dataSource]="tableData" *ngIf="tableData.length !== 0">
13+
<ng-container matColumnDef="codeValueId">
14+
<th mat-header-cell *matHeaderCellDef>{{ 'labels.inputs.' + textField | translate }}</th>
15+
<td mat-cell *matCellDef="let item">
16+
{{ item.value.name }}
17+
</td>
18+
</ng-container>
19+
20+
<ng-container matColumnDef="glAccountId">
21+
<th mat-header-cell *matHeaderCellDef>{{ 'labels.inputs.GL Account Name or Code' | translate }}</th>
22+
<td mat-cell *matCellDef="let item">({{ item.glAccount.glCode }}) {{ item.glAccount.name }}</td>
23+
</ng-container>
24+
25+
<ng-container matColumnDef="actions">
26+
<th mat-header-cell *matHeaderCellDef>{{ 'labels.inputs.Actions' | translate }}</th>
27+
<td mat-cell *matCellDef="let chargeOffReasonExpense; let i = index">
28+
<button mat-icon-button color="primary" (click)="edit(i)">
29+
<fa-icon icon="edit"></fa-icon>
30+
</button>
31+
<button mat-icon-button color="warn" (click)="delete(i)">
32+
<fa-icon icon="trash"></fa-icon>
33+
</button>
34+
</td>
35+
</ng-container>
36+
37+
<tr mat-header-row *matHeaderRowDef="tableDisplayedColumns"></tr>
38+
<tr mat-row *matRowDef="let row; columns: tableDisplayedColumns"></tr>
39+
</table>
40+
</div>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
table {
2+
width: 100%;
3+
}
4+
5+
.mat-elevation-z1 {
6+
margin: 1em 0 1.5em;
7+
}
8+
9+
h3,
10+
h4 {
11+
font-weight: 500;
12+
}

0 commit comments

Comments
 (0)