gnucash maint: Bug 798734 - Aging Reports don't handle mixed currency payments and invoices without Trading Accounts

Christopher Lam clam at code.gnucash.org
Sat Jan 28 08:07:40 EST 2023


Updated	 via  https://github.com/Gnucash/gnucash/commit/e615a577 (commit)
	from  https://github.com/Gnucash/gnucash/commit/67ab9e90 (commit)



commit e615a5775aebc78e105e33c3dd9ef7b3a43c220e
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Sat Jan 28 20:53:24 2023 +0800

    Bug 798734 - Aging Reports don't handle mixed currency payments and invoices without Trading Accounts

diff --git a/gnucash/report/report-utilities.scm b/gnucash/report/report-utilities.scm
index 1d2901158..36253fe31 100644
--- a/gnucash/report/report-utilities.scm
+++ b/gnucash/report/report-utilities.scm
@@ -1002,7 +1002,7 @@ query instead.")
     (match splits
       (() (vector invoices opposing-splits overpayment))
       (((? not-APAR? split) . rest)
-       (lp rest invoices (+ overpayment (xaccSplitGetAmount split))
+       (lp rest invoices (+ overpayment (xaccSplitGetValue split))
            opposing-splits))
       ((split . rest)
        (let* ((lot (xaccSplitGetLot split))
@@ -1017,13 +1017,13 @@ query instead.")
                    (((? split=?) . tail) (lp1 tail overpayment opposing-splits))
                    ((s . tail)
                     (let* ((lot-bal (gnc-lot-get-balance lot))
-                           (lot-bal (if (sign-equal? lot-bal (xaccSplitGetAmount s))
+                           (lot-bal (if (sign-equal? lot-bal (xaccSplitGetValue s))
                                         0 lot-bal))
                            (derived? (not (zero? lot-bal)))
                            (partial-amount
                             (fold
                              (lambda (a b)
-                               (if (equal? s a) b (+ b (xaccSplitGetAmount a))))
+                               (if (equal? s a) b (+ b (xaccSplitGetValue a))))
                              (- lot-bal) lot-all-splits)))
                       (lp1 tail (+ overpayment partial-amount)
                            (cons (list s partial-amount derived?)
@@ -1031,7 +1031,7 @@ query instead.")
            (inv
             (lp rest
                 (cons (cons inv split) invoices)
-                (+ overpayment (xaccSplitGetAmount split))
+                (+ overpayment (xaccSplitGetValue split))
                 opposing-splits))))))))
 
 ;; create a stepped list, then add a date in the infinite future for
@@ -1067,7 +1067,7 @@ query instead.")
                (bal (fold
                      (lambda (a b)
                        (if (<= (xaccTransGetDate (xaccSplitGetParent a)) to-date)
-                           (+ (xaccSplitGetAmount a) b)
+                           (+ (xaccSplitGetValue a) b)
                            b))
                      0 lot-splits))
                (bal (if receivable? bal (- bal)))



Summary of changes:
 gnucash/report/report-utilities.scm | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)



More information about the gnucash-changes mailing list