show zero accounts option patch

Fabien COELHO fabien at coelho.net
Mon Apr 19 08:27:44 EDT 2004


Dear gnucash developers,

I'm basically a happy user of gnucash, but I'll be even more happy a user
once the attached patch will have been applied and will be available in
future releases;-)

It adds a boolean option to decide whether to show zero-balanced accounts
in balance-sheet and profit-and-loss reports. This is really useful when
you have a few years of backlog and many 0.0 accounts that are shown in
all reports. The default behavior is the same as before.

The implementation was quite easy, as it is already implemented in the
backend function, so the fix only adds the stuff to the interface.

I'm not a guile programmer, so I just mimic the code around to add the
option. It works for me, so I guess it is fine. Feel free to edit the
labels, as I'm not sure my English is that clear.

Hope this help, have a nice day,

-- 
Fabien COELHO   _____   fabien at coelho.net   _____   http://www.coelho.net
-------------- next part --------------
*** ./balance-sheet.scm.orig	Sun Jan 25 03:43:15 2004
--- ./balance-sheet.scm	Mon Apr 19 14:04:08 2004
***************
*** 52,57 ****
--- 52,58 ----
  (define optname-price-source (N_ "Price Source"))
  (define optname-show-foreign (N_ "Show Foreign Currencies"))
  (define optname-show-rates (N_ "Show Exchange Rates"))
+ (define optname-show-zeros (N_ "Show accounts with zero balance"))
  
  ;; Moderatly ugly hack here, i.e. this depends on the internal
  ;; structure of html-table -- if that is changed, this might break.
***************
*** 153,158 ****
--- 154,165 ----
        gnc:pagename-display optname-show-rates
        "f" (N_ "Show the exchange rates used") #f))
  
+     (gnc:register-option 
+      options
+      (gnc:make-simple-boolean-option
+       gnc:pagename-display optname-show-zeros
+       "g" (N_ "Show accounts with a 0.0 total") #t))
+ 
      ;; Set the general page as default option tab
      (gnc:options-set-default-section options gnc:pagename-general)      
  
***************
*** 190,195 ****
--- 197,204 ----
                                     optname-price-source))
           (show-rates? (get-option gnc:pagename-display 
                                    optname-show-rates))
+ 	 (show-zeros? (get-option gnc:pagename-display 
+                                   optname-show-zeros))
  	 (from-date-printable (gnc:date-option-absolute-time
  			       (get-option gnc:pagename-general
  					   optname-from-date)))
***************
*** 315,321 ****
  		 30 20
                   #f #f #f #f #f
                   show-parent-balance? show-parent-total?
!                  show-fcur? report-currency exchange-fn #t))
  	  (set! liability-table 
                  (gnc:html-build-acct-table
                   #f to-date-tp
--- 324,330 ----
  		 30 20
                   #f #f #f #f #f
                   show-parent-balance? show-parent-total?
!                  show-fcur? report-currency exchange-fn show-zeros?))
  	  (set! liability-table 
                  (gnc:html-build-acct-table
                   #f to-date-tp
***************
*** 324,330 ****
  		 50 20
                   #f #f #f #f #f
                   show-parent-balance? show-parent-total?
!                  show-fcur? report-currency exchange-fn #t))
  	  (set! equity-table
                  (gnc:html-build-acct-table
                   #f to-date-tp
--- 333,339 ----
  		 50 20
                   #f #f #f #f #f
                   show-parent-balance? show-parent-total?
!                  show-fcur? report-currency exchange-fn show-zeros?))
  	  (set! equity-table
                  (gnc:html-build-acct-table
                   #f to-date-tp
***************
*** 333,339 ****
  		 70 10
                   #f #f #f #f #f 
                   show-parent-balance? show-parent-total?
!                  show-fcur? report-currency exchange-fn #t))
  
            (net-profit-balance 'minusmerge
                                     neg-net-profit-balance
--- 342,348 ----
  		 70 10
                   #f #f #f #f #f 
                   show-parent-balance? show-parent-total?
!                  show-fcur? report-currency exchange-fn show-zeros?))
  
            (net-profit-balance 'minusmerge
                                     neg-net-profit-balance
*** ./pnl.scm.orig	Mon Apr 19 14:02:40 2004
--- ./pnl.scm	Mon Apr 19 14:06:50 2004
***************
*** 56,61 ****
--- 56,62 ----
  (define optname-report-currency (N_ "Report's currency"))
  (define optname-price-source (N_ "Price Source"))
  (define optname-show-rates (N_ "Show Exchange Rates"))
+ (define optname-show-zeros (N_ "Show accounts with a 0.0 total"))
  
  ;; options generator
  (define (pnl-options-generator)
***************
*** 116,121 ****
--- 117,128 ----
        gnc:pagename-display optname-show-rates
        "f" (N_ "Show the exchange rates used") #t))
  
+     (gnc:register-option 
+      options
+      (gnc:make-simple-boolean-option
+       gnc:pagename-display optname-show-zeros
+       "g" (N_ "Show account with 0.0 balance") #t))
+ 
      ;; Set the general page as default option tab
      (gnc:options-set-default-section options gnc:pagename-general)      
  
***************
*** 156,161 ****
--- 163,170 ----
                                     optname-price-source))
           (show-rates? (get-option gnc:pagename-display 
                                    optname-show-rates))
+          (show-zeros? (get-option gnc:pagename-display 
+                                   optname-show-zeros))
           (to-date-tp (gnc:timepair-end-day-time 
                        (gnc:date-option-absolute-time
                         (get-option gnc:pagename-general
***************
*** 197,203 ****
                         #t gnc:accounts-get-comm-total-profit 
                         (_ "Profit") do-grouping? 
                         show-parent-balance? show-parent-total?
!                        show-fcur? report-currency exchange-fn #t))
            ;; add the table 
            (gnc:html-document-add-object! doc table)
  
--- 206,212 ----
                         #t gnc:accounts-get-comm-total-profit 
                         (_ "Profit") do-grouping? 
                         show-parent-balance? show-parent-total?
!                        show-fcur? report-currency exchange-fn show-zeros?))
            ;; add the table 
            (gnc:html-document-add-object! doc table)
  


More information about the gnucash-devel mailing list