diff options
author | John Wiegley <johnw@newartisans.com> | 2009-02-20 02:53:54 -0400 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2009-02-20 02:53:54 -0400 |
commit | c1b25fcf8629eca326fe6dd586e4896eeb5f2d45 (patch) | |
tree | f7c59ce215ee66513db2f9eb142cdf9e7095c465 /src/filters.h | |
parent | f2f52066d2a9c82619ffea0f3972e48417a90b5b (diff) | |
download | fork-ledger-c1b25fcf8629eca326fe6dd586e4896eeb5f2d45.tar.gz fork-ledger-c1b25fcf8629eca326fe6dd586e4896eeb5f2d45.tar.bz2 fork-ledger-c1b25fcf8629eca326fe6dd586e4896eeb5f2d45.zip |
Rewrote the equity command, which is working again
The old implementation used an account formatter, and was very
specialized. The new is done as a transaction filter, and works along
with everything else, eliminating bugs special to the equity report.
Diffstat (limited to 'src/filters.h')
-rw-r--r-- | src/filters.h | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/filters.h b/src/filters.h index d5636796..985fbf94 100644 --- a/src/filters.h +++ b/src/filters.h @@ -611,6 +611,34 @@ public: virtual void operator()(xact_t& xact); }; +class xacts_as_equity : public subtotal_xacts +{ + interval_t interval; + xact_t * last_xact; + account_t equity_account; + account_t * balance_account; + + xacts_as_equity(); + +public: + xacts_as_equity(xact_handler_ptr _handler, expr_t& amount_expr) + : subtotal_xacts(_handler, amount_expr), + equity_account(NULL, "Equity") { + TRACE_CTOR(xacts_as_equity, "xact_handler_ptr, expr_t&"); + balance_account = equity_account.find_account("Opening Balances"); + } + virtual ~xacts_as_equity() throw() { + TRACE_DTOR(xacts_as_equity); + } + + void report_subtotal(); + + virtual void flush() { + report_subtotal(); + subtotal_xacts::flush(); + } +}; + /** * @brief Brief * |