diff --git a/src/app/accounting/chart-of-accounts/create-gl-account/create-gl-account.component.html b/src/app/accounting/chart-of-accounts/create-gl-account/create-gl-account.component.html
index c7de4a3ef..04f8355ff 100644
--- a/src/app/accounting/chart-of-accounts/create-gl-account/create-gl-account.component.html
+++ b/src/app/accounting/chart-of-accounts/create-gl-account/create-gl-account.component.html
@@ -63,7 +63,7 @@
-
+
diff --git a/src/app/accounting/chart-of-accounts/create-gl-account/create-gl-account.component.ts b/src/app/accounting/chart-of-accounts/create-gl-account/create-gl-account.component.ts
index e9892a2ad..91221e11f 100644
--- a/src/app/accounting/chart-of-accounts/create-gl-account/create-gl-account.component.ts
+++ b/src/app/accounting/chart-of-accounts/create-gl-account/create-gl-account.component.ts
@@ -1,6 +1,6 @@
import { Component, OnInit } from '@angular/core';
import { FormGroup, FormBuilder, Validators } from '@angular/forms';
-import { Router } from '@angular/router';
+import { Router, ActivatedRoute } from '@angular/router';
import { AccountingService } from '../../accounting.service';
@@ -18,9 +18,23 @@ export class CreateGlAccountComponent implements OnInit {
accountUsageData: any;
tagData: any;
+ accountTypeId: number;
+ parentId: number;
+
+ cancelRoute = '/accounting/chart-of-accounts';
+
constructor(private formBuilder: FormBuilder,
private accountingService: AccountingService,
- private router: Router) { }
+ private route: ActivatedRoute,
+ private router: Router) {
+ this.route.queryParamMap.subscribe(params => {
+ this.accountTypeId = Number(params.get('accountType'));
+ this.parentId = Number(params.get('parent'));
+ if (this.parentId) {
+ this.cancelRoute = `/accounting/chart-of-accounts/gl-accounts/view/${this.parentId}`;
+ }
+ });
+ }
ngOnInit() {
this.createGlAccountForm();
@@ -34,7 +48,7 @@ export class CreateGlAccountComponent implements OnInit {
'name': ['', Validators.required],
'usage': ['', Validators.required],
'glCode': ['', Validators.required],
- 'parentId': [''],
+ 'parentId': [this.parentId],
'tagId': [''],
'manualEntriesAllowed': [true, Validators.required],
'description': ['']
@@ -46,6 +60,7 @@ export class CreateGlAccountComponent implements OnInit {
this.chartOfAccountsData = chartOfAccountsData;
this.accountTypeData = chartOfAccountsData.accountTypeOptions;
this.accountUsageData = chartOfAccountsData.usageOptions;
+ this.glAccountForm.get('type').setValue(this.accountTypeId);
});
}
diff --git a/src/app/accounting/chart-of-accounts/view-gl-account/view-gl-account.component.html b/src/app/accounting/chart-of-accounts/view-gl-account/view-gl-account.component.html
index 84b7f98d3..4ac1473ff 100644
--- a/src/app/accounting/chart-of-accounts/view-gl-account/view-gl-account.component.html
+++ b/src/app/accounting/chart-of-accounts/view-gl-account/view-gl-account.component.html
@@ -1,5 +1,5 @@
-