Bug 797326 - Enhancement: budget's Estimate tool should ignore Closing Entries

addition to estimate-budget tool to optionally ignore closing entries
using brand new API
This commit is contained in:
Christopher Lam 2019-09-04 21:40:23 +08:00
parent 198570d8c8
commit 8b8c957ed2

View File

@ -892,9 +892,10 @@ estimate_budget_helper(GtkTreeModel *model, GtkTreePath *path,
if (priv->useAvg && num_periods)
{
num = xaccAccountGetBalanceChangeForPeriod(acct,
recurrenceGetPeriodTime(&priv->r, 0, FALSE),
num = xaccAccountGetNoclosingBalanceChangeForPeriod
(acct, recurrenceGetPeriodTime(&priv->r, 0, FALSE),
recurrenceGetPeriodTime(&priv->r, num_periods - 1, TRUE), TRUE);
num = gnc_numeric_div(num,
gnc_numeric_create(num_periods, 1),
GNC_DENOM_AUTO,
@ -913,7 +914,10 @@ estimate_budget_helper(GtkTreeModel *model, GtkTreePath *path,
{
for (i = 0; i < num_periods; i++)
{
num = recurrenceGetAccountPeriodValue(&priv->r, acct, i);
num = xaccAccountGetNoclosingBalanceChangeForPeriod
(acct, recurrenceGetPeriodTime(&priv->r, i, FALSE),
recurrenceGetPeriodTime(&priv->r, i, TRUE), TRUE);
if (!gnc_numeric_check(num))
{
if (gnc_reverse_balance(acct))