28 #include "gnc-ui-balances.h"
37 G_GNUC_UNUSED
static QofLogModule log_module = GNC_MOD_GUI;
62 gnc_ui_account_get_balance_full (xaccGetBalanceInCurrencyFn fn,
70 balance = fn(account, commodity, recurse);
73 if (gnc_reverse_balance (account))
88 gnc_ui_account_get_balance (
const Account *account, gboolean recurse)
90 return gnc_ui_account_get_balance_full (xaccAccountGetBalanceInCurrency,
91 account, recurse, NULL, NULL);
113 gnc_ui_account_get_reconciled_balance (
const Account *account,
116 return gnc_ui_account_get_balance_full (xaccAccountGetReconciledBalanceInCurrency,
117 account, recurse, NULL, NULL);
136 gnc_ui_account_get_print_balance (xaccGetBalanceInCurrencyFn fn,
144 balance = gnc_ui_account_get_balance_full(fn, account, recurse,
146 print_info = gnc_account_print_info(account, TRUE);
147 return g_strdup(xaccPrintAmount(balance, print_info));
166 gnc_ui_account_get_print_report_balance (xaccGetBalanceInCurrencyFn fn,
176 balance = gnc_ui_account_get_balance_full(fn, account, recurse,
177 negative, report_commodity);
178 print_info = gnc_commodity_print_info(report_commodity, TRUE);
179 return g_strdup(xaccPrintAmount(balance, print_info));
184 gnc_ui_account_get_balance_as_of_date (
Account *account,
186 gboolean include_children)
192 return gnc_numeric_zero ();
197 if (include_children)
199 GList *children, *node;
203 for (node = children; node; node = node->next)
212 child_balance = xaccAccountConvertBalanceToCurrency (child,
213 child_balance, child_currency, currency);
214 balance = gnc_numeric_add_fixed (balance, child_balance);
217 g_list_free(children);
221 if (gnc_reverse_balance (account))
248 gnc_ui_owner_get_balance_full (
GncOwner *owner,
255 return gnc_numeric_zero ();
283 gnc_ui_owner_get_print_balance (
GncOwner *owner,
289 balance = gnc_ui_owner_get_balance_full (owner, negative, NULL);
290 print_info = gnc_commodity_print_info (gncOwnerGetCurrency (owner), TRUE);
291 return g_strdup (xaccPrintAmount (balance, print_info));
306 gnc_ui_owner_get_print_report_balance (
GncOwner *owner,
314 balance = gnc_ui_owner_get_balance_full (owner, negative,
316 print_info = gnc_commodity_print_info (report_commodity, TRUE);
317 return g_strdup (xaccPrintAmount (balance, print_info));
Business Interface: Object OWNERs.
utility functions for the GnuCash UI
gnc_numeric gnc_numeric_neg(gnc_numeric a)
gnc_commodity * gnc_default_report_currency(void)
gboolean gnc_numeric_negative_p(gnc_numeric a)
Account handling public routines.
gnc_numeric gncOwnerGetBalanceInCurrency(const GncOwner *owner, const gnc_commodity *report_currency)
gnc_numeric xaccAccountGetBalanceAsOfDate(Account *acc, time64 date)
GncOwnerType gncOwnerGetType(const GncOwner *owner)
GList * gnc_account_get_descendants(const Account *account)
gnc_commodity * xaccAccountGetCommodity(const Account *acc)
const gchar * QofLogModule