[jonah] portfolio value?

Guil Barros listmail at metathusalan.com
Mon Oct 13 15:40:03 PDT 2003


Got It!

here's the diff... how/what format do i send a patch in and where to?

<<<<<<<<begin
ala:/usr/local/horde-cvs/horde/jonah/lib# diff Jonah.php.dist Jonah.php
309a310
>         $portfolioValue = 0;
342a344
>                 $portfolioValue += ($counts[$symbol] * $quote['lastPrice']);
346a349,356
>         /**
>          * Print Portfolio Value from $portfolioValue.
>          */
>         $html .= '<tr class="item' . ($i %2) . '"><td><td><td>';
>       $html .= 'Portfolio Value:';
>       $html .= '<td><td><td>';
>       $html .= '$' . number_format($portfolioValue, 2);
>       $html .= '</td></td></td></td></td></td></tr>';

>>>>>>>end

thx,
-guil


Quoting Guil Barros <listmail at metathusalan.com>:

> ok, ignore my previous problems, i just needed to try a little harder :)
>
> heres the new one that will probably be solved by the time i hit send...
>
> i have:
>
>          $html .= '</td><td>';
>             if (!empty($counts[$symbol]) && !empty($quote['lastPrice'])) {
>                 $html .= '$' . number_format($counts[$symbol] *
> $quote['lastPrice'], 2);
>                 $portfolioRunningTotal += $counts[$symbol] *
> $quote['lastPrice'];
>             }
>             $html .= '</td></tr>';
>             $i++;
>
>         }
>         /**
>          * Print Portfolio Value from $portfolioRunningTotal.
>          */
>         $html .= '<tr class="item' . ($i %2) . '"><td><td><td>';
>         $html .= 'Portfolio Value:';
>         $html .= '<td><td><td>';
>         $html .= '$' . number_format('$portfolioRunningTotal', 2);
>         $html .= '</td></td></td></td></td></td></tr>';
>
>         $html .= '</table>';
>         return $html;
>     }
>
> but it seems that $portfolioRunningTotal never gets a value (apart from the
> '0'
> its initialized to). What am i missing?
>
> thanks,
> -guil
>
> Quoting Guil Barros <listmail at metathusalan.com>:
>
> > so here's what i have...
> >
> > im only making changes to Jonah::getStockListings as it seems (to me at
> > least)
> > that thats where it should go :)
> >
> > how do i go about declaring a variable? i need one to hold the sum of the
> > stock
> > values and for "quote[]"ing at the end. If i dont declare it somewhere i
> get:
> >
> > Notice: Undefined variable: portfolioRunningTotal in
> > /usr/local/horde-cvs/horde/jonah/lib/Jonah.php on line 343
> >
> > Notice: Undefined index: portfolioRunningTotal in
> > /usr/local/horde-cvs/horde/jonah/lib/Jonah.php on line 352
> >
> > here is what i have so far:
> > <<<<begin
> >
> >           $html .= '</td><td>';
> >             if (!empty($counts[$symbol]) && !empty($quote['lastPrice'])) {
> >                 $html .= '$' . number_format($counts[$symbol] *
> > $quote['lastPrice'], 2);
> >                 $portfolioRunningTotal += $counts[$symbol] *
> > $quote['lastPrice'];
> >             }
> >             $html .= '</td></tr>';
> >             $i++;
> >         }
> >         /**
> >          * Print Portfolio Value from $portfolioRunningTotal.
> >          */
> >         $html .= '<tr><td>';
> >         $html .= 'Portfolio Value:' . $quote['portfolioRunningTotal'];
> >         $html .= '</td></tr>';
> >         $html .= '</table>';
> >         return $html;
> > >>>>end
> >
> > please comment and tell me where im going wrong.
> >
> > thanks,
> > -guil
> >
> >
> >
> >
> >
> > Quoting Guil Barros <listmail at metathusalan.com>:
> >
> > > :)
> > >
> > > anyways, trying to figure this out. seems like a good small change for me
> > to
> > > make and figure out the horde/jonah layout and where to do things :)
> > >
> > > i think:
> > >  - add it in /jonah/content.php under $showStocks right after checking
> for
> > > $tickerSymbols. Should i do the calculation right there and then echo it
> or
> > > should i calculate somewhere else and then call the function? If so,
> which
> > > file
> > > should i put the function in? /lib/Jonah.php seems the spot for that, but
> > not
> > > entirely sure...
> > >
> > >  - how does it get added into the portal page? same deal?
> > >
> > > any input would be most appreciated. Been on and off trying to learn how
> to
> > > add
> > > things/fix things to horde but cant seem to find any docs, et at...
> > >
> > > thx,
> > > -guil
> > >
> > >
> > > Quoting Chuck Hagenbuch <chuck at horde.org>:
> > >
> > > > Quoting Guil Barros <listmail at metathusalan.com>:
> > > >
> > > > > how about an option to list your portfolio value at the bottom or the
> > > list
> > > > of
> > > > > stocks? maybe even graph it :)
> > > >
> > > > Sure, patch?
> > > >
> > > > ... you *knew* that was coming, didn't you? :)
> > > >
> > > > -chuck
> > > >
> > > > --
> > > > Charles Hagenbuch, <chuck at horde.org>
> > > > Born right the first time.
> > > >
> > > > --
> > > > Jonah mailing list
> > > > Frequently Asked Questions: http://horde.org/faq/
> > > > To unsubscribe, mail: jonah-unsubscribe at lists.horde.org
> > > >
> > >
> >
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-keys
Size: 997 bytes
Desc: PGP Public Key
Url : http://lists.horde.org/archives/jonah/attachments/20031013/050f8174/attachment.bin


More information about the jonah mailing list