Revert "--depth for register"
This commit is contained in:
parent
fbba9adc16
commit
69de980aeb
3 changed files with 15 additions and 33 deletions
|
|
@ -7740,7 +7740,7 @@ The market value of a posting or an account, without its children.
|
|||
The net gain (market value minus cost basis), for a posting or an
|
||||
account, without its children. It is the same as @samp{v-b}.
|
||||
|
||||
@item depth
|
||||
@item l
|
||||
The depth (``level'') of an account. If an account has one parent,
|
||||
its depth is one.
|
||||
|
||||
|
|
|
|||
|
|
@ -448,20 +448,16 @@ void collapse_posts::report_subtotal()
|
|||
DEBUG("filters.collapse", "Pseudo-xact date = " << *xact._date);
|
||||
DEBUG("filters.collapse", "earliest date = " << earliest_date);
|
||||
DEBUG("filters.collapse", "latest date = " << latest_date);
|
||||
|
||||
foreach (totals_map::value_type& pat, totals) {
|
||||
handle_value(/* value= */ pat.second,
|
||||
/* account= */ &temps.create_account(pat.first),
|
||||
/* xact= */ &xact,
|
||||
/* temps= */ temps,
|
||||
/* handler= */ handler,
|
||||
/* date= */ latest_date,
|
||||
/* act_date_p= */ false);
|
||||
}
|
||||
|
||||
handle_value(/* value= */ subtotal,
|
||||
/* account= */ totals_account,
|
||||
/* xact= */ &xact,
|
||||
/* temps= */ temps,
|
||||
/* handler= */ handler,
|
||||
/* date= */ latest_date,
|
||||
/* act_date_p= */ false);
|
||||
}
|
||||
|
||||
totals.clear();
|
||||
component_posts.clear();
|
||||
|
||||
last_xact = NULL;
|
||||
|
|
@ -470,20 +466,6 @@ void collapse_posts::report_subtotal()
|
|||
count = 0;
|
||||
}
|
||||
|
||||
value_t& collapse_posts::find_totals(account_t* account)
|
||||
{
|
||||
unsigned short depth=3;
|
||||
|
||||
if(depth==0)
|
||||
return totals[_("<Total>")];
|
||||
|
||||
if(account->depth==depth)
|
||||
return totals[account->fullname()];
|
||||
|
||||
//else recurse
|
||||
return find_totals(account->parent);
|
||||
}
|
||||
|
||||
void collapse_posts::operator()(post_t& post)
|
||||
{
|
||||
// If we've reached a new xact, report on the subtotal
|
||||
|
|
@ -493,7 +475,6 @@ void collapse_posts::operator()(post_t& post)
|
|||
report_subtotal();
|
||||
|
||||
post.add_to_value(subtotal, amount_expr);
|
||||
post.add_to_value(find_totals(post.account), amount_expr);
|
||||
|
||||
component_posts.push_back(&post);
|
||||
|
||||
|
|
|
|||
|
|
@ -421,9 +421,6 @@ public:
|
|||
|
||||
class collapse_posts : public item_handler<post_t>
|
||||
{
|
||||
|
||||
typedef std::map<string,value_t> totals_map;
|
||||
|
||||
expr_t& amount_expr;
|
||||
predicate_t display_predicate;
|
||||
predicate_t only_predicate;
|
||||
|
|
@ -432,7 +429,7 @@ class collapse_posts : public item_handler<post_t>
|
|||
xact_t * last_xact;
|
||||
post_t * last_post;
|
||||
temporaries_t temps;
|
||||
totals_map totals;
|
||||
account_t * totals_account;
|
||||
bool only_collapse_if_zero;
|
||||
std::list<post_t *> component_posts;
|
||||
report_t& report;
|
||||
|
|
@ -451,13 +448,17 @@ public:
|
|||
only_predicate(_only_predicate), count(0),
|
||||
last_xact(NULL), last_post(NULL),
|
||||
only_collapse_if_zero(_only_collapse_if_zero), report(_report) {
|
||||
create_accounts();
|
||||
TRACE_CTOR(collapse_posts, "post_handler_ptr, ...");
|
||||
}
|
||||
virtual ~collapse_posts() {
|
||||
TRACE_DTOR(collapse_posts);
|
||||
handler.reset();
|
||||
}
|
||||
value_t& find_totals(account_t* account);
|
||||
|
||||
void create_accounts() {
|
||||
totals_account = &temps.create_account(_("<Total>"));
|
||||
}
|
||||
|
||||
virtual void flush() {
|
||||
report_subtotal();
|
||||
|
|
@ -479,7 +480,7 @@ public:
|
|||
last_post = NULL;
|
||||
|
||||
temps.clear();
|
||||
totals.clear();
|
||||
create_accounts();
|
||||
component_posts.clear();
|
||||
|
||||
item_handler<post_t>::clear();
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue