GnuCash  2.6.99
Data Structures | Macros | Typedefs | Enumerations | Functions

Account handling public routines. More...

#include "qof.h"
#include "gnc-engine.h"
#include "policy.h"

Go to the source code of this file.

Data Structures

struct  AccountClass
 
struct  GncImportMatchMap
 
struct  GncImapInfo
 

Macros

#define GNC_TYPE_ACCOUNT   (gnc_account_get_type ())
 
#define GNC_ACCOUNT(o)   (G_TYPE_CHECK_INSTANCE_CAST ((o), GNC_TYPE_ACCOUNT, Account))
 
#define GNC_ACCOUNT_CLASS(k)   (G_TYPE_CHECK_CLASS_CAST((k), GNC_TYPE_ACCOUNT, AccountClass))
 
#define GNC_IS_ACCOUNT(o)   (G_TYPE_CHECK_INSTANCE_TYPE ((o), GNC_TYPE_ACCOUNT))
 
#define GNC_IS_ACCOUNT_CLASS(k)   (G_TYPE_CHECK_CLASS_TYPE ((k), GNC_TYPE_ACCOUNT))
 
#define GNC_ACCOUNT_GET_CLASS(o)   (G_TYPE_INSTANCE_GET_CLASS ((o), GNC_TYPE_ACCOUNT, AccountClass))
 
#define ACCOUNT_MATCH_ALL_TYPE   "account-match-all"
 This is the type-override when you want to match all accounts. More...
 
Account parameter names
#define ACCOUNT_KVP   "kvp"
 
#define ACCOUNT_NAME_   "name"
 
#define ACCOUNT_CODE_   "code"
 
#define ACCOUNT_DESCRIPTION_   "desc"
 
#define ACCOUNT_COLOR_   "color"
 
#define ACCOUNT_FILTER_   "filter"
 
#define ACCOUNT_SORT_ORDER_   "sort-order"
 
#define ACCOUNT_SORT_REVERSED_   "sort-reversed"
 
#define ACCOUNT_NOTES_   "notes"
 
#define ACCOUNT_BALANCE_   "balance"
 
#define ACCOUNT_CLEARED_   "cleared"
 
#define ACCOUNT_RECONCILED_   "reconciled"
 
#define ACCOUNT_PRESENT_   "present"
 
#define ACCOUNT_FUTURE_MINIMUM_   "future-minimum"
 
#define ACCOUNT_TAX_RELATED   "tax-related-p"
 
#define ACCOUNT_TYPE_   "account-type"
 
#define ACCOUNT_SCU   "smallest-commodity-unit"
 
#define ACCOUNT_NSCU   "non-standard-scu"
 
#define ACCOUNT_PARENT   "parent-account"
 

Typedefs

typedef gnc_numeric(* xaccGetBalanceFn) (const Account *account)
 
typedef gnc_numeric(* xaccGetBalanceInCurrencyFn) (const Account *account, const gnc_commodity *report_commodity, gboolean include_children)
 
typedef gnc_numeric(* xaccGetBalanceAsOfDateFn) (Account *account, time64 date)
 
typedef void(* AccountCb) (Account *a, gpointer data)
 
typedef gpointer(* AccountCb2) (Account *a, gpointer data)
 

Enumerations

enum  GNCAccountType {
  ACCT_TYPE_INVALID = -1, ACCT_TYPE_NONE = -1, ACCT_TYPE_BANK = 0, ACCT_TYPE_CASH = 1,
  ACCT_TYPE_CREDIT = 3, ACCT_TYPE_ASSET = 2, ACCT_TYPE_LIABILITY = 4, ACCT_TYPE_STOCK = 5,
  ACCT_TYPE_MUTUAL = 6, ACCT_TYPE_CURRENCY = 7, ACCT_TYPE_INCOME = 8, ACCT_TYPE_EXPENSE = 9,
  ACCT_TYPE_EQUITY = 10, ACCT_TYPE_RECEIVABLE = 11, ACCT_TYPE_PAYABLE = 12, ACCT_TYPE_ROOT = 13,
  ACCT_TYPE_TRADING = 14, NUM_ACCOUNT_TYPES = 15, ACCT_TYPE_CHECKING = 15, ACCT_TYPE_SAVINGS = 16,
  ACCT_TYPE_MONEYMRKT = 17, ACCT_TYPE_CREDITLINE = 18, ACCT_TYPE_LAST
}
 The account types are used to determine how the transaction data in the account is displayed. More...
 
enum  GNCPlaceholderType { PLACEHOLDER_NONE, PLACEHOLDER_THIS, PLACEHOLDER_CHILD }
 DOCUMENT ME!
 

Functions

GType gnc_account_get_type (void)
 Returns the GType type system description of the Account class. More...
 
gchar * gnc_account_name_violations_errmsg (const gchar *separator, GList *invalid_account_names)
 Composes a translatable error message showing which account names clash with the current account separator. More...
 
GList * gnc_account_list_name_violations (QofBook *book, const gchar *separator)
 Runs through all the accounts and returns a list of account names that contain the provided separator character. More...
 
void xaccAccountSetReconcileChildrenStatus (Account *account, gboolean status)
 DOCUMENT ME!
 
gboolean xaccAccountGetReconcileChildrenStatus (const Account *account)
 DOCUMENT ME!
 
gboolean xaccAccountHasAncestor (const Account *acc, const Account *ancestor)
 Returns true if the account is 'ancestor' or has 'ancestor' as an ancestor. More...
 
Account Constructors, Edit/Commit, Comparison
AccountxaccMallocAccount (QofBook *book)
 Constructor.
 
Accountgnc_account_create_root (QofBook *book)
 Create a new root level account. More...
 
AccountxaccCloneAccount (const Account *source, QofBook *book)
 The xaccCloneAccount() routine makes a simple copy of the indicated account, placing it in the indicated book. More...
 
void xaccAccountBeginEdit (Account *account)
 The xaccAccountBeginEdit() subroutine is the first phase of a two-phase-commit wrapper for account updates. More...
 
void xaccAccountCommitEdit (Account *account)
 ThexaccAccountCommitEdit() subroutine is the second phase of a two-phase-commit wrapper for account updates. More...
 
void xaccAccountDestroy (Account *account)
 The xaccAccountDestroy() routine can be used to get rid of an account. More...
 
gboolean xaccAccountEqual (const Account *a, const Account *b, gboolean check_guids)
 Compare two accounts for equality - this is a deep compare. More...
 
int xaccAccountOrder (const Account *account_1, const Account *account_2)
 The xaccAccountOrder() subroutine defines a sorting order on accounts. More...
 
Account general setters/getters
QofBook * gnc_account_get_book (const Account *account)
 
void xaccAccountSetType (Account *account, GNCAccountType)
 Set the account's type.
 
void xaccAccountSetName (Account *account, const char *name)
 Set the account's name.
 
void xaccAccountSetCode (Account *account, const char *code)
 Set the account's accounting code.
 
void xaccAccountSetDescription (Account *account, const char *desc)
 Set the account's description.
 
void xaccAccountSetColor (Account *account, const char *color)
 Set the account's Color.
 
void xaccAccountSetFilter (Account *account, const char *filter)
 Set the account's Filter.
 
void xaccAccountSetSortOrder (Account *account, const char *sortorder)
 Set the account's Sort Order.
 
void xaccAccountSetSortReversed (Account *account, gboolean sortreversed)
 Set the account's Sort Order direction.
 
void xaccAccountSetNotes (Account *account, const char *notes)
 Set the account's notes.
 
void xaccAccountSetLastNum (Account *account, const char *num)
 Set the last num field of an Account.
 
void gnc_account_set_policy (Account *account, GNCPolicy *policy)
 Set the account's lot order policy.
 
GNCAccountType xaccAccountGetType (const Account *account)
 Returns the account's account type. More...
 
gboolean xaccAccountIsPriced (const Account *acc)
 Returns true if the account is a stock, mutual fund or currency, otherwise false. More...
 
void gnc_account_set_start_balance (Account *acc, const gnc_numeric start_baln)
 This function will set the starting commodity balance for this account. More...
 
void gnc_account_set_start_cleared_balance (Account *acc, const gnc_numeric start_baln)
 This function will set the starting cleared commodity balance for this account. More...
 
void gnc_account_set_start_reconciled_balance (Account *acc, const gnc_numeric start_baln)
 This function will set the starting reconciled commodity balance for this account. More...
 
void gnc_account_set_balance_dirty (Account *acc)
 Tell the account that the running balances may be incorrect and need to be recomputed. More...
 
void gnc_account_set_sort_dirty (Account *acc)
 Tell the account believes that the splits may be incorrectly sorted and need to be resorted. More...
 
gboolean gnc_account_insert_split (Account *acc, Split *s)
 Insert the given split from an account. More...
 
gboolean gnc_account_remove_split (Account *acc, Split *s)
 Remove the given split from an account. More...
 
const char * xaccAccountGetName (const Account *account)
 Get the account's name.
 
const char * xaccAccountGetCode (const Account *account)
 Get the account's accounting code.
 
const char * xaccAccountGetDescription (const Account *account)
 Get the account's description.
 
const char * xaccAccountGetColor (const Account *account)
 Get the account's color.
 
const char * xaccAccountGetFilter (const Account *account)
 Get the account's filter.
 
const char * xaccAccountGetSortOrder (const Account *account)
 Get the account's Sort Order.
 
gboolean xaccAccountGetSortReversed (const Account *account)
 Get the account's Sort Order direction.
 
const char * xaccAccountGetNotes (const Account *account)
 Get the account's notes.
 
const char * xaccAccountGetLastNum (const Account *account)
 Get the last num field of an Account.
 
GNCPolicy * gnc_account_get_policy (Account *account)
 Get the account's lot order policy.
 
void xaccAccountRecomputeBalance (Account *)
 The following recompute the partial balances (stored with the transaction) and the total balance, for this account.
 
void xaccAccountSortSplits (Account *acc, gboolean force)
 The xaccAccountSortSplits() routine will resort the account's splits if the sort is dirty. More...
 
gchar * gnc_account_get_full_name (const Account *account)
 The gnc_account_get_full_name routine returns the fully qualified name of the account using the given separator char. More...
 
AccountxaccAccountGainsAccount (Account *acc, gnc_commodity *curr)
 Retrieve the gains account used by this account for the indicated currency, creating and recording a new one if necessary. More...
 
void dxaccAccountSetPriceSrc (Account *account, const char *src)
 Set a string that identifies the Finance::Quote backend that should be used to retrieve online prices. More...
 
const char * dxaccAccountGetPriceSrc (const Account *account)
 Get a string that identifies the Finance::Quote backend that should be used to retrieve online prices. More...
 
gboolean xaccAccountGetAutoInterestXfer (const Account *account, gboolean default_value)
 Returns a per-account flag: Prior to reconciling an account which charges or pays interest, this flag tells whether to prompt the user to enter a transaction for the interest charge or payment. More...
 
void xaccAccountSetAutoInterestXfer (Account *account, gboolean value)
 Sets a per-account flag: Prior to reconciling an account which charges or pays interest, this flag tells whether to prompt the user to enter a transaction for the interest charge or payment. More...
 
Account Commodity setters/getters
Accounts are used to store an amount of 'something', that 'something'
is called the 'commodity'.

An account can only hold one kind of commodity. The following are used to get and set the commodity, and also to set the SCU, the 'Smallest Commodity Unit'.

Note that when we say that a 'split' holds an 'amount', that amount is denominated in the account commodity. Do not confuse 'amount' and 'value'. The 'value' of a split is the value of the amount expressed in the currency of the transaction. Thus, for example, the 'amount' may be 12 apples, where the account commodity is 'apples'. The value of these 12 apples may be 12 dollars, where the transaction currency is 'dollars'.

The SCU is the 'Smallest Commodity Unit', signifying the smallest non-zero amount that can be stored in the account. It is represented as the integer denominator of a fraction. Thus, for example, a SCU of 12 means that 1/12 of something is the smallest amount that can be stored in the account. SCU's can be any value; they do not need to be decimal. This allows the use of accounts with unusual, non-decimal commodities and currencies.

Normally, the SCU is determined by the commodity of the account. However, this default SCU can be over-ridden and set to an account-specific value. This is account-specific value is called the 'non-standard' value in the documentation below.

void xaccAccountSetCommodity (Account *account, gnc_commodity *comm)
 Set the account's commodity.
 
gnc_commodity * xaccAccountGetCommodity (const Account *account)
 Get the account's commodity.
 
gnc_commodity * gnc_account_get_currency_or_parent (const Account *account)
 Returns a gnc_commodity that is a currency, suitable for being a Transaction's currency. More...
 
int xaccAccountGetCommoditySCU (const Account *account)
 Return the SCU for the account. More...
 
int xaccAccountGetCommoditySCUi (const Account *account)
 Return the 'internal' SCU setting. More...
 
void xaccAccountSetCommoditySCU (Account *account, int frac)
 Set the SCU for the account. More...
 
void xaccAccountSetNonStdSCU (Account *account, gboolean flag)
 Set the flag indicating that this account uses a non-standard SCU. More...
 
gboolean xaccAccountGetNonStdSCU (const Account *account)
 Return boolean, indicating whether this account uses a non-standard SCU. More...
 
Account Balance
gnc_numeric xaccAccountGetBalance (const Account *account)
 Get the current balance of the account, which may include future splits.
 
gnc_numeric xaccAccountGetClearedBalance (const Account *account)
 Get the current balance of the account, only including cleared transactions.
 
gnc_numeric xaccAccountGetReconciledBalance (const Account *account)
 Get the current balance of the account, only including reconciled transactions.
 
gnc_numeric xaccAccountGetPresentBalance (const Account *account)
 
gnc_numeric xaccAccountGetProjectedMinimumBalance (const Account *account)
 
gnc_numeric xaccAccountGetBalanceAsOfDate (Account *account, time64 date)
 Get the balance of the account as of the date specified.
 
gnc_numeric xaccAccountConvertBalanceToCurrency (const Account *account, gnc_numeric balance, const gnc_commodity *balance_currency, const gnc_commodity *new_currency)
 
gnc_numeric xaccAccountConvertBalanceToCurrencyAsOfDate (const Account *account, gnc_numeric balance, gnc_commodity *balance_currency, gnc_commodity *new_currency, time64 date)
 
gnc_numeric xaccAccountGetBalanceInCurrency (const Account *account, const gnc_commodity *report_commodity, gboolean include_children)
 
gnc_numeric xaccAccountGetClearedBalanceInCurrency (const Account *account, const gnc_commodity *report_commodity, gboolean include_children)
 
gnc_numeric xaccAccountGetReconciledBalanceInCurrency (const Account *account, const gnc_commodity *report_commodity, gboolean include_children)
 
gnc_numeric xaccAccountGetPresentBalanceInCurrency (const Account *account, const gnc_commodity *report_commodity, gboolean include_children)
 
gnc_numeric xaccAccountGetProjectedMinimumBalanceInCurrency (const Account *account, const gnc_commodity *report_commodity, gboolean include_children)
 
gnc_numeric xaccAccountGetBalanceAsOfDateInCurrency (Account *account, time64 date, gnc_commodity *report_commodity, gboolean include_children)
 
gnc_numeric xaccAccountGetBalanceChangeForPeriod (Account *acc, time64 date1, time64 date2, gboolean recurse)
 
Account Children and Parents.

The set of accounts is represented as a doubly-linked tree, so that given any account, both its parent and its children can be easily found.

At the top of the tree hierarchy lies a single root node, the root account.

The account tree hierarchy is unique, in that a given account can have only one parent account.

void gnc_account_append_child (Account *new_parent, Account *child)
 This function will remove from the child account any pre-existing parent relationship, and will then add the account as a child of the new parent. More...
 
void gnc_account_remove_child (Account *parent, Account *child)
 This function will remove the specified child account from the specified parent account. More...
 
Accountgnc_account_get_parent (const Account *account)
 This routine returns a pointer to the parent of the specified account. More...
 
Accountgnc_account_get_root (Account *account)
 This routine returns the root account of the account tree that the specified account belongs to. More...
 
gboolean gnc_account_is_root (const Account *account)
 This routine indicates whether the specified account is the root node of an account tree. More...
 
GList * gnc_account_get_children (const Account *account)
 This routine returns a GList of all children accounts of the specified account. More...
 
GList * gnc_account_get_children_sorted (const Account *account)
 This routine returns a GList of all children accounts of the specified account, ordered by xaccAccountOrder(). More...
 
gint gnc_account_n_children (const Account *account)
 Return the number of children of the specified account. More...
 
gint gnc_account_child_index (const Account *parent, const Account *child)
 Return the index of the specified child within the list of the parent's children. More...
 
Accountgnc_account_nth_child (const Account *parent, gint num)
 Return the n'th child account of the specified parent account. More...
 
GList * gnc_account_get_descendants (const Account *account)
 This routine returns a flat list of all of the accounts that are descendants of the specified account. More...
 
GList * gnc_account_get_descendants_sorted (const Account *account)
 This function returns a GList containing all the descendants of the specified account, sorted at each level. More...
 
gint gnc_account_n_descendants (const Account *account)
 Return the number of descendants of the specified account. More...
 
gint gnc_account_get_current_depth (const Account *account)
 Return the number of levels of this account below the root account. More...
 
gint gnc_account_get_tree_depth (const Account *account)
 Return the number of levels of descendants accounts below the specified account. More...
 
ForEach
void gnc_account_foreach_child (const Account *account, AccountCb func, gpointer user_data)
 This method will traverse the immediate children of this accounts, calling 'func' on each account. More...
 
void gnc_account_foreach_descendant (const Account *account, AccountCb func, gpointer user_data)
 This method will traverse all children of this accounts and their descendants, calling 'func' on each account. More...
 
gpointer gnc_account_foreach_descendant_until (const Account *account, AccountCb2 func, gpointer user_data)
 This method will traverse all children of this accounts and their descendants, calling 'func' on each account. More...
 
Concatenation, Merging
void gnc_account_join_children (Account *to_parent, Account *from_parent)
 The gnc_account_join_children() subroutine will move (reparent) all child accounts from the from_parent account to the to_parent account, preserving the account hierarchy. More...
 
void gnc_account_merge_children (Account *parent)
 The gnc_account_merge_children() subroutine will go through an account, merging all child accounts that have the same name and description. More...
 
Lookup Accounts and Subaccounts by name or code
Accountgnc_account_lookup_by_name (const Account *parent, const char *name)
 The gnc_account_lookup_by_name() subroutine fetches the account by name from the descendants of the specified account. More...
 
Accountgnc_account_lookup_by_full_name (const Account *any_account, const gchar *name)
 The gnc_account_lookup_full_name() subroutine works like gnc_account_lookup_by_name, but uses fully-qualified names using the given separator.
 
Accountgnc_account_lookup_by_code (const Account *parent, const char *code)
 The gnc_account_lookup_full_name() subroutine works like gnc_account_lookup_by_name, but uses the account code.
 
GNCAccountType conversion/checking
const char * xaccAccountTypeEnumAsString (GNCAccountType type)
 Conversion routines for the account types to/from strings that are used in persistent storage, communications. More...
 
gboolean xaccAccountStringToType (const char *str, GNCAccountType *type)
 Conversion routines for the account types to/from strings that are used in persistent storage, communications. More...
 
GNCAccountType xaccAccountStringToEnum (const char *str)
 Conversion routines for the account types to/from strings that are used in persistent storage, communications. More...
 
const char * xaccAccountGetTypeStr (GNCAccountType type)
 The xaccAccountGetTypeStr() routine returns a string suitable for use in the GUI/Interface. More...
 
guint32 xaccAccountTypesCompatibleWith (GNCAccountType type)
 Return the bitmask of account types compatible with a given type. More...
 
guint32 xaccParentAccountTypesCompatibleWith (GNCAccountType type)
 Return the bitmask of parent account types compatible with a given type. More...
 
gboolean xaccAccountTypesCompatible (GNCAccountType parent_type, GNCAccountType child_type)
 Return TRUE if accounts of type parent_type can have accounts of type child_type as children. More...
 
guint32 xaccAccountTypesValid (void)
 Returns the bitmask of the account type enums that are valid. More...
 
gboolean xaccAccountIsAssetLiabType (GNCAccountType t)
 Convenience function to check if the account is a valid Asset or Liability type, but not a business account type (meaning not an Accounts Payable/Accounts Receivable). More...
 
gboolean xaccAccountIsAPARType (GNCAccountType t)
 Convenience function to check if the account is a valid business account type (meaning an Accounts Payable/Accounts Receivable). More...
 
gboolean xaccAccountIsEquityType (GNCAccountType t)
 Convenience function to check if the account is a valid Equity type. More...
 
Account lots
void xaccAccountInsertLot (Account *, GNCLot *)
 The xaccAccountInsertLot() method will register the indicated lot with this account. More...
 
void xaccAccountRemoveLot (Account *, GNCLot *)
 
LotListxaccAccountGetLotList (const Account *account)
 The xaccAccountGetLotList() routine returns a list of all lots in this account. More...
 
gpointer xaccAccountForEachLot (const Account *acc, gpointer(*proc)(GNCLot *lot, gpointer user_data), gpointer user_data)
 The xaccAccountForEachLot() method will apply the function 'proc' to each lot in the account. More...
 
LotListxaccAccountFindOpenLots (const Account *acc, gboolean(*match_func)(GNCLot *lot, gpointer user_data), gpointer user_data, GCompareFunc sort_func)
 Find a list of open lots that match the match_func. More...
 
Account Reconciliation information getters/setters
gboolean xaccAccountGetReconcileLastDate (const Account *account, time64 *last_date)
 DOCUMENT ME!
 
void xaccAccountSetReconcileLastDate (Account *account, time64 last_date)
 DOCUMENT ME!
 
gboolean xaccAccountGetReconcileLastInterval (const Account *account, int *months, int *days)
 DOCUMENT ME!
 
void xaccAccountSetReconcileLastInterval (Account *account, int months, int days)
 DOCUMENT ME!
 
gboolean xaccAccountGetReconcilePostponeDate (const Account *account, time64 *postpone_date)
 DOCUMENT ME!
 
void xaccAccountSetReconcilePostponeDate (Account *account, time64 postpone_date)
 DOCUMENT ME!
 
gboolean xaccAccountGetReconcilePostponeBalance (const Account *account, gnc_numeric *balance)
 DOCUMENT ME!
 
void xaccAccountSetReconcilePostponeBalance (Account *account, gnc_numeric balance)
 DOCUMENT ME!
 
void xaccAccountClearReconcilePostpone (Account *account)
 DOCUMENT ME!
 
Account Placeholder flag
gboolean xaccAccountGetPlaceholder (const Account *account)
 Get the "placeholder" flag for an account. More...
 
void xaccAccountSetPlaceholder (Account *account, gboolean val)
 Set the "placeholder" flag for an account. More...
 
GNCPlaceholderType xaccAccountGetDescendantPlaceholder (const Account *account)
 Returns PLACEHOLDER_NONE if account is NULL or neither account nor any descendant of account is a placeholder. More...
 
Account Hidden flag
gboolean xaccAccountGetHidden (const Account *acc)
 Get the "hidden" flag for an account. More...
 
void xaccAccountSetHidden (Account *acc, gboolean val)
 Set the "hidden" flag for an account. More...
 
gboolean xaccAccountIsHidden (const Account *acc)
 Should this account be "hidden". More...
 
Account Tax related getters/setters
gboolean xaccAccountGetTaxRelated (const Account *account)
 DOCUMENT ME!
 
void xaccAccountSetTaxRelated (Account *account, gboolean tax_related)
 DOCUMENT ME!
 
const char * xaccAccountGetTaxUSCode (const Account *account)
 DOCUMENT ME!
 
void xaccAccountSetTaxUSCode (Account *account, const char *code)
 DOCUMENT ME!
 
const char * xaccAccountGetTaxUSPayerNameSource (const Account *account)
 DOCUMENT ME!
 
void xaccAccountSetTaxUSPayerNameSource (Account *account, const char *source)
 DOCUMENT ME!
 
gint64 xaccAccountGetTaxUSCopyNumber (const Account *account)
 DOCUMENT ME!
 
void xaccAccountSetTaxUSCopyNumber (Account *account, gint64 copy_number)
 DOCUMENT ME!
 
Account marking
void xaccAccountSetMark (Account *account, short mark)
 Set a mark on the account. More...
 
void xaccClearMark (Account *account, short val)
 Get the mark set by xaccAccountSetMark short xaccAccountGetMark (const Account *account);. More...
 
void xaccClearMarkDown (Account *account, short val)
 The xaccClearMarkDown will clear the mark only in this and in sub-accounts. More...
 
Staged Traversal

The following functions provide support for "staged traversals" over all of the transactions in an account or group.

The idea is to be able to perform a sequence of traversals ("stages"), and perform an operation on each transaction exactly once for that stage.

Only transactions whose current "stage" is less than the stage of the current traversal will be affected, and they will be "brought up" to the current stage when they are processed.

For example, you could perform a stage 1 traversal of all the transactions in an account, and then perform a stage 1 traversal of the transactions in a second account. Presuming the traversal of the first account didn't abort prematurely, any transactions shared by both accounts would be ignored during the traversal of the second account since they had been processed while traversing the first account.

However, if you had traversed the second account using a stage of 2, then all the transactions in the second account would have been processed.

Traversal can be aborted by having the callback function return a non-zero value. The traversal is aborted immediately, and the non-zero value is returned. Note that an aborted traversal can be restarted; no information is lost due to an abort.

The initial impetus for this particular approach came from generalizing a mark/sweep practice that was already being used in FileIO.c.

Note that currently, there is a hard limit of 256 stages, which can be changed by enlarging "marker" in the transaction struct.

void gnc_account_tree_begin_staged_transaction_traversals (Account *acc)
 gnc_account_tree_begin_staged_transaction_traversals() resets the traversal marker inside every transactions of every account in the account tree originating with the specified node. More...
 
void xaccSplitsBeginStagedTransactionTraversals (SplitList *splits)
 xaccSplitsBeginStagedTransactionTraversals() resets the traversal marker for each transaction which is a parent of one of the splits in the list.
 
void xaccAccountBeginStagedTransactionTraversals (const Account *account)
 xaccAccountBeginStagedTransactionTraversals() resets the traversal marker for each transaction which is a parent of one of the splits in the account.
 
gboolean xaccTransactionTraverse (Transaction *trans, int stage)
 xaccTransactionTraverse() checks the stage of the given transaction. More...
 
int xaccAccountStagedTransactionTraversal (const Account *a, unsigned int stage, TransactionCallback thunk, void *data)
 xaccAccountStagedTransactionTraversal() calls thunk on each transaction in account a whose current marker is less than the given stage and updates each transaction's marker to be stage. More...
 
int gnc_account_tree_staged_transaction_traversal (const Account *account, unsigned int stage, TransactionCallback thunk, void *data)
 gnc_account_tree_staged_transaction_traversal() calls thunk on each transaction in the group whose current marker is less than the given stage and updates each transaction's marker to be stage. More...
 
int xaccAccountTreeForEachTransaction (Account *acc, TransactionCallback proc, void *data)
 Traverse all of the transactions in the given account group. More...
 
GncImportMatchMapgnc_account_imap_create_imap (Account *acc)
 Obtain an ImportMatchMap object from an Account or a Book.
 
Accountgnc_account_imap_find_account (GncImportMatchMap *imap, const char *category, const char *key)
 
void gnc_account_imap_add_account (GncImportMatchMap *imap, const char *category, const char *key, Account *acc)
 
void gnc_account_imap_delete_account (GncImportMatchMap *imap, const char *category, const char *key)
 
Accountgnc_account_imap_find_account_bayes (GncImportMatchMap *imap, GList *tokens)
 Look up an Account in the map using Baysian. More...
 
void gnc_account_imap_add_account_bayes (GncImportMatchMap *imap, GList *tokens, Account *acc)
 Updates the imap for a given account using a list of tokens.
 
GList * gnc_account_imap_get_info_bayes (Account *acc)
 Returns a GList of structure imap_info of all Bayesian mappings for required Account.
 
GList * gnc_account_imap_get_info (Account *acc, const char *category)
 Returns a GList of structure imap_info of all Non Bayesian mappings for required Account.
 
gchar * gnc_account_get_map_entry (Account *acc, const char *full_category)
 Returns the text string pointed to by full_category for the Account, free the returned text.
 
void gnc_account_delete_map_entry (Account *acc, char *full_category, gboolean empty)
 Delete the entry for Account pointed to by full_category, if empty is TRUE then use delete if empty, full_category is freed.
 
void gnc_account_imap_convert_bayes (QofBook *book)
 Search for Bayesian entries with mappings based on full account name and change them to be based on the account guid.
 
Deprecated Routines.
void DxaccAccountSetCurrency (Account *account, gnc_commodity *currency)
 
gnc_commodity * DxaccAccountGetCurrency (const Account *account)
 
void dxaccAccountSetQuoteTZ (Account *account, const char *tz)
 Set the timezone to be used when interpreting the results from a given Finance::Quote backend. More...
 
const char * dxaccAccountGetQuoteTZ (const Account *account)
 Get the timezone to be used when interpreting the results from a given Finance::Quote backend. More...
 

Account lookup and GncGUID routines

#define xaccAccountGetGUID(X)   qof_entity_get_guid(QOF_INSTANCE(X))
 
#define xaccAccountReturnGUID(X)   (X ? *(qof_entity_get_guid(QOF_INSTANCE(X))) : *(guid_null()))
 
#define xaccAccountLookupDirect(g, b)   xaccAccountLookup(&(g),b)
 
const gchar * gnc_get_account_separator_string (void)
 Returns the account separation character chosen by the user. More...
 
gunichar gnc_get_account_separator (void)
 
void gnc_set_account_separator (const gchar *separator)
 
Accountgnc_book_get_root_account (QofBook *book)
 
void gnc_book_set_root_account (QofBook *book, Account *root)
 
AccountxaccAccountLookup (const GncGUID *guid, QofBook *book)
 The xaccAccountLookup() subroutine will return the account associated with the given id, or NULL if there is no such account. More...
 

Account split/transaction list management

#define xaccAccountInsertSplit(acc, s)   xaccSplitSetAccount((s), (acc))
 The xaccAccountInsertSplit() method will insert the indicated split into the indicated account. More...
 
SplitListxaccAccountGetSplitList (const Account *account)
 The xaccAccountGetSplitList() routine returns a pointer to a GList of the splits in the account. More...
 
gint64 xaccAccountCountSplits (const Account *acc, gboolean include_children)
 The xaccAccountCountSplits() routine returns the number of all the splits in the account. More...
 
void xaccAccountMoveAllSplits (Account *accfrom, Account *accto)
 The xaccAccountMoveAllSplits() routine reassigns each of the splits in accfrom to accto. More...
 
gint xaccAccountForEachTransaction (const Account *account, TransactionCallback proc, void *data)
 The xaccAccountForEachTransaction() routine will traverse all of the transactions in account and call the callback function proc on each transaction. More...
 
Transaction * xaccAccountFindTransByDesc (const Account *account, const char *description)
 Returns a pointer to the transaction, not a copy. More...
 
Split * xaccAccountFindSplitByDesc (const Account *account, const char *description)
 Returns a pointer to the split, not a copy. More...
 

Detailed Description

Account handling public routines.

Author
Copyright (C) 1997 Robin D. Clark
Copyright (C) 1997-2003 Linas Vepstas linas.nosp@m.@lin.nosp@m.as.or.nosp@m.g

Definition in file Account.h.