summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/post.h13
-rw-r--r--src/textual.cc11
-rw-r--r--src/xact.cc6
3 files changed, 24 insertions, 6 deletions
diff --git a/src/post.h b/src/post.h
index 51cbad64..eef58e52 100644
--- a/src/post.h
+++ b/src/post.h
@@ -52,12 +52,13 @@ class account_t;
class post_t : public item_t
{
public:
-#define POST_VIRTUAL 0x04 // the account was specified with (parens)
-#define POST_MUST_BALANCE 0x08 // posting must balance in the transaction
-#define POST_CALCULATED 0x10 // posting's amount was calculated
-#define POST_COST_CALCULATED 0x20 // posting's cost was calculated
-#define POST_COST_IN_FULL 0x40 // cost specified using @@
-#define POST_ANONYMIZED 0x80 // a temporary, anonymous posting
+#define POST_VIRTUAL 0x0010 // the account was specified with (parens)
+#define POST_MUST_BALANCE 0x0020 // posting must balance in the transaction
+#define POST_CALCULATED 0x0040 // posting's amount was calculated
+#define POST_COST_CALCULATED 0x0080 // posting's cost was calculated
+#define POST_COST_IN_FULL 0x0100 // cost specified using @@
+#define POST_COST_FIXATED 0x0200 // cost is fixed using = indicator
+#define POST_ANONYMIZED 0x0400 // a temporary, anonymous posting
xact_t * xact; // only set for posts of regular xacts
account_t * account;
diff --git a/src/textual.cc b/src/textual.cc
index 85b1a14b..dba31323 100644
--- a/src/textual.cc
+++ b/src/textual.cc
@@ -1096,6 +1096,14 @@ post_t * instance_t::parse_post(char * line,
if (*p) {
post->cost = amount_t();
+ bool fixed_cost = false;
+ if (*p == '=') {
+ p++;
+ fixed_cost = true;
+ if (*p == '\0')
+ throw parse_error(_("Posting is missing a cost amount"));
+ }
+
beg = p - line;
ptristream cstream(p, len - beg);
@@ -1122,6 +1130,9 @@ post_t * instance_t::parse_post(char * line,
post->cost->in_place_negate();
}
+ if (fixed_cost)
+ post->add_flags(POST_COST_FIXATED);
+
DEBUG("textual.parse", "line " << linenum << ": "
<< "Total cost is " << *post->cost);
DEBUG("textual.parse", "line " << linenum << ": "
diff --git a/src/xact.cc b/src/xact.cc
index 77a55c66..60186b1e 100644
--- a/src/xact.cc
+++ b/src/xact.cc
@@ -300,6 +300,12 @@ bool xact_base_t::finalize()
post->amount = breakdown.amount;
DEBUG("xact.finalize", "added breakdown, balance = " << balance);
}
+
+ if (post->has_flags(POST_COST_FIXATED) &&
+ post->amount.has_annotation() && post->amount.annotation().price) {
+ DEBUG("xact.finalize", "fixating annotation price");
+ post->amount.annotation().add_flags(ANNOTATION_PRICE_FIXATED);
+ }
}
if (null_post != NULL) {