gnucash maint: Multiple changes pushed

Christopher Lam clam at
Thu Nov 21 07:44:56 EST 2019

Updated	 via (commit)
	 via (commit)
	 via (commit)
	 via (commit)
	from (commit)

commit 063a2704995029cdc7f331e2d4d11c2cd8dbfdbf
Author: Christopher Lam <christopher.lck at>
Date:   Thu Nov 21 20:30:16 2019 +0800

    [new-owner-report] fix: payment->invoice gets invoice totals
    previously the payment-amount deduction loop used the
    payment-split-list to obtain the invoice-posting-split's amount. this
    would occasionally fail and would return the invoice-payment-split
    amount, obtaining the wrong sign.
    modify to retrieve the invoice total via gncInvoice API.
    therefore payment-amount, minus gncInvoiceGetTotal(inv) amounts,
    results in the overpayment amount.

commit b3493509d19f25de3498530e5409fd2559a9e6ff
Author: Christopher Lam <christopher.lck at>
Date:   Thu Nov 21 09:57:51 2019 +0800

    [balsheet-pnl] speed up by pre-generating account report-date splits
    previous code was very inefficient: if an account had N old splits and
    balance-sheet reported on M recent dates, it would scan splitlist
    multiple times: (1) to retrieve splits, (2) filter until
    column-date, (3) find the last one. i.e. total O(N * M * 3).
    this algorithm pre-generates the account's report-date splits by
    scanning each account only once, creating M splits which are queried
    by get-cell-anchor-fn via list-ref. i.e. O(N)
    it is immedialtely converted to a vector because we want O(1)
    access. from get-cell-anchor-fn
    a future optimisation may scan the accounts' splitlists once per
    report run, acquiring all required data (i.e. last period split,
    split->balance, closing entries) in 1 pass, to generate a column-data

commit dda3da841604c9a5b3aebcec8de5b0ca1b68a446
Author: Christopher Lam <christopher.lck at>
Date:   Thu Nov 21 12:20:57 2019 +0800

    [report-utilities][API] gnc:account-accumulate-at-dates
    this is a generalised form from gnc:account-get-balances-at-dates to
    accumulate a list from report dates.
    this function will scan through account splitlist, processing each
    split via split->elt, accumulating results at date boundaries into the
    results list. it uses ice-9 match for conciseness.
    in: acc   - account
        dates - a list of time64
        split->elt - an unary lambda. the result of calling (split->elt split)
                     will be accumulated onto the resulting list. by
                     default it returns the last split-balance before
                     date boundary, similar to gnc:account-get-balances-at-dates
    out: (list elt0 elt1 ...), each entry is the result of split->elt

commit f0a189adbbe5ab9e66c0a76f7fa82c9969bb1b6a
Author: Christopher Lam <christopher.lck at>
Date:   Thu Nov 21 11:51:05 2019 +0800

    [test-report-utilities] add test-get-account-at-dates

Summary of changes:
 .../report/business-reports/new-owner-report.scm   |   3 +-
 gnucash/report/report-system/report-system.scm     |   1 +
 gnucash/report/report-system/report-utilities.scm  | 105 ++++++++++++---------
 .../report-system/test/test-report-utilities.scm   |  88 +++++++++++++++++
 gnucash/report/standard-reports/balsheet-pnl.scm   |  27 ++++--
 5 files changed, 165 insertions(+), 59 deletions(-)

More information about the gnucash-patches mailing list