[account] add and expose xaccAccountGetReconciledBalanceAsOfDate

pull/660/head
Christopher Lam 6 years ago
parent cfa1625854
commit a8f03cf1c8

@ -3428,6 +3428,24 @@ xaccAccountGetNoclosingBalanceAsOfDate (Account *acc, time64 date)
return GetBalanceAsOfDate (acc, date, TRUE);
}
gnc_numeric
xaccAccountGetReconciledBalanceAsOfDate (Account *acc, time64 date)
{
gnc_numeric balance = gnc_numeric_zero();
g_return_val_if_fail(GNC_IS_ACCOUNT(acc), gnc_numeric_zero());
for (GList *node = GET_PRIVATE(acc)->splits; node; node = node->next)
{
Split *split = (Split*) node->data;
if ((xaccSplitGetReconcile (split) == YREC) &&
(xaccSplitGetDateReconciled (split) <= date))
balance = gnc_numeric_add_fixed (balance, xaccSplitGetAmount (split));
};
return balance;
}
/*
* Originally gsr_account_present_balance in gnc-split-reg.c
*

@ -558,6 +558,9 @@ gnc_numeric xaccAccountGetProjectedMinimumBalance (const Account *account);
gnc_numeric xaccAccountGetBalanceAsOfDate (Account *account,
time64 date);
/** Get the reconciled balance of the account as of the date specified */
gnc_numeric xaccAccountGetReconciledBalanceAsOfDate (Account *account, time64 date);
/* These two functions convert a given balance from one commodity to
another. The account argument is only used to get the Book, and
may have nothing to do with the supplied balance. Likewise, the

Loading…
Cancel
Save