gnucash maint: Multiple changes pushed

John Ralls jralls at code.gnucash.org
Mon Jun 3 13:21:37 EDT 2019


Updated	 via  https://github.com/Gnucash/gnucash/commit/9056b14d (commit)
	 via  https://github.com/Gnucash/gnucash/commit/69ea174c (commit)
	 via  https://github.com/Gnucash/gnucash/commit/f6d607d7 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/6888bb30 (commit)
	from  https://github.com/Gnucash/gnucash/commit/c140563e (commit)



commit 9056b14d9e62bf49216684ca782e4577f133d088
Merge: c140563e1 69ea174cd
Author: John Ralls <jralls at ceridwen.us>
Date:   Mon Jun 3 10:19:02 2019 -0700

    Merge Adrién Panella's 'budget'into maint.


commit 69ea174cd106da81c2b5b34a3f6d080327c24eb7
Author: Adrian Panella <ianchi74 at outlook.com>
Date:   Sat May 25 01:00:08 2019 -0500

    Bug 689753- Budget Report: Neg Num Not Colored Red
    
    Use consistent formating in budget/actual/difference
    showing negative budgets in red (same as actual/dif)

diff --git a/gnucash/report/standard-reports/budget.scm b/gnucash/report/standard-reports/budget.scm
index 2e6bacf0f..fa82bd9ff 100644
--- a/gnucash/report/standard-reports/budget.scm
+++ b/gnucash/report/standard-reports/budget.scm
@@ -367,7 +367,8 @@
                  (col3 (+ col2 (if show-diff? 1 0))))
             (if show-budget?
                 (gnc:html-table-set-cell/tag!
-                 html-table rownum col0 style-tag
+                 html-table rownum col0
+                 (if (negative? bgt-val) style-tag-neg style-tag)
                  (if (zero? bgt-val) "."
                      (gnc:make-gnc-monetary comm bgt-val))))
             (if show-actual?

commit f6d607d787690b77d1c2fe2e034a0199cbd99fce
Author: Adrian Panella <ianchi74 at outlook.com>
Date:   Sat May 25 00:31:07 2019 -0500

    Bug 624176 - budget report - rollup-budget ignored
    
    The report's logic needs to allways rollup budget ammounts
    so remove the option from the UI so as not to confuse the
    user (it wasn't used anyway)

diff --git a/gnucash/report/standard-reports/budget.scm b/gnucash/report/standard-reports/budget.scm
index 32028e86e..2e6bacf0f 100644
--- a/gnucash/report/standard-reports/budget.scm
+++ b/gnucash/report/standard-reports/budget.scm
@@ -60,8 +60,6 @@
 (define opthelp-show-difference (N_ "Display the difference as budget - actual."))
 (define optname-show-totalcol (N_ "Show Column with Totals"))
 (define opthelp-show-totalcol (N_ "Display a column with the row totals."))
-(define optname-rollup-budget (N_ "Roll up budget amounts to parent"))
-(define opthelp-rollup-budget (N_ "If parent account does not have its own budget value, use the sum of the child account budget values."))
 (define optname-show-zb-accounts (N_ "Include accounts with zero total balances and budget values"))
 (define opthelp-show-zb-accounts (N_ "Include accounts with zero total (recursive) balances and budget values in this report."))
 
@@ -262,10 +260,6 @@
      (gnc:make-simple-boolean-option
       gnc:pagename-display optname-show-totalcol
       "s4" opthelp-show-totalcol #f))
-    (add-option
-     (gnc:make-simple-boolean-option
-      gnc:pagename-display optname-rollup-budget
-      "s4" opthelp-rollup-budget #f))
     (add-option
      (gnc:make-simple-boolean-option
       gnc:pagename-display optname-show-zb-accounts
@@ -292,7 +286,6 @@
          (show-budget? (get-val params 'show-budget))
          (show-diff? (get-val params 'show-difference))
          (show-totalcol? (get-val params 'show-totalcol))
-         (rollup-budget? (get-val params 'rollup-budget))
          (use-ranges? (get-val params 'use-ranges))
          (num-rows (gnc:html-acct-table-num-rows acct-table))
          (numcolumns (gnc:html-table-num-columns html-table))
@@ -347,11 +340,9 @@
     ;;   colnum - starting column number
     ;;   budget - budget to use
     ;;   acct - account being displayed
-    ;;   rollup-budget? - rollup budget values for account children
-    ;;                    if account budget not set
     ;;   exchange-fn - exchange function (not used)
     (define (gnc:html-table-add-budget-line!
-             html-table rownum colnum budget acct rollup-budget?
+             html-table rownum colnum budget acct
              column-list exchange-fn)
       (let* ((comm (xaccAccountGetCommodity acct))
              (reverse-balance? (gnc-reverse-balance acct))
@@ -605,7 +596,7 @@
                  (acct (get-val env 'account))
                  (exchange-fn (get-val env 'exchange-fn)))
             (gnc:html-table-add-budget-line!
-             html-table rownum colnum budget acct rollup-budget?
+             html-table rownum colnum budget acct
              column-info-list exchange-fn)
             (loop (1+ rownum)))))
 
@@ -634,8 +625,6 @@
          (accounts (get-option gnc:pagename-accounts
                                optname-accounts))
          (bottom-behavior (get-option gnc:pagename-accounts optname-bottom-behavior))
-         (rollup-budget? (get-option gnc:pagename-display
-                                     optname-rollup-budget))
          (show-zb-accts? (get-option gnc:pagename-display
                                      optname-show-zb-accounts))
          (use-ranges? (get-option gnc:pagename-general optname-use-budget-period-range))
@@ -696,8 +685,6 @@
                      (get-option gnc:pagename-display optname-show-difference))
                (list 'show-totalcol
                      (get-option gnc:pagename-display optname-show-totalcol))
-               (list 'rollup-budget
-                     (get-option gnc:pagename-display optname-rollup-budget))
                (list 'use-ranges use-ranges?)
                (list 'collapse-before include-collapse-before?)
                (list 'collapse-after include-collapse-after?)

commit 6888bb30a2da250a5583e58f68876d2613d58296
Author: Adrian Panella <ianchi74 at outlook.com>
Date:   Sat May 25 00:16:54 2019 -0500

    [budget report] Fix multiple currency budget rollup

diff --git a/gnucash/report/report-system/report-utilities.scm b/gnucash/report/report-system/report-utilities.scm
index 5f7241547..e37ce42e2 100644
--- a/gnucash/report/report-system/report-utilities.scm
+++ b/gnucash/report/report-system/report-utilities.scm
@@ -981,14 +981,22 @@ flawed. see report-utilities.scm. please update reports.")
 ;;   budget - budget to use
 ;;   children - list of children
 ;;   period - budget period to use
+;;   currency - currency to use to accumulate the balances
 ;;
 ;; Return value:
 ;;   budget value to use for account for specified period.
-(define (budget-account-sum budget children period)
-  (apply + (map
-            (lambda (child)
-              (gnc:get-account-period-rolledup-budget-value budget child period))
-            children)))
+(define (budget-account-sum budget children period currency)
+  (let ((pricedb (gnc-pricedb-get-db (gnc-get-current-book)))
+        (start (gnc-budget-get-period-start-date budget period)))
+    (apply + (map
+              (lambda (child)
+                (gnc-pricedb-convert-balance-nearest-price-t64
+                  pricedb
+                  (gnc:get-account-period-rolledup-budget-value budget child period)
+                  (xaccAccountGetCommodity child)
+                  currency
+                  start))
+              children))))
 
 ;; Calculate the value to use for the budget of an account for a specific period.
 ;; - If the account has a budget value set for the period, use it
@@ -1004,10 +1012,11 @@ flawed. see report-utilities.scm. please update reports.")
 ;;   sum of all budgets for list of children for specified period.
 (define (gnc:get-account-period-rolledup-budget-value budget acct period)
   (let* ((bgt-set? (gnc-budget-is-account-period-value-set budget acct period))
-         (children (gnc-account-get-children acct)))
+         (children (gnc-account-get-children acct))
+         (currency (xaccAccountGetCommodity acct)))
     (cond
      (bgt-set? (gnc-budget-get-account-period-value budget acct period))
-     ((not (null? children)) (budget-account-sum budget children period))
+     ((not (null? children)) (budget-account-sum budget children period currency))
      (else 0))))
 
 ;; Sums rolled-up budget values for a single account from start-period (inclusive) to



Summary of changes:
 gnucash/report/report-system/report-utilities.scm | 23 ++++++++++++++++-------
 gnucash/report/standard-reports/budget.scm        | 20 ++++----------------
 2 files changed, 20 insertions(+), 23 deletions(-)



More information about the gnucash-changes mailing list