[Gnucash-changes] Add option to advanced portfolio to include $0 splits (#143772).

Derek Atkins warlord at cvs.gnucash.org
Sat Aug 21 12:34:10 EDT 2004


Log Message:
-----------
Add option to advanced portfolio to include $0 splits (#143772).

	* src/report/standard-reports/advanced-portfolio.scm:
	  Add option to include zero-amount splits in computations.
	  Fixes #143722.

Tags:
----
gnucash-1-8-branch

Modified Files:
--------------
    gnucash:
        ChangeLog
    gnucash/src/report/standard-reports:
        advanced-portfolio.scm

Revision Data
-------------
Index: ChangeLog
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/ChangeLog,v
retrieving revision 1.1461.2.350
retrieving revision 1.1461.2.351
diff -LChangeLog -LChangeLog -u -r1.1461.2.350 -r1.1461.2.351
--- ChangeLog
+++ ChangeLog
@@ -1,3 +1,9 @@
+2004-18-21  Derek Atkins  <derek at ihtfp.com>
+
+	* src/report/standard-reports/advanced-portfolio.scm:
+	  Add option to include zero-amount splits in computations.
+	  Fixes #143722.
+
 2004-08-19  Derek Atkins  <derek at ihtfp.com>
 
 	* configure.in: change the gtkhtml order to search for >= 1.1 before
Index: advanced-portfolio.scm
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/report/standard-reports/advanced-portfolio.scm,v
retrieving revision 1.4.2.4
retrieving revision 1.4.2.5
diff -Lsrc/report/standard-reports/advanced-portfolio.scm -Lsrc/report/standard-reports/advanced-portfolio.scm -u -r1.4.2.4 -r1.4.2.5
--- src/report/standard-reports/advanced-portfolio.scm
+++ src/report/standard-reports/advanced-portfolio.scm
@@ -41,6 +41,7 @@
 (define optname-price-source (N_ "Price Source"))
 (define optname-shares-digits (N_ "Share decimal places"))
 (define optname-zero-shares (N_ "Include accounts with no shares"))
+(define optname-include-gains (N_ "Include gains and losses"))
 
 (define (options-generator)
   (let* ((options (gnc:new-options)) 
@@ -78,6 +79,13 @@
       "e" (N_ "The number of decimal places to use for share numbers") 2
       0 6 0 1))
 
+    (gnc:register-option 
+     options 
+     (gnc:make-simple-boolean-option
+      gnc:pagename-general optname-include-gains "f" 
+      (N_ "Include splits with no shares for calculating money-in and money-out")
+      #f))
+
     ;; Account tab
     (add-option
      (gnc:make-account-list-option
@@ -127,7 +135,7 @@
     (string=? (gnc:split-get-guid s1) (gnc:split-get-guid s2)))
   
   (define (table-add-stock-rows table accounts to-date
-                                currency price-fn exchange-fn include-empty
+                                currency price-fn exchange-fn include-empty include-gains
                                 total-value total-moneyin total-moneyout
                                 total-gain)
 
@@ -178,7 +186,7 @@
                              ((same-split? s split) 
 			      ;; (gnc:debug "amount" (gnc:numeric-to-double (gnc:split-get-amount s)) )
                               (cond
-                                ((not (gnc:numeric-zero-p (gnc:split-get-amount s)))
+                              ((or include-gains (not (gnc:numeric-zero-p (gnc:split-get-amount s))))
                                  (unitscoll 'add commodity (gnc:split-get-amount s)) ;; Is the stock transaction?
                                  (if (< 0 (gnc:numeric-to-double
                                            (gnc:split-get-amount s)))
@@ -282,6 +290,8 @@
                                   gnc:optname-reportname))
         (include-empty (get-option gnc:pagename-accounts
                                   optname-zero-shares))
+        (include-gains (get-option gnc:pagename-general
+                                  optname-include-gains))
 
         (total-value    (gnc:make-commodity-collector))
         (total-moneyin  (gnc:make-commodity-collector))
@@ -330,7 +340,7 @@
           
           (table-add-stock-rows
            table accounts to-date currency price-fn exchange-fn
-           include-empty total-value total-moneyin total-moneyout total-gain)
+           include-empty include-gains total-value total-moneyin total-moneyout total-gain)
           
           (gnc:html-table-append-row/markup!
            table


More information about the gnucash-changes mailing list