Don't compute running total for balance reports
This commit is contained in:
parent
fb9af0f111
commit
6ac79137f7
3 changed files with 23 additions and 19 deletions
|
|
@ -123,9 +123,10 @@ class account_t : public scope_t
|
||||||
#define ACCOUNT_EXT_SORT_CALC 0x01
|
#define ACCOUNT_EXT_SORT_CALC 0x01
|
||||||
#define ACCOUNT_EXT_HAS_NON_VIRTUALS 0x02
|
#define ACCOUNT_EXT_HAS_NON_VIRTUALS 0x02
|
||||||
#define ACCOUNT_EXT_HAS_UNB_VIRTUALS 0x04
|
#define ACCOUNT_EXT_HAS_UNB_VIRTUALS 0x04
|
||||||
#define ACCOUNT_EXT_VISITED 0x08
|
#define ACCOUNT_EXT_AUTO_VIRTUALIZE 0x08
|
||||||
#define ACCOUNT_EXT_MATCHING 0x10
|
#define ACCOUNT_EXT_VISITED 0x10
|
||||||
#define ACCOUNT_EXT_DISPLAYED 0x20
|
#define ACCOUNT_EXT_MATCHING 0x20
|
||||||
|
#define ACCOUNT_EXT_DISPLAYED 0x40
|
||||||
|
|
||||||
struct details_t
|
struct details_t
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -194,33 +194,33 @@ void calc_posts::operator()(post_t& post)
|
||||||
|
|
||||||
if (last_post) {
|
if (last_post) {
|
||||||
assert(last_post->has_xdata());
|
assert(last_post->has_xdata());
|
||||||
add_or_set_value(xdata.total, last_post->xdata().total);
|
if (! account_wise)
|
||||||
|
xdata.total = last_post->xdata().total;
|
||||||
xdata.count = last_post->xdata().count + 1;
|
xdata.count = last_post->xdata().count + 1;
|
||||||
} else {
|
} else {
|
||||||
xdata.count = 1;
|
xdata.count = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
value_t amount;
|
post.add_to_value(xdata.visited_value, amount_expr);
|
||||||
post.add_to_value(amount, amount_expr);
|
xdata.add_flags(POST_EXT_VISITED);
|
||||||
|
|
||||||
add_or_set_value(xdata.total, amount);
|
account_t * acct = post.reported_account();
|
||||||
|
acct->xdata().add_flags(ACCOUNT_EXT_VISITED);
|
||||||
if (calc_totals) {
|
|
||||||
account_t * acct = post.reported_account();
|
|
||||||
|
|
||||||
|
if (! account_wise) {
|
||||||
|
add_or_set_value(xdata.total, xdata.visited_value);
|
||||||
|
} else {
|
||||||
account_t::xdata_t * acct_xdata = &acct->xdata();
|
account_t::xdata_t * acct_xdata = &acct->xdata();
|
||||||
|
|
||||||
add_or_set_value(acct_xdata->self_details.total, amount);
|
add_or_set_value(acct_xdata->self_details.total, xdata.visited_value);
|
||||||
|
|
||||||
acct_xdata->self_details.posts_count++;
|
acct_xdata->self_details.posts_count++;
|
||||||
acct_xdata->self_details.posts_virtuals_count++;
|
acct_xdata->self_details.posts_virtuals_count++;
|
||||||
|
|
||||||
acct_xdata->add_flags(ACCOUNT_EXT_VISITED);
|
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
add_or_set_value(acct_xdata->family_details.total, amount);
|
add_or_set_value(acct_xdata->family_details.total, xdata.visited_value);
|
||||||
acct_xdata->family_details.posts_count++;
|
|
||||||
|
|
||||||
|
acct_xdata->family_details.posts_count++;
|
||||||
if (post.has_flags(POST_VIRTUAL))
|
if (post.has_flags(POST_VIRTUAL))
|
||||||
acct_xdata->family_details.posts_virtuals_count++;
|
acct_xdata->family_details.posts_virtuals_count++;
|
||||||
|
|
||||||
|
|
@ -259,7 +259,8 @@ namespace {
|
||||||
// If the account for this post is all virtual, then report the post as
|
// If the account for this post is all virtual, then report the post as
|
||||||
// such. This allows subtotal reports to show "(Account)" for accounts
|
// such. This allows subtotal reports to show "(Account)" for accounts
|
||||||
// that contain only virtual posts.
|
// that contain only virtual posts.
|
||||||
if (account && account->has_xdata()) {
|
if (account && account->has_xdata() &&
|
||||||
|
account->xdata().has_flags(ACCOUNT_EXT_AUTO_VIRTUALIZE)) {
|
||||||
if (! account->xdata().has_flags(ACCOUNT_EXT_HAS_NON_VIRTUALS)) {
|
if (! account->xdata().has_flags(ACCOUNT_EXT_HAS_NON_VIRTUALS)) {
|
||||||
post.add_flags(POST_VIRTUAL);
|
post.add_flags(POST_VIRTUAL);
|
||||||
if (! account->xdata().has_flags(ACCOUNT_EXT_HAS_UNB_VIRTUALS))
|
if (! account->xdata().has_flags(ACCOUNT_EXT_HAS_UNB_VIRTUALS))
|
||||||
|
|
@ -567,6 +568,8 @@ void subtotal_posts::operator()(post_t& post)
|
||||||
// such, so that `handle_value' can show "(Account)" for accounts
|
// such, so that `handle_value' can show "(Account)" for accounts
|
||||||
// that contain only virtual posts.
|
// that contain only virtual posts.
|
||||||
|
|
||||||
|
post.reported_account()->xdata().add_flags(ACCOUNT_EXT_AUTO_VIRTUALIZE);
|
||||||
|
|
||||||
if (! post.has_flags(POST_VIRTUAL))
|
if (! post.has_flags(POST_VIRTUAL))
|
||||||
post.reported_account()->xdata().add_flags(ACCOUNT_EXT_HAS_NON_VIRTUALS);
|
post.reported_account()->xdata().add_flags(ACCOUNT_EXT_HAS_NON_VIRTUALS);
|
||||||
else if (! post.has_flags(POST_MUST_BALANCE))
|
else if (! post.has_flags(POST_MUST_BALANCE))
|
||||||
|
|
|
||||||
|
|
@ -342,16 +342,16 @@ class calc_posts : public item_handler<post_t>
|
||||||
{
|
{
|
||||||
post_t * last_post;
|
post_t * last_post;
|
||||||
expr_t& amount_expr;
|
expr_t& amount_expr;
|
||||||
bool calc_totals;
|
bool account_wise;
|
||||||
|
|
||||||
calc_posts();
|
calc_posts();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
calc_posts(post_handler_ptr handler,
|
calc_posts(post_handler_ptr handler,
|
||||||
expr_t& _amount_expr,
|
expr_t& _amount_expr,
|
||||||
bool _calc_totals = false)
|
bool _account_wise = false)
|
||||||
: item_handler<post_t>(handler), last_post(NULL),
|
: item_handler<post_t>(handler), last_post(NULL),
|
||||||
amount_expr(_amount_expr), calc_totals(_calc_totals) {
|
amount_expr(_amount_expr), account_wise(_account_wise) {
|
||||||
TRACE_CTOR(calc_posts, "post_handler_ptr, expr_t&, bool");
|
TRACE_CTOR(calc_posts, "post_handler_ptr, expr_t&, bool");
|
||||||
}
|
}
|
||||||
virtual ~calc_posts() {
|
virtual ~calc_posts() {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue