fixed display predicates in the register report
This commit is contained in:
parent
b7777eac68
commit
c9b54e6ece
3 changed files with 29 additions and 30 deletions
43
format.cc
43
format.cc
|
|
@ -358,34 +358,33 @@ void format_transaction::operator()(transaction_t * xact) const
|
||||||
xact->total += *xact;
|
xact->total += *xact;
|
||||||
xact->index = last_xact ? last_xact->index + 1 : 0;
|
xact->index = last_xact ? last_xact->index + 1 : 0;
|
||||||
|
|
||||||
if (! disp_pred_functor(xact))
|
if (disp_pred_functor(xact)) {
|
||||||
return;
|
xact->flags |= TRANSACTION_DISPLAYED;
|
||||||
|
|
||||||
xact->flags |= TRANSACTION_DISPLAYED;
|
// This makes the assumption that transactions from a single entry
|
||||||
|
// are always grouped together.
|
||||||
// This makes the assumption that transactions from a single entry
|
|
||||||
// are always grouped together.
|
|
||||||
|
|
||||||
#ifdef COLLAPSED_REGISTER
|
#ifdef COLLAPSED_REGISTER
|
||||||
if (collapsed) {
|
if (collapsed) {
|
||||||
// If we've reached a new entry, report on the subtotal
|
// If we've reached a new entry, report on the subtotal
|
||||||
// accumulated thus far.
|
// accumulated thus far.
|
||||||
|
|
||||||
if (last_entry && last_entry != xact->entry) {
|
if (last_entry && last_entry != xact->entry) {
|
||||||
report_cumulative_subtotal();
|
report_cumulative_subtotal();
|
||||||
subtotal = 0;
|
subtotal = 0;
|
||||||
count = 0;
|
count = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
subtotal += *xact;
|
subtotal += *xact;
|
||||||
count++;
|
count++;
|
||||||
} else
|
} else
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
if (last_entry != xact->entry) {
|
if (last_entry != xact->entry) {
|
||||||
first_line_format.format_elements(output_stream, details_t(xact));
|
first_line_format.format_elements(output_stream, details_t(xact));
|
||||||
} else {
|
} else {
|
||||||
next_lines_format.format_elements(output_stream, details_t(xact));
|
next_lines_format.format_elements(output_stream, details_t(xact));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
2
format.h
2
format.h
|
|
@ -82,6 +82,8 @@ struct format_t
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define COLLAPSED_REGISTER 1 // support collapsed registers
|
||||||
|
|
||||||
class format_transaction
|
class format_transaction
|
||||||
{
|
{
|
||||||
std::ostream& output_stream;
|
std::ostream& output_stream;
|
||||||
|
|
|
||||||
14
main.cc
14
main.cc
|
|
@ -578,18 +578,15 @@ int main(int argc, char * argv[])
|
||||||
predicate.reset(parse_expr(predicate_string));
|
predicate.reset(parse_expr(predicate_string));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! show_empty && display_predicate_string.empty()) {
|
if (display_predicate_string.empty()) {
|
||||||
if (command == "b")
|
if (command == "b" && ! show_empty)
|
||||||
display_predicate_string = "T";
|
display_predicate_string = "T";
|
||||||
else if (command == "E")
|
else if (command == "E")
|
||||||
display_predicate_string = "a";
|
display_predicate_string = "a";
|
||||||
}
|
} else {
|
||||||
|
|
||||||
if (! display_predicate_string.empty()) {
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
if (debug)
|
if (debug)
|
||||||
std::cerr << "display predicate = " << display_predicate_string
|
std::cerr << "display-p = " << display_predicate_string << std::endl;
|
||||||
<< std::endl;
|
|
||||||
#endif
|
#endif
|
||||||
display_predicate.reset(parse_expr(display_predicate_string));
|
display_predicate.reset(parse_expr(display_predicate_string));
|
||||||
}
|
}
|
||||||
|
|
@ -599,7 +596,7 @@ int main(int argc, char * argv[])
|
||||||
if (! sort_string.empty())
|
if (! sort_string.empty())
|
||||||
sort_order.reset(parse_expr(sort_string));
|
sort_order.reset(parse_expr(sort_string));
|
||||||
|
|
||||||
// Setup the meaning of %t and %T encountered in format strings
|
// Setup the meaning of %t and %T, used in format strings
|
||||||
|
|
||||||
format_t::value_expr.reset(parse_expr(value_expr));
|
format_t::value_expr.reset(parse_expr(value_expr));
|
||||||
format_t::total_expr.reset(parse_expr(total_expr));
|
format_t::total_expr.reset(parse_expr(total_expr));
|
||||||
|
|
@ -705,6 +702,7 @@ int main(int argc, char * argv[])
|
||||||
xact_display_flags);
|
xact_display_flags);
|
||||||
std::stable_sort(transactions_pool.begin(), transactions_pool.end(),
|
std::stable_sort(transactions_pool.begin(), transactions_pool.end(),
|
||||||
compare_items<transaction_t>(sort_order.get()));
|
compare_items<transaction_t>(sort_order.get()));
|
||||||
|
|
||||||
if (show_commodities_revalued) {
|
if (show_commodities_revalued) {
|
||||||
changed_value_filter<format_transaction>
|
changed_value_filter<format_transaction>
|
||||||
filtered_formatter(formatter);
|
filtered_formatter(formatter);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue