diff --git a/src/app/accounting/accounting-routing.module.ts b/src/app/accounting/accounting-routing.module.ts
index 7182ae191..c1d377c51 100644
--- a/src/app/accounting/accounting-routing.module.ts
+++ b/src/app/accounting/accounting-routing.module.ts
@@ -15,11 +15,14 @@ import { EditFinancialActivityMappingComponent } from './financial-activity-mapp
import { ChartOfAccountsComponent } from './chart-of-accounts/chart-of-accounts.component';
import { ChartOfAccountsResolver } from './chart-of-accounts/chart-of-accounts.resolver';
+
import { CreateGlAccountComponent } from './chart-of-accounts/create-gl-account/create-gl-account.component';
import { ViewGlAccountComponent } from './chart-of-accounts/view-gl-account/view-gl-account.component';
import { ViewGlAccountResolver } from './chart-of-accounts/view-gl-account/view-gl-account.resolver';
import { EditGlAccountComponent } from './chart-of-accounts/edit-gl-account/edit-gl-account.component';
+import { ClosingEntriesComponent } from './closing-entries/closing-entries.component';
+
const routes: Routes = [
Route.withShell([
{
@@ -89,6 +92,9 @@ const routes: Routes = [
{
path: 'chart-of-accounts',
data: { title: extract('Chart of Accounts'), breadcrumb: 'Chart of Accounts' },
+ resolve: {
+ glAccountData: ChartOfAccountsResolver
+ },
children: [
{
path: '',
@@ -122,6 +128,11 @@ const routes: Routes = [
]
}
]
+ },
+ {
+ path: 'closing-entries',
+ component: ClosingEntriesComponent,
+ data: { title: extract('Accounting Closures'), breadcrumb: 'Closing Entries' }
}
]
}
diff --git a/src/app/accounting/accounting.component.html b/src/app/accounting/accounting.component.html
index 7c210baee..2ae5a6ace 100644
--- a/src/app/accounting/accounting.component.html
+++ b/src/app/accounting/accounting.component.html
@@ -52,11 +52,9 @@
List of accounts used by the organisation
-
+
archive
-
- Closing Entries
-
+ Closing Entries
Journal entries made at the end of accounting period
diff --git a/src/app/accounting/accounting.module.ts b/src/app/accounting/accounting.module.ts
index 23bcbca2c..0d73f1ed0 100644
--- a/src/app/accounting/accounting.module.ts
+++ b/src/app/accounting/accounting.module.ts
@@ -16,9 +16,11 @@ import { CreateFinancialActivityMappingComponent } from './financial-activity-ma
import { ViewFinancialActivityMappingComponent } from './financial-activity-mappings/view-financial-activity-mapping/view-financial-activity-mapping.component';
import { EditFinancialActivityMappingComponent } from './financial-activity-mappings/edit-financial-activity-mapping/edit-financial-activity-mapping.component';
import { ChartOfAccountsComponent } from './chart-of-accounts/chart-of-accounts.component';
+
import { CreateGlAccountComponent } from './chart-of-accounts/create-gl-account/create-gl-account.component';
import { ViewGlAccountComponent } from './chart-of-accounts/view-gl-account/view-gl-account.component';
import { EditGlAccountComponent } from './chart-of-accounts/edit-gl-account/edit-gl-account.component';
+import { ClosingEntriesComponent } from './closing-entries/closing-entries.component';
@NgModule({
imports: [
@@ -43,7 +45,8 @@ import { EditGlAccountComponent } from './chart-of-accounts/edit-gl-account/edit
ChartOfAccountsComponent,
CreateGlAccountComponent,
ViewGlAccountComponent,
- EditGlAccountComponent
+ EditGlAccountComponent,
+ ClosingEntriesComponent
],
entryComponents: [
RevertTransactionComponent,
diff --git a/src/app/accounting/accounting.service.ts b/src/app/accounting/accounting.service.ts
index b2b4d5e46..760986b12 100644
--- a/src/app/accounting/accounting.service.ts
+++ b/src/app/accounting/accounting.service.ts
@@ -121,4 +121,8 @@ export class AccountingService {
return this.http.delete(`/glaccounts/${glAccountId}`);
}
+ getAccountingClosures() {
+ return this.http.get('/glclosures');
+ }
+
}
diff --git a/src/app/accounting/closing-entries/closing-entries.component.html b/src/app/accounting/closing-entries/closing-entries.component.html
new file mode 100644
index 000000000..6e9ac6c51
--- /dev/null
+++ b/src/app/accounting/closing-entries/closing-entries.component.html
@@ -0,0 +1,55 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ office.name }}
+
+
+
+
+
+
+
+
+
+
+ | Office |
+ {{ glAccountClosure.officeName }} |
+
+
+
+ Closure Date |
+ {{ glAccountClosure.closingDate }} |
+
+
+
+ Comments |
+ {{ glAccountClosure.comments }} |
+
+
+
+ Created By |
+ {{ glAccountClosure.createdByUsername }} |
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/app/accounting/closing-entries/closing-entries.component.scss b/src/app/accounting/closing-entries/closing-entries.component.scss
new file mode 100644
index 000000000..1922e7ffa
--- /dev/null
+++ b/src/app/accounting/closing-entries/closing-entries.component.scss
@@ -0,0 +1,3 @@
+table {
+ width: 100%;
+}
diff --git a/src/app/accounting/closing-entries/closing-entries.component.spec.ts b/src/app/accounting/closing-entries/closing-entries.component.spec.ts
new file mode 100644
index 000000000..5222b7e6d
--- /dev/null
+++ b/src/app/accounting/closing-entries/closing-entries.component.spec.ts
@@ -0,0 +1,25 @@
+import { async, ComponentFixture, TestBed } from '@angular/core/testing';
+
+import { ClosingEntriesComponent } from './closing-entries.component';
+
+describe('ClosingEntriesComponent', () => {
+ let component: ClosingEntriesComponent;
+ let fixture: ComponentFixture;
+
+ beforeEach(async(() => {
+ TestBed.configureTestingModule({
+ declarations: [ ClosingEntriesComponent ]
+ })
+ .compileComponents();
+ }));
+
+ beforeEach(() => {
+ fixture = TestBed.createComponent(ClosingEntriesComponent);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ });
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+});
diff --git a/src/app/accounting/closing-entries/closing-entries.component.ts b/src/app/accounting/closing-entries/closing-entries.component.ts
new file mode 100644
index 000000000..84ff590d7
--- /dev/null
+++ b/src/app/accounting/closing-entries/closing-entries.component.ts
@@ -0,0 +1,63 @@
+import { Component, OnInit, ViewChild } from '@angular/core';
+import { MatPaginator, MatSort, MatTableDataSource } from '@angular/material';
+import { FormControl } from '@angular/forms';
+import { startWith, map, tap } from 'rxjs/operators';
+
+import { AccountingService } from '../accounting.service';
+
+@Component({
+ selector: 'mifosx-closing-entries',
+ templateUrl: './closing-entries.component.html',
+ styleUrls: ['./closing-entries.component.scss']
+})
+export class ClosingEntriesComponent implements OnInit {
+
+ displayedColumns: string[] = ['officeName', 'closingDate', 'comments', 'createdByUsername'];
+ dataSource: any;
+
+ officeName = new FormControl();
+ officeData: any;
+ filteredOfficeData: any;
+
+ @ViewChild(MatPaginator) paginator: MatPaginator;
+ @ViewChild(MatSort) sort: MatSort;
+
+ constructor(private accountingService: AccountingService) { }
+
+ ngOnInit() {
+ this.getOffices();
+ this.applyFilter();
+ this.getAccountingClosures();
+ }
+
+ applyFilter() {
+ this.officeName.valueChanges.subscribe((filterValue: string) => {
+ this.dataSource.filter = filterValue.trim().toLowerCase();
+ });
+ }
+
+ getAccountingClosures() {
+ this.accountingService.getAccountingClosures().subscribe((glAccountClosureData: any) => {
+ this.dataSource = new MatTableDataSource(glAccountClosureData);
+ this.dataSource.paginator = this.paginator;
+ this.dataSource.sort = this.sort;
+ });
+ }
+
+ getOffices() {
+ this.accountingService.getOffices().subscribe(officeData => {
+ this.officeData = officeData;
+ this.filteredOfficeData = this.officeName.valueChanges
+ .pipe(
+ startWith(''),
+ map((office: any) => typeof office === 'string' ? office : office.name),
+ map((officeName: string) => officeName ? this.filterOfficeAutocompleteData(this.officeData, officeName) : this.officeData)
+ );
+ });
+ }
+
+ private filterOfficeAutocompleteData(officeData: any, officeName: string): any {
+ return officeData.filter((office: any) => office.name.toLowerCase().includes(officeName.toLowerCase()));
+ }
+
+}