diff options
author | John Wiegley <johnw@newartisans.com> | 2006-02-27 23:52:31 +0000 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2008-04-13 02:41:27 -0400 |
commit | 7901598f1d1e419e19c860e81749805371298030 (patch) | |
tree | f3b4b42ad4217cd5a59eafb8cb8ffacea83b60ca /balance.cc | |
parent | 4507573d4fbc4ece6a4bb832b2e1fffae0885db8 (diff) | |
download | fork-ledger-7901598f1d1e419e19c860e81749805371298030.tar.gz fork-ledger-7901598f1d1e419e19c860e81749805371298030.tar.bz2 fork-ledger-7901598f1d1e419e19c860e81749805371298030.zip |
Checked in all major updates.
Diffstat (limited to 'balance.cc')
-rw-r--r-- | balance.cc | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -34,6 +34,22 @@ balance_t balance_t::value(const std::time_t moment) const return temp; } +balance_t balance_t::factor_price() const +{ + balance_t temp; + + for (amounts_map::const_iterator i = amounts.begin(); + i != amounts.end(); + i++) { + if ((*i).second.commodity().price) + temp += *((*i).second.commodity().price) * (*i).second; + else + temp += (*i).second; + } + + return temp; +} + struct compare_amount_commodities { bool operator()(const amount_t * left, const amount_t * right) const { return left->commodity().symbol < right->commodity().symbol; |