summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/ledger3.texi26
-rw-r--r--src/filters.cc3
-rw-r--r--src/journal.cc13
3 files changed, 27 insertions, 15 deletions
diff --git a/doc/ledger3.texi b/doc/ledger3.texi
index f99504f0..b8aaa49b 100644
--- a/doc/ledger3.texi
+++ b/doc/ledger3.texi
@@ -1312,9 +1312,9 @@ your opening balance entry could look like this:
Assets:Joint Checking $800.14
Assets:Other Checking $63.44
Assets:Savings $2805.54
- Assets:Investments:401K:Deferred 100.0000 VIFSX @ $80.5227
- Assets:Investments:401K:Matching 50.0000 VIFSX @ $83.7015
- Assets:Investments:IRA 250.0000 VTHRX @ $20.5324
+ Assets:Investments:401K:Deferred 100.0000 VIFSX @@ $80.5227
+ Assets:Investments:401K:Matching 50.0000 VIFSX @@ $83.7015
+ Assets:Investments:IRA 250.0000 VTHRX @@ $20.5324
Liabilities:Mortgage $-175634.88
Liabilities:Car Loan $-3494.26
Liabilities:Visa -$1762.44
@@ -2182,7 +2182,7 @@ This is a synonym for @code{comment} and must be closed by an @code{end} tag.
@item year
@c instance_t::year_directive in textual.cc
Denotes the year used for all subsequent transactions that give a date
-without a year. The year should appear immediately after the Y, for
+without a year. The year should appear immediately after the directive, for
example: @code{year 2004}. This is useful at the beginning of a file, to
specify the year for that file. If all transactions specify a year,
however, this command has no effect.
@@ -2970,12 +2970,12 @@ resulting posting cost is $50.00 per share.
@node Explicit posting costs, Posting cost expressions, Posting cost, Transactions
@section Explicit posting costs
-You can make any posting's cost explicit using the @ symbol after the amount
+You can make any posting's cost explicit using the @@ symbol after the amount
or amount expression:
@smallexample
2012-03-10 My Broker
- Assets:Brokerage 10 AAPL @ $50.00
+ Assets:Brokerage 10 AAPL @@ $50.00
Assets:Brokerage:Cash $-500.00
@end smallexample
@@ -2984,7 +2984,7 @@ the first posting's cost, you can elide the other amount:
@smallexample
2012-03-10 My Broker
- Assets:Brokerage 10 AAPL @ $50.00
+ Assets:Brokerage 10 AAPL @@ $50.00
Assets:Brokerage:Cash
@end smallexample
@@ -3029,7 +3029,7 @@ You can even have both:
@node Total posting costs, Virtual posting costs, Posting cost expressions, Transactions
@section Total posting costs
-The cost figure following the @ character specifies the @emph{per-unit} price for
+The cost figure following the @@ character specifies the @emph{per-unit} price for
the commodity being transferred. If you'd like to specify the total cost
instead, use @@@@:
@@ -3149,7 +3149,7 @@ Plus, it comes with dangers. This works fine:
@smallexample
2012-04-10 My Broker
- Assets:Brokerage 10 AAPL @ $50.00
+ Assets:Brokerage 10 AAPL @@ $50.00
Assets:Brokerage:Cash $750.00
2012-04-10 My Broker
@@ -3167,7 +3167,7 @@ Plus, it comes with dangers. This works fine:
@smallexample
2012-04-10 My Broker
- Assets:Brokerage 10 AAPL @ $50.00
+ Assets:Brokerage 10 AAPL @@ $50.00
Assets:Brokerage:Cash $750.00
2012-04-10 My Broker
@@ -3192,7 +3192,7 @@ following two transactions are equivalent:
@smallexample
2012-04-10 My Broker
- Assets:Brokerage 10 AAPL @ $50.00
+ Assets:Brokerage 10 AAPL @@ $50.00
Assets:Brokerage:Cash $750.00
2012-04-10 My Broker
@@ -3257,7 +3257,7 @@ that dates are parsed in value expressions):
You can also associate arbitrary notes for your own record keeping in
parentheses, and reveal them with --lot-notes. One caveat is that the note
-cannot begin with an @ character, as that would indicate a virtual cost:
+cannot begin with an @@ character, as that would indicate a virtual cost:
@smallexample
2012-04-10 My Broker
@@ -4914,7 +4914,7 @@ model transaction:
--- Context is first posting of the following transaction ---
2004/05/27 Book Store
; This note applies to all postings. :SecondTag:
- Expenses:Books 20 BOOK @ $10
+ Expenses:Books 20 BOOK @@ $10
; Metadata: Some Value
; Typed:: $100 + $200
; :ExampleTag:
diff --git a/src/filters.cc b/src/filters.cc
index 5e2bf983..7570809a 100644
--- a/src/filters.cc
+++ b/src/filters.cc
@@ -983,7 +983,8 @@ void interval_posts::flush()
sort_posts_by_date());
// Determine the beginning interval by using the earliest post
- if (! interval.find_period(all_posts.front()->date()))
+ if (all_posts.front() &&
+ ! interval.find_period(all_posts.front()->date()))
throw_(std::logic_error, _("Failed to find period for interval report"));
// Walk the interval forward reporting all posts within each one
diff --git a/src/journal.cc b/src/journal.cc
index e6c09125..f45b7527 100644
--- a/src/journal.cc
+++ b/src/journal.cc
@@ -127,8 +127,19 @@ account_t * journal_t::register_account(const string& name, post_t * post,
// object.
if (account_aliases.size() > 0) {
accounts_map::const_iterator i = account_aliases.find(name);
- if (i != account_aliases.end())
+ if (i != account_aliases.end()) {
result = (*i).second;
+ } else {
+ // only check the very first account for alias expansion, in case
+ // that can be expanded successfully
+ size_t colon = name.find(':');
+ if(colon != string::npos) {
+ accounts_map::const_iterator i = account_aliases.find(name.substr(0, colon));
+ if (i != account_aliases.end()) {
+ result = find_account((*i).second->fullname() + name.substr(colon));
+ }
+ }
+ }
}
// Create the account object and associate it with the journal; this