From 1b8954e46dc26d2a3c205377b213f07d85b90b58 Mon Sep 17 00:00:00 2001 From: Mark Date: Thu, 12 Oct 2017 12:43:06 +0200 Subject: [PATCH 1/3] Set title to empty string to prevent displaying undefined when not title is given --- src/app/common/date-input/date-input.component.ts | 2 +- src/app/common/text-input/text-input.component.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/common/date-input/date-input.component.ts b/src/app/common/date-input/date-input.component.ts index a92a732b..ca35a7e5 100644 --- a/src/app/common/date-input/date-input.component.ts +++ b/src/app/common/date-input/date-input.component.ts @@ -29,7 +29,7 @@ export class DateInputComponent { @Input() form: FormGroup; - @Input() title: string; + @Input() title = ''; get hasRequiredError(): boolean { return this.hasError('required'); diff --git a/src/app/common/text-input/text-input.component.ts b/src/app/common/text-input/text-input.component.ts index 8728cc8f..a3208872 100644 --- a/src/app/common/text-input/text-input.component.ts +++ b/src/app/common/text-input/text-input.component.ts @@ -36,7 +36,7 @@ export class TextInputComponent { @Input() hideIfDisabled = false; - @Input() title: string; + @Input() title = ''; get hasRequiredError(): boolean { return this.hasError('required'); From e0d4d7d06af473a309a77d6cd4c7abc8eb952563 Mon Sep 17 00:00:00 2001 From: Mark Date: Thu, 12 Oct 2017 12:43:40 +0200 Subject: [PATCH 2/3] Change order of credit/debit column to be consistent --- .../trailBalance/trail-balance.component.html | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/app/accounting/trailBalance/trail-balance.component.html b/src/app/accounting/trailBalance/trail-balance.component.html index d75b41da..6266e6f1 100644 --- a/src/app/accounting/trailBalance/trail-balance.component.html +++ b/src/app/accounting/trailBalance/trail-balance.component.html @@ -24,29 +24,29 @@ Ledger - Credit + Debit - Debit + Credit {{row['ledger'].identifier }} - {{row['ledger'].name }} - {{row['type'] == 'CREDIT' ? (row['amount'] | number) : '-'}} + {{row['type'] == 'DEBIT' ? (row['amount'] | number): '-'}} - {{row['type'] == 'DEBIT' ? (row['amount'] | number): '-'}} + {{row['type'] == 'CREDIT' ? (row['amount'] | number) : '-'}} Total - {{(trialBalance$ | async)?.creditTotal | number}} + {{(trialBalance$ | async)?.debitTotal | number}} - {{(trialBalance$ | async)?.debitTotal | number}} + {{(trialBalance$ | async)?.creditTotal | number}} From 0cf4c62d05ec1e7b819eb66fc3d37d92706e3da2 Mon Sep 17 00:00:00 2001 From: Mark Date: Thu, 12 Oct 2017 12:44:09 +0200 Subject: [PATCH 3/3] Add financial condition report --- src/app/accounting/accounting.module.ts | 4 +- src/app/accounting/accounting.routing.ts | 6 + .../financial-condition.component.html | 135 ++++++++++++++++++ .../financial-condition.component.scss | 3 + .../financial-condition.component.ts | 54 +++++++ .../accounting/general-ledger.component.html | 5 + .../services/accounting/accounting.service.ts | 5 + .../domain/financial-condition-entry.model.ts | 20 +++ .../financial-condition-section.model.ts | 26 ++++ .../domain/financial-condition.model.ts | 23 +++ .../domain/permittable-group-ids.ts | 1 + .../security/authz/permission-id.type.ts | 1 + .../authz/permittable-group-id-mapper.ts | 4 + 13 files changed, 286 insertions(+), 1 deletion(-) create mode 100644 src/app/accounting/financialCondition/financial-condition.component.html create mode 100644 src/app/accounting/financialCondition/financial-condition.component.scss create mode 100644 src/app/accounting/financialCondition/financial-condition.component.ts create mode 100644 src/app/services/accounting/domain/financial-condition-entry.model.ts create mode 100644 src/app/services/accounting/domain/financial-condition-section.model.ts create mode 100644 src/app/services/accounting/domain/financial-condition.model.ts diff --git a/src/app/accounting/accounting.module.ts b/src/app/accounting/accounting.module.ts index 950e9382..b524d4b2 100644 --- a/src/app/accounting/accounting.module.ts +++ b/src/app/accounting/accounting.module.ts @@ -92,6 +92,7 @@ import {PayrollCollectionNotificationEffects} from './store/payroll/effects/noti import {PaymentsListComponent} from './payroll/payments.list.component'; import {CreateJournalEntryFormComponent} from './journalEntries/form/create.form.component'; import {IncomeStatementComponent} from './incomeStatement/income-statement.component'; +import {FinancialConditionComponent} from './financialCondition/financial-condition.component'; @NgModule({ imports: [ @@ -171,7 +172,8 @@ import {IncomeStatementComponent} from './incomeStatement/income-statement.compo CreatePayrollFormComponent, PayrollFormComponent, PaymentsListComponent, - IncomeStatementComponent + IncomeStatementComponent, + FinancialConditionComponent ], providers: [ CommandsResolver, diff --git a/src/app/accounting/accounting.routing.ts b/src/app/accounting/accounting.routing.ts index 23b2ae5c..5b21879e 100644 --- a/src/app/accounting/accounting.routing.ts +++ b/src/app/accounting/accounting.routing.ts @@ -43,6 +43,7 @@ import {CreatePayrollFormComponent} from './payroll/form/create.form.component'; import {PaymentsListComponent} from './payroll/payments.list.component'; import {CreateJournalEntryFormComponent} from './journalEntries/form/create.form.component'; import {IncomeStatementComponent} from './incomeStatement/income-statement.component'; +import {FinancialConditionComponent} from './financialCondition/financial-condition.component'; export const AccountingRoutes: Routes = [ {path: '', component: GeneralLedgerComponent}, @@ -129,6 +130,11 @@ export const AccountingRoutes: Routes = [ component: IncomeStatementComponent, data: {hasPermission: {id: 'accounting_income_statement', accessLevel: 'READ'}} }, + { + path: 'financialCondition', + component: FinancialConditionComponent, + data: {hasPermission: {id: 'accounting_fin_condition', accessLevel: 'READ'}} + }, { path: 'transactiontypes', component: TransactionTypeListComponent, diff --git a/src/app/accounting/financialCondition/financial-condition.component.html b/src/app/accounting/financialCondition/financial-condition.component.html new file mode 100644 index 00000000..e7b119f4 --- /dev/null +++ b/src/app/accounting/financialCondition/financial-condition.component.html @@ -0,0 +1,135 @@ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Assets +
+ {{entry.description}} + + {{entry.value | displayFimsFinancialNumber}} +
+ Subtotal + + + {{assets.subtotal | displayFimsFinancialNumber}} + +
+ Total Assets + + + {{financialCondition.totalAssets | displayFimsFinancialNumber}} + +
+ Equities +
+ {{entry.description}} + + {{entry.value | displayFimsFinancialNumber}} +
+ Subtotal + + + {{equities.subtotal | displayFimsFinancialNumber}} + +
+ Liabilities +
+ {{entry.description}} + + {{entry.value | displayFimsFinancialNumber}} +
+ Subtotal + + + {{liabilities.subtotal | displayFimsFinancialNumber}} + +
+ Total Equities and Liabilities + + + {{financialCondition.totalEquitiesAndLiabilities | displayFimsFinancialNumber}} + +
+
+
diff --git a/src/app/accounting/financialCondition/financial-condition.component.scss b/src/app/accounting/financialCondition/financial-condition.component.scss new file mode 100644 index 00000000..3041f5b3 --- /dev/null +++ b/src/app/accounting/financialCondition/financial-condition.component.scss @@ -0,0 +1,3 @@ +.double-underline { + border-bottom: 3px double; +} diff --git a/src/app/accounting/financialCondition/financial-condition.component.ts b/src/app/accounting/financialCondition/financial-condition.component.ts new file mode 100644 index 00000000..6d30dc16 --- /dev/null +++ b/src/app/accounting/financialCondition/financial-condition.component.ts @@ -0,0 +1,54 @@ +/** + * Copyright 2017 The Mifos Initiative. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import {Component} from '@angular/core'; +import {AccountingService} from '../../services/accounting/accounting.service'; +import {FinancialCondition} from '../../services/accounting/domain/financial-condition.model'; +import {Observable} from 'rxjs/Observable'; +import {FinancialConditionSection} from '../../services/accounting/domain/financial-condition-section.model'; + +@Component({ + templateUrl: './financial-condition.component.html', + styleUrls: ['./financial-condition.component.scss'] +}) +export class FinancialConditionComponent { + + financialCondition$: Observable; + + assets$: Observable; + + equities$: Observable; + + liabilities$: Observable; + + constructor(private accountingService: AccountingService) { + this.financialCondition$ = accountingService.getFinancialCondition().share(); + + this.assets$ = this.financialCondition$ + .map(statement => statement.financialConditionSections + .find(section => section.type === 'ASSET') + ); + + this.equities$ = this.financialCondition$ + .map(statement => statement.financialConditionSections + .find(section => section.type === 'EQUITY') + ); + + this.liabilities$ = this.financialCondition$ + .map(statement => statement.financialConditionSections + .find(section => section.type === 'LIABILITY') + ); + } +} diff --git a/src/app/accounting/general-ledger.component.html b/src/app/accounting/general-ledger.component.html index d0e85d6a..e4725d04 100644 --- a/src/app/accounting/general-ledger.component.html +++ b/src/app/accounting/general-ledger.component.html @@ -48,6 +48,11 @@

Trial balance

Income statement

View income statement

+ + timeline +

Financial condition

+

View financial condition

+
receipt

Payrolls

diff --git a/src/app/services/accounting/accounting.service.ts b/src/app/services/accounting/accounting.service.ts index 972f6e4d..c8de88fa 100644 --- a/src/app/services/accounting/accounting.service.ts +++ b/src/app/services/accounting/accounting.service.ts @@ -33,6 +33,7 @@ import {TransactionType} from './domain/transaction-type.model'; import {TransactionTypePage} from './domain/transaction-type-page.model'; import {AccountType} from './domain/account-type.model'; import {IncomeStatement} from './domain/income-statement.model'; +import {FinancialCondition} from './domain/financial-condition.model'; @Injectable() export class AccountingService { @@ -191,4 +192,8 @@ export class AccountingService { return this.http.get(`${this.baseUrl}/incomestatement`); } + public getFinancialCondition(): Observable { + return this.http.get(`${this.baseUrl}/financialcondition`); + } + } diff --git a/src/app/services/accounting/domain/financial-condition-entry.model.ts b/src/app/services/accounting/domain/financial-condition-entry.model.ts new file mode 100644 index 00000000..a0e37c80 --- /dev/null +++ b/src/app/services/accounting/domain/financial-condition-entry.model.ts @@ -0,0 +1,20 @@ +/** + * Copyright 2017 The Mifos Initiative. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export interface FinancialConditionEntry { + description: string; + value: string; +} diff --git a/src/app/services/accounting/domain/financial-condition-section.model.ts b/src/app/services/accounting/domain/financial-condition-section.model.ts new file mode 100644 index 00000000..9f02ea71 --- /dev/null +++ b/src/app/services/accounting/domain/financial-condition-section.model.ts @@ -0,0 +1,26 @@ +/** + * Copyright 2017 The Mifos Initiative. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import {FinancialConditionEntry} from './financial-condition-entry.model'; + +export type Type = 'ASSET' | 'EQUITY' | 'LIABILITY'; + +export interface FinancialConditionSection { + type: Type; + description: string; + financialConditionEntries: FinancialConditionEntry[]; + subtotal: string; +} diff --git a/src/app/services/accounting/domain/financial-condition.model.ts b/src/app/services/accounting/domain/financial-condition.model.ts new file mode 100644 index 00000000..67903b8c --- /dev/null +++ b/src/app/services/accounting/domain/financial-condition.model.ts @@ -0,0 +1,23 @@ +/** + * Copyright 2017 The Mifos Initiative. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import {FinancialConditionSection} from './financial-condition-section.model'; + +export interface FinancialCondition { + date: string; + financialConditionSections: FinancialConditionSection[]; + totalAssets: string; + totalEquitiesAndLiabilities: string; +} diff --git a/src/app/services/accounting/domain/permittable-group-ids.ts b/src/app/services/accounting/domain/permittable-group-ids.ts index 037d62bc..e4ce45f6 100644 --- a/src/app/services/accounting/domain/permittable-group-ids.ts +++ b/src/app/services/accounting/domain/permittable-group-ids.ts @@ -20,4 +20,5 @@ export class AccountingPermittableGroupIds { public static readonly LEDGER_MANAGEMENT = 'accounting__v1__ledger'; public static readonly TRANSACTION_TYPES = 'accounting__v1__tx_types'; public static readonly THOTH_INCOME_STMT = 'accounting__v1__income_stmt'; + public static readonly THOTH_FIN_CONDITION = 'accounting__v1__fin_condition'; } diff --git a/src/app/services/security/authz/permission-id.type.ts b/src/app/services/security/authz/permission-id.type.ts index 94930961..fd9aa78c 100644 --- a/src/app/services/security/authz/permission-id.type.ts +++ b/src/app/services/security/authz/permission-id.type.ts @@ -21,6 +21,7 @@ export type PermissionId = 'identity_self' | 'identity_identities' | 'identity_r 'office_self' | 'office_offices' | 'office_employees' | 'customer_customers' | 'customer_tasks' | 'catalog_catalogs' | 'customer_identifications' | 'customer_portrait' | 'accounting_accounts' | 'accounting_ledgers' | 'accounting_journals' | 'accounting_tx_types' | 'accounting_income_statement' | + 'accounting_fin_condition' | 'portfolio_product_operations' | 'portfolio_loss_provision' | 'portfolio_products' | 'portfolio_cases' | 'deposit_definitions' | 'deposit_instances' | 'teller_management' | 'teller_operations' | diff --git a/src/app/services/security/authz/permittable-group-id-mapper.ts b/src/app/services/security/authz/permittable-group-id-mapper.ts index beea5eef..6f2caedf 100644 --- a/src/app/services/security/authz/permittable-group-id-mapper.ts +++ b/src/app/services/security/authz/permittable-group-id-mapper.ts @@ -72,6 +72,10 @@ export class PermittableGroupIdMapper { id: 'accounting_income_statement', label: 'Income statement' }; + this._permittableGroupMap[AccountingPermittableGroupIds.THOTH_FIN_CONDITION] = { + id: 'accounting_fin_condition', + label: 'Financial condition' + }; this._permittableGroupMap[PortfolioPermittableGroupIds.PRODUCT_OPERATIONS_MANAGEMENT] = { id: 'portfolio_product_operations',