gnucash maint: Multiple changes pushed

Christopher Lam clam at code.gnucash.org
Sat Sep 7 06:22:56 EDT 2019


Updated	 via  https://github.com/Gnucash/gnucash/commit/a940434e (commit)
	 via  https://github.com/Gnucash/gnucash/commit/656dddc1 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/228e5f47 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/3764a053 (commit)
	from  https://github.com/Gnucash/gnucash/commit/25cc3307 (commit)



commit a940434e5cf383bcd627558f71673b814977442b
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Sat Sep 7 15:57:40 2019 +0800

    [taxinvoice] comments were interfering with i18n. remove

diff --git a/gnucash/report/business-reports/taxinvoice.scm b/gnucash/report/business-reports/taxinvoice.scm
index 882b91611..03ccd3d65 100644
--- a/gnucash/report/business-reports/taxinvoice.scm
+++ b/gnucash/report/business-reports/taxinvoice.scm
@@ -80,7 +80,6 @@
 (define headingpage  (N_ "Headings 1"))
 (define headingpage2 (N_ "Headings 2"))
 (define notespage    (N_ "Notes"))
-;(define filespage    (N_ "Files"))
 (define displaypage  (N_ "Display"))
 (define elementspage			(N_ "Elements"))
 ; option names 
@@ -328,9 +327,7 @@
 
   (let ((options (options-generator)))
        (set-opt options headingpage optname-report-title (_ "Tax Invoice"))
-       ;(gnc:warn "title: " (gnc:option-value title-op))
        (set-opt options headingpage optname-unit-price (_ "Unit"))
-       ;(gnc:warn "unitprice: " (gnc:option-value unit-price-op))
        (set-opt options headingpage optname-tax-rate (_ "GST Rate"))
        (set-opt options headingpage optname-tax-amount (_ "GST Amount"))
        (set-opt options headingpage2 optname-amount-due (_ "Amount Due (inc GST)"))

commit 656dddc1664d51672833c5ad378fa920de745407
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Sat Sep 7 16:30:05 2019 +0800

    [html-acct-table] compact formals definitions
    
    use fewer conditionals, improve readability

diff --git a/gnucash/report/report-system/html-acct-table.scm b/gnucash/report/report-system/html-acct-table.scm
index 879eea295..8d49f32c4 100644
--- a/gnucash/report/report-system/html-acct-table.scm
+++ b/gnucash/report/report-system/html-acct-table.scm
@@ -1189,92 +1189,52 @@
 		  (parent-acct-bal-mode
 		   (or (get-val env 'parent-account-balance-mode)
 		       'omit-bal))
-		  (bal-method
-		   ;; figure out how to calculate our balance:
-		   ;; 'immediate-bal|'recursive-bal ('omit-bal handled below)
-		   (or (and (equal? row-type 'subtotal-row) 'recursive-bal)
-		       (and (equal? (+ display-depth 1) display-tree-depth)
-			    (or (and (equal? limit-behavior 'summarize)
-				     'recursive-bal)
-				(and (null? children) 'immediate-bal)
-				;; otherwise, parent account at depth limit,
-				;; with either 'truncate or 'flatten...
-				parent-acct-bal-mode
-				)
-			    )
-		       (if (null? children) #f parent-acct-bal-mode)
-		       'immediate-bal
-		       )
-		   )
-		  (comm-amt
-		   ;; this will be the immediate/recursive commodity
-		   ;; balance (a commodity collector) or #f.
-		   (get-val env (assq-ref '((immediate-bal . account-bal)
-				            (recursive-bal . recursive-bal)
-				            (omit-bal . #f))
-				          bal-method)))
-		  (zero-mode (let ((mode
-				       (get-val
-					env 'zero-balance-display-mode)))
-			       (or (if (equal? mode #t) 'show-balance mode)
-				   'show-balance)
-			       ))
-		  (reverse-balance (gnc-reverse-balance acct))
-		  (native-comm?
-		   (lambda (amt)
-		     (gnc:uniform-commodity? amt report-commodity)))
+
+                  (bal-method
+                   ;; figure out how to calculate our balance:
+                   ;; 'immediate-bal|'recursive-bal ('omit-bal handled below)
+                   (cond ((eq? row-type 'subtotal-row) 'recursive-bal)
+                         ((eq? (1+ display-depth) display-tree-depth)
+                          (cond ((eq? limit-behavior 'summarize) 'recursive-bal)
+                                ((null? children) 'immediate-bal)
+                                (else parent-acct-bal-mode)))
+                         ((not (null? children)) parent-acct-bal-mode)
+                         (else 'immediate-bal)))
+
+                  (comm-amt
+                   (get-val env (assq-ref '((immediate-bal . account-bal)
+                                            (recursive-bal . recursive-bal)
+                                            (omit-bal . #f))
+                                          bal-method)))
+                  (amt (and comm-amt
+                            (if (gnc-reverse-balance acct)
+                                (gnc:commodity-collector-get-negated comm-amt)
+                                comm-amt)))
+
+                  (zero-mode (let ((mode (get-val env 'zero-balance-display-mode)))
+                               (if (boolean? mode)
+                                   'show-balance
+                                   mode)))
+
+                  (native-comm?
+                   (lambda (amt)
+                     (gnc:uniform-commodity? amt report-commodity)))
+
                   ;; amount is either a <gnc:monetary> or #f
-		  (amount (and comm-amt
-			       (if (and (equal? zero-mode 'omit-balance)
-                                        (gnc-commodity-collector-allzero?
-                                         comm-amt)
-                                        )
-				   #f
-				   ;; else:
-                                   ;; this let* block evals to a <gnc:monetary>
-				   (let*
-				       ((amt (gnc:make-commodity-collector)))
-				     (if reverse-balance
-					 (amt 'minusmerge comm-amt #f)
-					 (set! amt comm-amt))
-				     (or (and (native-comm? amt)
-					      (gnc:sum-collector-commodity
-					       amt
-					       report-commodity
-					       exchange-fn)
-					      )
-					 ((if (and (equal?
-                                                    multicommodity-mode 'table)
-                                                   (equal?
-                                                    row-type 'account-row)
-                                                   )
-                                              gnc-commodity-table
-                                              gnc:sum-collector-commodity
-                                              )
-                                          amt
-                                          report-commodity
-                                          exchange-fn
-                                          )  ;; factored from below
-; 					 (if (and (equal?
-; 						   multicommodity-mode 'table)
-; 						  (equal?
-; 						   row-type 'account-row)
-; 						  )
-; 					     (gnc-commodity-table
-; 					      amt
-; 					      report-commodity
-; 					      exchange-fn)
-; 					     (gnc:sum-collector-commodity
-; 					      amt
-; 					      report-commodity
-; 					      exchange-fn)
-; 					     )
+                  (amount (and amt
+                               (not (and (eq? zero-mode 'omit-balance)
+                                         (gnc-commodity-collector-allzero? amt)))
+                               (cond
+                                ((and (not (native-comm? amt))
+                                      (eq? multicommodity-mode 'table)
+                                      (eq? row-type 'account-row))
+                                 (gnc-commodity-table
+                                  amt report-commodity exchange-fn))
+                                (else
+                                 (gnc:sum-collector-commodity
+                                  amt report-commodity exchange-fn)))))
 
-					 )
-				     ) ;; end of let*
-				   ) ;; end of if
-			       ))
-		  (indented-depth (get-val env 'indented-depth))
+                  (indented-depth (get-val env 'indented-depth))
 		  (account-colspan (get-val env 'account-colspan))
 		  )
 

commit 228e5f47a83ec7cb8b9834be3abe491438e234e9
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Fri Sep 6 00:19:29 2019 +0800

    Bug 796952 - Report formatting (justify) is broken
    
    Remove the "minus 1" to amount-depth for some accounts with children
    and display-amount is 'immediate-bal. This means amounts are now
    strictly(*) indented according to account depth instead of a weird
    formula if account-has-children and immediate-bal.
    
    (*) when subtotal-mode isn't "canonically tabbed"

diff --git a/gnucash/report/report-system/html-acct-table.scm b/gnucash/report/report-system/html-acct-table.scm
index 025951552..879eea295 100644
--- a/gnucash/report/report-system/html-acct-table.scm
+++ b/gnucash/report/report-system/html-acct-table.scm
@@ -1166,7 +1166,6 @@
 			params))
 		  (acct (get-val env 'account))
 		  (children (get-val env 'account-children))
-		  (children-displayed? (get-val env 'children-displayed?))
 		  (label (get-val env 'account-label))
 		  (acct-name (get-val env 'account-name)) ;; for diagnostics...
 		  (report-commodity  (get-val env 'report-commodity))
@@ -1293,18 +1292,6 @@
 	      amount
 	      (+ account-cols (- 0 1)
 		 (- logical-cols display-depth)
-		 ;; account for 'immediate-bal parents displaying children
-		 ;; NOTE: before you go mucking with this, BE ABSOLUTELY
-		 ;; SURE you know what you're doing... i spent A LOT of
-		 ;; time trying to make sure this is right. i know, in
-		 ;; some reports, the output might look incorrect. but,
-		 ;; if you think long and hard about it, i think you'll
-		 ;; find the current treatment correct... i think. -DM-
-		 (- 0 (if (if (not children-displayed?)
-			      #f
-			      (equal? bal-method 'immediate-bal))
-			  1 0)
-		    )
 		 (if (equal? subtotal-mode 'canonically-tabbed) 1 0)
 		 )                          ;; amount-depth
 	      1                             ;; amount-colspan
diff --git a/gnucash/report/standard-reports/test/test-balsheet-pnl.scm b/gnucash/report/standard-reports/test/test-balsheet-pnl.scm
index 954798e09..8fed4fac5 100644
--- a/gnucash/report/standard-reports/test/test-balsheet-pnl.scm
+++ b/gnucash/report/standard-reports/test/test-balsheet-pnl.scm
@@ -216,13 +216,13 @@
       (let ((sxml (options->sxml balance-sheet-uuid balance-sheet-options "balsheet-multilevel")))
         (test-equal "multilevel. root = $0.00"
           (list "$0.00")
-          (sxml->table-row-col sxml 1 3 5))
+          (sxml->table-row-col sxml 1 3 6))
         (test-equal "multilevel. assets = $0.00"
           (list "$0.00")
-          (sxml->table-row-col sxml 1 4 4))
+          (sxml->table-row-col sxml 1 4 5))
         (test-equal "multilevel. bank1 = $0.00"
           (list "$0.00")
-          (sxml->table-row-col sxml 1 5 3))
+          (sxml->table-row-col sxml 1 5 4))
         (test-equal "multilevel. bonds = $2,000.00"
           (list "$2,000.00")
           (sxml->table-row-col sxml 1 6 3))
@@ -240,7 +240,7 @@
           (sxml->table-row-col sxml 1 10 4))
         (test-equal "multilevel. broker = $2,000.00"
           (list "$2,000.00")
-          (sxml->table-row-col sxml 1 11 3))
+          (sxml->table-row-col sxml 1 11 4))
         (test-equal "multilevel. funds = $15,000.00"
           (list "30 FUNDS" "$15,000.00" "$15,000.00")
           (sxml->table-row-col sxml 1 12 3))
@@ -249,7 +249,7 @@
           (sxml->table-row-col sxml 1 13 4))
         (test-equal "multilevel. foreign = $0.00"
           (list "$0.00")
-          (sxml->table-row-col sxml 1 14 3))
+          (sxml->table-row-col sxml 1 14 4))
         (test-equal "multilevel. foreignsavings = #200.00 = $340"
           (list "#200.00" "$340.00" "$340.00")
           (sxml->table-row-col sxml 1 15 3))
@@ -352,7 +352,7 @@
       (let ((sxml (options->sxml balance-sheet-uuid balance-sheet-options "balsheet-incl-zb-accts=#t omit-zb-bals=#f")))
         (test-equal "omit-zb-bals=#f"
           (list "$0.00")
-          (sxml->table-row-col sxml 1 3 5))
+          (sxml->table-row-col sxml 1 3 6))
         (test-equal "incl-zb-accts=#t"
           '("Empty" "$0.00")
           (sxml->table-row-col sxml 1 8 #f)))
@@ -362,35 +362,41 @@
     (let* ((pnl-options (default-pnl-testing-options))
            (sxml (options->sxml pnl-uuid pnl-options "pnl-default")))
       (test-equal "total revenue  = $1,270.00"
-        (list "$1,270.00" "$1,270.00")
-        (sxml->table-row-col sxml 1 5 6))
+        (list "$1,270.00")
+        ((sxpath '(// table // (tr 1) // table // (tr 5) // (td 6) // *text*))
+         sxml))
       (test-equal "total expenses  = $0.00"
-        (list "$0.00" "$0.00")
-        (sxml->table-row-col sxml 1 3 6))
+        (list "$0.00")
+        ((sxpath '(// table // (tr 2) // table // (tr 3) // (td 6) // *text*))
+         sxml))
 
       (set-option! pnl-options "Commodities" "Price Source" 'weighted-average)
       (let ((sxml (options->sxml pnl-uuid pnl-options "pnl-weighted-average")))
         (test-equal "weighted average revenue = $1160.36"
-          (list "$1,160.36" "$1,160.36")
-          (sxml->table-row-col sxml 1 5 6)))
+          (list "$1,160.36")
+          ((sxpath '(// table // (tr 1) // table // (tr 5) // (td 6) // *text*))
+           sxml)))
 
       (set-option! pnl-options "Commodities" "Price Source" 'average-cost)
       (let ((sxml (options->sxml pnl-uuid pnl-options "pnl-average-cost")))
         (test-equal "average-cost revenue = $976"
-          (list "$976.00" "$976.00")
-          (sxml->table-row-col sxml 1 5 6)))
+          (list "$976.00")
+          ((sxpath '(// table // (tr 1) // table // (tr 5) // (td 6) // *text*))
+           sxml)))
 
       (set-option! pnl-options "Commodities" "Price Source" 'pricedb-nearest)
       (let ((sxml (options->sxml pnl-uuid pnl-options "pnl-pricedb-nearest")))
         (test-equal "pricedb-nearest revenue = $1270"
-          (list "$1,270.00" "$1,270.00")
-          (sxml->table-row-col sxml 1 5 6)))
+          (list "$1,270.00")
+          ((sxpath '(// table // (tr 1) // table // (tr 5) // (td 6) // *text*))
+           sxml)))
 
       (set-option! pnl-options "Commodities" "Price Source" 'pricedb-latest)
       (let ((sxml (options->sxml pnl-uuid pnl-options "pnl-pricedb-latest")))
         (test-equal "pricedb-latest revenue = $1270"
-          (list "$1,270.00" "$1,270.00")
-          (sxml->table-row-col sxml 1 5 6)))
+          (list "$1,270.00")
+          ((sxpath '(// table // (tr 1) // table // (tr 5) // (td 6) // *text*))
+           sxml)))
 
       ;; set multilevel subtotal style
       ;; verifies amount in EVERY line of the report.
@@ -398,23 +404,29 @@
       (set-option! pnl-options "Display" "Parent account subtotals" 't)
       (let ((sxml (options->sxml pnl-uuid pnl-options "pnl-multilevel")))
         (test-equal "multilevel. income = -$250.00"
-          (list "-$250.00" "-$250.00")
-          (sxml->table-row-col sxml 1 3 5))
-        (test-equal "multilevel. income-GBP = $0.00"
-          (list "-#600.00" "-$1,020.00" "-#600.00" "-$1,020.00")
-          (sxml->table-row-col sxml 1 4 5))
+          (list "-$250.00")
+          ((sxpath '(// table // (tr 1) // table // (tr 3) // (td 6) // *text*))
+           sxml))
+        (test-equal "multilevel. income-GBP = -#600"
+          (list "-#600.00" "-$1,020.00")
+          ((sxpath '(// table // (tr 1) // table // (tr 4) // (td 5) // *text*))
+           sxml))
         (test-equal "multilevel. total income = -$1,270.00"
-          (list "-$1,270.00" "-$1,270.00")
-          (sxml->table-row-col sxml 1 5 6))
+          (list "-$1,270.00")
+          ((sxpath '(// table // (tr 1) // table // (tr 5) // (td 6) // *text*))
+           sxml))
         (test-equal "multilevel. total revenue = $1,270.00"
-          (list "$1,270.00" "$1,270.00")
-          (sxml->table-row-col sxml 1 6 6))
+          (list "$1,270.00")
+          ((sxpath '(// table // (tr 1) // table // (tr 6) // (td 6) // *text*))
+           sxml))
         (test-equal "multilevel. expenses = $0.00"
-          (list "$0.00" "$0.00")
-          (sxml->table-row-col sxml 1 3 6))
+          (list "$0.00")
+          ((sxpath '(// table // (tr 2) // table // (tr 3) // (td 6) // *text*))
+           sxml))
         (test-equal "multilevel. net-income = $1,270"
-          (list "$1,270.00" "$1,270.00")
-          (sxml->table-row-col sxml 1 4 6)))
+          (list "$1,270.00")
+          ((sxpath '(// table // (tr 2) // table // (tr 4) // (td 6) // *text*))
+           sxml)))
 
       ;; set recursive-subtotal subtotal style
       (set-option! pnl-options "Display" "Parent account balances" 'recursive-bal)

commit 3764a053cf0b04944edba6ff8afd5fbdbfa13d24
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Fri Sep 6 00:18:21 2019 +0800

    Revert "Bug 796952 - Report formatting (justify) is broken"
    
    This reverts commit 35ed4cf2, restoring indenting for account
    summary. The next commit will fix the indented amounts to land under
    the 'Balance' header.
    
    This fixes: Bug 797332 - Account Summary Report balance lacks
    indentation

diff --git a/gnucash/report/standard-reports/account-summary.scm b/gnucash/report/standard-reports/account-summary.scm
index af30dfb5d..65416b0b7 100644
--- a/gnucash/report/standard-reports/account-summary.scm
+++ b/gnucash/report/standard-reports/account-summary.scm
@@ -457,23 +457,25 @@
 		)
           (if show-account-bals?
               (gnc:html-table-set-cell/tag!
-               build-table 0 (1+ cur-col) "number-header"
+               build-table 0 (+ cur-col account-cols) "number-header"
 	       (_ "Balance"))
               )
-          (let ((row 0))
-            (while (< row table-rows)
-              (let ((col 1))
-                (gnc:html-table-set-cell! build-table (1+ row) cur-col
-                                          (gnc:html-table-get-cell hold-table row 0))
-                (if show-account-bals?
-                    (while (< col hold-table-width)
-                      (if (gnc:html-table-get-cell hold-table row col)
-                          (gnc:html-table-set-cell!
-                           build-table (1+ row) (1+ cur-col)
-                           (gnc:html-table-get-cell hold-table row col)))
-                      (set! col (1+ col)))))
-              (set! row (1+ row))))
-          (set! cur-col (+ cur-col (if show-account-bals? 2 1)))
+	  (let ((row 0))
+	    (while (< row table-rows)
+		   (gnc:html-table-set-row-markup! build-table (+ row 1)
+						   (gnc:html-table-row-markup hold-table row))
+		   (let ((col 0))
+		     (while (< col hold-table-width)
+			    (gnc:html-table-set-cell!
+			     build-table (+ row 1) (+ cur-col col)
+			     (gnc:html-table-get-cell hold-table row col)
+			     )
+			    (set! col (+ col 1))
+			    )
+		     )
+		   (set! row (+ row 1))
+		   )
+	    )
 	  (set! cur-col (+ cur-col hold-table-width))
 	  (if show-account-notes?
 	      (begin



Summary of changes:
 gnucash/report/business-reports/taxinvoice.scm     |   3 -
 gnucash/report/report-system/html-acct-table.scm   | 141 +++++++--------------
 .../report/standard-reports/account-summary.scm    |  32 ++---
 .../standard-reports/test/test-balsheet-pnl.scm    |  74 ++++++-----
 4 files changed, 104 insertions(+), 146 deletions(-)



More information about the gnucash-changes mailing list