GnuCashew ~ GnuCash Enabled Web
GCW
Definition.h
Go to the documentation of this file.
1 #line 2 "src/Dbo/Accounts/Definition.h"
2 
3 #ifndef __DBO_ACCOUNTS_DEFINITION_H___
4 #define __DBO_ACCOUNTS_DEFINITION_H___
5 
6 #include <Wt/WFormModel.h>
7 
8 namespace GCW {
9  namespace Dbo {
10  namespace Accounts {
11 
12 extern const char * s_tableName;
13 
14 /*!
15 ** \brief Account Debit/Credit Enum
16 **
17 ** This indicates if this account is a 'debit' type account or
18 ** a 'credit' type account.
19 *
20 ** \sa GCW::Dbo::Accounts::Item
21 **
22 */
23 enum class DrCr
24 {
25  /// 0x00 ~ invalid - should not happen
26  NONE = 0x00,
27 
28  /// 0x01 ~ DEBIT type account
29  DEBIT = 0x01,
30 
31  /// 0x02 ~ CREDIT type account
32  CREDIT = 0x02
33 };
34 
35 /*!
36 ** \brief Account Type
37 **
38 ** These are used internally to switch the views depending on the account type.
39 ** While these codes exactly match the codes in the native gnucash proper, they
40 ** should not be relied on to match the native gnucash account type codes
41 ** (those are textual, see; GCW::Dbo::Accounts::Item::accountTypeName). But,
42 ** these are internal anyhow, and they don't get stored. They're just used to
43 ** steer the application, especially as it pertains to debit/credit calculations.
44 **
45 ** The definition-table can be found here: \ref s_accountDefs
46 **
47 ** \note gnucash source reference: ..src/libgnucash/engine/Account.h
48 **
49 */
50 enum class Type
51 {
52  /// -1 ~ not a type
53  INVALID = -1,
54 
55  /// -1 ~ not a type
56  NONE = -1,
57 
58  /// 00 ~ bank institutionally held monies, can be interest bearing
59  BANK = 0,
60 
61  /// 01 ~ pure cash (shoebox)
62  CASH = 1,
63 
64  /// 03 ~ AMEX / VISA / DISCOVER type of credit cards
65  CREDIT = 3,
66 
67  /// 02 ~ generic generalized asset account
68  ASSET = 2,
69 
70  /// 04 ~ generic generalized liability account
71  LIABILITY = 4,
72 
73  /// 05 ~ stock account show as three-column registers: price, # shares, value
74  STOCK = 5,
75 
76  /// 06 ~ similar to stock, shows: price, # shares, value
77  MUTUAL = 6,
78 
79  /// 07 ~ currency trading account (DEPRECATED)
80  CURRENCY = 7,
81 
82  /// 08 ~ income tracking account
83  INCOME = 8,
84 
85  /// 09 ~ expense tracking account
86  EXPENSE = 9,
87 
88  /// 10 ~ used to balance the balance sheet
89  EQUITY = 10,
90 
91  /// 11 ~ A/R receivable account
92  RECEIVABLE = 11,
93 
94  /// 12 ~ A/R payable account
95  PAYABLE = 12,
96 
97  /// 13 ~ hidden root account for the account tree
98  ROOT = 13,
99 
100  /// 14 ~ used to record multiple commodify transactions
101  TRADING = 14,
102 
103  /// 15 ~ end of account types
104  NUM_ACCOUNT_TYPES = 15,
105 
106  /// 15 ~ do not use
107  CHECKING = 15,
108 
109  /// 16 ~ do not use
110  SAVINGS = 16,
111 
112  /// 17 ~ do not use
113  MONEYMRKT = 17,
114 
115  /// 18 ~ do not use
116  CREDITLINE = 18,
117 
118  /// end of list
119  LAST
120 
121 };
122 
123 /*!
124 ** \brief Account Definition
125 **
126 ** This structure provides a set of account-definitions that are used in the
127 ** various views and balance calculations.
128 **
129 */
130 typedef struct ACCOUNTDEF_S
131 {
132  /// Account Type as per gnucash
134 
135  /// indicate if the account is Debit or Credit
137 
138  /// the 'name' used in the back-end for the account
139  std::string backendName;
140 
141  /// a printable 'label' for the 'account' column in the registers
142  std::string colAccount;
143 
144  /// a printable 'label' for the 'debit' column in the registers
145  std::string colDr;
146 
147  /// a printable 'label' for the 'credit' column in the registers
148  std::string colCr;
149 
150  /// acceptable parent account types
152 
154 
155 extern const std::vector< AccountDef_t > s_accountDefs;
156 
157 #ifdef NEVER
158 /*!
159 ** \brief AccountType Parentage
160 **
161 ** This array defines the various account types and their suitable
162 ** parentages.
163 **
164 */
165 typedef struct ACCOUNTPARENT_S
166 {
167  Type type;
168  Type parent;
169 
170 } AccountParent_t;
171 
172 extern const std::vector< AccountParent_t > s_accountParents;
173 #endif
174 
175  namespace Field {
176 
177 extern const Wt::WFormModel::Field guid ; // text(32) PRIMARY KEY NOT NULL
178 extern const Wt::WFormModel::Field name ; // text(2048) NOT NULL
179 extern const Wt::WFormModel::Field account_typeName ; // text(2048) NOT NULL
180 extern const Wt::WFormModel::Field commodity_guid ; // text(32)
181 extern const Wt::WFormModel::Field commodity_scu ; // integer NOT NULL (special currency unit)
182 extern const Wt::WFormModel::Field non_std_scu ; // integer NOT NULL (1=special currency unit in use)
183 extern const Wt::WFormModel::Field parent_guid ; // text(32)
184 extern const Wt::WFormModel::Field code ; // text(2048)
185 extern const Wt::WFormModel::Field description ; // text(2048)
186 extern const Wt::WFormModel::Field hidden ; // integer
187 extern const Wt::WFormModel::Field placeHolder ; // integer
188 
189  } // endnamespace Field {
190  } // endnamespace Accounts {
191  } // endnamespace Dbo {
192 } // endnamespace GCW {
193 
194 #endif // __DBO_ACCOUNTS_DEFINITION_H___
195 
196 
197 
const Wt::WFormModel::Field name
Definition: Accounts.cpp:47
const Wt::WFormModel::Field guid
Definition: Accounts.cpp:46
const Wt::WFormModel::Field description
Definition: Accounts.cpp:54
const Wt::WFormModel::Field commodity_scu
Definition: Accounts.cpp:50
const Wt::WFormModel::Field account_typeName
Definition: Accounts.cpp:48
const Wt::WFormModel::Field code
Definition: Accounts.cpp:53
const Wt::WFormModel::Field non_std_scu
Definition: Accounts.cpp:51
const Wt::WFormModel::Field commodity_guid
Definition: Accounts.cpp:49
const Wt::WFormModel::Field placeHolder
Definition: Accounts.cpp:56
const Wt::WFormModel::Field hidden
Definition: Accounts.cpp:55
const Wt::WFormModel::Field parent_guid
Definition: Accounts.cpp:52
Type
Account Type.
Definition: Definition.h:51
@ CREDITLINE
18 ~ do not use
@ NUM_ACCOUNT_TYPES
15 ~ end of account types
@ CURRENCY
07 ~ currency trading account (DEPRECATED)
@ EXPENSE
09 ~ expense tracking account
@ CHECKING
15 ~ do not use
@ ASSET
02 ~ generic generalized asset account
@ INCOME
08 ~ income tracking account
@ BANK
00 ~ bank institutionally held monies, can be interest bearing
@ MUTUAL
06 ~ similar to stock, shows: price, # shares, value
@ LIABILITY
04 ~ generic generalized liability account
@ SAVINGS
16 ~ do not use
@ NONE
-1 ~ not a type
@ EQUITY
10 ~ used to balance the balance sheet
@ INVALID
-1 ~ not a type
@ TRADING
14 ~ used to record multiple commodify transactions
@ CASH
01 ~ pure cash (shoebox)
@ CREDIT
03 ~ AMEX / VISA / DISCOVER type of credit cards
@ MONEYMRKT
17 ~ do not use
@ ROOT
13 ~ hidden root account for the account tree
@ PAYABLE
12 ~ A/R payable account
@ RECEIVABLE
11 ~ A/R receivable account
@ STOCK
05 ~ stock account show as three-column registers: price, # shares, value
DrCr
Account Debit/Credit Enum.
Definition: Definition.h:24
@ DEBIT
0x01 ~ DEBIT type account
@ NONE
0x00 ~ invalid - should not happen
@ CREDIT
0x02 ~ CREDIT type account
const std::vector< AccountDef_t > s_accountDefs
Definition: Accounts.cpp:20
struct GCW::Dbo::Accounts::ACCOUNTDEF_S AccountDef_t
Account Definition.
const char * s_tableName
Definition: Accounts.cpp:7
const Wt::WFormModel::Field parent
Definition: BillTerms.cpp:15
const Wt::WFormModel::Field type
Definition: BillTerms.cpp:16
Definition: App.h:17
std::string backendName
the 'name' used in the back-end for the account
Definition: Definition.h:139
std::string colAccount
a printable 'label' for the 'account' column in the registers
Definition: Definition.h:142
std::string colDr
a printable 'label' for the 'debit' column in the registers
Definition: Definition.h:145
std::string colCr
a printable 'label' for the 'credit' column in the registers
Definition: Definition.h:148
Type parentType
acceptable parent account types
Definition: Definition.h:151
Type type
Account Type as per gnucash.
Definition: Definition.h:133
DrCr drcr
indicate if the account is Debit or Credit
Definition: Definition.h:136