gnucash maint: Multiple changes pushed

Christopher Lam clam at code.gnucash.org
Sat Feb 18 00:41:09 EST 2023


Updated	 via  https://github.com/Gnucash/gnucash/commit/5acf686c (commit)
	 via  https://github.com/Gnucash/gnucash/commit/2acba0ea (commit)
	 via  https://github.com/Gnucash/gnucash/commit/87ff5f11 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/498799a7 (commit)
	from  https://github.com/Gnucash/gnucash/commit/10b73de1 (commit)



commit 5acf686c769f660f5d8bd5f5ca0e710aad99df76
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Sat Feb 18 13:00:27 2023 +0800

    [eguile-utilities.scm] fmtnumeric: use xaccPrintAmount
    
    fmtnumeric is used to render Quantity, Discount percent. Previously it
    would render 1/3 as 0.333333333. Use xaccPrintAmount to show exact
    fractions for Qty and Discount, where appropriate.

diff --git a/gnucash/report/eguile-utilities.scm b/gnucash/report/eguile-utilities.scm
index 01c908405..4c0abc9db 100644
--- a/gnucash/report/eguile-utilities.scm
+++ b/gnucash/report/eguile-utilities.scm
@@ -34,12 +34,13 @@
 (use-modules (gnucash report))
 
 (define-public (fmtnumber n)
+  (issue-deprecation-warning "fmtnumber is deprecated")
   ;; Format a number (integer or real) into something printable
   (number->string (if (integer? n) (inexact->exact n) n)))
 
-;; Format gnc-numeric n with as many decimal places as required
+;; Format gnc-numeric n with decimal places, or exact fraction
 (define-public fmtnumeric
-  (compose fmtnumber exact->inexact))
+  (lambda (n) (xaccPrintAmount n (gnc-default-print-info #f))))
 
 (define-public (gnc-monetary-neg? monetary)
   ;; return true if the monetary value is negative

commit 2acba0ea18247dc953b6ddf2068e80e543f9a97e
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Sat Feb 18 13:01:12 2023 +0800

    [taxinvoice.scm] use fmtnumeric to render discount percentage

diff --git a/gnucash/report/reports/standard/taxinvoice.scm b/gnucash/report/reports/standard/taxinvoice.scm
index 454dee676..53c81647f 100644
--- a/gnucash/report/reports/standard/taxinvoice.scm
+++ b/gnucash/report/reports/standard/taxinvoice.scm
@@ -58,7 +58,7 @@
                        (gnc:make-gnc-monetary curr amt) #f) acc)))
       (((= gncTaxTableEntryGetAmount percent) . rest)
        (lp rest
-           (cons (string-append (gnc:default-html-number-renderer percent #f) "%")
+           (cons (string-append (fmtnumeric percent) "%")
                  acc))))))
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

commit 87ff5f1191815d1f44fa66fd8eb282cb9d334778
Author: Jeff <GnuCash-List at ratherbe.info>
Date:   Sat Feb 18 12:34:36 2023 +0800

    [taxinvoice.eguile.scm] subtotal discount column appropriately

diff --git a/gnucash/report/reports/support/taxinvoice.eguile.scm b/gnucash/report/reports/support/taxinvoice.eguile.scm
index c8d316adf..0b8bce5e6 100644
--- a/gnucash/report/reports/support/taxinvoice.eguile.scm
+++ b/gnucash/report/reports/support/taxinvoice.eguile.scm
@@ -298,7 +298,7 @@
       (let* ((inv-total (gncInvoiceGetTotal opt-invoice))
              (tax-total (gncInvoiceGetTotalTax opt-invoice))
              (sub-total (gncInvoiceGetTotalSubtotal opt-invoice))
-             (dsc-total (- inv-total tax-total sub-total))
+             (dsc-total (gnc:make-commodity-collector))
              (total-col (gnc:make-commodity-collector)))
         (total-col 'add currency inv-total)
         (for-each
@@ -314,6 +314,7 @@
                   (acc       (if cust-doc? (gncEntryGetInvAccount entry)(gncEntryGetBillAccount entry)))
                   (taxable   (if cust-doc? (gncEntryGetInvTaxable entry)(gncEntryGetBillTaxable entry)))
                   (taxtable  (if cust-doc? (gncEntryGetInvTaxTable entry)(gncEntryGetBillTaxTable entry))))
+              (dsc-total 'add currency rdiscval)
     ?>
     <tr valign="top">
       <?scm (if opt-col-date (begin ?>
@@ -362,7 +363,7 @@
                     (if (and discount?) 1 0)
         ) ?>"><strong><?scm:d opt-subtotal-heading ?></strong></td>
         <?scm (if discount? (begin ?>
-        <td align="right" class="subtotal"><strong><?scm:d (fmtmoney currency dsc-total) ?></strong></td>
+        <td align="right" class="subtotal"><strong><?scm (display-comm-coll-total dsc-total #f) ?></strong></td>
         <?scm )) ?>
         <?scm (if tax? (begin ?>
           <td align="right" class="subtotal"><strong><?scm:d (fmtmoney currency sub-total) ?></strong></td>

commit 498799a7491230cb5b16bc6c50ba360cd08a08b0
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Sat Feb 18 13:07:43 2023 +0800

    [receipt.eguile.scm] remove commented-out line

diff --git a/gnucash/report/reports/support/receipt.eguile.scm b/gnucash/report/reports/support/receipt.eguile.scm
index 1957e3812..f73659f31 100644
--- a/gnucash/report/reports/support/receipt.eguile.scm
+++ b/gnucash/report/reports/support/receipt.eguile.scm
@@ -176,7 +176,6 @@
           <td align="right"><?scm:d (fmtnumeric qty) ?></td>
           <td align="right"><?scm:d (format #f "~4,2,,,'0f" (gnc-numeric-to-double each)) ?></td>
           <td align="right" nowrap><?scm:d (format #f "~4,2,,,'0f" (gnc-numeric-to-double rval)) ?>
-          <!-- <td align="right" nowrap><?scm:d (fmtnumeric rval) ?> -->
               <?scm (if tax? (begin ?>
                  T
               <?scm ) (begin ?>



Summary of changes:
 gnucash/report/eguile-utilities.scm                  | 5 +++--
 gnucash/report/reports/standard/taxinvoice.scm       | 2 +-
 gnucash/report/reports/support/receipt.eguile.scm    | 1 -
 gnucash/report/reports/support/taxinvoice.eguile.scm | 5 +++--
 4 files changed, 7 insertions(+), 6 deletions(-)



More information about the gnucash-changes mailing list