GnuCashew ~ Web Application compatible with GnuCash sql data files.
GCW
Loading...
Searching...
No Matches
Accounts/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
8namespace GCW {
9 namespace Dbo {
10 namespace Accounts {
11
12extern 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*/
23enum 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*/
50enum 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
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*/
130typedef 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
155extern 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*/
165typedef struct ACCOUNTPARENT_S
166{
167 Type type;
168 Type parent;
169
170} AccountParent_t;
171
172extern const std::vector< AccountParent_t > s_accountParents;
173#endif
174
175 namespace Field {
176
177extern const Wt::WFormModel::Field guid ; // text(32) PRIMARY KEY NOT NULL
178extern const Wt::WFormModel::Field name ; // text(2048) NOT NULL
179extern const Wt::WFormModel::Field account_typeName ; // text(2048) NOT NULL
180extern const Wt::WFormModel::Field commodity_guid ; // text(32)
181extern const Wt::WFormModel::Field commodity_scu ; // integer NOT NULL (special currency unit)
182extern const Wt::WFormModel::Field non_std_scu ; // integer NOT NULL (1=special currency unit in use)
183extern const Wt::WFormModel::Field parent_guid ; // text(32)
184extern const Wt::WFormModel::Field code ; // text(2048)
185extern const Wt::WFormModel::Field description ; // text(2048)
186extern const Wt::WFormModel::Field hidden ; // integer
187extern 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 char * Field
const Wt::WFormModel::Field name
const Wt::WFormModel::Field guid
endGCW::Dbo::Accounts::s_accountDefs
const Wt::WFormModel::Field description
const Wt::WFormModel::Field commodity_scu
const Wt::WFormModel::Field account_typeName
const Wt::WFormModel::Field code
const Wt::WFormModel::Field non_std_scu
const Wt::WFormModel::Field commodity_guid
const Wt::WFormModel::Field placeHolder
const Wt::WFormModel::Field hidden
const Wt::WFormModel::Field parent_guid
@ 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
@ 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)
@ 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.
@ DEBIT
0x01 ~ DEBIT type account
@ NONE
0x00 ~ invalid - should not happen
@ CREDIT
0x02 ~ CREDIT type account
const std::vector< AccountDef_t > s_accountDefs
struct GCW::Dbo::Accounts::ACCOUNTDEF_S AccountDef_t
Account Definition.
Definition App.h:18
std::string backendName
the 'name' used in the back-end for the account
std::string colAccount
a printable 'label' for the 'account' column in the registers
std::string colDr
a printable 'label' for the 'debit' column in the registers
std::string colCr
a printable 'label' for the 'credit' column in the registers
Type parentType
acceptable parent account types
Type type
Account Type as per gnucash.
DrCr drcr
indicate if the account is Debit or Credit