Skip to content

Commit cbb809e

Browse files
Jose Alberto Hernandezadamsaghy
Jose Alberto Hernandez
authored andcommitted
Loan Product with Capitalized Income GL accounting mappings
1 parent e308f96 commit cbb809e

20 files changed

+94
-2
lines changed

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

+16
Original file line numberDiff line numberDiff line change
@@ -1011,6 +1011,14 @@ <h4 fxFlexFill class="mat-h4">{{ 'labels.heading.Income' | translate }}</h4>
10111011
[withTitle]="'47%'"
10121012
>
10131013
</mifosx-gl-account-display>
1014+
<mifosx-gl-account-display
1015+
fxFlex="100%"
1016+
*ngIf="accountingMappings.incomeFromCapitalizationAccount"
1017+
[accountTitle]="'Income capitalization'"
1018+
[glAccount]="accountingMappings.incomeFromCapitalizationAccount"
1019+
[withTitle]="'47%'"
1020+
>
1021+
</mifosx-gl-account-display>
10141022

10151023
<h4 fxFlexFill class="mat-h4">{{ 'labels.heading.Expenses' | translate }}</h4>
10161024

@@ -1054,6 +1062,14 @@ <h4 fxFlexFill class="mat-h4">{{ 'labels.heading.Liabilities' | translate }}</h4
10541062
[withTitle]="'47%'"
10551063
>
10561064
</mifosx-gl-account-display>
1065+
<mifosx-gl-account-display
1066+
fxFlex="100%"
1067+
*ngIf="accountingMappings.deferredIncomeLiabilityAccount"
1068+
[accountTitle]="'Deferred income'"
1069+
[glAccount]="accountingMappings.deferredIncomeLiabilityAccount"
1070+
[withTitle]="'47%'"
1071+
>
1072+
</mifosx-gl-account-display>
10571073

10581074
<div *ngIf="isAdvancedAccountingEnabled()" fxFlexFill fxLayout="row wrap" fxLayout.lt-md="column">
10591075
<h3 class="mat-h3" fxFlexFill>{{ 'labels.heading.Advanced Accounting Rules' | translate }}</h3>

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

+8
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,10 @@ export class LoanProductSummaryComponent implements OnInit, OnChanges {
152152
this.loanProduct.incomeFromChargeOffPenaltyAccountId,
153153
incomeAccountData
154154
),
155+
incomeFromCapitalizationAccount: this.glAccountLookUp(
156+
this.loanProduct.incomeFromCapitalizationAccountId,
157+
incomeAccountData
158+
),
155159

156160
writeOffAccount: this.glAccountLookUp(this.loanProduct.writeOffAccountId, expenseAccountData),
157161
goodwillCreditAccount: this.glAccountLookUp(this.loanProduct.goodwillCreditAccountId, expenseAccountData),
@@ -161,6 +165,10 @@ export class LoanProductSummaryComponent implements OnInit, OnChanges {
161165
overpaymentLiabilityAccount: this.glAccountLookUp(
162166
this.loanProduct.overpaymentLiabilityAccountId,
163167
liabilityAccountData
168+
),
169+
deferredIncomeLiabilityAccount: this.glAccountLookUp(
170+
this.loanProduct.deferredIncomeLiabilityAccountId,
171+
liabilityAccountData
164172
)
165173
};
166174

src/app/products/loan-products/create-loan-product/create-loan-product.component.html

+1
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@
113113
[loanProductsTemplate]="loanProductsTemplate"
114114
[accountingRuleData]="accountingRuleData"
115115
[loanProductFormValid]="loanProductFormValid"
116+
[capitalizedIncome]="capitalizedIncome"
116117
>
117118
</mifosx-loan-product-accounting-step>
118119
</mat-step>

src/app/products/loan-products/edit-loan-product/edit-loan-product.component.html

+1
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@
115115
[loanProductsTemplate]="loanProductAndTemplate"
116116
[accountingRuleData]="accountingRuleData"
117117
[loanProductFormValid]="loanProductFormValidAndNotPristine"
118+
[capitalizedIncome]="capitalizedIncome"
118119
>
119120
</mifosx-loan-product-accounting-step>
120121
</mat-step>

src/app/products/loan-products/loan-product-stepper/loan-product-accounting-step/loan-product-accounting-step.component.html

+20
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,16 @@ <h4 fxFlex="98%" class="mat-h4">{{ 'labels.heading.Income' | translate }}</h4>
189189
>
190190
</mifosx-gl-account-selector>
191191

192+
<mifosx-gl-account-selector
193+
*ngIf="capitalizedIncome.enableIncomeCapitalization"
194+
fxFlex="48%"
195+
[inputFormControl]="loanProductAccountingForm.controls.incomeFromCapitalizationAccountId"
196+
[glAccountList]="incomeAccountData"
197+
[required]="true"
198+
[inputLabel]="'Income capitalization'"
199+
>
200+
</mifosx-gl-account-selector>
201+
192202
<mat-divider fxFlex="98%"></mat-divider>
193203

194204
<h4 fxFlex="98%" class="mat-h4">{{ 'labels.heading.Expenses' | translate }}</h4>
@@ -242,6 +252,16 @@ <h4 fxFlex="98%" class="mat-h4">{{ 'labels.heading.Liabilities' | translate }}</
242252
>
243253
</mifosx-gl-account-selector>
244254

255+
<mifosx-gl-account-selector
256+
*ngIf="capitalizedIncome.enableIncomeCapitalization"
257+
fxFlex="48%"
258+
[inputFormControl]="loanProductAccountingForm.controls.deferredIncomeLiabilityAccountId"
259+
[glAccountList]="liabilityAccountData"
260+
[required]="true"
261+
[inputLabel]="'Deferred income'"
262+
>
263+
</mifosx-gl-account-selector>
264+
245265
<mat-divider fxFlex="98%"></mat-divider>
246266

247267
<mat-checkbox fxFlex="73%" formControlName="advancedAccountingRules">{{

src/app/products/loan-products/loan-product-stepper/loan-product-accounting-step/loan-product-accounting-step.component.ts

+33-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Component, Input, OnInit } from '@angular/core';
1+
import { Component, Input, OnChanges, OnInit, SimpleChanges } from '@angular/core';
22
import { UntypedFormArray, UntypedFormBuilder, UntypedFormControl, UntypedFormGroup, Validators } from '@angular/forms';
33
import { MatDialog } from '@angular/material/dialog';
44

@@ -9,16 +9,18 @@ import { TranslateService } from '@ngx-translate/core';
99
import { FormfieldBase } from 'app/shared/form-dialog/formfield/model/formfield-base';
1010
import { SelectBase } from 'app/shared/form-dialog/formfield/model/select-base';
1111
import { ChargeOffReasonToExpenseAccountMapping } from 'app/shared/models/general.model';
12+
import { CapitalizedIncome } from '../loan-product-payment-strategy-step/payment-allocation-model';
1213

1314
@Component({
1415
selector: 'mifosx-loan-product-accounting-step',
1516
templateUrl: './loan-product-accounting-step.component.html',
1617
styleUrls: ['./loan-product-accounting-step.component.scss']
1718
})
18-
export class LoanProductAccountingStepComponent implements OnInit {
19+
export class LoanProductAccountingStepComponent implements OnInit, OnChanges {
1920
@Input() loanProductsTemplate: any;
2021
@Input() accountingRuleData: any;
2122
@Input() loanProductFormValid: boolean;
23+
@Input() capitalizedIncome: CapitalizedIncome;
2224

2325
loanProductAccountingForm: UntypedFormGroup;
2426

@@ -61,6 +63,10 @@ export class LoanProductAccountingStepComponent implements OnInit {
6163
this.setConditionalControls();
6264
}
6365

66+
ngOnChanges(changes: SimpleChanges): void {
67+
this.setCapitalizedIncomeControls();
68+
}
69+
6470
ngOnInit() {
6571
this.chargeData = this.loanProductsTemplate.chargeOptions || [];
6672
this.penaltyData = this.loanProductsTemplate.penaltyOptions || [];
@@ -79,6 +85,7 @@ export class LoanProductAccountingStepComponent implements OnInit {
7985
});
8086

8187
const accountingMappings = this.loanProductsTemplate.accountingMappings;
88+
this.setCapitalizedIncomeControls();
8289
switch (this.loanProductsTemplate.accountingRule.id) {
8390
case 3:
8491
case 4:
@@ -90,6 +97,12 @@ export class LoanProductAccountingStepComponent implements OnInit {
9097
this.loanProductAccountingForm.patchValue({
9198
enableAccrualActivityPosting: this.loanProductsTemplate.enableAccrualActivityPosting
9299
});
100+
if (this.capitalizedIncome.enableIncomeCapitalization) {
101+
this.loanProductAccountingForm.patchValue({
102+
deferredIncomeLiabilityAccountId: accountingMappings.deferredIncomeLiabilityAccount.id,
103+
incomeFromCapitalizationAccountId: accountingMappings.incomeFromCapitalizationAccount.id
104+
});
105+
}
93106
/* falls through */
94107
case 2:
95108
this.loanProductAccountingForm.patchValue({
@@ -524,4 +537,22 @@ export class LoanProductAccountingStepComponent implements OnInit {
524537
get loanProductAccounting() {
525538
return this.loanProductAccountingForm.value;
526539
}
540+
541+
setCapitalizedIncomeControls() {
542+
if (this.isAccountingAccrualBased) {
543+
if (this.capitalizedIncome.enableIncomeCapitalization) {
544+
this.loanProductAccountingForm.addControl(
545+
'deferredIncomeLiabilityAccountId',
546+
new UntypedFormControl('', Validators.required)
547+
);
548+
this.loanProductAccountingForm.addControl(
549+
'incomeFromCapitalizationAccountId',
550+
new UntypedFormControl('', Validators.required)
551+
);
552+
} else {
553+
this.loanProductAccountingForm.removeControl('deferredIncomeLiabilityAccountId');
554+
this.loanProductAccountingForm.removeControl('incomeFromCapitalizationAccountId');
555+
}
556+
}
557+
}
527558
}

src/app/products/loan-products/models/loan-product.model.ts

+2
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ export interface LoanProduct {
117117
accountingMappings?: { [key: string]: AccountingMapping };
118118
fundSourceAccountId?: number;
119119
goodwillCreditAccountId?: number;
120+
incomeFromCapitalizationAccountId?: number;
120121
incomeFromChargeOffFeesAccountId?: number;
121122
incomeFromChargeOffInterestAccountId?: number;
122123
incomeFromChargeOffPenaltyAccountId?: number;
@@ -134,6 +135,7 @@ export interface LoanProduct {
134135
receivablePenaltyAccountId?: number;
135136
transfersInSuspenseAccountId?: number;
136137
writeOffAccountId?: number;
138+
deferredIncomeLiabilityAccountId?: number;
137139
// Advanced Accounting
138140
paymentChannelToFundSourceMappings?: PaymentChannelToFundSourceMapping[];
139141
feeToIncomeAccountMappings?: ChargeToIncomeAccountMapping[];

src/assets/translations/cs-CS.json

+1
Original file line numberDiff line numberDiff line change
@@ -1482,6 +1482,7 @@
14821482
"Default Savings Account": "Výchozí spořicí účet",
14831483
"Default Shares per Client": "Výchozí podíly na klienta",
14841484
"Default Theme": "Výchozí motiv",
1485+
"Deferred income": "Výnosy příštích období",
14851486
"Deleted": "Smazáno",
14861487
"Delinquency Action": "Akce delikvence",
14871488
"Delinquency Bucket": "Delikvence Bucket",

src/assets/translations/de-DE.json

+1
Original file line numberDiff line numberDiff line change
@@ -1482,6 +1482,7 @@
14821482
"Default Savings Account": "Standardsparkonto",
14831483
"Default Shares per Client": "Standardanteile pro Kunde",
14841484
"Default Theme": "Standardthema",
1485+
"Deferred income": "Rechnungsabgrenzungsposten",
14851486
"Deleted": "Gelöscht",
14861487
"Delinquency Action": "Kriminalitätsaktion",
14871488
"Delinquency Bucket": "Kriminalitätseimer",

src/assets/translations/en-US.json

+1
Original file line numberDiff line numberDiff line change
@@ -1486,6 +1486,7 @@
14861486
"Default Savings Account": "Default Savings Account",
14871487
"Default Shares per Client": "Default Shares per Client",
14881488
"Default Theme": "Default Theme",
1489+
"Deferred income": "Deferred income",
14891490
"Deleted": "Deleted",
14901491
"Delinquency Action": "Delinquency Action",
14911492
"Delinquency Bucket": "Delinquency Bucket",

src/assets/translations/es-CL.json

+1
Original file line numberDiff line numberDiff line change
@@ -1481,6 +1481,7 @@
14811481
"Default Savings Account": "Cuenta de Ahorros predeterminada",
14821482
"Default Shares per Client": "Acciones predeterminadas por cliente",
14831483
"Default Theme": "Tema predeterminado",
1484+
"Deferred income": "Ingresos diferidos",
14841485
"Deleted": "Eliminado",
14851486
"Delinquency Action": "Acción de morosidad",
14861487
"Delinquency Bucket": "Clasificación de morosidad",

src/assets/translations/es-MX.json

+1
Original file line numberDiff line numberDiff line change
@@ -1481,6 +1481,7 @@
14811481
"Default Savings Account": "Cuenta de Ahorros predeterminada",
14821482
"Default Shares per Client": "Acciones predeterminadas por cliente",
14831483
"Default Theme": "Tema predeterminado",
1484+
"Deferred income": "Ingresos diferidos",
14841485
"Deleted": "Eliminado",
14851486
"Delinquency Action": "Acción de morosidad",
14861487
"Delinquency Bucket": "Clasificación de morosidad",

src/assets/translations/fr-FR.json

+1
Original file line numberDiff line numberDiff line change
@@ -1482,6 +1482,7 @@
14821482
"Default Savings Account": "Compte d'épargne par défaut",
14831483
"Default Shares per Client": "Actions par défaut par client",
14841484
"Default Theme": "Thème par défaut",
1485+
"Deferred income": "Produits différés",
14851486
"Deleted": "Supprimé",
14861487
"Delinquency Action": "Action de délinquance",
14871488
"Delinquency Bucket": "Seau de délinquance",

src/assets/translations/it-IT.json

+1
Original file line numberDiff line numberDiff line change
@@ -1482,6 +1482,7 @@
14821482
"Default Savings Account": "Conto di risparmio predefinito",
14831483
"Default Shares per Client": "Condivisioni predefinite per cliente",
14841484
"Default Theme": "Tema predefinito",
1485+
"Deferred income": "Ricavi differiti",
14851486
"Deleted": "Eliminato",
14861487
"Delinquency Action": "Azione di delinquenza",
14871488
"Delinquency Bucket": "Il secchio della delinquenza",

src/assets/translations/ko-KO.json

+1
Original file line numberDiff line numberDiff line change
@@ -1483,6 +1483,7 @@
14831483
"Default Savings Account": "기본 저축 계좌",
14841484
"Default Shares per Client": "클라이언트당 기본 공유",
14851485
"Default Theme": "기본 테마",
1486+
"Deferred income": "이연소득",
14861487
"Deleted": "삭제됨",
14871488
"Delinquency Action": "연체 행동",
14881489
"Delinquency Bucket": "연체 버킷",

src/assets/translations/lt-LT.json

+1
Original file line numberDiff line numberDiff line change
@@ -1482,6 +1482,7 @@
14821482
"Default Savings Account": "Numatytoji taupomoji sąskaita",
14831483
"Default Shares per Client": "Numatytosios akcijos vienam klientui",
14841484
"Default Theme": "Numatytoji tema",
1485+
"Deferred income": "Atidėtos pajamos",
14851486
"Deleted": "Ištrinta",
14861487
"Delinquency Action": "Deliktingumo veiksmas",
14871488
"Delinquency Bucket": "Nusikaltimų kibiras",

src/assets/translations/lv-LV.json

+1
Original file line numberDiff line numberDiff line change
@@ -1482,6 +1482,7 @@
14821482
"Default Savings Account": "Noklusējuma krājkonts",
14831483
"Default Shares per Client": "Noklusējuma akcijas vienam klientam",
14841484
"Default Theme": "Noklusējuma motīvs",
1485+
"Deferred income": "Atliktie ienākumi",
14851486
"Deleted": "Izdzēsts",
14861487
"Delinquency Action": "Likumpārkāpums",
14871488
"Delinquency Bucket": "Noziedzības spainis",

src/assets/translations/ne-NE.json

+1
Original file line numberDiff line numberDiff line change
@@ -1482,6 +1482,7 @@
14821482
"Default Savings Account": "पूर्वनिर्धारित बचत खाता",
14831483
"Default Shares per Client": "प्रति ग्राहक पूर्वनिर्धारित शेयरहरू",
14841484
"Default Theme": "पूर्वनिर्धारित विषयवस्तु",
1485+
"Deferred income": "स्थगित आय",
14851486
"Deleted": "मेटाइयो",
14861487
"Delinquency Action": "अपराध कार्य",
14871488
"Delinquency Bucket": "अपराध बाल्टी",

src/assets/translations/pt-PT.json

+1
Original file line numberDiff line numberDiff line change
@@ -1482,6 +1482,7 @@
14821482
"Default Savings Account": "Conta poupança padrão",
14831483
"Default Shares per Client": "Compartilhamentos padrão por cliente",
14841484
"Default Theme": "Tema Padrão",
1485+
"Deferred income": "Renda diferida",
14851486
"Deleted": "Excluído",
14861487
"Delinquency Action": "Ação de inadimplência",
14871488
"Delinquency Bucket": "Balde de inadimplência",

src/assets/translations/sw-SW.json

+1
Original file line numberDiff line numberDiff line change
@@ -1482,6 +1482,7 @@
14821482
"Default Savings Account": "Akaunti ya Akiba chaguomsingi",
14831483
"Default Shares per Client": "Hisa Chaguomsingi kwa kila Mteja",
14841484
"Default Theme": "Mandhari Chaguomsingi",
1485+
"Deferred income": "Mapato yaliyoahirishwa",
14851486
"Deleted": "Imefutwa",
14861487
"Delinquency Action": "Kitendo cha Delinquency",
14871488
"Delinquency Bucket": "Ndoo ya Uhalifu",

0 commit comments

Comments
 (0)