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

Addendum to 8b8c957ed -- if budgeted amounts exclude closing entries,
actual amounts should also exclude closing entries.

Amend documentation, modify budget test to add a closing entry which
will be ignored.
This commit is contained in:
Christopher Lam
2019-10-25 18:27:47 +08:00
parent 1dc22e53c5
commit b2fcfbd3c6
4 changed files with 11 additions and 3 deletions

View File

@@ -419,7 +419,7 @@ recurrenceGetAccountPeriodValue(const Recurrence *r, Account *acc, guint n)
g_return_val_if_fail(r && acc, gnc_numeric_zero());
t1 = recurrenceGetPeriodTime(r, n, FALSE);
t2 = recurrenceGetPeriodTime(r, n, TRUE);
return xaccAccountGetBalanceChangeForPeriod (acc, t1, t2, TRUE);
return xaccAccountGetNoclosingBalanceChangeForPeriod (acc, t1, t2, TRUE);
}
void

View File

@@ -140,7 +140,8 @@ time64 recurrenceGetPeriodTime(const Recurrence *r, guint n, gboolean end);
/**
* @return the amount that an Account's value changed between the beginning
* and end of the nth instance of the Recurrence.
* and end of the nth instance of the Recurrence. Please note this function
* is only used in budget reports and will exclude closing entries.
**/
gnc_numeric recurrenceGetAccountPeriodValue(const Recurrence *r,
Account *acct, guint n);

View File

@@ -145,8 +145,12 @@ void gnc_budget_unset_account_period_value(
gboolean gnc_budget_is_account_period_value_set(
const GncBudget *budget, const Account *account, guint period_num);
/* get the budget account period's budgeted value */
gnc_numeric gnc_budget_get_account_period_value(
const GncBudget *budget, const Account *account, guint period_num);
/* get the budget account period's actual value, including children,
excluding closing entries */
gnc_numeric gnc_budget_get_account_period_actual_value(
const GncBudget *budget, Account *account, guint period_num);

View File

@@ -839,6 +839,7 @@
(budget (gnc-budget-new book))
(bank (cdr (assoc "Bank" account-alist)))
(income (cdr (assoc "Income" account-alist)))
(equity (cdr (assoc "Equity" account-alist)))
(expense (cdr (assoc "Expenses" account-alist))))
(gnc-budget-set-name budget "test budget")
(gnc-budget-begin-edit budget)
@@ -861,7 +862,9 @@
(env-create-transaction env (midperiod 2) bank income 67)
(env-create-transaction env (midperiod 3) bank income 77)
(env-create-transaction env (midperiod 0) expense bank 20)
(env-create-transaction env (midperiod 1) expense bank 20))
(env-create-transaction env (midperiod 1) expense bank 20)
(let ((clos (env-create-transaction env (midperiod 1) income equity 55)))
(xaccTransSetIsClosingTxn clos #t)))
budget))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;