--- advanced-portfolio-old.scm	2005-07-25 18:40:58.000000000 -0500
+++ advanced-portfolio.scm	2005-07-25 20:42:03.000000000 -0500
@@ -210,20 +210,22 @@
                          (gnc:transaction-get-splits parent)
                        )
                      )
                    )
                  )
                  (gnc:account-get-split-list current)
                )
 ;;               (gnc:debug "totalunits" totalunits)
 ;;               (gnc:debug "totalunityears" totalunityears)
 
+               (moneyincoll 'minusmerge dividendcoll #f)
+               (moneyoutcoll 'minusmerge brokeragecoll #f)
                (gaincoll 'merge moneyoutcoll #f)
                (gaincoll 'add (gnc:gnc-monetary-commodity value) (gnc:gnc-monetary-amount value))
                (gaincoll 'merge moneyincoll #f)
 
 	    (if (or include-empty (not (gnc:numeric-zero-p units)))
 		(begin (total-value 'add (gnc:gnc-monetary-commodity value) (gnc:gnc-monetary-amount value))
                        (total-moneyin 'merge moneyincoll #f)
                        (total-moneyout 'merge moneyoutcoll #f)
                        (total-gain 'merge gaincoll #f)
 		       (gnc:html-table-append-row/markup!
