diff --git a/libgnucash/engine/Account.cpp b/libgnucash/engine/Account.cpp index ebe8f38518..f74aaf4d1b 100644 --- a/libgnucash/engine/Account.cpp +++ b/libgnucash/engine/Account.cpp @@ -3448,32 +3448,14 @@ xaccAccountGetReconciledBalanceAsOfDate (Account *acc, time64 date) /* * Originally gsr_account_present_balance in gnc-split-reg.c - * - * How does this routine compare to xaccAccountGetBalanceAsOfDate just - * above? These two routines should eventually be collapsed into one. - * Perhaps the startup logic from that one, and the logic from this - * one that walks from the tail of the split list. */ gnc_numeric xaccAccountGetPresentBalance (const Account *acc) { - AccountPrivate *priv; - GList *node; - time64 today; - g_return_val_if_fail(GNC_IS_ACCOUNT(acc), gnc_numeric_zero()); - priv = GET_PRIVATE(acc); - today = gnc_time64_get_today_end(); - for (node = g_list_last(priv->splits); node; node = node->prev) - { - Split *split = static_cast(node->data); - - if (xaccTransGetDate (xaccSplitGetParent (split)) <= today) - return xaccSplitGetBalance (split); - } - - return gnc_numeric_zero (); + return xaccAccountGetBalanceAsOfDate (GNC_ACCOUNT (acc), + gnc_time64_get_today_end ()); }