diff options
author | John Wiegley <johnw@newartisans.com> | 2010-06-10 12:29:58 -0400 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2010-06-10 12:29:58 -0400 |
commit | 685b12d8d3d225498f6dfdbe7b17056684cc2ca8 (patch) | |
tree | 1077572642a7ac55f29a31d95288c79e1dc03a74 /src/textual.cc | |
parent | a2bcfe4338801d1979ee859a3ce6cc289f80a5aa (diff) | |
download | fork-ledger-685b12d8d3d225498f6dfdbe7b17056684cc2ca8.tar.gz fork-ledger-685b12d8d3d225498f6dfdbe7b17056684cc2ca8.tar.bz2 fork-ledger-685b12d8d3d225498f6dfdbe7b17056684cc2ca8.zip |
Allow fixated costs, as well as prices
You can now establish a fixated price automatically by way of a fixated
cost. The syntax for this is:
2009/11/01 Sample
Assets 1 apple @ =$0.10
Equity
Diffstat (limited to 'src/textual.cc')
-rw-r--r-- | src/textual.cc | 11 |
1 files changed, 11 insertions, 0 deletions
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 << ": " |