2001-08-07 18:36:04 -05:00
|
|
|
/********************************************************************\
|
|
|
|
* AccountP.h -- Account engine-private data structure *
|
|
|
|
* Copyright (C) 1997 Robin D. Clark *
|
2002-05-22 00:48:22 -05:00
|
|
|
* Copyright (C) 1997-2002, Linas Vepstas <linas@linas.org> *
|
2001-08-07 18:36:04 -05:00
|
|
|
* *
|
|
|
|
* This program is free software; you can redistribute it and/or *
|
|
|
|
* modify it under the terms of the GNU General Public License as *
|
|
|
|
* published by the Free Software Foundation; either version 2 of *
|
|
|
|
* the License, or (at your option) any later version. *
|
|
|
|
* *
|
|
|
|
* This program is distributed in the hope that it will be useful, *
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
|
|
* GNU General Public License for more details. *
|
|
|
|
* *
|
|
|
|
* You should have received a copy of the GNU General Public License*
|
|
|
|
* along with this program; if not, contact: *
|
|
|
|
* *
|
|
|
|
* Free Software Foundation Voice: +1-617-542-5942 *
|
2005-11-16 23:35:02 -06:00
|
|
|
* 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 *
|
|
|
|
* Boston, MA 02110-1301, USA gnu@gnu.org *
|
2001-08-07 18:36:04 -05:00
|
|
|
* *
|
|
|
|
\********************************************************************/
|
|
|
|
|
2003-03-14 17:59:25 -06:00
|
|
|
/** @file AccountP.h
|
2001-08-07 18:36:04 -05:00
|
|
|
*
|
|
|
|
* This is the *private* header for the account structure.
|
|
|
|
* No one outside of the engine should ever include this file.
|
|
|
|
*
|
|
|
|
* This header includes prototypes for "dangerous" functions.
|
|
|
|
* Invoking any of these functions potentially leave the account
|
|
|
|
* in an inconsistent state. If they are not used in the proper
|
|
|
|
* setting, they can leave the account structures in an inconsistent
|
|
|
|
* state. Thus, these methods should never be used outside of
|
2010-02-17 23:31:54 -06:00
|
|
|
* the engine, which is why they are "hidden" here.
|
2001-08-07 18:36:04 -05:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef XACC_ACCOUNT_P_H
|
|
|
|
#define XACC_ACCOUNT_P_H
|
|
|
|
|
|
|
|
#include "Account.h"
|
2003-10-11 23:44:40 -05:00
|
|
|
|
2017-08-14 13:32:45 -05:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2011-11-05 18:05:00 -05:00
|
|
|
#define GNC_ID_ROOT_ACCOUNT "RootAccount"
|
|
|
|
|
2001-08-07 18:36:04 -05:00
|
|
|
/** STRUCTS *********************************************************/
|
2003-03-14 17:59:25 -06:00
|
|
|
|
2010-02-17 23:31:54 -06:00
|
|
|
/** This is the data that describes an account.
|
2003-03-14 17:59:25 -06:00
|
|
|
*
|
|
|
|
* This is the *private* header for the account structure.
|
|
|
|
* No one outside of the engine should ever include this file.
|
|
|
|
*/
|
2005-01-30 15:06:20 -06:00
|
|
|
|
2021-08-23 05:05:08 -05:00
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
Unset = -1,
|
|
|
|
False,
|
|
|
|
True
|
|
|
|
} TriState;
|
|
|
|
|
2011-05-23 14:44:24 -05:00
|
|
|
/** \struct Account */
|
2011-11-05 18:05:00 -05:00
|
|
|
typedef struct AccountPrivate
|
|
|
|
{
|
|
|
|
/* The accountName is an arbitrary string assigned by the user.
|
2023-01-31 12:16:33 -06:00
|
|
|
* It is intended to be a short, 5 to 30 character long string that
|
2011-11-05 18:05:00 -05:00
|
|
|
* is displayed by the GUI as the account mnemonic.
|
|
|
|
*/
|
2021-07-08 14:42:03 -05:00
|
|
|
const char *accountName;
|
2011-11-05 18:05:00 -05:00
|
|
|
|
|
|
|
/* The accountCode is an arbitrary string assigned by the user.
|
|
|
|
* It is intended to be reporting code that is a synonym for the
|
|
|
|
* accountName. Typically, it will be a numeric value that follows
|
|
|
|
* the numbering assignments commonly used by accountants, such
|
|
|
|
* as 100, 200 or 600 for top-level accounts, and 101, 102.. etc.
|
|
|
|
* for detail accounts.
|
|
|
|
*/
|
2021-07-08 14:42:03 -05:00
|
|
|
const char *accountCode;
|
2011-11-05 18:05:00 -05:00
|
|
|
|
|
|
|
/* The description is an arbitrary string assigned by the user.
|
|
|
|
* It is intended to be a longer, 1-5 sentence description of what
|
|
|
|
* this account is all about.
|
|
|
|
*/
|
2021-07-08 14:42:03 -05:00
|
|
|
const char *description;
|
2011-11-05 18:05:00 -05:00
|
|
|
|
|
|
|
/* The type field is the account type, picked from the enumerated
|
|
|
|
* list that includes ACCT_TYPE_BANK, ACCT_TYPE_STOCK,
|
|
|
|
* ACCT_TYPE_CREDIT, ACCT_TYPE_INCOME, etc. Its intended use is to
|
|
|
|
* be a hint to the GUI as to how to display and format the
|
|
|
|
* transaction data.
|
|
|
|
*/
|
|
|
|
GNCAccountType type;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* The commodity field denotes the kind of 'stuff' stored
|
|
|
|
* in this account. The 'amount' field of a split indicates
|
|
|
|
* how much of the 'stuff' there is.
|
|
|
|
*/
|
|
|
|
gnc_commodity * commodity;
|
|
|
|
int commodity_scu;
|
|
|
|
gboolean non_standard_scu;
|
|
|
|
|
|
|
|
/* The parent and children pointers are used to implement an account
|
|
|
|
* hierarchy, of accounts that have sub-accounts ("detail accounts").
|
|
|
|
*/
|
|
|
|
Account *parent; /* back-pointer to parent */
|
|
|
|
GList *children; /* list of sub-accounts */
|
|
|
|
|
|
|
|
/* protected data - should only be set by backends */
|
|
|
|
gnc_numeric starting_balance;
|
2019-09-04 08:11:10 -05:00
|
|
|
gnc_numeric starting_noclosing_balance;
|
2011-11-05 18:05:00 -05:00
|
|
|
gnc_numeric starting_cleared_balance;
|
|
|
|
gnc_numeric starting_reconciled_balance;
|
|
|
|
|
|
|
|
/* cached parameters */
|
|
|
|
gnc_numeric balance;
|
2019-09-04 08:11:10 -05:00
|
|
|
gnc_numeric noclosing_balance;
|
2011-11-05 18:05:00 -05:00
|
|
|
gnc_numeric cleared_balance;
|
|
|
|
gnc_numeric reconciled_balance;
|
|
|
|
|
2022-12-09 04:10:59 -06:00
|
|
|
gnc_numeric higher_balance_limit;
|
|
|
|
gboolean higher_balance_cached;
|
|
|
|
gnc_numeric lower_balance_limit;
|
|
|
|
gboolean lower_balance_cached;
|
2022-12-13 05:47:30 -06:00
|
|
|
TriState include_sub_account_balances;
|
|
|
|
|
2011-11-05 18:05:00 -05:00
|
|
|
gboolean balance_dirty; /* balances in splits incorrect */
|
|
|
|
|
|
|
|
GList *splits; /* list of split pointers */
|
|
|
|
gboolean sort_dirty; /* sort order of splits is bad */
|
|
|
|
|
|
|
|
LotList *lots; /* list of lot pointers */
|
|
|
|
GNCPolicy *policy; /* Cached pointer to policy method */
|
|
|
|
|
2021-08-23 05:05:08 -05:00
|
|
|
TriState sort_reversed;
|
|
|
|
TriState equity_type;
|
|
|
|
char *notes;
|
|
|
|
char *color;
|
2021-09-13 10:43:38 -05:00
|
|
|
char *tax_us_code;
|
|
|
|
char *tax_us_pns;
|
|
|
|
char *last_num;
|
2021-08-23 05:05:08 -05:00
|
|
|
char *sort_order;
|
|
|
|
char *filter;
|
|
|
|
|
2011-11-05 18:05:00 -05:00
|
|
|
/* The "mark" flag can be used by the user to mark this account
|
|
|
|
* in any way desired. Handy for specialty traversals of the
|
|
|
|
* account tree. */
|
|
|
|
short mark;
|
2020-07-21 15:39:26 -05:00
|
|
|
gboolean defer_bal_computation;
|
2011-11-05 18:05:00 -05:00
|
|
|
} AccountPrivate;
|
|
|
|
|
2001-10-05 03:35:04 -05:00
|
|
|
struct account_s
|
|
|
|
{
|
2010-02-17 23:31:54 -06:00
|
|
|
QofInstance inst;
|
2001-08-07 18:36:04 -05:00
|
|
|
};
|
|
|
|
|
2010-03-27 16:01:21 -05:00
|
|
|
/* Set the account's GncGUID. This should only be done when reading
|
2001-08-07 18:36:04 -05:00
|
|
|
* an account from a datafile, or some other external source. Never
|
|
|
|
* call this on an existing account! */
|
2010-03-27 16:01:21 -05:00
|
|
|
void xaccAccountSetGUID (Account *account, const GncGUID *guid);
|
2001-08-07 18:36:04 -05:00
|
|
|
|
* src/engine/GNCId.c: Implement xaccForeachEntity() as a which
allows a traversal of all entities of a particular type.
* Register GncObject_t descriptions for Splits, Transactions, and
Accounts. Move the QueryObject definitions into the actual module
sources for Transactions, Splits, Accounts, and Books. This
allows QueryNew searches for Splits, Transactions, and Accounts.
* gnc-engine.c: call the registration functions for Splits,
Transactions, Accounts, and Books to enable searching using the
new search subsystem.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@6913 57a11ea4-9604-0410-9ed3-97b8803252fd
2002-05-24 21:50:24 -05:00
|
|
|
/* Register Accounts with the engine */
|
|
|
|
gboolean xaccAccountRegister (void);
|
|
|
|
|
2011-11-05 18:05:00 -05:00
|
|
|
/* Structure for accessing static functions for testing */
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
AccountPrivate *(*get_private) (Account *acc);
|
|
|
|
Account *(*coll_get_root_account) (QofCollection *col);
|
|
|
|
void (*xaccFreeAccountChildren) (Account *acc);
|
|
|
|
void (*xaccFreeAccount) (Account *acc);
|
|
|
|
void (*qofAccountSetParent) (Account *acc, QofInstance *parent);
|
|
|
|
Account *(*gnc_account_lookup_by_full_name_helper) (const Account *acc,
|
2012-01-01 14:36:46 -06:00
|
|
|
gchar **names);
|
2011-11-05 18:05:00 -05:00
|
|
|
} AccountTestFunctions;
|
|
|
|
|
|
|
|
AccountTestFunctions* _utest_account_fill_functions(void);
|
|
|
|
|
2017-08-14 13:32:45 -05:00
|
|
|
#ifdef __cplusplus
|
|
|
|
} /* extern "C" */
|
|
|
|
#endif
|
2011-11-05 18:05:00 -05:00
|
|
|
|
2001-08-07 18:36:04 -05:00
|
|
|
#endif /* XACC_ACCOUNT_P_H */
|