summaryrefslogtreecommitdiff
path: root/src/print.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/print.cc')
-rw-r--r--src/print.cc18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/print.cc b/src/print.cc
index 0683f2e3..02e518f7 100644
--- a/src/print.cc
+++ b/src/print.cc
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003-2013, John Wiegley. All rights reserved.
+ * Copyright (c) 2003-2015, John Wiegley. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -243,13 +243,21 @@ namespace {
amtbuf << string(2 - (slip + amt_slip), ' ');
amtbuf << amt;
- if (post->cost &&
+ if (post->given_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 << " @ "
- << (*post->cost / post->amount).abs();
+ 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->given_cost->abs();
+ else
+ amtbuf << " " << cost_op << " "
+ << (*post->given_cost / post->amount).abs();
}
if (post->assigned_amount)