This looks reasonable.. I also reformmated that section of code a bit to make it more readable. Let me know if this breaks.
-derek Matt Martin <[EMAIL PROTECTED]> writes: > All, > > The new advanced-portfolio report ROCKS! > However, it seems to give wrong numbers if I have transactions dealing > with more than one security. > This happens, for instance, when my paycheck is distributed to several > IRA funds. > Right now it seems to add the money which goes into all other funds in > one transaction as coming out of the fund of interest. > This makes my %return on investment happily positive but incorrect. > > I think I have a fix for my circumstance, but not sure if it will > break something else. > It only adds the "money in" or "money out" amounts if handling a > specific split buying/selling the commodity of interest, > not for all splits in a transaction containing that commodity. Hope > that makes sense... > > Now my net ROI appears correct and very,very negative. :( > > Patch is attached. > > Regards. > > -- > > Matt Martin > [EMAIL PROTECTED] > 600 West Grove Parkway #1042,Tempe, AZ, 85283 > Visit my homepage at http://matthewmartin.org > > --- gnucash/src/report/standard-reports/advanced-portfolio.scm Tue Oct 1 >13:48:27 2002 > +++ /usr/local/share/gnucash/guile-modules/gnucash/report/advanced-portfolio.scm > Sun Oct 6 16:38:17 2002 > @@ -158,11 +158,13 @@ > (* >(gnc:numeric-to-double (gnc:split-get-amount s)) > >(gnc:date-year-delta > >(car (gnc:transaction-get-date-posted parent)) > - >(current-time))))) ) > + >(current-time))))) > + (cond > + ((gnc:numeric-negative-p >(gnc:split-get-value s)) > + (moneyoutcoll 'add currency >(gnc:numeric-neg (gnc:split-get-value s)))) > + (else (moneyincoll 'add currency >(gnc:numeric-neg (gnc:split-get-value s)))))) > ((split-account-type? s 'expense) (brokeragecoll 'add >currency (gnc:split-get-value s))) > ((split-account-type? s 'income) (dividendcoll 'add >currency (gnc:split-get-value s))) > - ((gnc:numeric-negative-p (gnc:split-get-value s)) >(moneyincoll 'add currency (gnc:split-get-value s))) > - (else (moneyoutcoll 'add currency (gnc:split-get-value >s))) > ) > ) > (gnc:transaction-get-splits parent) -- Derek Atkins, SB '93 MIT EE, SM '95 MIT Media Laboratory Member, MIT Student Information Processing Board (SIPB) URL: http://web.mit.edu/warlord/ PP-ASEL-IA N1NWH [EMAIL PROTECTED] PGP key available _______________________________________________ gnucash-devel mailing list [EMAIL PROTECTED] http://www.gnucash.org/cgi-bin/mailman/listinfo/gnucash-devel
