diff options
Diffstat (limited to 'autoxact.cc')
-rw-r--r-- | autoxact.cc | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/autoxact.cc b/autoxact.cc new file mode 100644 index 00000000..c49d1d38 --- /dev/null +++ b/autoxact.cc @@ -0,0 +1,28 @@ +#include "autoxact.h" + +namespace ledger { + +void automated_transaction_t::extend_entry(entry_t * entry) +{ + for (transactions_list::iterator i = entry->transactions.begin(); + i != entry->transactions.end(); + i++) + if (matches(masks, *((*i)->account))) { + for (transactions_list::iterator t = transactions.begin(); + t != transactions.end(); + t++) { + amount_t amt; + if ((*t)->amount.commodity->symbol.empty()) + amt = (*i)->amount * (*t)->amount; + else + amt = (*t)->amount; + + transaction_t * xact + = new transaction_t(entry, (*t)->account, amt, amt, + (*t)->flags | TRANSACTION_AUTO); + entry->add_transaction(xact); + } + } +} + +} // namespace ledger |