diff options
author | John Wiegley <johnw@newartisans.com> | 2006-03-24 16:37:26 +0000 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2008-04-13 02:41:31 -0400 |
commit | a5aff9eee967adb8c71ce6fc25db0458d522836e (patch) | |
tree | 1ab913955246a1ba0afd19d1f2fc776797a046d7 /balance.h | |
parent | 44561c1c1d233d9432de319a71b44a3e05275d49 (diff) | |
download | ledger-a5aff9eee967adb8c71ce6fc25db0458d522836e.tar.gz ledger-a5aff9eee967adb8c71ce6fc25db0458d522836e.tar.bz2 ledger-a5aff9eee967adb8c71ce6fc25db0458d522836e.zip |
Several fixes to lot price handling.
Diffstat (limited to 'balance.h')
-rw-r--r-- | balance.h | 24 |
1 files changed, 24 insertions, 0 deletions
@@ -449,6 +449,19 @@ class balance_t (*i).second.abs(); } + void reduce() { + for (amounts_map::iterator i = amounts.begin(); + i != amounts.end(); + i++) + (*i).second.reduce(); + } + + balance_t reduced() const { + balance_t temp(*this); + temp.reduce(); + return temp; + } + void round() { for (amounts_map::iterator i = amounts.begin(); i != amounts.end(); @@ -893,6 +906,17 @@ class balance_pair_t return quantity.valid() && (! cost || cost->valid()); } + void reduce() { + quantity.reduce(); + if (cost) cost->reduce(); + } + + balance_pair_t reduced() const { + balance_pair_t temp(*this); + temp.reduce(); + return temp; + } + void round() { quantity.round(); if (cost) cost->round(); |