From 8d2fce1ae8a1b8c3cce4e22d807421915a0001ce Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Sat, 12 Jun 2010 21:39:28 -0400 Subject: Automated xacts may now contain "deferred tags" For example, consider the following automated transaction: = /Food/ ; Next Date:: date + 10 (Expenses:Tax) 1.00 ; Next Date:: date + 20 This will add a metadata field named 'Next Date' to the _matching posting_, with a value that is 10 days later than that posting. It will also generate a new posting for that transaction, whose amount is the same as the matching posting. Further, it will add a 'Next Date' metadata tag to the _generated posting_ whose value is 20 days later than the date of the matching posting. --- src/journal.cc | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/journal.cc') diff --git a/src/journal.cc b/src/journal.cc index fd6d3eac..ed1e26be 100644 --- a/src/journal.cc +++ b/src/journal.cc @@ -105,7 +105,8 @@ account_t * journal_t::find_account_re(const string& regexp) return master->find_account_re(regexp); } -bool journal_t::add_xact(xact_t * xact) +bool journal_t::add_xact(xact_t * xact, + optional current_year) { xact->journal = this; @@ -114,16 +115,17 @@ bool journal_t::add_xact(xact_t * xact) return false; } - extend_xact(xact); + extend_xact(xact, current_year); xacts.push_back(xact); return true; } -void journal_t::extend_xact(xact_base_t * xact) +void journal_t::extend_xact(xact_base_t * xact, + optional current_year) { foreach (auto_xact_t * auto_xact, auto_xacts) - auto_xact->extend_xact(*xact); + auto_xact->extend_xact(*xact, current_year); } bool journal_t::remove_xact(xact_t * xact) -- cgit v1.2.3