GnuCash c935c2f+
Loading...
Searching...
No Matches
window-main-summarybar.c
1/********************************************************************
2 * window-main-summarybar.c -- summary of financial info *
3 * Copyright (C) 1998,1999 Jeremy Collins *
4 * Copyright (C) 1998,1999,2000 Linas Vepstas *
5 * Copyright (C) 2001 Bill Gribble *
6 * Copyright (C) 2005 Joshua Sled <jsled@asynchronous.org> *
7 * *
8 * This program is free software; you can redistribute it and/or *
9 * modify it under the terms of the GNU General Public License as *
10 * published by the Free Software Foundation; either version 2 of *
11 * the License, or (at your option) any later version. *
12 * *
13 * This program is distributed in the hope that it will be useful, *
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
16 * GNU General Public License for more details. *
17 * *
18 * You should have received a copy of the GNU General Public License*
19 * along with this program; if not, contact: *
20 * *
21 * Free Software Foundation Voice: +1-617-542-5942 *
22 * 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 *
23 * Boston, MA 02110-1301, USA gnu@gnu.org *
24 ********************************************************************/
25
26#include <config.h>
27
28#include <gtk/gtk.h>
29#include <glib/gi18n.h>
30
31#include "Account.h"
33#include "gnc-component-manager.h"
34#include "gnc-euro.h"
35#include "gnc-event.h"
36#include "gnc-prefs.h"
37#include "gnc-locale-utils.h"
38#include "gnc-ui-util.h"
39#include "window-main-summarybar.h"
40#include "dialog-utils.h"
41
42typedef struct
43{
44 GtkWidget *hbox;
45 GtkWidget *totals_combo;
46 GtkListStore *datamodel;
47 int component_id;
48 int cnxn_id;
49 gboolean combo_popped;
50 gboolean show_negative_color;
51 gchar *negative_color;
53
54#define WINDOW_SUMMARYBAR_CM_CLASS "summary-bar"
55
56#define GNC_PREFS_GROUP "window.pages.account-tree.summary"
57#define GNC_PREF_GRAND_TOTAL "grand-total"
58#define GNC_PREF_NON_CURRENCY "non-currency"
59
71typedef struct
72{
73 gnc_commodity * currency;
74 gnc_numeric assets;
75 gnc_numeric profits;
76 gint total_mode;
78
79
80/* defines for total_mode in GNCCurrencyAcc and GNCCurrencyItem */
81#define TOTAL_SINGLE 0
82#define TOTAL_CURR_TOTAL 1
83#define TOTAL_NON_CURR_TOTAL 2
84#define TOTAL_GRAND_TOTAL 3
85
86
88typedef struct
89{
90 gnc_commodity *default_currency;
91 gboolean grand_total;
92 gboolean non_currency;
93 time64 start_date;
94 time64 end_date;
96
101static GNCCurrencyAcc *
102gnc_ui_get_currency_accumulator(GList **list, gnc_commodity * currency, gint total_mode)
103{
104 GList *current;
105 GNCCurrencyAcc *found;
106
107 for (current = g_list_first(*list); current; current = g_list_next(current))
108 {
109 found = current->data;
110 if ((gnc_commodity_equiv(currency, found->currency))
111 && (found->total_mode == total_mode))
112 {
113 return found;
114 }
115 }
116
117 found = g_new0 (GNCCurrencyAcc, 1);
118 found->currency = currency;
119 found->assets = gnc_numeric_zero ();
120 found->profits = gnc_numeric_zero ();
121 found->total_mode = total_mode;
122 *list = g_list_append (*list, found);
123
124 return found;
125}
126
130static void
131gnc_ui_accounts_recurse (Account *parent, GList **currency_list,
132 GNCSummarybarOptions options)
133{
134 gnc_numeric start_amount;
135 gnc_numeric start_amount_default_currency;
136 gnc_numeric end_amount;
137 gnc_numeric end_amount_default_currency;
138 GNCAccountType account_type;
139 gnc_commodity * account_currency;
140 GNCCurrencyAcc *currency_accum = NULL;
141 GNCCurrencyAcc *grand_total_accum = NULL;
142 GNCCurrencyAcc *non_curr_accum = NULL;
143 GList *children, *node;
144 gboolean non_currency = FALSE;
145
146 if (parent == NULL) return;
147
148 children = gnc_account_get_children(parent);
149 for (node = children; node; node = g_list_next(node))
150 {
151 Account *account = node->data;
152 QofBook *book = gnc_account_get_book (account);
153 GNCPriceDB *pricedb = gnc_pricedb_get_db (book);
154 gnc_commodity *to_curr = options.default_currency;
155
156 account_type = xaccAccountGetType(account);
157 account_currency = xaccAccountGetCommodity(account);
158
159 if (options.grand_total)
160 grand_total_accum = gnc_ui_get_currency_accumulator(currency_list,
161 to_curr,
162 TOTAL_GRAND_TOTAL);
163
164 if (!gnc_commodity_is_currency(account_currency))
165 {
166 non_currency = TRUE;
167 non_curr_accum = gnc_ui_get_currency_accumulator(currency_list,
168 to_curr,
169 TOTAL_NON_CURR_TOTAL);
170 }
171
172 if (!non_currency || options.non_currency)
173 {
174 currency_accum = gnc_ui_get_currency_accumulator(currency_list,
175 account_currency,
176 TOTAL_SINGLE);
177 }
178
179 switch (account_type)
180 {
181 case ACCT_TYPE_BANK:
182 case ACCT_TYPE_CASH:
183 case ACCT_TYPE_ASSET:
184 case ACCT_TYPE_STOCK:
185 case ACCT_TYPE_MUTUAL:
186 case ACCT_TYPE_CREDIT:
190 end_amount = xaccAccountGetBalanceAsOfDate(account, options.end_date);
191 end_amount_default_currency =
193 end_amount,
194 account_currency,
195 to_curr,
196 options.end_date);
197
198 if (!non_currency || options.non_currency)
199 {
200 currency_accum->assets =
201 gnc_numeric_add (currency_accum->assets, end_amount,
202 gnc_commodity_get_fraction (account_currency),
203 GNC_HOW_RND_ROUND_HALF_UP);
204 }
205
206 if (non_currency)
207 {
208 non_curr_accum->assets =
209 gnc_numeric_add (non_curr_accum->assets, end_amount_default_currency,
211 GNC_HOW_RND_ROUND_HALF_UP);
212 }
213
214 if (options.grand_total)
215 {
216 grand_total_accum->assets =
217 gnc_numeric_add (grand_total_accum->assets, end_amount_default_currency,
219 GNC_HOW_RND_ROUND_HALF_UP);
220 }
221
222 gnc_ui_accounts_recurse(account, currency_list, options);
223 break;
224 case ACCT_TYPE_INCOME:
226 start_amount = xaccAccountGetBalanceAsOfDate(account, options.start_date);
227 start_amount_default_currency =
229 start_amount,
230 account_currency,
231 to_curr,
232 options.start_date);
233 end_amount = xaccAccountGetBalanceAsOfDate(account, options.end_date);
234 end_amount_default_currency =
236 end_amount,
237 account_currency,
238 to_curr,
239 options.end_date);
240
241 if (!non_currency || options.non_currency)
242 {
243 currency_accum->profits =
244 gnc_numeric_add (currency_accum->profits, start_amount,
245 gnc_commodity_get_fraction (account_currency),
246 GNC_HOW_RND_ROUND_HALF_UP);
247 currency_accum->profits =
248 gnc_numeric_sub (currency_accum->profits, end_amount,
249 gnc_commodity_get_fraction (account_currency),
250 GNC_HOW_RND_ROUND_HALF_UP);
251 }
252
253 if (non_currency)
254 {
255 non_curr_accum->profits =
256 gnc_numeric_add (non_curr_accum->profits, start_amount_default_currency,
258 GNC_HOW_RND_ROUND_HALF_UP);
259 non_curr_accum->profits =
260 gnc_numeric_sub (non_curr_accum->profits, end_amount_default_currency,
262 GNC_HOW_RND_ROUND_HALF_UP);
263 }
264
265 if (options.grand_total)
266 {
267 grand_total_accum->profits =
268 gnc_numeric_add (grand_total_accum->profits,
269 start_amount_default_currency,
271 GNC_HOW_RND_ROUND_HALF_UP);
272 grand_total_accum->profits =
273 gnc_numeric_sub (grand_total_accum->profits,
274 end_amount_default_currency,
276 GNC_HOW_RND_ROUND_HALF_UP);
277 }
278
279 gnc_ui_accounts_recurse(account, currency_list, options);
280 break;
281 case ACCT_TYPE_EQUITY:
282 /* no-op, see comments at top about summing assets */
283 break;
289 break;
291 default:
292 break;
293 }
294 }
295 g_list_free(children);
296}
297
298static char*
299get_total_mode_label (GNCCurrencyAcc *currency_accum)
300{
301 const char *mnemonic = gnc_commodity_get_nice_symbol (currency_accum->currency);
302 char *label_str;
303 if (mnemonic == NULL)
304 mnemonic = "";
305 // i.e., "$, grand total," [profits: $12,345.67, assets: $23,456.78]
306 switch (currency_accum->total_mode)
307 {
308 case TOTAL_CURR_TOTAL:
309 label_str = g_strdup_printf( _("%s, Total:"), mnemonic );
310 break;
311 case TOTAL_NON_CURR_TOTAL:
312 label_str = g_strdup_printf( _("%s, Non Currency Commodities Total:"), mnemonic );
313 break;
314 case TOTAL_GRAND_TOTAL:
315 label_str = g_strdup_printf( _("%s, Grand Total:"), mnemonic );
316 break;
317 case TOTAL_SINGLE:
318 default:
319 label_str = g_strdup_printf( _("%s:"), mnemonic );
320 break;
321 }
322 return label_str;
323}
324
325enum
326{
327 COLUMN_MNEMONIC_TYPE,
328 COLUMN_ASSETS,
329 COLUMN_ASSETS_VALUE,
330 COLUMN_PROFITS,
331 COLUMN_PROFITS_VALUE,
332 COLUMN_ASSETS_NEG,
333 COLUMN_PROFITS_NEG,
334 N_COLUMNS
335};
336
337/* The gnc_main_window_summary_refresh() subroutine redraws summary
338 * information. The statusbar includes two fields, titled 'profits'
339 * and 'assets'. The total assets equal the sum of all of the
340 * non-equity, non-income accounts. In theory, assets also equals the
341 * grand total value of the equity accounts, but that assumes that
342 * folks are using the equity account type correctly (which is not
343 * likely). Thus we show the sum of assets, rather than the sum of
344 * equities.
345 *
346 * The EURO gets special treatment. There can be one line with
347 * EUR amounts and a EUR (total) line which sums up all EURO
348 * member currencies.
349 *
350 * There can be a 'grand total', too, which sums up all accounts
351 * converted to one common currency and a total of all non
352 * currency commodities (e.g. stock, funds). */
353
354static void
355gnc_main_window_summary_refresh (GNCMainSummary * summary)
356{
357 Account *root;
358 GNCCurrencyAcc *currency_accum;
359 GList *currency_list;
360 GList *current;
361 GNCSummarybarOptions options;
362
363
364 root = gnc_get_current_root_account ();
365 options.default_currency = gnc_default_currency ();
366 if (options.default_currency == NULL)
367 {
368 options.default_currency = xaccAccountGetCommodity(root);
369 }
370
371 options.grand_total =
372 gnc_prefs_get_bool(GNC_PREFS_GROUP, GNC_PREF_GRAND_TOTAL);
373 options.non_currency =
374 gnc_prefs_get_bool(GNC_PREFS_GROUP, GNC_PREF_NON_CURRENCY);
375 options.start_date = gnc_accounting_period_fiscal_start();
376 options.end_date = gnc_accounting_period_fiscal_end();
377
378 currency_list = NULL;
379
380 /* grand total should be first in the list */
381 if (options.grand_total)
382 {
383 gnc_ui_get_currency_accumulator (&currency_list, options.default_currency,
384 TOTAL_GRAND_TOTAL);
385 }
386 /* Make sure there's at least one accumulator in the list. */
387 gnc_ui_get_currency_accumulator (&currency_list, options.default_currency,
388 TOTAL_SINGLE);
389
390 gnc_ui_accounts_recurse(root, &currency_list, options);
391
392 {
393 GtkTreeIter iter;
394 char asset_amount_string[256], profit_amount_string[256];
395
396 g_object_ref(summary->datamodel);
397 gtk_combo_box_set_model(GTK_COMBO_BOX(summary->totals_combo), NULL);
398 gtk_list_store_clear(summary->datamodel);
399 for (current = g_list_first(currency_list); current; current = g_list_next(current))
400 {
401 gchar *total_mode_label;
402 gchar *bidi_total, *bidi_asset_amount, *bidi_profit_amount;
403
404 currency_accum = current->data;
405
406 xaccSPrintAmount(asset_amount_string,
407 currency_accum->assets,
408 gnc_commodity_print_info(currency_accum->currency, TRUE));
409
410 xaccSPrintAmount(profit_amount_string,
411 currency_accum->profits,
412 gnc_commodity_print_info(currency_accum->currency, TRUE));
413
414 gtk_list_store_append(summary->datamodel, &iter);
415 total_mode_label = get_total_mode_label (currency_accum);
416 bidi_total = gnc_wrap_text_with_bidi_ltr_isolate(total_mode_label);
417 bidi_asset_amount = gnc_wrap_text_with_bidi_ltr_isolate(asset_amount_string);
418 bidi_profit_amount = gnc_wrap_text_with_bidi_ltr_isolate(profit_amount_string);
419 gtk_list_store_set(summary->datamodel, &iter,
420 COLUMN_MNEMONIC_TYPE, bidi_total,
421 COLUMN_ASSETS, _("Net Assets:"),
422 COLUMN_ASSETS_VALUE, bidi_asset_amount,
423 COLUMN_ASSETS_NEG, gnc_numeric_negative_p(currency_accum->assets),
424 COLUMN_PROFITS, _("Profits:"),
425 COLUMN_PROFITS_VALUE, bidi_profit_amount,
426 COLUMN_PROFITS_NEG, gnc_numeric_negative_p(currency_accum->profits),
427 -1);
428 g_free(total_mode_label);
429 g_free(bidi_total);
430 g_free(bidi_asset_amount);
431 g_free(bidi_profit_amount);
432 }
433 gtk_combo_box_set_model(GTK_COMBO_BOX(summary->totals_combo),
434 GTK_TREE_MODEL(summary->datamodel));
435 g_object_unref(summary->datamodel);
436
437 gtk_combo_box_set_active(GTK_COMBO_BOX(summary->totals_combo), 0);
438 }
439
440 g_list_free_full (currency_list, g_free);
441}
442
443static gchar*
444get_negative_color_str (void)
445{
446 GdkRGBA color;
447 gchar *color_str;
448 GtkWidget *label = gtk_label_new ("Color");
449 GtkStyleContext *context = gtk_widget_get_style_context (GTK_WIDGET(label));
450 g_object_ref_sink (label);
451 gtk_style_context_add_class (context, "gnc-class-negative-numbers");
452 gtk_style_context_get_color (context, GTK_STATE_FLAG_NORMAL, &color);
453 color_str = g_strdup_printf ("#%02X%02X%02X",
454 (int)(0.5 + CLAMP (color.red, 0., 1.) * 255.),
455 (int)(0.5 + CLAMP (color.green, 0., 1.) * 255.),
456 (int)(0.5 + CLAMP (color.blue, 0., 1.) * 255.));
457 g_object_unref (label);
458 return color_str;
459}
460
461static void
462summarybar_update_color (gpointer gsettings, gchar *key, gpointer user_data)
463{
464 GNCMainSummary *summary = user_data;
465
466 g_free(summary->negative_color);
467 summary->negative_color = get_negative_color_str();
468 summary->show_negative_color = gnc_prefs_get_bool (GNC_PREFS_GROUP_GENERAL, GNC_PREF_NEGATIVE_IN_RED);
469
470 gnc_main_window_summary_refresh (summary);
471}
472
473static void
474gnc_main_window_summary_destroy_cb(GNCMainSummary *summary, gpointer data)
475{
476 gnc_prefs_remove_cb_by_id (GNC_PREFS_GROUP, summary->cnxn_id);
477 gnc_unregister_gui_component(summary->component_id);
478
479 gnc_prefs_remove_cb_by_func(GNC_PREFS_GROUP_GENERAL, GNC_PREF_NEGATIVE_IN_RED,
480 summarybar_update_color, summary);
481
482 g_free (summary->negative_color);
483 g_free (summary);
484}
485
486static void
487summarybar_refresh_handler(GHashTable * changes, gpointer user_data)
488{
489 GNCMainSummary * summary = user_data;
490 gnc_main_window_summary_refresh(summary);
491}
492
493static void
494prefs_changed_cb (gpointer prefs, gchar *pref, gpointer user_data)
495{
496 GNCMainSummary * summary = user_data;
497 gnc_main_window_summary_refresh(summary);
498}
499
500
501static gchar *
502make_markup (GtkTreeModel *model, GtkTreeIter *iter,
503 const GNCMainSummary *summary,
504 gint label_col, gint value_col, gint neg_col)
505{
506 gchar *label, *value;
507 gboolean neg;
508 gtk_tree_model_get (model, iter, label_col, &label, value_col, &value, neg_col, &neg,
509 -1);
510 gchar* markup = summary->show_negative_color && neg
511 ? g_markup_printf_escaped ("%s <span foreground='%s'>%s</span>",
512 label, summary->negative_color, value)
513 : g_markup_printf_escaped ("%s %s", label, value);
514 g_free (label);
515 g_free (value);
516 return markup;
517}
518
519static void
520cdf (GtkCellLayout *cell_layout, GtkCellRenderer *cell, GtkTreeModel *tree_model, GtkTreeIter *iter,
521 gpointer user_data)
522{
523 GNCMainSummary * summary = user_data;
524 gint viewcol;
525
526 viewcol = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (cell), "view_column"));
527
528 if (summary->combo_popped)
529 g_object_set (cell, "xalign", 0.0, NULL);
530 else
531 g_object_set (cell, "xalign", 0.5, NULL);
532
533 if (viewcol == 0)
534 {
535 gchar *type;
536 gtk_tree_model_get (GTK_TREE_MODEL (tree_model), iter,
537 COLUMN_MNEMONIC_TYPE, &type,
538 -1);
539 g_object_set (cell, "text", type, NULL);
540 g_free (type);
541 }
542
543 if (viewcol == 2)
544 {
545 gchar *markup = make_markup (tree_model, iter, summary,
546 COLUMN_ASSETS, COLUMN_ASSETS_VALUE, COLUMN_ASSETS_NEG);
547 g_object_set (cell, "markup", markup, NULL);
548 g_free (markup);
549 }
550
551 if (viewcol == 4)
552 {
553 gchar *markup = make_markup (tree_model, iter, summary,
554 COLUMN_PROFITS, COLUMN_PROFITS_VALUE, COLUMN_PROFITS_NEG);
555 g_object_set (cell, "markup", markup, NULL);
556 g_free (markup);
557 }
558}
559
560static void
561summary_combo_popped (GObject *widget, GParamSpec *pspec, gpointer user_data)
562{
563 GNCMainSummary * summary = user_data;
564 if (summary->combo_popped)
565 summary->combo_popped = FALSE;
566 else
567 summary->combo_popped = TRUE;
568}
569
570GtkWidget *
571gnc_main_window_summary_new (void)
572{
573 GNCMainSummary * retval = g_new0(GNCMainSummary, 1);
574 GtkCellRenderer *textRenderer;
575 int i;
576
577 retval->datamodel = gtk_list_store_new (N_COLUMNS,
578 G_TYPE_STRING,
579 G_TYPE_STRING,
580 G_TYPE_STRING,
581 G_TYPE_STRING,
582 G_TYPE_STRING,
583 G_TYPE_BOOLEAN,
584 G_TYPE_BOOLEAN);
585
586 retval->hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 5);
587 gtk_box_set_homogeneous (GTK_BOX (retval->hbox), FALSE);
588
589 // Set the name for this wodget so it can be easily manipulated with css
590 gtk_widget_set_name (GTK_WIDGET(retval->hbox), "gnc-id-account-summary-bar");
591
592 retval->totals_combo = gtk_combo_box_new_with_model (GTK_TREE_MODEL (retval->datamodel));
593 g_object_unref (retval->datamodel);
594
595 retval->negative_color = get_negative_color_str();
596 retval->show_negative_color = gnc_prefs_get_bool (GNC_PREFS_GROUP_GENERAL, GNC_PREF_NEGATIVE_IN_RED);
597 gnc_prefs_register_cb (GNC_PREFS_GROUP_GENERAL, GNC_PREF_NEGATIVE_IN_RED,
598 summarybar_update_color, retval);
599
600 retval->component_id = gnc_register_gui_component (WINDOW_SUMMARYBAR_CM_CLASS,
601 summarybar_refresh_handler,
602 NULL, retval);
603 gnc_gui_component_watch_entity_type (retval->component_id,
604 GNC_ID_ACCOUNT,
605 QOF_EVENT_DESTROY
606 | GNC_EVENT_ITEM_CHANGED);
607
608 // Allows you to get when the popup menu is present
609 g_signal_connect (retval->totals_combo, "notify::popup-shown",G_CALLBACK (summary_combo_popped), retval);
610
611 retval->combo_popped = FALSE;
612
613 for (i = 0; i <= N_COLUMNS - 2; i += 2)
614 {
615 textRenderer = GTK_CELL_RENDERER(gtk_cell_renderer_text_new());
616
617 gtk_cell_renderer_set_fixed_size (textRenderer, 50, -1);
618
619 gtk_cell_layout_pack_start (GTK_CELL_LAYOUT(retval->totals_combo), textRenderer, TRUE);
620
621 g_object_set_data (G_OBJECT(textRenderer), "view_column", GINT_TO_POINTER (i));
622 gtk_cell_layout_set_cell_data_func (GTK_CELL_LAYOUT(retval->totals_combo), textRenderer, cdf, retval, NULL);
623 }
624
625 gtk_container_set_border_width (GTK_CONTAINER (retval->hbox), 2);
626 gtk_box_pack_start (GTK_BOX(retval->hbox), retval->totals_combo, TRUE, TRUE, 5);
627 gtk_widget_show (retval->totals_combo);
628 gtk_widget_show (retval->hbox);
629
630 g_signal_connect_swapped (G_OBJECT (retval->hbox), "destroy",
631 G_CALLBACK (gnc_main_window_summary_destroy_cb),
632 retval);
633
634 gnc_main_window_summary_refresh(retval);
635
636 retval->cnxn_id = gnc_prefs_register_cb (GNC_PREFS_GROUP, NULL,
637 prefs_changed_cb, retval);
638
639 return retval->hbox;
640}
Account handling public routines.
General utilities for dealing with accounting periods.
Additional event handling code.
Generic api to store and retrieve preferences.
utility functions for the GnuCash UI
GNCAccountType
The account types are used to determine how the transaction data in the account is displayed.
Definition Account.h:103
GNCAccountType xaccAccountGetType(const Account *acc)
Returns the account's account type.
Definition Account.cpp:3267
gnc_numeric xaccAccountGetBalanceAsOfDate(Account *acc, time64 date)
Get the balance of the account at the end of the day before the date specified.
Definition Account.cpp:3533
GList * gnc_account_get_children(const Account *account)
This routine returns a GList of all children accounts of the specified account.
Definition Account.cpp:2960
gnc_commodity * xaccAccountGetCommodity(const Account *acc)
Get the account's commodity
Definition Account.cpp:3408
@ ACCT_TYPE_INCOME
Income accounts are used to denote income.
Definition Account.h:140
@ ACCT_TYPE_MUTUAL
Mutual Fund accounts will typically be shown in registers which show three columns: price,...
Definition Account.h:125
@ ACCT_TYPE_TRADING
Account used to record multiple commodity transactions.
Definition Account.h:155
@ ACCT_TYPE_EXPENSE
Expense accounts are used to denote expenses.
Definition Account.h:143
@ ACCT_TYPE_BANK
The bank account type denotes a savings or checking account held at a bank.
Definition Account.h:107
@ ACCT_TYPE_PAYABLE
A/P account type.
Definition Account.h:151
@ ACCT_TYPE_ASSET
asset (and liability) accounts indicate generic, generalized accounts that are none of the above.
Definition Account.h:116
@ ACCT_TYPE_CURRENCY
The currency account type indicates that the account is a currency trading account.
Definition Account.h:129
@ ACCT_TYPE_RECEIVABLE
A/R account type.
Definition Account.h:149
@ ACCT_TYPE_CASH
The cash account type is used to denote a shoe-box or pillowcase stuffed with * cash.
Definition Account.h:110
@ ACCT_TYPE_LIABILITY
liability (and asset) accounts indicate generic, generalized accounts that are none of the above.
Definition Account.h:119
@ ACCT_TYPE_EQUITY
Equity account is used to balance the balance sheet.
Definition Account.h:146
@ ACCT_TYPE_CREDIT
The Credit card account is used to denote credit (e.g.
Definition Account.h:113
@ ACCT_TYPE_STOCK
Stock accounts will typically be shown in registers which show three columns: price,...
Definition Account.h:122
gboolean gnc_commodity_equiv(const gnc_commodity *a, const gnc_commodity *b)
This routine returns TRUE if the two commodities are equivalent.
int gnc_commodity_get_fraction(const gnc_commodity *cm)
Retrieve the fraction for the specified commodity.
const char * gnc_commodity_get_nice_symbol(const gnc_commodity *cm)
Retrieve a symbol for the specified commodity, suitable for display to the user.
gboolean gnc_commodity_is_currency(const gnc_commodity *cm)
Checks to see if the specified commodity is an ISO 4217 recognized currency or a legacy currency.
gint64 time64
Most systems that are currently maintained, including Microsoft Windows, BSD-derived Unixes and Linux...
Definition gnc-date.h:87
int xaccSPrintAmount(char *bufp, gnc_numeric val, GNCPrintAmountInfo info)
Make a string representation of a gnc_numeric.
char * gnc_wrap_text_with_bidi_ltr_isolate(const char *text)
This function helps with GTK's use of 'Unicode Bidirectional Text Algorithm'.
gnc_commodity * gnc_default_currency(void)
Return the default currency set by the user.
gnc_numeric gnc_numeric_sub(gnc_numeric a, gnc_numeric b, gint64 denom, gint how)
Return a-b.
gboolean gnc_numeric_negative_p(gnc_numeric a)
Returns 1 if a < 0, otherwise returns 0.
gnc_numeric gnc_numeric_add(gnc_numeric a, gnc_numeric b, gint64 denom, gint how)
Return a+b.
void gnc_prefs_remove_cb_by_func(const gchar *group, const gchar *pref_name, gpointer func, gpointer user_data)
Remove a function that was registered for a callback when the given preference changed.
gulong gnc_prefs_register_cb(const char *group, const gchar *pref_name, gpointer func, gpointer user_data)
Register a callback that gets triggered when the given preference changes.
void gnc_prefs_remove_cb_by_id(const gchar *group, guint id)
Remove a function that was registered for a callback when a specific preference in the settings group...
gboolean gnc_prefs_get_bool(const gchar *group, const gchar *pref_name)
Get a boolean value from the preferences backend.
gnc_numeric gnc_pricedb_convert_balance_nearest_price_t64(GNCPriceDB *pdb, gnc_numeric balance, const gnc_commodity *balance_currency, const gnc_commodity *new_currency, time64 t)
Convert a balance from one currency to another using the price nearest to the given time.
GNCPriceDB * gnc_pricedb_get_db(QofBook *book)
Return the pricedb associated with the book.
STRUCTS.
An accumulator for a given currency.
options for summarybar
QofBook reference.
Definition qofbook-p.hpp:47