summaryrefslogtreecommitdiff
path: root/src/balance.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2009-02-22 04:43:34 -0400
committerJohn Wiegley <johnw@newartisans.com>2009-02-22 04:51:11 -0400
commite124811d8a31292c06430815683b2e0fe87f7ceb (patch)
treee165b781aa87402980c3a47a5617794387e81494 /src/balance.cc
parent04fd1ae24c3be6f9d3400c55bce90c3fd743e96b (diff)
downloadfork-ledger-e124811d8a31292c06430815683b2e0fe87f7ceb.tar.gz
fork-ledger-e124811d8a31292c06430815683b2e0fe87f7ceb.tar.bz2
fork-ledger-e124811d8a31292c06430815683b2e0fe87f7ceb.zip
Added --exchange (-x) option
This is like -V, except it lets you specify the goal commodity to report in terms of, for example: reg -x CAD
Diffstat (limited to 'src/balance.cc')
-rw-r--r--src/balance.cc6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/balance.cc b/src/balance.cc
index b8e4e07d..70e83362 100644
--- a/src/balance.cc
+++ b/src/balance.cc
@@ -159,7 +159,8 @@ balance_t& balance_t::operator/=(const amount_t& amt)
}
optional<balance_t>
-balance_t::value(const optional<datetime_t>& moment,
+balance_t::value(const bool primary_only,
+ const optional<datetime_t>& moment,
const optional<commodity_t&>& in_terms_of) const
{
optional<balance_t> temp;
@@ -167,7 +168,8 @@ balance_t::value(const optional<datetime_t>& moment,
foreach (const amounts_map::value_type& pair, amounts) {
if (! temp)
temp = balance_t();
- if (optional<amount_t> val = pair.second.value(moment, in_terms_of))
+ if (optional<amount_t> val = pair.second.value(primary_only, moment,
+ in_terms_of))
*temp += *val;
else
*temp += pair.second;