Skip to content
This repository has been archived by the owner on Jan 11, 2024. It is now read-only.

Commit

Permalink
Merge pull request #45 from markvanveen/develop
Browse files Browse the repository at this point in the history
Financial Condition Report
  • Loading branch information
markvanveen committed Oct 12, 2017
2 parents 5aedaa8 + 0cf4c62 commit 21ab3ba
Show file tree
Hide file tree
Showing 16 changed files with 294 additions and 9 deletions.
4 changes: 3 additions & 1 deletion src/app/accounting/accounting.module.ts
Expand Up @@ -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: [
Expand Down Expand Up @@ -171,7 +172,8 @@ import {IncomeStatementComponent} from './incomeStatement/income-statement.compo
CreatePayrollFormComponent,
PayrollFormComponent,
PaymentsListComponent,
IncomeStatementComponent
IncomeStatementComponent,
FinancialConditionComponent
],
providers: [
CommandsResolver,
Expand Down
6 changes: 6 additions & 0 deletions src/app/accounting/accounting.routing.ts
Expand Up @@ -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},
Expand Down Expand Up @@ -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,
Expand Down
@@ -0,0 +1,135 @@
<!--
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.
-->

<fims-layout-card-over title="{{'Financial condition' | translate}}" [navigateBackTo]="['../']">
<div layout="row">
<table td-data-table *ngIf="financialCondition$ | async as financialCondition">
<ng-container *ngIf="assets$ | async as assets">
<tr td-data-table-row>
<td td-data-table-cell>
<b translate>Assets</b>
</td>
<td td-data-table-cell></td>
<td td-data-table-cell></td>
</tr>
<tr td-data-table-row *ngFor="let entry of assets.financialConditionEntries">
<td td-data-table-cell></td>
<td td-data-table-cell>
{{entry.description}}
</td>
<td td-data-table-cell>
{{entry.value | displayFimsFinancialNumber}}
</td>
</tr>
<tr td-data-table-row>
<td td-data-table-cell>
<i translate>Subtotal</i>
</td>
<td td-data-table-cell></td>
<td td-data-table-cell>
<i class="double-underline">
{{assets.subtotal | displayFimsFinancialNumber}}
</i>
</td>
</tr>
<tr td-data-table-row></tr>
<tr td-data-table-row>
<td td-data-table-cell>
<b translate>Total Assets</b>
</td>
<td td-data-table-cell></td>
<td td-data-table-cell>
<b class="double-underline">
{{financialCondition.totalAssets | displayFimsFinancialNumber}}
</b>
</td>
</tr>
<tr td-data-table-row></tr>
</ng-container>
<ng-container *ngIf="equities$ | async as equities">
<tr td-data-table-row>
<td td-data-table-cell>
<b translate>Equities</b>
</td>
<td td-data-table-cell></td>
<td td-data-table-cell></td>
</tr>
<tr td-data-table-row *ngFor="let entry of equities.financialConditionEntries">
<td td-data-table-cell></td>
<td td-data-table-cell>
{{entry.description}}
</td>
<td td-data-table-cell>
{{entry.value | displayFimsFinancialNumber}}
</td>
</tr>
<tr td-data-table-row>
<td td-data-table-cell>
<i translate>Subtotal</i>
</td>
<td td-data-table-cell></td>
<td td-data-table-cell>
<i class="double-underline">
{{equities.subtotal | displayFimsFinancialNumber}}
</i>
</td>
</tr>
<tr td-data-table-row></tr>
</ng-container>
<ng-container *ngIf="liabilities$ | async as liabilities">
<tr td-data-table-row>
<td td-data-table-cell>
<b translate>Liabilities</b>
</td>
<td td-data-table-cell></td>
<td td-data-table-cell></td>
</tr>
<tr td-data-table-row *ngFor="let entry of liabilities.financialConditionEntries">
<td td-data-table-cell></td>
<td td-data-table-cell>
{{entry.description}}
</td>
<td td-data-table-cell>
{{entry.value | displayFimsFinancialNumber}}
</td>
</tr>
<tr td-data-table-row>
<td td-data-table-cell>
<i translate>Subtotal</i>
</td>
<td td-data-table-cell></td>
<td td-data-table-cell>
<i class="double-underline">
{{liabilities.subtotal | displayFimsFinancialNumber}}
</i>
</td>
</tr>
<tr td-data-table-row></tr>
<tr td-data-table-row>
<td td-data-table-cell>
<b translate>Total Equities and Liabilities</b>
</td>
<td td-data-table-cell></td>
<td td-data-table-cell>
<b class="double-underline">
{{financialCondition.totalEquitiesAndLiabilities | displayFimsFinancialNumber}}
</b>
</td>
</tr>
</ng-container>
</table>
</div>
</fims-layout-card-over>
@@ -0,0 +1,3 @@
.double-underline {
border-bottom: 3px double;
}
@@ -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<FinancialCondition>;

assets$: Observable<FinancialConditionSection>;

equities$: Observable<FinancialConditionSection>;

liabilities$: Observable<FinancialConditionSection>;

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')
);
}
}
5 changes: 5 additions & 0 deletions src/app/accounting/general-ledger.component.html
Expand Up @@ -48,6 +48,11 @@ <h3 md-line translate>Trial balance</h3>
<h3 md-line translate>Income statement</h3>
<p md-line translate>View income statement</p>
</a>
<a md-list-item [routerLink]="['./financialCondition']" *hasPermission="{ id: 'accounting_fin_condition', accessLevel: 'READ'}">
<md-icon md-list-avatar>timeline</md-icon>
<h3 md-line translate>Financial condition</h3>
<p md-line translate>View financial condition</p>
</a>
<a md-list-item [routerLink]="['./payrolls']" *hasPermission="{ id: 'payroll_distribution', accessLevel: 'READ' }">
<md-icon md-list-avatar>receipt</md-icon>
<h3 md-line translate>Payrolls</h3>
Expand Down
12 changes: 6 additions & 6 deletions src/app/accounting/trailBalance/trail-balance.component.html
Expand Up @@ -24,29 +24,29 @@
<span translate>Ledger</span>
</th>
<th td-data-table-column>
<span translate>Credit</span>
<span translate>Debit</span>
</th>
<th td-data-table-column>
<span translate>Debit</span>
<span translate>Credit</span>
</th>
<tr td-data-table-row *ngFor="let row of (trialBalance$ | async)?.trialBalanceEntries">
<td td-data-table-cell>
<a [routerLink]="['../ledgers/detail', row['ledger'].identifier]" *hasPermission="{ id: 'accounting_ledgers', accessLevel: 'READ' }">{{row['ledger'].identifier }} - {{row['ledger'].name }}</a>
</td>
<td td-data-table-cell>
{{row['type'] == 'CREDIT' ? (row['amount'] | number) : '-'}}
{{row['type'] == 'DEBIT' ? (row['amount'] | number): '-'}}
</td>
<td td-data-table-cell>
{{row['type'] == 'DEBIT' ? (row['amount'] | number): '-'}}
{{row['type'] == 'CREDIT' ? (row['amount'] | number) : '-'}}
</td>
</tr>
<tr td-data-table-row>
<td td-data-table-cell translate>Total</td>
<td td-data-table-cell>
{{(trialBalance$ | async)?.creditTotal | number}}
{{(trialBalance$ | async)?.debitTotal | number}}
</td>
<td td-data-table-cell>
{{(trialBalance$ | async)?.debitTotal | number}}
{{(trialBalance$ | async)?.creditTotal | number}}
</td>
</tr>
</table>
Expand Down
2 changes: 1 addition & 1 deletion src/app/common/date-input/date-input.component.ts
Expand Up @@ -29,7 +29,7 @@ export class DateInputComponent {

@Input() form: FormGroup;

@Input() title: string;
@Input() title = '';

get hasRequiredError(): boolean {
return this.hasError('required');
Expand Down
2 changes: 1 addition & 1 deletion src/app/common/text-input/text-input.component.ts
Expand Up @@ -36,7 +36,7 @@ export class TextInputComponent {

@Input() hideIfDisabled = false;

@Input() title: string;
@Input() title = '';

get hasRequiredError(): boolean {
return this.hasError('required');
Expand Down
5 changes: 5 additions & 0 deletions src/app/services/accounting/accounting.service.ts
Expand Up @@ -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 {
Expand Down Expand Up @@ -191,4 +192,8 @@ export class AccountingService {
return this.http.get(`${this.baseUrl}/incomestatement`);
}

public getFinancialCondition(): Observable<FinancialCondition> {
return this.http.get(`${this.baseUrl}/financialcondition`);
}

}
@@ -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;
}
@@ -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;
}
23 changes: 23 additions & 0 deletions 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;
}
Expand Up @@ -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';
}

0 comments on commit 21ab3ba

Please sign in to comment.