From 2ef1934bb0dbcd08dfe8d4dc68bfd1509c8f51ce Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Fri, 26 Jun 2009 17:09:34 +0100 Subject: Restored --price option, added baseline test This option reports only in terms of the annotated price of the commodities involved, otherwise it reports the amounts themselves. It can be used in conjunction with other reports, as it applies to the displayed amounts, not the actual amounts being calculated. --- src/balance.cc | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/balance.cc') diff --git a/src/balance.cc b/src/balance.cc index 07657287..274f860a 100644 --- a/src/balance.cc +++ b/src/balance.cc @@ -203,6 +203,16 @@ balance_t::value(const bool primary_only, return resolved ? temp : optional(); } +balance_t balance_t::price() const +{ + balance_t temp; + + foreach (const amounts_map::value_type& pair, amounts) + temp += pair.second.price(); + + return temp; +} + optional balance_t::commodity_amount(const optional& commodity) const { -- cgit v1.2.3