summaryrefslogtreecommitdiff
path: root/src/filters.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2009-02-16 18:11:23 -0400
committerJohn Wiegley <johnw@newartisans.com>2009-02-16 18:11:23 -0400
commit15bfeb3cb1d04657d9fc7dc6120e5c460dc0db2b (patch)
treefa1075c7f7ac4709ac2cb8c4b82f22697159119d /src/filters.cc
parent053ecc9366e9b7875ccb10edbff0b8c357cb0c38 (diff)
downloadfork-ledger-15bfeb3cb1d04657d9fc7dc6120e5c460dc0db2b.tar.gz
fork-ledger-15bfeb3cb1d04657d9fc7dc6120e5c460dc0db2b.tar.bz2
fork-ledger-15bfeb3cb1d04657d9fc7dc6120e5c460dc0db2b.zip
Added several new reporting options
To help with gathering specific reports: - --payee-as-account copies the entry's payee field to the account, allowing the subtotal report to show unique payees for each period. - --comm-as-account copies the transaction's amount's commodity to the account. - --code-as-account copies the entry's code to the account Also created aliases for some of these options, for conistency's sake: - --commodity-as-payee is now an alias for --comm-as-payee - --commodity-as-account is now an alias for --comm-as-account
Diffstat (limited to 'src/filters.cc')
-rw-r--r--src/filters.cc35
1 files changed, 3 insertions, 32 deletions
diff --git a/src/filters.cc b/src/filters.cc
index 9fa97330..65fa92db 100644
--- a/src/filters.cc
+++ b/src/filters.cc
@@ -560,49 +560,20 @@ void by_payee_xacts::operator()(xact_t& xact)
(*(*i).second)(xact);
}
-void set_comm_as_payee::operator()(xact_t& xact)
+void transfer_details::operator()(xact_t& xact)
{
entry_temps.push_back(*xact.entry);
entry_t& entry = entry_temps.back();
- entry._date = xact._date;
- entry._date_eff = xact._date_eff;
- entry.code = xact.entry->code;
-
- if (xact.amount.commodity())
- entry.payee = xact.amount.commodity().symbol();
- else
- entry.payee = "<none>";
+ entry._date = xact.reported_date();
xact_temps.push_back(xact);
xact_t& temp = xact_temps.back();
temp.entry = &entry;
temp.set_state(xact.state());
temp.add_flags(ITEM_TEMP);
-
entry.add_xact(&temp);
- item_handler<xact_t>::operator()(temp);
-}
-
-void set_code_as_payee::operator()(xact_t& xact)
-{
- entry_temps.push_back(*xact.entry);
- entry_t& entry = entry_temps.back();
- entry._date = xact._date;
- entry._date_eff = xact._date_eff;
-
- if (xact.entry->code)
- entry.payee = *xact.entry->code;
- else
- entry.payee = "<none>";
-
- xact_temps.push_back(xact);
- xact_t& temp = xact_temps.back();
- temp.entry = &entry;
- temp.set_state(xact.state());
- temp.add_flags(ITEM_TEMP);
-
- entry.add_xact(&temp);
+ set_details(entry, temp);
item_handler<xact_t>::operator()(temp);
}