diff options
author | John Wiegley <johnw@newartisans.com> | 2010-06-09 03:39:17 -0400 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2010-06-09 03:39:17 -0400 |
commit | 158b9c92fdf60dc24ab7d461d8ae88eb277d892e (patch) | |
tree | 94143f056a4e8e8a86d9223e17e57345531562f1 /src/xact.cc | |
parent | 659741ac47cf6aaf9c275fe7825885b38910d2eb (diff) | |
download | fork-ledger-158b9c92fdf60dc24ab7d461d8ae88eb277d892e.tar.gz fork-ledger-158b9c92fdf60dc24ab7d461d8ae88eb277d892e.tar.bz2 fork-ledger-158b9c92fdf60dc24ab7d461d8ae88eb277d892e.zip |
Fixed minor rounding issue with priced commodities
Diffstat (limited to 'src/xact.cc')
-rw-r--r-- | src/xact.cc | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/xact.cc b/src/xact.cc index 495e6410..77a55c66 100644 --- a/src/xact.cc +++ b/src/xact.cc @@ -275,11 +275,11 @@ bool xact_base_t::finalize() datetime_t(date(), time_duration(0, 0, 0, 0))); if (post->amount.has_annotation() && - breakdown.basis_cost.commodity() == - breakdown.final_cost.commodity()) { - if (amount_t gain_loss = (breakdown.basis_cost - - breakdown.final_cost).rounded()) { + breakdown.basis_cost.commodity() == breakdown.final_cost.commodity()) { + if (amount_t gain_loss = breakdown.basis_cost - breakdown.final_cost) { DEBUG("xact.finalize", "gain_loss = " << gain_loss); + gain_loss.in_place_round(); + DEBUG("xact.finalize", "gain_loss rounds to = " << gain_loss); add_or_set_value(balance, gain_loss.reduced()); @@ -293,6 +293,8 @@ bool xact_base_t::finalize() p->set_state(post->state()); add_post(p); DEBUG("xact.finalize", "added gain_loss, balance = " << balance); + } else { + DEBUG("xact.finalize", "gain_loss would have display as zero"); } } else { post->amount = breakdown.amount; |