From 3edf2986335280bb13fffc51f23212622a79c9a9 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Wed, 11 Aug 2004 01:37:12 -0400 Subject: added several kinds of transaction filters --- format.cc | 93 --------------------------------------------------------------- 1 file changed, 93 deletions(-) (limited to 'format.cc') diff --git a/format.cc b/format.cc index e39b4b78..a5c73b2a 100644 --- a/format.cc +++ b/format.cc @@ -312,99 +312,6 @@ void format_t::format_elements(std::ostream& out, } } -#ifdef COLLAPSED_REGISTER - -void format_transaction::report_cumulative_subtotal() const -{ - if (count == 1) { - first_line_format.format_elements(output_stream, details_t(last_xact)); - return; - } - - assert(count > 1); - - account_t splits(NULL, ""); - transaction_t splits_total(NULL, &splits); - splits_total.total = subtotal; - - balance_t value; - format_t::compute_total(value, details_t(&splits_total)); - - splits_total.entry = last_entry; - splits_total.total = last_xact->total; - - bool first = true; - for (amounts_map::const_iterator i = value.amounts.begin(); - i != value.amounts.end(); - i++) { - splits_total.amount = (*i).second; - splits_total.cost = (*i).second; - splits_total.total += (*i).second; - if (first) { - first_line_format.format_elements(output_stream, - details_t(&splits_total)); - first = false; - } else { - next_lines_format.format_elements(output_stream, - details_t(&splits_total)); - } - } -} - -#endif // COLLAPSED_REGISTER - -void format_transaction::operator()(transaction_t * xact) const -{ - if (last_xact) - xact->total += last_xact->total; - - if (inverted) { - xact->amount.negate(); - xact->cost.negate(); - } - - xact->total += *xact; - xact->index = last_xact ? last_xact->index + 1 : 0; - - if (disp_pred(xact)) { - xact->dflags |= TRANSACTION_DISPLAYED; - - // This makes the assumption that transactions from a single entry - // are always grouped together. - -#ifdef COLLAPSED_REGISTER - if (collapsed) { - // If we've reached a new entry, report on the subtotal - // accumulated thus far. - - if (last_entry && last_entry != xact->entry) { - report_cumulative_subtotal(); - subtotal = 0; - count = 0; - } - - subtotal += *xact; - count++; - } else -#endif - { - if (last_entry != xact->entry) { - first_line_format.format_elements(output_stream, details_t(xact)); - } else { - next_lines_format.format_elements(output_stream, details_t(xact)); - } - } - } - - if (inverted) { - xact->amount.negate(); - xact->cost.negate(); - } - - last_entry = xact->entry; - last_xact = xact; -} - bool format_account::disp_subaccounts_p(const account_t * account, const item_predicate& disp_pred, -- cgit v1.2.3