GnuCashew ~ GnuCash Enabled Web
GCW
Public Member Functions | Private Attributes | List of all members
GCW::Dbo::Accounts::Item Class Reference

Account Item Class. More...

#include <Item.h>

+ Inheritance diagram for GCW::Dbo::Accounts::Item:

Public Member Functions

 Item ()
 ctor More...
 
 Item (const std::string &_guid)
 ctor with guid. More...
 
auto accountDef () const -> const GCW::Dbo::Accounts::AccountDef_t &
 Account Definition. More...
 
auto accountDrCr () const -> GCW::Dbo::Accounts::DrCr
 Account Debit/Credit. More...
 
auto accountType () const -> GCW::Dbo::Accounts::Type
 Account Type. More...
 
auto guid () const -> const std::string &
 GUID. More...
 
auto name () const -> const std::string &
 Name. More...
 
auto accountTypeName () const -> const std::string &
 Type Name. More...
 
auto commodity_guid () const -> const std::string &
 Commodity GUID. More...
 
auto commodity_scu () const -> const int
 Commodity SCU (Special Currency Unit) More...
 
auto non_std_scu () const -> const int
 Non Standard SCU (Special Currency Unit) More...
 
auto parent_guid () const -> const std::string &
 Parent GUID. More...
 
auto code () const -> const std::string &
 Code. More...
 
auto description () const -> const std::string &
 Description. More...
 
auto hidden () const -> const int
 Hidden. More...
 
auto placeHolder () const -> const int
 Placeholder. More...
 
auto fullName () const -> std::string
 Full Name. More...
 
auto hasColor () const -> bool
 Has Color. More...
 
auto color () const -> std::string
 Color. More...
 
template<class Action >
void persist (Action &action)
 persist the data More...
 
- Public Member Functions inherited from GCW::Dbo::BaseItem< Item >
 BaseItem ()
 

Private Attributes

std::string m_guid
 
std::string m_name
 
std::string m_account_typeName
 
std::string m_commodity_guid
 
int m_commodity_scu
 
int m_non_std_scu
 
std::string m_parent_guid
 
std::string m_code
 
std::string m_description
 
int m_hidden
 
int m_placeHolder
 

Additional Inherited Members

- Public Types inherited from GCW::Dbo::BaseItem< Item >
using Ptr = Wt::Dbo::ptr< Item >
 
using Collection = Wt::Dbo::collection< Ptr >
 
using Vector = std::vector< Ptr >
 

Detailed Description

Account Item Class.

This class represents an 'account' within gnucash. This is a Dbo object so this class is used as the interface between the gnucashew application and the back-end database.

dot_inline_dotgraph_2.png
Native GnuCash Account Sqlite Schema
CREATE TABLE accounts
(
guid text(32) PRIMARY KEY NOT NULL,
name text(2048) NOT NULL,
account_type text(2048) NOT NULL,
commodity_guid text(32),
commodity_scu integer NOT NULL,
non_std_scu integer NOT NULL,
parent_guid text(32),
code text(2048),
description text(2048),
hidden integer,
placeholder integer
);
sqlite> select * from accounts;
guid name type commodity scu nss parent code desc h p
aa283385e0cf4f57b3360ca5a843bde5|Root Account |ROOT |10b24d11b4b94b8789d1830da2695bbb|100|0 | | | |0|0
6e5313b77b4247039f0240ca79e4d871|Assets |ASSET|10b24d11b4b94b8789d1830da2695bbb|100|0 |aa283385e0cf4f57b3360ca5a843bde5| |Assets |0|1
b61b07c024fc463489f5db031135a29e|Current Assets |ASSET|10b24d11b4b94b8789d1830da2695bbb|100|0 |6e5313b77b4247039f0240ca79e4d871| |Current Assets |0|1
822a857c5f484affa5a6a3e62f4b700f|Checking Account|BANK |10b24d11b4b94b8789d1830da2695bbb|100|0 |b61b07c024fc463489f5db031135a29e| |Checking Account|0|0
9e851f524a6a44ef8c93a6b52b004cae|Savings Account |BANK |10b24d11b4b94b8789d1830da2695bbb|100|0 |b61b07c024fc463489f5db031135a29e| |Savings Account |0|0
auto guid() const -> const std::string &
GUID.
Definition: Item.h:128
auto hidden() const -> const int
Hidden.
Definition: Item.h:201
auto commodity_scu() const -> const int
Commodity SCU (Special Currency Unit)
Definition: Item.h:163
auto parent_guid() const -> const std::string &
Parent GUID.
Definition: Item.h:181
auto commodity_guid() const -> const std::string &
Commodity GUID.
Definition: Item.h:154
auto description() const -> const std::string &
Description.
Definition: Item.h:194
auto name() const -> const std::string &
Name.
Definition: Item.h:135
auto code() const -> const std::string &
Code.
Definition: Item.h:188
auto non_std_scu() const -> const int
Non Standard SCU (Special Currency Unit)
Definition: Item.h:171
@ ASSET
02 ~ generic generalized asset account
@ BANK
00 ~ bank institutionally held monies, can be interest bearing
@ ROOT
13 ~ hidden root account for the account tree
const Wt::WFormModel::Field parent
Definition: BillTerms.cpp:15
const Wt::WFormModel::Field type
Definition: BillTerms.cpp:16

Definition at line 87 of file Item.h.

Constructor & Destructor Documentation

◆ Item() [1/2]

GCW::Dbo::Accounts::Item::Item ( )
inline

ctor

Definition at line 95 of file Item.h.

◆ Item() [2/2]

GCW::Dbo::Accounts::Item::Item ( const std::string &  _guid)
inline

ctor with guid.

Definition at line 100 of file Item.h.

Member Function Documentation

◆ accountDef()

auto GCW::Dbo::Accounts::Item::accountDef ( ) const -> const GCW::Dbo::Accounts::AccountDef_t &

Account Definition.

Return the definition object for the account.

Definition at line 11 of file Item.cpp.

References accountTypeName(), and GCW::Dbo::Accounts::s_accountDefs.

◆ accountDrCr()

auto GCW::Dbo::Accounts::Item::accountDrCr ( ) const -> GCW::Dbo::Accounts::DrCr

Account Debit/Credit.

Return the account Debit/Credit type.

Definition at line 24 of file Item.cpp.

References GCW::Dbo::Accounts::NONE, and GCW::Dbo::Accounts::s_accountDefs.

◆ accountType()

auto GCW::Dbo::Accounts::Item::accountType ( ) const -> GCW::Dbo::Accounts::Type

Account Type.

Return the account Type as an enum.

Definition at line 37 of file Item.cpp.

References GCW::Dbo::Accounts::NONE, and GCW::Dbo::Accounts::s_accountDefs.

◆ accountTypeName()

auto GCW::Dbo::Accounts::Item::accountTypeName ( ) const -> const std::string &
inline

Type Name.

Return account type as a 'string' value. This is, in fact, how the account type is actually recorded in the back-end database, as a 'text' string such as 'BANK', 'CASH', 'INCOME' and so forth. GnuCashew takes this text value and uses that to switch to the GCW::Dbo::Accounts::Type account type enum.

Item::accountType()

Definition at line 147 of file Item.h.

References m_account_typeName.

Referenced by accountDef().

◆ code()

auto GCW::Dbo::Accounts::Item::code ( ) const -> const std::string &
inline

Code.

Use this to carry the 'account number' or other code related to the account

Definition at line 188 of file Item.h.

References m_code.

◆ color()

auto GCW::Dbo::Accounts::Item::color ( ) const -> std::string

Color.

Return the color as a string-value.

Definition at line 66 of file Item.cpp.

References GCW::Dbo::Slots::get(), GCW::Dbo::Accounts::Field::guid, and GCW::Dbo::Slots::Field::string_val.

◆ commodity_guid()

auto GCW::Dbo::Accounts::Item::commodity_guid ( ) const -> const std::string &
inline

Commodity GUID.

Definition at line 154 of file Item.h.

References m_commodity_guid.

◆ commodity_scu()

auto GCW::Dbo::Accounts::Item::commodity_scu ( ) const -> const int
inline

Commodity SCU (Special Currency Unit)

Currency Unit is usually 1/100. This field allows it to be changed. If this value is non-standard, the Item::non_std_scu() will return true.

Definition at line 163 of file Item.h.

References m_commodity_scu.

◆ description()

auto GCW::Dbo::Accounts::Item::description ( ) const -> const std::string &
inline

Description.

Definition at line 194 of file Item.h.

References m_description.

◆ fullName()

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

Full Name.

Return the 'full name representation' of the account. This includes all parent accounts, using the ':' separator.

Example
Assets:Current Assets:Checking Account

Definition at line 50 of file Item.cpp.

References GCW::Dbo::Accounts::fullName().

◆ guid()

auto GCW::Dbo::Accounts::Item::guid ( ) const -> const std::string &
inline

GUID.

Return account 'guid' value - the primary key for the account

Definition at line 128 of file Item.h.

References m_guid.

◆ hasColor()

auto GCW::Dbo::Accounts::Item::hasColor ( ) const -> bool

Has Color.

Returns 'true' if this account has a color assigned to it.

Definition at line 58 of file Item.cpp.

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

◆ hidden()

auto GCW::Dbo::Accounts::Item::hidden ( ) const -> const int
inline

Hidden.

'true' causes this account to not appear in a lot of the lists and things

Definition at line 201 of file Item.h.

References m_hidden.

◆ name()

auto GCW::Dbo::Accounts::Item::name ( ) const -> const std::string &
inline

Name.

Return account printable 'name' value

Definition at line 135 of file Item.h.

References m_name.

◆ non_std_scu()

auto GCW::Dbo::Accounts::Item::non_std_scu ( ) const -> const int
inline

Non Standard SCU (Special Currency Unit)

If the Item::commodity_scu() is non-standard, this returns true

Definition at line 171 of file Item.h.

References m_non_std_scu.

◆ parent_guid()

auto GCW::Dbo::Accounts::Item::parent_guid ( ) const -> const std::string &
inline

Parent GUID.

Link to a parent account.

Note
All accounts 'require' a parent account link, with the exception of the internal 'root' account.

Definition at line 181 of file Item.h.

References m_parent_guid.

◆ persist()

template<class Action >
void GCW::Dbo::Accounts::Item::persist ( Action &  action)
inline

◆ placeHolder()

auto GCW::Dbo::Accounts::Item::placeHolder ( ) const -> const int
inline

Placeholder.

'true' causes this account to not allow transactions to be posted in to

Definition at line 208 of file Item.h.

References m_placeHolder.

Member Data Documentation

◆ m_account_typeName

std::string GCW::Dbo::Accounts::Item::m_account_typeName
private

Definition at line 262 of file Item.h.

Referenced by accountTypeName(), and persist().

◆ m_code

std::string GCW::Dbo::Accounts::Item::m_code
private

Definition at line 267 of file Item.h.

Referenced by code(), and persist().

◆ m_commodity_guid

std::string GCW::Dbo::Accounts::Item::m_commodity_guid
private

Definition at line 263 of file Item.h.

Referenced by commodity_guid(), and persist().

◆ m_commodity_scu

int GCW::Dbo::Accounts::Item::m_commodity_scu
private

Definition at line 264 of file Item.h.

Referenced by commodity_scu(), and persist().

◆ m_description

std::string GCW::Dbo::Accounts::Item::m_description
private

Definition at line 268 of file Item.h.

Referenced by description(), and persist().

◆ m_guid

std::string GCW::Dbo::Accounts::Item::m_guid
private

Definition at line 260 of file Item.h.

Referenced by guid(), and persist().

◆ m_hidden

int GCW::Dbo::Accounts::Item::m_hidden
private

Definition at line 269 of file Item.h.

Referenced by hidden(), and persist().

◆ m_name

std::string GCW::Dbo::Accounts::Item::m_name
private

Definition at line 261 of file Item.h.

Referenced by name(), and persist().

◆ m_non_std_scu

int GCW::Dbo::Accounts::Item::m_non_std_scu
private

Definition at line 265 of file Item.h.

Referenced by non_std_scu(), and persist().

◆ m_parent_guid

std::string GCW::Dbo::Accounts::Item::m_parent_guid
private

Definition at line 266 of file Item.h.

Referenced by parent_guid(), and persist().

◆ m_placeHolder

int GCW::Dbo::Accounts::Item::m_placeHolder
private

Definition at line 270 of file Item.h.

Referenced by persist(), and placeHolder().


The documentation for this class was generated from the following files: