[GNC-dev] New balsheet (and P&L report), API considerations, and (slow?) KVP in Account.cpp

John Ralls jralls at ceridwen.fremont.ca.us
Sat Jun 23 11:56:42 EDT 2018



> On Jun 22, 2018, at 9:42 PM, Christopher Lam <christopher.lck at gmail.com> wrote:
> 
> 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.
> 
> _

Chris,

Only profiling will tell how much of a performance hit this creates.

I don’t see where in your commit you’re computing the split’s no-closing balance. Perhaps that’s why it doesn’t work?

Regards,
John Ralls


More information about the gnucash-devel mailing list