diff options
author | Martin Michlmayr <tbm@cyrius.com> | 2014-05-30 20:23:59 -0400 |
---|---|---|
committer | Martin Michlmayr <tbm@cyrius.com> | 2014-05-30 20:23:59 -0400 |
commit | b534ee80a35bec45f5885ed34cc8aa672b5941a5 (patch) | |
tree | 91657e65d1e4d42982e63410e880734bd5274800 /src/print.cc | |
parent | fafd7c13460c872c7c5736932a4264a6a3b1fbe5 (diff) | |
download | fork-ledger-b534ee80a35bec45f5885ed34cc8aa672b5941a5.tar.gz fork-ledger-b534ee80a35bec45f5885ed34cc8aa672b5941a5.tar.bz2 fork-ledger-b534ee80a35bec45f5885ed34cc8aa672b5941a5.zip |
Handle POST_COST_VIRTUAL in print
Bug fix for #1046
Diffstat (limited to 'src/print.cc')
-rw-r--r-- | src/print.cc | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/print.cc b/src/print.cc index c0817950..9be3b511 100644 --- a/src/print.cc +++ b/src/print.cc @@ -245,10 +245,18 @@ namespace { if (post->cost && ! post->has_flags(POST_CALCULATED | POST_COST_CALCULATED)) { + std::string cost_op; if (post->has_flags(POST_COST_IN_FULL)) - amtbuf << " @@ " << post->cost->abs(); + cost_op = "@@"; else - amtbuf << " @ " + cost_op = "@"; + if (post->has_flags(POST_COST_VIRTUAL)) + cost_op = "(" + cost_op + ")"; + + if (post->has_flags(POST_COST_IN_FULL)) + amtbuf << " " << cost_op << " " << post->cost->abs(); + else + amtbuf << " " << cost_op << " " << (*post->cost / post->amount).abs(); } |