Hi All

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.

After all

 * 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 https://github.com/christopherlam/gnucash/tree/maint-create-API-call-for-noclosing-balances - 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 https://github.com/christopherlam/gnucash/tree/maint-create-API-call-for-noclosing-balances - 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 https://github.com/christopherlam/gnucash/tree/maint-create-API-call-for-noclosing-balances 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.

_______________________________________________
gnucash-devel mailing list
gnucash-devel@gnucash.org
https://lists.gnucash.org/mailman/listinfo/gnucash-devel

Reply via email to