[GNC-dev] New balsheet (and P&L report), API considerations, and (slow?) KVP in Account.cpp
christopher.lck at gmail.com
Sat Jun 23 00:42:53 EDT 2018
I'm working through balance-sheet.scm and overhauling this report.
At the same time, I can see that balance-sheet.scm and
income-statement.scm can be merged together.
* balance sheet = asset/liability/equity balance at date X,
* income statement = difference in income/expense balances at date X and Y
The issue I have is that the balance sheet can call
xaccAccountGetBalanceAsOfDate(acc,date) directly to nicely retrieve the
balance, whereas income statement cannot directly call it because it
also includes closing transactions.
My proposal is to augment xaccAccountGetBalanceAsOfDate to accept a 3rd
boolean argument i.e.
xaccAccountGetBalanceAsOfDate(acc,date,ignoreclosing) which will
selectively produce the balance, ignore closing transactions.
This is partly done in the last commit of
- it will augment API everywhere, and also modify Account.cpp,
especially xaccAccountRecomputeBalance which will call
xaccTransGetIsClosingTxn(xaccSplitGetParent(split)) for each split in
the account to determine closing status and cache the balances for each
split. See draft on
- this currently fails because I'm not good at C.
*My query is whether it will be too expensive to call
xaccTransGetIsClosingTxn for each split in Account.cpp to produce the
split->noclosing_balance, which will be crucial to calculate income
between two dates.*
*Currently this 'closing-txn' filter is done in income-statement.scm via
a "Closing Entries" string/regex filter and xaccTransGetIsClosingTxn
calls, which IMHO is not ideal either.
Any help welcome!
P.S. if this last commit is removed, the
branch contains work-so-far for updated balance-sheet. Screenshot
https://screenshots.firefox.com/eelmGQrGCtcP6bqC/null - see the
multilevel subtotals were previously horizonal, are now vertical;
original-currency amounts, and multiple-date balance sheets.
More information about the gnucash-devel