GnuCashew ~ GnuCash Enabled Web
GCW
Item.cpp
Go to the documentation of this file.
1 #line 2 "src/Dbo/Accounts/Item.cpp"
2 
3 //#include <gnucash/gnc-session.h>
4 //#include <gnucash/Account.h>
5 
6 #include "../Transactions/Transactions.h"
7 #include "../Slots/Slots.h"
8 #include "Item.h"
9 
10 auto
12 accountDef() const-> const GCW::Dbo::Accounts::AccountDef_t &
13 {
14  auto atn = accountTypeName();
15 
16  for( auto & val : GCW::Dbo::Accounts::s_accountDefs )
17  if( val.backendName == accountTypeName() )
18  return val;
19 
21 }
22 
23 auto
25 accountDrCr() const-> GCW::Dbo::Accounts::DrCr
26 {
27  auto atn = accountTypeName();
28 
29  for( auto & val : GCW::Dbo::Accounts::s_accountDefs )
30  if( val.backendName == accountTypeName() )
31  return val.drcr;
32 
34 }
35 
36 auto
38 accountType() const-> GCW::Dbo::Accounts::Type
39 {
40  auto atn = accountTypeName();
41 
42  for( auto & val : GCW::Dbo::Accounts::s_accountDefs )
43  if( val.backendName == accountTypeName() )
44  return val.type;
45 
47 }
48 
49 auto
51 fullName() const-> std::string
52 {
53  return GCW::Dbo::Accounts::fullName( self() );
54 
55 } // endfullName() const-> std::string
56 
57 auto
59 hasColor() const-> bool
60 {
61  return GCW::Dbo::Slots::get( guid(), "color" ).get();
62 
63 } // endhasColor() const-> bool
64 
65 auto
67 color() const-> std::string
68 {
69  std::string retVal;
70 
71  if( auto slotItem = GCW::Dbo::Slots::get( guid(), "color" ) )
72  {
73  retVal = slotItem-> string_val();
74  }
75 
76  return retVal;
77 
78 } // endcolor() const-> std::string
79 
80 
auto hasColor() const -> bool
Has Color.
Definition: Item.cpp:59
auto color() const -> std::string
Color.
Definition: Item.cpp:67
auto accountDrCr() const -> GCW::Dbo::Accounts::DrCr
Account Debit/Credit.
Definition: Item.cpp:25
auto accountType() const -> GCW::Dbo::Accounts::Type
Account Type.
Definition: Item.cpp:38
auto fullName() const -> std::string
Full Name.
Definition: Item.cpp:51
auto accountTypeName() const -> const std::string &
Type Name.
Definition: Item.h:147
auto accountDef() const -> const GCW::Dbo::Accounts::AccountDef_t &
Account Definition.
Definition: Item.cpp:12
const Wt::WFormModel::Field guid
Definition: Accounts.cpp:46
Type
Account Type.
Definition: Definition.h:51
@ NONE
-1 ~ not a type
DrCr
Account Debit/Credit Enum.
Definition: Definition.h:24
@ NONE
0x00 ~ invalid - should not happen
const std::vector< AccountDef_t > s_accountDefs
Definition: Accounts.cpp:20
auto fullName(const std::string &_guid) -> std::string
Account Fullname via GUID.
Definition: Accounts.cpp:282
Wt::WFormModel::Field string_val
Definition: Slots.cpp:18
auto get() -> GCW::Dbo::Slots::Item::Vector
Definition: Slots.cpp:30
Definition: App.h:17
Definition: guid.cpp:397