GnuCashew ~ GnuCash Enabled Web
GCW
Namespaces | Classes | Typedefs | Enumerations | Functions | Variables
GCW::Dbo::Accounts Namespace Reference

Namespaces

 Children
 Account Children Namespace.
 
 Field
 

Classes

struct  ACCOUNTDEF_S
 Account Definition. More...
 
class  Item
 Account Item Class. More...
 

Typedefs

typedef struct GCW::Dbo::Accounts::ACCOUNTDEF_S AccountDef_t
 Account Definition. More...
 

Enumerations

enum class  DrCr { NONE = 0x00 , DEBIT = 0x01 , CREDIT = 0x02 }
 Account Debit/Credit Enum. More...
 
enum class  Type {
  INVALID = -1 , NONE = -1 , BANK = 0 , CASH = 1 ,
  CREDIT = 3 , ASSET = 2 , LIABILITY = 4 , STOCK = 5 ,
  MUTUAL = 6 , CURRENCY = 7 , INCOME = 8 , EXPENSE = 9 ,
  EQUITY = 10 , RECEIVABLE = 11 , PAYABLE = 12 , ROOT = 13 ,
  TRADING = 14 , NUM_ACCOUNT_TYPES = 15 , CHECKING = 15 , SAVINGS = 16 ,
  MONEYMRKT = 17 , CREDITLINE = 18 , LAST
}
 Account Type. More...
 

Functions

auto rootAccount () -> Item::Ptr
 Load Root Account. More...
 
auto load (const std::string &_guid) -> Item::Ptr
 Load Account by GUID. More...
 
auto byGuid (const std::string &_guid) -> Item::Ptr
 Load Account by GUID. More...
 
auto byChildName (const std::string &_parentGuid, const std::string &_childName) -> Item::Ptr
 Load Account by 'child name' and 'parent id'. More...
 
auto byFullName (const std::string &_fullName) -> Item::Ptr
 Load Account by 'full name' with ':' account separator. More...
 
auto allAccounts () -> Item::Vector
 Load all accounts. More...
 
auto activeAccounts () -> Item::Vector
 Load accounts as; if( !hidden() && !placeHolder() ) More...
 
auto fullName (const std::string &_guid) -> std::string
 Account Fullname via GUID. More...
 
auto fullName (Item::Ptr _item) -> std::string
 Account Fullname via Item. More...
 

Variables

const char * s_tableName = "accounts"
 
const std::vector< AccountDef_ts_accountDefs
 

Typedef Documentation

◆ AccountDef_t

Account Definition.

This structure provides a set of account-definitions that are used in the various views and balance calculations.

Enumeration Type Documentation

◆ DrCr

Account Debit/Credit Enum.

This indicates if this account is a 'debit' type account or a 'credit' type account.

See also
GCW::Dbo::Accounts::Item
Enumerator
NONE 

0x00 ~ invalid - should not happen

DEBIT 

0x01 ~ DEBIT type account

CREDIT 

0x02 ~ CREDIT type account

Definition at line 23 of file Definition.h.

◆ Type

Account Type.

These are used internally to switch the views depending on the account type. While these codes exactly match the codes in the native gnucash proper, they should not be relied on to match the native gnucash account type codes (those are textual, see; GCW::Dbo::Accounts::Item::accountTypeName). But, these are internal anyhow, and they don't get stored. They're just used to steer the application, especially as it pertains to debit/credit calculations.

The definition-table can be found here: s_accountDefs

Note
gnucash source reference: ..src/libgnucash/engine/Account.h
Enumerator
INVALID 

-1 ~ not a type

NONE 

-1 ~ not a type

BANK 

00 ~ bank institutionally held monies, can be interest bearing

CASH 

01 ~ pure cash (shoebox)

CREDIT 

03 ~ AMEX / VISA / DISCOVER type of credit cards

ASSET 

02 ~ generic generalized asset account

LIABILITY 

04 ~ generic generalized liability account

STOCK 

05 ~ stock account show as three-column registers: price, # shares, value

MUTUAL 

06 ~ similar to stock, shows: price, # shares, value

CURRENCY 

07 ~ currency trading account (DEPRECATED)

INCOME 

08 ~ income tracking account

EXPENSE 

09 ~ expense tracking account

EQUITY 

10 ~ used to balance the balance sheet

RECEIVABLE 

11 ~ A/R receivable account

PAYABLE 

12 ~ A/R payable account

ROOT 

13 ~ hidden root account for the account tree

TRADING 

14 ~ used to record multiple commodify transactions

NUM_ACCOUNT_TYPES 

15 ~ end of account types

CHECKING 

15 ~ do not use

SAVINGS 

16 ~ do not use

MONEYMRKT 

17 ~ do not use

CREDITLINE 

18 ~ do not use

LAST 

end of list

Definition at line 50 of file Definition.h.

Function Documentation

◆ activeAccounts()

auto GCW::Dbo::Accounts::activeAccounts ( ) -> Item::Vector

Load accounts as; if( !hidden() && !placeHolder() )

Definition at line 236 of file Accounts.cpp.

References GCW::app(), GCW::Dbo::Accounts::Field::hidden, and GCW::Dbo::Accounts::Field::placeHolder.

◆ allAccounts()

auto GCW::Dbo::Accounts::allAccounts ( ) -> Item::Vector

Load all accounts.

Definition at line 216 of file Accounts.cpp.

References GCW::app().

Referenced by GCW::Eng::AccountComboModel::AccountComboModel().

◆ byChildName()

auto GCW::Dbo::Accounts::byChildName ( const std::string &  _parentGuid,
const std::string &  _childName 
) -> Item::Ptr

Load Account by 'child name' and 'parent id'.

Definition at line 169 of file Accounts.cpp.

References GCW::app().

Referenced by byFullName().

◆ byFullName()

auto GCW::Dbo::Accounts::byFullName ( const std::string &  _fullName) -> Item::Ptr

Load Account by 'full name' with ':' account separator.

Definition at line 187 of file Accounts.cpp.

References GCW::app(), byChildName(), GCW::Dbo::Accounts::Field::guid, rootAccount(), split(), and GCW::Core::split().

Referenced by GCW::Eng::AccountRegisterModel::getTransferGuid().

◆ byGuid()

auto GCW::Dbo::Accounts::byGuid ( const std::string &  _guid) -> Item::Ptr

◆ fullName() [1/2]

auto GCW::Dbo::Accounts::fullName ( const std::string &  _accountGuid) -> std::string

Account Fullname via GUID.

Compute Account Full-Name from Heirarchy.

This function will calculate the "full account name" from the accountGuid up to the root parent.

If the provided account guid is blank, then just return an empty string.

During the building process, even though the "root account" is a valid account, it is ignored and not included in the results.

Recursively, this should generate a name such as; "Assets:2023:Cash:FGB:OLB:2300-LSI"

Definition at line 281 of file Accounts.cpp.

References byGuid(), GCW::Dbo::Accounts::Field::name, GCW::Dbo::Accounts::Field::parent_guid, and rootAccount().

Referenced by GCW::Eng::AccountComboModel::AccountComboModel(), GCW::Gui::AccountEditor::AccountEditor(), GCW::Dbo::Accounts::Item::fullName(), fullName(), GCW::Gui::BillPay::EditWidget::loadData(), GCW::Gui::BillPay::Model::loadData(), GCW::Gui::CentralWidget::open_AccountRegister(), and GCW::Eng::AccountRegisterModel::refreshFromDisk().

◆ fullName() [2/2]

auto GCW::Dbo::Accounts::fullName ( Item::Ptr  _item) -> std::string

Account Fullname via Item.

Definition at line 338 of file Accounts.cpp.

References fullName(), and GCW::Dbo::Accounts::Field::guid.

◆ load()

auto GCW::Dbo::Accounts::load ( const std::string &  _guid) -> Item::Ptr

◆ rootAccount()

auto GCW::Dbo::Accounts::rootAccount ( ) -> Item::Ptr

Load Root Account.

Definition at line 125 of file Accounts.cpp.

Referenced by byFullName(), fullName(), and GCW::Eng::AccountsTreeViewModel::load().

Variable Documentation

◆ s_accountDefs

const std::vector< GCW::Dbo::Accounts::AccountDef_t > GCW::Dbo::Accounts::s_accountDefs
extern
Initial value:
=
{
{ GCW::Dbo::Accounts::Type::INVALID , GCW::Dbo::Accounts::DrCr::NONE , "INVALID" , "account" , "fundsin" , "fundsout" , },
{ GCW::Dbo::Accounts::Type::NONE , GCW::Dbo::Accounts::DrCr::NONE , "NONE" , "account" , "fundsin" , "fundsout" , },
{ GCW::Dbo::Accounts::Type::BANK , GCW::Dbo::Accounts::DrCr::DEBIT , "BANK" , "transfer" , "deposit" , "withdrawal" , Type::ASSET },
{ GCW::Dbo::Accounts::Type::CASH , GCW::Dbo::Accounts::DrCr::DEBIT , "CASH" , "transfer" , "receive" , "spend" , Type::ASSET },
{ GCW::Dbo::Accounts::Type::CREDIT , GCW::Dbo::Accounts::DrCr::CREDIT , "CREDIT" , "blank" , "payment" , "charge" , Type::LIABILITY },
{ GCW::Dbo::Accounts::Type::ASSET , GCW::Dbo::Accounts::DrCr::DEBIT , "ASSET" , "transfer" , "increase" , "decrease" , Type::ASSET },
{ GCW::Dbo::Accounts::Type::LIABILITY , GCW::Dbo::Accounts::DrCr::CREDIT , "LIABILITY" , "account" , "decrease" , "increase" , Type::LIABILITY },
{ GCW::Dbo::Accounts::Type::STOCK , GCW::Dbo::Accounts::DrCr::DEBIT , "STOCK" , "account" , "buy" , "sell" , },
{ GCW::Dbo::Accounts::Type::MUTUAL , GCW::Dbo::Accounts::DrCr::DEBIT , "MUTUAL" , "account" , "buy" , "sell" , },
{ GCW::Dbo::Accounts::Type::CURRENCY , GCW::Dbo::Accounts::DrCr::DEBIT , "CURRENCY" , "account" , "buy" , "sell" , Type::ASSET },
{ GCW::Dbo::Accounts::Type::INCOME , GCW::Dbo::Accounts::DrCr::CREDIT , "INCOME" , "account" , "charge" , "income" , Type::INCOME },
{ GCW::Dbo::Accounts::Type::EXPENSE , GCW::Dbo::Accounts::DrCr::DEBIT , "EXPENSE" , "transfer" , "expense" , "rebate" , Type::EXPENSE },
{ GCW::Dbo::Accounts::Type::EQUITY , GCW::Dbo::Accounts::DrCr::CREDIT , "EQUITY" , "transfer" , "decrease" , "increase" , Type::EQUITY },
{ GCW::Dbo::Accounts::Type::RECEIVABLE , GCW::Dbo::Accounts::DrCr::DEBIT , "RECEIVABLE" , "transfer" , "invoice" , "payment" , },
{ GCW::Dbo::Accounts::Type::PAYABLE , GCW::Dbo::Accounts::DrCr::CREDIT , "PAYABLE" , "account" , "payment" , "bill" , Type::LIABILITY },
{ GCW::Dbo::Accounts::Type::ROOT , GCW::Dbo::Accounts::DrCr::NONE , "ROOT" , "account" , "debit" , "credit" , },
{ GCW::Dbo::Accounts::Type::TRADING , GCW::Dbo::Accounts::DrCr::DEBIT , "TRADING" , "account" , "decrease" , "increase" , },
{ GCW::Dbo::Accounts::Type::CHECKING , GCW::Dbo::Accounts::DrCr::DEBIT , "CHECKING" , "account" , "debit" , "credit" , Type::ASSET },
{ GCW::Dbo::Accounts::Type::SAVINGS , GCW::Dbo::Accounts::DrCr::DEBIT , "SAVINGS" , "account" , "debit" , "credit" , Type::ASSET },
{ GCW::Dbo::Accounts::Type::MONEYMRKT , GCW::Dbo::Accounts::DrCr::DEBIT , "MONEYMRKT" , "account" , "debit" , "credit" , },
{ GCW::Dbo::Accounts::Type::CREDITLINE , GCW::Dbo::Accounts::DrCr::CREDIT , "CREDITLINE" , "account" , "decrease" , "increase" , Type::LIABILITY },
}
@ CREDITLINE
18 ~ do not use
@ 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
@ DEBIT
0x01 ~ DEBIT type account
@ NONE
0x00 ~ invalid - should not happen
@ CREDIT
0x02 ~ CREDIT type account
; type drcr name colAccount colDr colCr parentType
const Wt::WFormModel::Field name
Definition: Accounts.cpp:47
const Wt::WFormModel::Field type
Definition: BillTerms.cpp:16

These are the account-types, debit/credit types, and register column labels for said accounts.

refreshFromDisk()

See also
account_type_labels Account Type Labels

Definition at line 20 of file Accounts.cpp.

Referenced by GCW::Dbo::Accounts::Item::accountDef(), GCW::Dbo::Accounts::Item::accountDrCr(), GCW::Dbo::Accounts::Item::accountType(), AccountTypeCombo::AccountTypeCombo(), and GCW::Eng::AccountRegisterModel::refreshFromDisk().

◆ s_tableName

const char * GCW::Dbo::Accounts::s_tableName = "accounts"
extern

Definition at line 7 of file Accounts.cpp.

Referenced by GCW::Dbo::AbstractSession::open().