Skip to content

Commit

Permalink
Allow accounting mappings for fund source asset or liability
Browse files Browse the repository at this point in the history
  • Loading branch information
Jose Alberto Hernandez authored and galovics committed Aug 4, 2022
1 parent 1c8a772 commit 01e60a0
Show file tree
Hide file tree
Showing 11 changed files with 84 additions and 41 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
<mat-label>Parent</mat-label>
<mat-select formControlName="parentId">
<mat-option *ngFor="let parent of parentData" [value]="parent.id">
{{ parent.name }}
({{ parent.glCode }}) {{ parent.name }}
</mat-option>
</mat-select>
</mat-form-field>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
<mat-label>Parent</mat-label>
<mat-select formControlName="parentId">
<mat-option *ngFor="let parent of parentData" [value]="parent.id">
{{ parent.name }}
({{ parent.glCode }}) {{ parent.name }}
</mat-option>
</mat-select>
</mat-form-field>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,9 @@ export class GlAccountTreeService {
glAccountTree[0].children[4].children.push(glAccounts[glAccount.id]);
}
} else {
glAccounts[glAccount.parentId].children.push(glAccounts[glAccount.id]);
if (glAccounts[glAccount.parentId]) {
glAccounts[glAccount.parentId].children.push(glAccounts[glAccount.id]);
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@
</div>

<div fxFlex="50%" *ngIf="glAccount.parent">
{{ glAccount.parent.name }}
<a class="tab-link" [routerLink]="['/accounting/chart-of-accounts/gl-accounts/view/' + glAccount.parent.id]">
({{ glAccount.parent.glCode }}) {{ glAccount.parent.name }}
</a>
</div>

<div fxFlex="50%" class="header" *ngIf="glAccount.tagId.id">
Expand All @@ -82,7 +84,7 @@
</div>

<div fxFlex="50%">
{{ glAccount.manualEntriesAllowed }}
{{ glAccount.manualEntriesAllowed ? 'Yes' : 'No' }}
</div>

<div fxFlex="50%" class="header" *ngIf="glAccount.description">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<span fxFlex="60%">{{ loanDetails.maxOutstandingLoanBalance | number }}</span>
</div>

<h3> Loan Tranche Details</h3>
<h3>Loan Tranche Details</h3>

<div fxLayout="row" fxLayoutAlign="flex-end">
<button mat-raised-button color="primary" *ngIf="showAddDeleteTrancheButtons('adddisbursedetails')">
Expand Down Expand Up @@ -65,16 +65,16 @@ <h3>Installment Amount Variations: </h3>
<th mat-header-cell *matHeaderCellDef> Applicable From Date </th>
<td mat-cell *matCellDef="let ele"> {{ ele.termVariationApplicableFrom | dateFormat}} </td>
</ng-container>

<ng-container matColumnDef="fixed emi amount">
<th mat-header-cell *matHeaderCellDef> Installment Amount </th>
<td mat-cell *matCellDef="let ele"> {{ ele.termValue }} </td>
</ng-container>

<tr mat-header-row *matHeaderRowDef="emivariationColumns"></tr>
<tr mat-row *matRowDef="let row; columns: emivariationColumns;"></tr>
</table>
</div>


</div>
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ export class CreateLoanProductComponent implements OnInit {
private router: Router) {
this.route.data.subscribe((data: { loanProductsTemplate: any }) => {
this.loanProductsTemplate = data.loanProductsTemplate;
const assetAccountData = this.loanProductsTemplate.accountingMappingOptions.assetAccountOptions || [];
const liabilityAccountData = this.loanProductsTemplate.accountingMappingOptions.liabilityAccountOptions || [];
this.loanProductsTemplate.accountingMappingOptions.assetAndLiabilityAccountOptions = assetAccountData.concat(liabilityAccountData);
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ export class EditLoanProductComponent implements OnInit {
private router: Router) {
this.route.data.subscribe((data: { loanProductAndTemplate: any }) => {
this.loanProductAndTemplate = data.loanProductAndTemplate;
const assetAccountData = this.loanProductAndTemplate.accountingMappingOptions.assetAccountOptions || [];
const liabilityAccountData = this.loanProductAndTemplate.accountingMappingOptions.liabilityAccountOptions || [];
this.loanProductAndTemplate.accountingMappingOptions.assetAndLiabilityAccountOptions = assetAccountData.concat(liabilityAccountData);
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,27 @@

<div *ngIf="loanProductAccountingForm.value.accountingRule >= 2 && loanProductAccountingForm.value.accountingRule <= 4" fxFlexFill fxLayout="row wrap" fxLayoutGap="2%" fxLayout.lt-md="column">

<h4 fxFlex="98%" class="mat-h4">Assets</h4>
<h4 fxFlex="98%" class="mat-h4">Assets / Liability</h4>

<mat-form-field fxFlex="48%">
<mat-label>Fund source</mat-label>
<mat-select formControlName="fundSourceAccountId" required>
<mat-option *ngFor="let assetAccount of assetAccountData" [value]="assetAccount.id">
{{ assetAccount.name }}
<mat-option *ngFor="let assetAndLiabilityAccount of assetAndLiabilityAccountData" [value]="assetAndLiabilityAccount.id">
({{ assetAndLiabilityAccount.glCode }}) {{ assetAndLiabilityAccount.name }}
</mat-option>
</mat-select>
<mat-error>
Fund source is <strong>required</strong>
</mat-error>
</mat-form-field>

<h4 fxFlex="98%" class="mat-h4">Assets</h4>

<mat-form-field fxFlex="48%">
<mat-label>Loan portfolio</mat-label>
<mat-select formControlName="loanPortfolioAccountId" required>
<mat-option *ngFor="let assetAccount of assetAccountData" [value]="assetAccount.id">
{{ assetAccount.name }}
({{ assetAccount.glCode }}) {{ assetAccount.name }}
</mat-option>
</mat-select>
<mat-error>
Expand All @@ -44,7 +46,7 @@ <h4 fxFlex="98%" class="mat-h4">Assets</h4>
<mat-label>Interest Receivable</mat-label>
<mat-select formControlName="receivableInterestAccountId" required>
<mat-option *ngFor="let assetAccount of assetAccountData" [value]="assetAccount.id">
{{ assetAccount.name }}
({{ assetAccount.glCode }}) {{ assetAccount.name }}
</mat-option>
</mat-select>
<mat-error>
Expand All @@ -56,7 +58,7 @@ <h4 fxFlex="98%" class="mat-h4">Assets</h4>
<mat-label>Fees Receivable</mat-label>
<mat-select formControlName="receivableFeeAccountId" required>
<mat-option *ngFor="let assetAccount of assetAccountData" [value]="assetAccount.id">
{{ assetAccount.name }}
({{ assetAccount.glCode }}) {{ assetAccount.name }}
</mat-option>
</mat-select>
<mat-error>
Expand All @@ -68,7 +70,7 @@ <h4 fxFlex="98%" class="mat-h4">Assets</h4>
<mat-label>Penalties Receivable</mat-label>
<mat-select formControlName="receivablePenaltyAccountId" required>
<mat-option *ngFor="let assetAccount of assetAccountData" [value]="assetAccount.id">
{{ assetAccount.name }}
({{ assetAccount.glCode }}) {{ assetAccount.name }}
</mat-option>
</mat-select>
<mat-error>
Expand All @@ -82,7 +84,7 @@ <h4 fxFlex="98%" class="mat-h4">Assets</h4>
<mat-label>Transfer in suspense</mat-label>
<mat-select formControlName="transfersInSuspenseAccountId" required>
<mat-option *ngFor="let assetAccount of assetAccountData" [value]="assetAccount.id">
{{ assetAccount.name }}
({{ assetAccount.glCode }}) {{ assetAccount.name }}
</mat-option>
</mat-select>
<mat-error>
Expand All @@ -98,7 +100,7 @@ <h4 fxFlex="98%" class="mat-h4">Income</h4>
<mat-label>Income from Interest</mat-label>
<mat-select formControlName="interestOnLoanAccountId" required>
<mat-option *ngFor="let incomeAccount of incomeAccountData" [value]="incomeAccount.id">
{{ incomeAccount.name }}
({{ incomeAccount.glCode }}) {{ incomeAccount.name }}
</mat-option>
</mat-select>
<mat-error>
Expand All @@ -110,7 +112,7 @@ <h4 fxFlex="98%" class="mat-h4">Income</h4>
<mat-label>Income from fees</mat-label>
<mat-select formControlName="incomeFromFeeAccountId" required>
<mat-option *ngFor="let incomeAccount of incomeAccountData" [value]="incomeAccount.id">
{{ incomeAccount.name }}
({{ incomeAccount.glCode }}) {{ incomeAccount.name }}
</mat-option>
</mat-select>
<mat-error>
Expand All @@ -122,7 +124,7 @@ <h4 fxFlex="98%" class="mat-h4">Income</h4>
<mat-label>Income from penalties</mat-label>
<mat-select formControlName="incomeFromPenaltyAccountId" required>
<mat-option *ngFor="let incomeAccount of incomeAccountData" [value]="incomeAccount.id">
{{ incomeAccount.name }}
({{ incomeAccount.glCode }}) {{ incomeAccount.name }}
</mat-option>
</mat-select>
<mat-error>
Expand All @@ -134,7 +136,7 @@ <h4 fxFlex="98%" class="mat-h4">Income</h4>
<mat-label>Income from Recovery Repayments</mat-label>
<mat-select formControlName="incomeFromRecoveryAccountId" required>
<mat-option *ngFor="let incomeAccount of incomeAccountData" [value]="incomeAccount.id">
{{ incomeAccount.name }}
({{ incomeAccount.glCode }}) {{ incomeAccount.name }}
</mat-option>
</mat-select>
<mat-error>
Expand All @@ -150,14 +152,26 @@ <h4 fxFlex="98%" class="mat-h4">Expenses</h4>
<mat-label>Losses written off</mat-label>
<mat-select formControlName="writeOffAccountId" required>
<mat-option *ngFor="let expenseAccount of expenseAccountData" [value]="expenseAccount.id">
{{ expenseAccount.name }}
({{ expenseAccount.glCode }}) {{ expenseAccount.name }}
</mat-option>
</mat-select>
<mat-error>
Losses written off is <strong>required</strong>
</mat-error>
</mat-form-field>

<mat-form-field fxFlex="48%">
<mat-label>Goodwill credit</mat-label>
<mat-select formControlName="goodwillCreditAccountId" required>
<mat-option *ngFor="let expenseAccount of expenseAccountData" [value]="expenseAccount.id">
({{ expenseAccount.glCode }}) {{ expenseAccount.name }}
</mat-option>
</mat-select>
<mat-error>
Goodwill credit is <strong>required</strong>
</mat-error>
</mat-form-field>

<mat-divider fxFlex="98%"></mat-divider>

<h4 fxFlex="98%" class="mat-h4">Liabilities</h4>
Expand All @@ -166,7 +180,7 @@ <h4 fxFlex="98%" class="mat-h4">Liabilities</h4>
<mat-label>Over payment liability</mat-label>
<mat-select formControlName="overpaymentLiabilityAccountId" required>
<mat-option *ngFor="let liabilityAccount of liabilityAccountData" [value]="liabilityAccount.id">
{{ liabilityAccount.name }}
({{ liabilityAccount.glCode }}) {{ liabilityAccount.name }}
</mat-option>
</mat-select>
<mat-error>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export class LoanProductAccountingStepComponent implements OnInit {
expenseAccountData: any;
liabilityAccountData: any;
incomeAndLiabilityAccountData: any;
assetAndLiabilityAccountData: any;

paymentFundSourceDisplayedColumns: string[] = ['paymentTypeId', 'fundSourceAccountId', 'actions'];
feesPenaltyIncomeDisplayedColumns: string[] = ['chargeId', 'incomeAccountId', 'actions'];
Expand All @@ -48,6 +49,7 @@ export class LoanProductAccountingStepComponent implements OnInit {
this.expenseAccountData = this.loanProductsTemplate.accountingMappingOptions.expenseAccountOptions || [];
this.liabilityAccountData = this.loanProductsTemplate.accountingMappingOptions.liabilityAccountOptions || [];
this.incomeAndLiabilityAccountData = this.incomeAccountData.concat(this.liabilityAccountData);
this.assetAndLiabilityAccountData = this.loanProductsTemplate.accountingMappingOptions.assetAndLiabilityAccountOptions || [];

this.loanProductAccountingForm.patchValue({
'accountingRule': this.loanProductsTemplate.accountingRule.id
Expand All @@ -72,6 +74,7 @@ export class LoanProductAccountingStepComponent implements OnInit {
'incomeFromPenaltyAccountId': this.loanProductsTemplate.accountingMappings.incomeFromPenaltyAccount.id,
'incomeFromRecoveryAccountId': this.loanProductsTemplate.accountingMappings.incomeFromRecoveryAccount.id,
'writeOffAccountId': this.loanProductsTemplate.accountingMappings.writeOffAccount.id,
'goodwillCreditAccountId': this.loanProductsTemplate.accountingMappings.goodwillCreditAccount.id,
'overpaymentLiabilityAccountId': this.loanProductsTemplate.accountingMappings.overpaymentLiabilityAccount.id,
'advancedAccountingRules': (this.loanProductsTemplate.paymentChannelToFundSourceMappings || this.loanProductsTemplate.feeToIncomeAccountMappings || this.loanProductsTemplate.penaltyToIncomeAccountMappings) ? true : false
});
Expand Down Expand Up @@ -106,6 +109,7 @@ export class LoanProductAccountingStepComponent implements OnInit {
this.loanProductAccountingForm.addControl('incomeFromPenaltyAccountId', new FormControl('', Validators.required));
this.loanProductAccountingForm.addControl('incomeFromRecoveryAccountId', new FormControl('', Validators.required));
this.loanProductAccountingForm.addControl('writeOffAccountId', new FormControl('', Validators.required));
this.loanProductAccountingForm.addControl('goodwillCreditAccountId', new FormControl('', Validators.required));
this.loanProductAccountingForm.addControl('overpaymentLiabilityAccountId', new FormControl('', Validators.required));
this.loanProductAccountingForm.addControl('advancedAccountingRules', new FormControl(false));

Expand All @@ -130,6 +134,7 @@ export class LoanProductAccountingStepComponent implements OnInit {
this.loanProductAccountingForm.removeControl('incomeFromPenaltyAccountId');
this.loanProductAccountingForm.removeControl('incomeFromRecoveryAccountId');
this.loanProductAccountingForm.removeControl('writeOffAccountId');
this.loanProductAccountingForm.removeControl('goodwillCreditAccountId');
this.loanProductAccountingForm.removeControl('overpaymentLiabilityAccountId');
this.loanProductAccountingForm.removeControl('advancedAccountingRules');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -589,11 +589,16 @@ <h3 class="mat-h3" fxFlexFill>Accounting</h3>

<div fxFlexFill *ngIf="loanProduct.accountingRule >= 2 && loanProduct.accountingRule <= 4" fxLayout="row wrap" fxLayout.lt-md="column">

<h4 fxFlexFill class="mat-h4">Assets</h4>
<h4 fxFlexFill class="mat-h4">Assets / Liabilities</h4>

<div fxFlexFill fxLayout="row wrap" fxLayout.lt-md="column">
<span fxFlex="40%">Fund source:</span>
<span fxFlex="60%">{{ loanProduct.fundSourceAccountId | find:loanProductsTemplate.accountingMappingOptions.assetAccountOptions:'id':'name' }}</span>
<span fxFlex="60%">{{ loanProduct.fundSourceAccountId | find:loanProductsTemplate.accountingMappingOptions.assetAndLiabilityAccountOptions:'id':'name' }}</span>
</div>

<h4 fxFlexFill class="mat-h4">Assets</h4>

<div fxFlexFill fxLayout="row wrap" fxLayout.lt-md="column">
<span fxFlex="40%">Loan portfolio:</span>
<span fxFlex="60%">{{ loanProduct.loanPortfolioAccountId | find:loanProductsTemplate.accountingMappingOptions.assetAccountOptions:'id':'name' }}</span>
<div fxFlexFill *ngIf="loanProduct.accountingRule === 3 || loanProduct.accountingRule === 4" fxLayout="row wrap" fxLayout.lt-md="column">
Expand Down Expand Up @@ -623,9 +628,11 @@ <h4 fxFlexFill class="mat-h4">Income</h4>

<h4 fxFlexFill class="mat-h4">Expenses</h4>

<div fxFlexFill>
<div fxFlexFill fxLayout="row wrap" fxLayout.lt-md="column">
<span fxFlex="40%">Losses written off:</span>
<span fxFlex="60%">{{ loanProduct.writeOffAccountId | find:loanProductsTemplate.accountingMappingOptions.expenseAccountOptions:'id':'name' }}</span>
<span fxFlex="40%">Goodwill credit:</span>
<span fxFlex="60%">{{ loanProduct.goodwillCreditAccountId | find:loanProductsTemplate.accountingMappingOptions.expenseAccountOptions:'id':'name' }}</span>
</div>

<h4 fxFlexFill class="mat-h4">Liabilities</h4>
Expand Down
Loading

0 comments on commit 01e60a0

Please sign in to comment.