feat: Computed Net Income under Equity in Balance Sheet report. (#271)

This commit is contained in:
Ahmed Bouhuolia
2023-10-26 18:59:09 +02:00
committed by GitHub
parent 08ac5f4b01
commit e070ac72dd
27 changed files with 1463 additions and 253 deletions

View File

@@ -8,6 +8,10 @@ import {
BALANCE_SHEET_SCHEMA_NODE_TYPE,
IBalanceSheetDataNode,
IBalanceSheetSchemaNode,
IBalanceSheetNetIncomeNode,
IBalanceSheetAccountNode,
IBalanceSheetAccountsNode,
IBalanceSheetAggregateNode,
} from '@/interfaces';
import { tableRowMapper } from 'utils';
import FinancialSheet from '../FinancialSheet';
@@ -108,11 +112,13 @@ export default class BalanceSheetTable extends R.compose(
};
/**
*
* @param node
* Retrieves the table row from the given report aggregate node.
* @param {IBalanceSheetAggregateNode} node
* @returns {ITableRow}
*/
private aggregateNodeTableRowsMapper = (node): ITableRow => {
private aggregateNodeTableRowsMapper = (
node: IBalanceSheetAggregateNode
): ITableRow => {
const columns = this.commonColumnsAccessors();
const meta = {
rowTypes: [IROW_TYPE.AGGREGATE],
@@ -122,11 +128,13 @@ export default class BalanceSheetTable extends R.compose(
};
/**
*
* @param node
* Retrieves the table row from the given report accounts node.
* @param {IBalanceSheetAccountsNode} node
* @returns {ITableRow}
*/
private accountsNodeTableRowsMapper = (node): ITableRow => {
private accountsNodeTableRowsMapper = (
node: IBalanceSheetAccountsNode
): ITableRow => {
const columns = this.commonColumnsAccessors();
const meta = {
rowTypes: [IROW_TYPE.ACCOUNTS],
@@ -136,11 +144,13 @@ export default class BalanceSheetTable extends R.compose(
};
/**
*
* @param {} node
* Retrieves the table row from the given report account node.
* @param {IBalanceSheetAccountNode} node
* @returns {ITableRow}
*/
private accountNodeTableRowsMapper = (node): ITableRow => {
private accountNodeTableRowsMapper = (
node: IBalanceSheetAccountNode
): ITableRow => {
const columns = this.commonColumnsAccessors();
const meta = {
@@ -150,6 +160,22 @@ export default class BalanceSheetTable extends R.compose(
return tableRowMapper(node, columns, meta);
};
/**
* Retrieves the table row from the given report net income node.
* @param {IBalanceSheetNetIncomeNode} node
* @returns {ITableRow}
*/
private netIncomeNodeTableRowsMapper = (
node: IBalanceSheetNetIncomeNode
): ITableRow => {
const columns = this.commonColumnsAccessors();
const meta = {
rowTypes: [IROW_TYPE.NET_INCOME],
id: node.id,
};
return tableRowMapper(node, columns, meta);
};
/**
* Mappes the given report node to table rows.
* @param {IBalanceSheetDataNode} node -
@@ -169,6 +195,10 @@ export default class BalanceSheetTable extends R.compose(
this.isNodeType(BALANCE_SHEET_SCHEMA_NODE_TYPE.ACCOUNT),
this.accountNodeTableRowsMapper,
],
[
this.isNodeType(BALANCE_SHEET_SCHEMA_NODE_TYPE.NET_INCOME),
this.netIncomeNodeTableRowsMapper,
],
])(node);
};