diff --git a/src/app/accounting/accounting-routing.module.ts b/src/app/accounting/accounting-routing.module.ts
index 5d02709ab..5df66c81d 100644
--- a/src/app/accounting/accounting-routing.module.ts
+++ b/src/app/accounting/accounting-routing.module.ts
@@ -6,6 +6,7 @@ import { AccountingComponent } from './accounting.component';
import { FrequentPostingsComponent } from './frequent-postings/frequent-postings.component';
import { ViewTransactionComponent } from './view-transaction/view-transaction.component';
import { CreateJournalEntryComponent } from './create-journal-entry/create-journal-entry.component';
+import { SearchJournalEntryComponent } from './search-journal-entry/search-journal-entry.component';
const routes: Routes = [
Route.withShell([
@@ -33,6 +34,11 @@ const routes: Routes = [
}
]
},
+ {
+ path: 'journal-entries',
+ component: SearchJournalEntryComponent,
+ data: { title: extract('Search Journal Entry'), breadcrumb: 'Search Journal Entry' }
+ },
{
path: 'journal-entries/create',
component: CreateJournalEntryComponent,
diff --git a/src/app/accounting/accounting.component.html b/src/app/accounting/accounting.component.html
index 55db81f90..67a179cc3 100644
--- a/src/app/accounting/accounting.component.html
+++ b/src/app/accounting/accounting.component.html
@@ -18,11 +18,9 @@
Manual journal entry transactions recorded in a journal
-
+
search
-
- Search Journal Entries
-
+ Search Journal Entries
Advanced search option for journal entries
diff --git a/src/app/accounting/accounting.module.ts b/src/app/accounting/accounting.module.ts
index c33f805db..0907620b0 100644
--- a/src/app/accounting/accounting.module.ts
+++ b/src/app/accounting/accounting.module.ts
@@ -10,6 +10,7 @@ import { ViewTransactionComponent } from './view-transaction/view-transaction.co
import { RevertTransactionComponent } from './revert-transaction/revert-transaction.component';
import { ViewJournalEntryComponent } from './view-journal-entry/view-journal-entry.component';
import { CreateJournalEntryComponent } from './create-journal-entry/create-journal-entry.component';
+import { SearchJournalEntryComponent } from './search-journal-entry/search-journal-entry.component';
@NgModule({
imports: [
@@ -24,7 +25,8 @@ import { CreateJournalEntryComponent } from './create-journal-entry/create-journ
ViewTransactionComponent,
RevertTransactionComponent,
ViewJournalEntryComponent,
- CreateJournalEntryComponent
+ CreateJournalEntryComponent,
+ SearchJournalEntryComponent
],
entryComponents: [
RevertTransactionComponent,
diff --git a/src/app/accounting/accounting.service.ts b/src/app/accounting/accounting.service.ts
index adf6f75a9..1a0de68f3 100644
--- a/src/app/accounting/accounting.service.ts
+++ b/src/app/accounting/accounting.service.ts
@@ -36,6 +36,10 @@ export class AccountingService {
return this.http.get(`/journalentries`, { params: httpParams });
}
+ getJournalEntries() {
+ return this.http.get('/journalentries');
+ }
+
revertTransaction(transactionId: string, comments: string) {
let httpParams = new HttpParams();
httpParams = httpParams.set('command', 'reverse');
diff --git a/src/app/accounting/search-journal-entry/search-journal-entry.component.html b/src/app/accounting/search-journal-entry/search-journal-entry.component.html
new file mode 100644
index 000000000..06a365f82
--- /dev/null
+++ b/src/app/accounting/search-journal-entry/search-journal-entry.component.html
@@ -0,0 +1,106 @@
+
+
+
+
+ {{ office.name }}
+
+
+
+
+
+
+ {{ affectedGLEntryDebit.name + ' (' + affectedGLEntryDebit.glCode + ')' }}
+
+
+
+
+
+
+ {{ filter.option }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ | Entry ID |
+ {{ transaction.id }} |
+
+
+
+ Office |
+ {{ transaction.officeName }} |
+
+
+
+ Transaction ID |
+ {{ transaction.transactionId }} |
+
+
+
+ Transaction Date |
+ {{ transaction.transactionDate }} |
+
+
+
+ Type |
+ {{ transaction.glAccountType.value }} |
+
+
+
+ Created by |
+ {{ transaction.createdByUserName }} |
+
+
+
+ Account Code |
+ {{ transaction.glAccountCode }} |
+
+
+
+ Account Name |
+ {{ transaction.glAccountName }} |
+
+
+
+ Debit |
+ {{ (transaction.currency.displaySymbol || transaction.currency.code) + ' ' + transaction.amount }} |
+
+
+
+ Credit |
+ {{ (transaction.currency.displaySymbol || transaction.currency.code) + ' ' + transaction.amount }} |
+
+
+
+
+
+
+
+
+
+
diff --git a/src/app/accounting/search-journal-entry/search-journal-entry.component.scss b/src/app/accounting/search-journal-entry/search-journal-entry.component.scss
new file mode 100644
index 000000000..1922e7ffa
--- /dev/null
+++ b/src/app/accounting/search-journal-entry/search-journal-entry.component.scss
@@ -0,0 +1,3 @@
+table {
+ width: 100%;
+}
diff --git a/src/app/accounting/search-journal-entry/search-journal-entry.component.spec.ts b/src/app/accounting/search-journal-entry/search-journal-entry.component.spec.ts
new file mode 100644
index 000000000..32ed3373f
--- /dev/null
+++ b/src/app/accounting/search-journal-entry/search-journal-entry.component.spec.ts
@@ -0,0 +1,25 @@
+import { async, ComponentFixture, TestBed } from '@angular/core/testing';
+
+import { SearchJournalEntryComponent } from './search-journal-entry.component';
+
+describe('SearchJournalEntryComponent', () => {
+ let component: SearchJournalEntryComponent;
+ let fixture: ComponentFixture;
+
+ beforeEach(async(() => {
+ TestBed.configureTestingModule({
+ declarations: [ SearchJournalEntryComponent ]
+ })
+ .compileComponents();
+ }));
+
+ beforeEach(() => {
+ fixture = TestBed.createComponent(SearchJournalEntryComponent);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ });
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+});
diff --git a/src/app/accounting/search-journal-entry/search-journal-entry.component.ts b/src/app/accounting/search-journal-entry/search-journal-entry.component.ts
new file mode 100644
index 000000000..a5eef7def
--- /dev/null
+++ b/src/app/accounting/search-journal-entry/search-journal-entry.component.ts
@@ -0,0 +1,100 @@
+import { Component, OnInit, ViewChild } from '@angular/core';
+import { MatPaginator, MatSort, MatTableDataSource } from '@angular/material';
+import { FormControl } from '@angular/forms';
+import { Router } from '@angular/router';
+
+import { AccountingService } from '../accounting.service';
+
+@Component({
+ selector: 'mifosx-search-journal-entry',
+ templateUrl: './search-journal-entry.component.html',
+ styleUrls: ['./search-journal-entry.component.scss']
+})
+export class SearchJournalEntryComponent implements OnInit {
+
+ officeName = new FormControl();
+ glAccountCode = new FormControl();
+ transactionDateFrom = new FormControl(new Date(2000, 0, 1));
+ transactionDateTo = new FormControl(new Date());
+ transactionId = new FormControl();
+ minDate = new Date(2000, 0, 1);
+ maxDate = new Date();
+ filter = new FormControl('');
+ displayedColumns: string[] = ['id', 'officeName', 'transactionId', 'transactionDate', 'glAccountType', 'createdByUserName', 'glAccountCode', 'glAccountName', 'debit', 'credit'];
+ dataSource: any;
+ officeData: any;
+ glAccountData: any;
+ filterData = [
+ {
+ option: 'All',
+ value: ''
+ },
+ {
+ option: 'Manual Entries',
+ value: true
+ },
+ {
+ option: 'System Entries',
+ value: false
+ }
+ ];
+ filterValue: any = { officeName: '', glAccountCode: '', filter: '', transactionId: '' };
+
+ @ViewChild(MatPaginator) paginator: MatPaginator;
+ @ViewChild(MatSort) sort: MatSort;
+
+ constructor(private accountingService: AccountingService,
+ private router: Router) { }
+
+ ngOnInit() {
+ this.getOffices();
+ this.getGlAccounts();
+ this.getJournalEntries();
+ }
+
+ getJournalEntries() {
+ this.accountingService.getJournalEntries().subscribe((journalEntryData: any) => {
+ this.dataSource = new MatTableDataSource(journalEntryData.pageItems);
+ this.dataSource.paginator = this.paginator;
+ this.dataSource.sortingDataAccessor = (transaction: any, property: any) => {
+ switch (property) {
+ case 'glAccountType': return transaction.glAccountType.value;
+ case 'debit': return transaction.amount;
+ case 'credit': return transaction.amount;
+ default: return transaction[property];
+ }
+ };
+ this.dataSource.sort = this.sort;
+ this.dataSource.filterPredicate = this.filterPredicate;
+ });
+ }
+
+ filterPredicate(data: any, filterValue: string) {
+ return data.officeName.indexOf(filterValue['officeName']) != -1
+ && data.glAccountCode.indexOf(filterValue['glAccountCode']) != -1
+ && data.manualEntry.toString().indexOf(filterValue['filter']) != -1
+ && data.transactionId.indexOf(filterValue['transactionId']) != -1;
+ }
+
+ applyFilter(filterValue: string, property: string) {
+ this.filterValue[property] = filterValue;
+ this.dataSource.filter = this.filterValue;
+ }
+
+ getOffices() {
+ this.accountingService.getOffices().subscribe(officeData => {
+ this.officeData = officeData;
+ });
+ }
+
+ getGlAccounts() {
+ this.accountingService.getGlAccounts().subscribe(glAccountData => {
+ this.glAccountData = glAccountData;
+ });
+ }
+
+ viewTransaction(journalEntry: any) {
+ this.router.navigate(['/accounting/transactions/view', journalEntry.transactionId]);
+ }
+
+}