From 7901598f1d1e419e19c860e81749805371298030 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Mon, 27 Feb 2006 23:52:31 +0000 Subject: Checked in all major updates. --- balance.cc | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'balance.cc') diff --git a/balance.cc b/balance.cc index 6305eb95..01332fae 100644 --- a/balance.cc +++ b/balance.cc @@ -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; -- cgit v1.2.3