diff --git a/client/src/containers/FinancialStatements/reducers.js b/client/src/containers/FinancialStatements/reducers.js index 6af950eea..5d07b81b9 100644 --- a/client/src/containers/FinancialStatements/reducers.js +++ b/client/src/containers/FinancialStatements/reducers.js @@ -140,6 +140,14 @@ export const profitLossSheetReducer = (profitLoss) => { ], }); } + if (profitLoss.net_other_income) { + results.push({ + name: 'Net other income', + total: profitLoss.net_other_income.total, + total_periods: profitLoss.net_other_income.total_periods, + rowTypes: ['net_other_income', 'section_total', 'total'], + }); + } if (profitLoss.net_income) { results.push({ name: 'Net Income', @@ -209,6 +217,7 @@ export const generalLedgerTableRowsReducer = (accounts) => { ...account.opening_balance, name: 'Opening balance', rowType: 'OPENING_BALANCE', + date: moment(account.opening_balance.date).format('DD MMM YYYY'), }, ...account.transactions.map((transaction) => ({ ...transaction, @@ -220,8 +229,11 @@ export const generalLedgerTableRowsReducer = (accounts) => { ...account.closing_balance, name: 'Closing balance', rowType: 'CLOSING_BALANCE', + date: moment(account.closing_balance.date).format('DD MMM YYYY'), }, ], + amount: account.closing_balance.amount, + formatted_amount: account.closing_balance.formatted_amount, }; }) .value(); diff --git a/client/src/style/pages/FinancialStatements/BalanceSheet.scss b/client/src/style/pages/FinancialStatements/BalanceSheet.scss index 10a7a3462..90b59ca54 100644 --- a/client/src/style/pages/FinancialStatements/BalanceSheet.scss +++ b/client/src/style/pages/FinancialStatements/BalanceSheet.scss @@ -36,7 +36,7 @@ .tr.is-expanded{ .td.total, .td.total-period{ - > span.cell-text{ + .cell-text{ display: none; } } diff --git a/client/src/style/pages/FinancialStatements/GeneralLedger.scss b/client/src/style/pages/FinancialStatements/GeneralLedger.scss index 1966a177e..a50936220 100644 --- a/client/src/style/pages/FinancialStatements/GeneralLedger.scss +++ b/client/src/style/pages/FinancialStatements/GeneralLedger.scss @@ -34,6 +34,18 @@ .tr:not(.no-results) .td{ border-left: 1px solid #ececec; } + + .tr{ + &.is-expanded{ + + .td.amount{ + + .cell-inner{ + display: none + } + } + } + } .tr.row-type{ diff --git a/client/src/style/pages/FinancialStatements/ProfitLossSheet.scss b/client/src/style/pages/FinancialStatements/ProfitLossSheet.scss index a90bbe12a..44e394406 100644 --- a/client/src/style/pages/FinancialStatements/ProfitLossSheet.scss +++ b/client/src/style/pages/FinancialStatements/ProfitLossSheet.scss @@ -31,7 +31,7 @@ .tr.is-expanded{ .td.total, .td.total-period{ - > span{ + .cell-text{ display: none; } } diff --git a/server/src/interfaces/ProfitLossSheet.ts b/server/src/interfaces/ProfitLossSheet.ts index ce3e849a0..df58c14c7 100644 --- a/server/src/interfaces/ProfitLossSheet.ts +++ b/server/src/interfaces/ProfitLossSheet.ts @@ -53,6 +53,7 @@ export interface IProfitLossSheetStatement { otherIncome: IProfitLossSheetAccountsSection, netIncome: IProfitLossSheetTotalSection; operatingProfit: IProfitLossSheetTotalSection; + netOtherIncome: IProfitLossSheetTotalSection, grossProfit: IProfitLossSheetTotalSection; }; diff --git a/server/src/services/FinancialStatements/ProfitLossSheet/ProfitLossSheet.ts b/server/src/services/FinancialStatements/ProfitLossSheet/ProfitLossSheet.ts index 6f1478570..9073aae22 100644 --- a/server/src/services/FinancialStatements/ProfitLossSheet/ProfitLossSheet.ts +++ b/server/src/services/FinancialStatements/ProfitLossSheet/ProfitLossSheet.ts @@ -52,7 +52,9 @@ export default class ProfitLossSheet extends FinancialSheet { } get otherIncomeAccounts() { - return this.accounts.filter((a) => a.accountType === ACCOUNT_TYPE.OTHER_INCOME); + return this.accounts.filter( + (a) => a.accountType === ACCOUNT_TYPE.OTHER_INCOME + ); } /** @@ -76,7 +78,9 @@ export default class ProfitLossSheet extends FinancialSheet { * @return {IAccount & { type: IAccountType }[]}} */ get otherExpensesAccounts() { - return this.accounts.filter((a) => a.accountType === ACCOUNT_TYPE.OTHER_EXPENSE); + return this.accounts.filter( + (a) => a.accountType === ACCOUNT_TYPE.OTHER_EXPENSE + ); } /** @@ -84,7 +88,9 @@ export default class ProfitLossSheet extends FinancialSheet { * @return {IAccount & { type: IAccountType }[]} */ get costOfSalesAccounts() { - return this.accounts.filter((a) => a.accountType === ACCOUNT_TYPE.COST_OF_GOODS_SOLD); + return this.accounts.filter( + (a) => a.accountType === ACCOUNT_TYPE.COST_OF_GOODS_SOLD + ); } /** @@ -244,8 +250,8 @@ export default class ProfitLossSheet extends FinancialSheet { return { name: 'Other Income', entryNormal: 'credit', - ...this.sectionMapper(this.otherIncomeAccounts) - } + ...this.sectionMapper(this.otherIncomeAccounts), + }; } /** @@ -369,12 +375,16 @@ export default class ProfitLossSheet extends FinancialSheet { const grossProfit = this.getSummarySection(income, costOfSales); // - Operating profit = Gross profit - Expenses. - const operatingProfit = this.getSummarySection(grossProfit, [ - expenses, - costOfSales, - ]); - // - Net income = Operating profit - Other expenses. - const netIncome = this.getSummarySection(operatingProfit, otherExpenses); + const operatingProfit = this.getSummarySection(grossProfit, expenses); + + // Net other income = Other income - other expenses. + const netOtherIncome = this.getSummarySection(otherIncome, otherExpenses); + + // - Net income = (Operating profit + other income) - Other expenses. + const netIncome = this.getSummarySection( + [operatingProfit, netOtherIncome], + [], + ); return { income, @@ -383,8 +393,9 @@ export default class ProfitLossSheet extends FinancialSheet { expenses, otherIncome, otherExpenses, - netIncome, operatingProfit, + netOtherIncome, + netIncome, }; }