GnuCash 7574033+
Loading...
Searching...
No Matches
gnc-budget.h File Reference

GnuCash Budgets. More...

#include <glib.h>
#include "qof.h"
#include "Account.h"
#include "Recurrence.h"

Go to the source code of this file.

Macros

#define GNC_TYPE_BUDGET   (gnc_budget_get_type ())
#define GNC_BUDGET(o)
#define GNC_BUDGET_CLASS(k)
#define GNC_IS_BUDGET(o)
#define GNC_IS_BUDGET_CLASS(k)
#define GNC_BUDGET_GET_CLASS(o)
#define GNC_BUDGET_MAX_NUM_PERIODS_DIGITS   3
#define GNC_BUDGET_NOTES_PATH   "notes"
#define gnc_budget_return_guid(X)
#define gnc_budget_lookup_direct(g, b)

Functions

GType gnc_budget_get_type (void)
gboolean gnc_budget_register (void)
GncBudget * gnc_budget_new (QofBook *book)
 Creates and initializes a Budget.
void gnc_budget_destroy (GncBudget *budget)
 Deletes the given budget object.
void gnc_budget_begin_edit (GncBudget *bgt)
void gnc_budget_commit_edit (GncBudget *bgt)
GncBudget * gnc_budget_clone (const GncBudget *budget)
 Clones a budget creating a copy.
const GncGUID * gnc_budget_get_guid (const GncBudget *budget)
void gnc_budget_set_name (GncBudget *budget, const gchar *name)
 Set/Get the name of the Budget.
const gchar * gnc_budget_get_name (const GncBudget *budget)
void gnc_budget_set_description (GncBudget *budget, const gchar *description)
 Set/Get the description of the Budget.
const gchar * gnc_budget_get_description (const GncBudget *budget)
void gnc_budget_set_num_periods (GncBudget *budget, guint num_periods)
 Set/Get the number of periods in the Budget.
guint gnc_budget_get_num_periods (const GncBudget *budget)
void gnc_budget_set_recurrence (GncBudget *budget, const Recurrence *r)
const Recurrence * gnc_budget_get_recurrence (const GncBudget *budget)
time64 gnc_budget_get_period_start_date (const GncBudget *budget, guint period_num)
 Get the starting date of the Budget period.
time64 gnc_budget_get_period_end_date (const GncBudget *budget, guint period_num)
 Get the ending date of the Budget period.
void gnc_budget_set_account_period_value (GncBudget *budget, const Account *account, guint period_num, gnc_numeric val)
void gnc_budget_unset_account_period_value (GncBudget *budget, const Account *account, guint period_num)
gboolean gnc_budget_is_account_period_value_set (const GncBudget *budget, const Account *account, guint period_num)
gnc_numeric gnc_budget_get_account_period_value (const GncBudget *budget, const Account *account, guint period_num)
gnc_numeric gnc_budget_get_account_period_actual_value (const GncBudget *budget, Account *account, guint period_num)
void gnc_budget_set_account_period_note (GncBudget *budget, const Account *account, guint period_num, const gchar *note)
const gchar * gnc_budget_get_account_period_note (const GncBudget *budget, const Account *account, guint period_num)
GncBudget * gnc_budget_get_default (QofBook *book)
GncBudget * gnc_budget_lookup (const GncGUID *guid, const QofBook *book)

Detailed Description

GnuCash Budgets.

Design decisions:

  • The budget values that the user enters (and that are stored) for each account are inclusive of any sub-accounts.
    • Reason: This allows the user to budget an amount for a "parent" account, while tracking (e.g.) expenses with more detail in sub-accounts.
    • Implication: when reporting budgeted values for parent accounts, just show the stored value, not a sum.
  • Budget values are always in the account's commodity.

Accounts with sub-accounts can have a value budgeted. For those accounts,

Option 1: when setting or getting budgeted values, the value is always exclusive of sub-account values. Pro: consistent values in all contexts. Con: no summary behavior.

Option 2: make setting only for account proper, but always report summaries. Con: value can change as soon as it is entered; forces entry from bottom-up.

  • Option 3: value is always inclusive of sub-accounts, although potentially in a different commodity. Pro: allows top-down entry; no auto value update. Con: ? [ This option was selected. ]

Definition in file gnc-budget.h.