diff --git a/src/app/products/loan-products/common/loan-product-summary/loan-product-summary.component.html b/src/app/products/loan-products/common/loan-product-summary/loan-product-summary.component.html index 78be4a6187..3ec704ee01 100644 --- a/src/app/products/loan-products/common/loan-product-summary/loan-product-summary.component.html +++ b/src/app/products/loan-products/common/loan-product-summary/loan-product-summary.component.html @@ -934,17 +934,17 @@

{{'labels.heading.Map Penalties to Specific Income -

{{'labels.heading.Map Charge-off reasons to Expense accounts' | translate}}

- +
diff --git a/src/app/products/loan-products/common/loan-product-summary/loan-product-summary.component.ts b/src/app/products/loan-products/common/loan-product-summary/loan-product-summary.component.ts index 0103b5bd3e..19ab1dcf59 100644 --- a/src/app/products/loan-products/common/loan-product-summary/loan-product-summary.component.ts +++ b/src/app/products/loan-products/common/loan-product-summary/loan-product-summary.component.ts @@ -1,6 +1,6 @@ import { Component, Input, OnChanges, OnInit, SimpleChanges } from '@angular/core'; import { DelinquencyBucket, LoanProduct } from '../../models/loan-product.model'; -import {AccountingMapping, Charge, ChargeOffReasonsToGLAccountMapping, ChargeToIncomeAccountMapping, GLAccount, PaymentChannelToFundSourceMapping, PaymentType, PaymentTypeOption} from '../../../../shared/models/general.model'; +import {AccountingMapping, Charge, ChargeOffReasonToExpenseAccountMapping, ChargeToIncomeAccountMapping, GLAccount, PaymentChannelToFundSourceMapping, PaymentType, PaymentTypeOption} from '../../../../shared/models/general.model'; import { AdvancePaymentAllocationData, CreditAllocation, PaymentAllocation } from '../../loan-product-stepper/loan-product-payment-strategy-step/payment-allocation-model'; import { LoanProducts } from '../../loan-products'; import { CodeName, OptionData, StringEnumOptionData } from '../../../../shared/models/option-data.model'; @@ -36,7 +36,7 @@ export class LoanProductSummaryComponent implements OnInit, OnChanges { paymentChannelToFundSourceMappings: PaymentChannelToFundSourceMapping[] = []; feeToIncomeAccountMappings: ChargeToIncomeAccountMapping[] = []; penaltyToIncomeAccountMappings: ChargeToIncomeAccountMapping[] = []; - chargeOffReasonsToExpenseMappings: ChargeOffReasonsToGLAccountMapping[] = []; + chargeOffReasonToExpenseAccountMappings: ChargeOffReasonToExpenseAccountMapping[] = []; constructor(private accounting: Accounting) { } @@ -65,7 +65,7 @@ export class LoanProductSummaryComponent implements OnInit, OnChanges { this.paymentChannelToFundSourceMappings = this.loanProduct.paymentChannelToFundSourceMappings || []; this.feeToIncomeAccountMappings = this.loanProduct.feeToIncomeAccountMappings || []; this.penaltyToIncomeAccountMappings = this.loanProduct.penaltyToIncomeAccountMappings || []; - this.chargeOffReasonsToExpenseMappings = this.loanProduct.chargeOffReasonToGLAccountMappings || []; + this.chargeOffReasonToExpenseAccountMappings = this.loanProduct.chargeOffReasonToExpenseAccountMappings || []; } else { this.accountingMappings = {}; @@ -132,10 +132,10 @@ export class LoanProductSummaryComponent implements OnInit, OnChanges { }); } - this.chargeOffReasonsToExpenseMappings = []; - if (this.loanProduct.chargeOffReasonToGLAccountMappings?.length > 0) { - this.loanProduct.chargeOffReasonToGLAccountMappings.forEach((m: ChargeOffReasonsToGLAccountMapping) => { - this.chargeOffReasonsToExpenseMappings.push(m); + this.chargeOffReasonToExpenseAccountMappings = []; + if (this.loanProduct.chargeOffReasonToExpenseAccountMappings?.length > 0) { + this.loanProduct.chargeOffReasonToExpenseAccountMappings.forEach((m: ChargeOffReasonToExpenseAccountMapping) => { + this.chargeOffReasonToExpenseAccountMappings.push(m); }); } } @@ -355,7 +355,7 @@ export class LoanProductSummaryComponent implements OnInit, OnChanges { return (this.loanProduct.paymentChannelToFundSourceMappings?.length > 0 || this.loanProduct.feeToIncomeAccountMappings?.length > 0 || this.loanProduct.penaltyToIncomeAccountMappings?.length > 0 - || this.loanProduct.chargeOffReasonToGLAccountMappings?.length > 0); + || this.loanProduct.chargeOffReasonToExpenseAccountMappings?.length > 0); } getAccountingRuleName(value: string): string { diff --git a/src/app/products/loan-products/loan-product-stepper/loan-product-accounting-step/loan-product-accounting-step.component.html b/src/app/products/loan-products/loan-product-stepper/loan-product-accounting-step/loan-product-accounting-step.component.html index 7e88302843..f3d5507355 100644 --- a/src/app/products/loan-products/loan-product-stepper/loan-product-accounting-step/loan-product-accounting-step.component.html +++ b/src/app/products/loan-products/loan-product-stepper/loan-product-accounting-step/loan-product-accounting-step.component.html @@ -337,12 +337,12 @@

{{'labels.heading.Map Penalties to Specific Inco

{{'labels.heading.Map Charge-off reasons to Expense accounts' | translate}}

-
-
{{'labels.inputs.Charge-off reason' | translate}} - {{ chargeOffReasonsToExpenseMapping.chargeOffReasonsCodeValue.name }} + {{ chargeOffReasonsToExpenseMapping.chargeOffReasonCodeValue.name }}
+
@@ -361,10 +361,10 @@

{{'labels.heading.Map Charge-off reasons to Expe

diff --git a/src/app/products/loan-products/loan-product-stepper/loan-product-accounting-step/loan-product-accounting-step.component.ts b/src/app/products/loan-products/loan-product-stepper/loan-product-accounting-step/loan-product-accounting-step.component.ts index 390e9cb71f..ac321769ab 100644 --- a/src/app/products/loan-products/loan-product-stepper/loan-product-accounting-step/loan-product-accounting-step.component.ts +++ b/src/app/products/loan-products/loan-product-stepper/loan-product-accounting-step/loan-product-accounting-step.component.ts @@ -8,7 +8,7 @@ import { FormDialogComponent } from 'app/shared/form-dialog/form-dialog.componen import { TranslateService } from '@ngx-translate/core'; import { FormfieldBase } from 'app/shared/form-dialog/formfield/model/formfield-base'; import { SelectBase } from 'app/shared/form-dialog/formfield/model/select-base'; -import { ChargeOffReasonsToGLAccountMapping } from 'app/shared/models/general.model'; +import { ChargeOffReasonToExpenseAccountMapping } from 'app/shared/models/general.model'; @Component({ selector: 'mifosx-loan-product-accounting-step', @@ -94,7 +94,7 @@ export class LoanProductAccountingStepComponent implements OnInit { 'incomeFromGoodwillCreditInterestAccountId': accountingMappings.incomeFromGoodwillCreditInterestAccount ? accountingMappings.incomeFromGoodwillCreditInterestAccount.id : '', 'incomeFromGoodwillCreditFeesAccountId': accountingMappings.incomeFromGoodwillCreditFeesAccount ? accountingMappings.incomeFromGoodwillCreditFeesAccount.id : '', 'incomeFromGoodwillCreditPenaltyAccountId': accountingMappings.incomeFromGoodwillCreditPenaltyAccount ? accountingMappings.incomeFromGoodwillCreditPenaltyAccount.id : '', - 'advancedAccountingRules': (this.loanProductsTemplate.paymentChannelToFundSourceMappings || this.loanProductsTemplate.feeToIncomeAccountMappings || this.loanProductsTemplate.penaltyToIncomeAccountMappings || this.loanProductsTemplate.chargeOffReasonsToExpenseMappings) ? true : false + 'advancedAccountingRules': (this.loanProductsTemplate.paymentChannelToFundSourceMappings || this.loanProductsTemplate.feeToIncomeAccountMappings || this.loanProductsTemplate.penaltyToIncomeAccountMappings || this.loanProductsTemplate.chargeOffReasonToExpenseAccountMappings) ? true : false }); this.loanProductAccountingForm.setControl('paymentChannelToFundSourceMappings', @@ -106,9 +106,9 @@ export class LoanProductAccountingStepComponent implements OnInit { this.loanProductAccountingForm.setControl('penaltyToIncomeAccountMappings', this.formBuilder.array((this.loanProductsTemplate.penaltyToIncomeAccountMappings || []).map((penaltyIncome: any) => ({ chargeId: penaltyIncome.charge.id, incomeAccountId: penaltyIncome.incomeAccount.id })))); - this.loanProductAccountingForm.setControl('chargeOffReasonsToExpenseMappings', - this.formBuilder.array((this.loanProductsTemplate.chargeOffReasonToGLAccountMappings || []).map((m: ChargeOffReasonsToGLAccountMapping) => - ({ chargeOffReasonCodeValueId: m.chargeOffReasonsCodeValue.id, expenseGLAccountId: m.chargeOffExpenseAccount.id })))); + this.loanProductAccountingForm.setControl('chargeOffReasonToExpenseAccountMappings', + this.formBuilder.array((this.loanProductsTemplate.chargeOffReasonToExpenseAccountMappings || []).map((m: ChargeOffReasonToExpenseAccountMapping) => + ({ chargeOffReasonCodeValueId: m.chargeOffReasonCodeValue.id, expenseGLAccountId: m.chargeOffExpenseAccount.id })))); } } @@ -148,12 +148,12 @@ export class LoanProductAccountingStepComponent implements OnInit { this.loanProductAccountingForm.addControl('paymentChannelToFundSourceMappings', this.formBuilder.array([])); this.loanProductAccountingForm.addControl('feeToIncomeAccountMappings', this.formBuilder.array([])); this.loanProductAccountingForm.addControl('penaltyToIncomeAccountMappings', this.formBuilder.array([])); - this.loanProductAccountingForm.addControl('chargeOffReasonsToExpenseMappings', this.formBuilder.array([])); + this.loanProductAccountingForm.addControl('chargeOffReasonToExpenseAccountMappings', this.formBuilder.array([])); } else { this.loanProductAccountingForm.removeControl('paymentChannelToFundSourceMappings'); this.loanProductAccountingForm.removeControl('feeToIncomeAccountMappings'); this.loanProductAccountingForm.removeControl('penaltyToIncomeAccountMappings'); - this.loanProductAccountingForm.removeControl('chargeOffReasonsToExpenseMappings'); + this.loanProductAccountingForm.removeControl('chargeOffReasonToExpenseAccountMappings'); } }); } else { @@ -204,8 +204,8 @@ export class LoanProductAccountingStepComponent implements OnInit { return this.loanProductAccountingForm.get('penaltyToIncomeAccountMappings') as UntypedFormArray; } - get chargeOffReasonsToExpenseMappings(): UntypedFormArray { - return this.loanProductAccountingForm.get('chargeOffReasonsToExpenseMappings') as UntypedFormArray; + get chargeOffReasonToExpenseAccountMappings(): UntypedFormArray { + return this.loanProductAccountingForm.get('chargeOffReasonToExpenseAccountMappings') as UntypedFormArray; } setLoanProductAccountingFormDirty() { diff --git a/src/app/products/loan-products/models/loan-product.model.ts b/src/app/products/loan-products/models/loan-product.model.ts index 7711fdab1f..0a16eed7a0 100644 --- a/src/app/products/loan-products/models/loan-product.model.ts +++ b/src/app/products/loan-products/models/loan-product.model.ts @@ -1,4 +1,4 @@ -import {AccountingMapping, ChargeOffReasonsToGLAccountMapping, ChargeToIncomeAccountMapping, Currency, PaymentChannelToFundSourceMapping} from 'app/shared/models/general.model'; +import {AccountingMapping, ChargeOffReasonToExpenseAccountMapping, ChargeToIncomeAccountMapping, Currency, PaymentChannelToFundSourceMapping} from 'app/shared/models/general.model'; import { OptionData, StringEnumOptionData } from 'app/shared/models/option-data.model'; import { CreditAllocation, PaymentAllocation } from '../loan-product-stepper/loan-product-payment-strategy-step/payment-allocation-model'; @@ -125,7 +125,7 @@ export interface LoanProduct { paymentChannelToFundSourceMappings?: PaymentChannelToFundSourceMapping[]; feeToIncomeAccountMappings?: ChargeToIncomeAccountMapping[]; penaltyToIncomeAccountMappings?: ChargeToIncomeAccountMapping[]; - chargeOffReasonToGLAccountMappings?: ChargeOffReasonsToGLAccountMapping[]; + chargeOffReasonToExpenseAccountMappings?: ChargeOffReasonToExpenseAccountMapping[]; enableAccrualActivityPosting?: boolean; supportedInterestRefundTypes?: StringEnumOptionData[]; chargeOffBehaviour?: StringEnumOptionData; diff --git a/src/app/shared/models/general.model.ts b/src/app/shared/models/general.model.ts index 8a7c4044c6..16317dfed9 100644 --- a/src/app/shared/models/general.model.ts +++ b/src/app/shared/models/general.model.ts @@ -39,14 +39,14 @@ export interface PaymentChannelToFundSourceMapping { fundSourceAccount: AccountingMapping; } -export interface ChargeOffReasonsToGLAccountMapping { +export interface ChargeOffReasonToExpenseAccountMapping { chargeOffReasonCodeValueId?: number; chargeOffReason? : OptionData; - chargeOffReasonsCodeValue?: ChargeOffReasonsCodeValue; + chargeOffReasonCodeValue?: ChargeOffReasonCodeValue; chargeOffExpenseAccount?: AccountingMapping; } -export interface ChargeOffReasonsCodeValue { +export interface ChargeOffReasonCodeValue { active: boolean; description: string; id: number;
{{'labels.inputs.Charge-off reason' | translate}} {{'labels.inputs.Actions' | translate}} - -