summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2004-09-23 20:10:33 -0400
committerJohn Wiegley <johnw@newartisans.com>2004-09-23 20:10:33 -0400
commit02580c2efbad9b364ab0dfa535c5fe0577cb818d (patch)
treede3d7ee548e2fbc2c7ccfa7dbefc3b646e45977c
parentd0ba09f1e0f26fd3f449ca639abb71083ead9243 (diff)
downloadfork-ledger-02580c2efbad9b364ab0dfa535c5fe0577cb818d.tar.gz
fork-ledger-02580c2efbad9b364ab0dfa535c5fe0577cb818d.tar.bz2
fork-ledger-02580c2efbad9b364ab0dfa535c5fe0577cb818d.zip
more "entry" fixes
-rw-r--r--journal.cc10
-rw-r--r--ledger.texi9
2 files changed, 17 insertions, 2 deletions
diff --git a/journal.cc b/journal.cc
index 174bd91a..fee080e6 100644
--- a/journal.cc
+++ b/journal.cc
@@ -380,9 +380,13 @@ entry_t * journal_t::derive_entry(strings_list::iterator i,
xact = new transaction_t(m_xact->account, - first->amount);
added->add_transaction(xact);
- if (i != end)
- if (account_t * acct = find_account(*i))
+ if (i != end) {
+ account_t * acct = find_account_re(*i);
+ if (! acct)
+ acct = find_account(*i);
+ if (acct)
added->transactions.back()->account = acct;
+ }
} else {
while (i != end) {
std::string& re_pat(*i++);
@@ -668,6 +672,8 @@ void export_journal()
.def("remove_account", &journal_t::remove_account)
.def("find_account", py_find_account_1, return_internal_reference<1>())
.def("find_account", py_find_account_2, return_internal_reference<1>())
+ .def("find_account_re", &journal_t::find_account_re,
+ return_internal_reference<1>())
.def("add_entry", &journal_t::add_entry)
.def("remove_entry", &journal_t::remove_entry)
diff --git a/ledger.texi b/ledger.texi
index 3d668f3d..b024e33c 100644
--- a/ledger.texi
+++ b/ledger.texi
@@ -307,6 +307,15 @@ ledger entry 4/9 viva 11.00
# Pay $11.00 to food from checking
ledger entry 4/9 viva 11.00 checking
+# Pay $11.00 to food, $8.00 to tips
+ledger entry 4/9 viva food 11.00 tips 8
+
+# Same as the last, but draw from cash
+ledger entry 4/9 viva food 11.00 tips 8 cash
+
+# Same as the last, but force the commodity
+ledger entry 4/9 viva food $11.00 tips $8 cash
+
# Pay DM 11.00 to dining, no matter what the entry said
ledger entry 4/9 viva dining "DM 11.00"
@end example