GnuCashew ~ GnuCash Enabled Web
GCW
Manager.h
Go to the documentation of this file.
1 #line 2 "src/Dbo/Transactions/Manager.h"
2 
3 #ifndef __DBO_TRANSACTIONSMANAGER_H___
4 #define __DBO_TRANSACTIONSMANAGER_H___
5 
6 #include "../Accounts/Accounts.h"
7 #include "../Splits/Splits.h"
8 #include "Transactions.h"
9 
10 /*
11 ** Now we can start building our class!
12 **
13 */
14 namespace GCW {
15  namespace Dbo {
16  namespace Transactions {
17 
18 /*!
19 ** \brief Transaction Manager
20 **
21 ** This class is simply a convenience class for grouping all the
22 ** transaction manipulation tasks in to one place. It allows
23 ** new transactions to be created, and takes care of insuring that
24 ** the transaction is always in balance, and always contains the
25 ** requisite debits and credits to insure a properly balanced
26 ** transaction.
27 **
28 */
29 class Manager
30 {
31  public:
32 
33  Manager();
35 
36  /*!
37  ** \brief Set Transaction
38  **
39  ** Set transaction based on the transaction Guid. This will load
40  ** the transaction as well as all the splits associated with it.
41  **
42  */
43  auto loadTransaction( const std::string & _transactionGuid )-> void;
44 
45  auto deleteTransaction()-> void;
46 
47  /*!
48  ** \brief Set Split
49  **
50  ** Set transaction based on any one of the splits.
51  **
52  ** This will load the split, then load the transaction for that split,
53  ** causing all the other splits to load.
54  **
55  */
56  auto loadSplit( const std::string & _splitGuid )-> void;
57 
58  /*!
59  ** \brief New Transaction
60  **
61  ** This will create a new Transaction for an account within the
62  ** system fully populated with at least two splits.
63  **
64  */
65  auto newTransaction( const std::string & _accountGuid1, const std::string & _accountGuid2 )-> void;
66 
67  /*!
68  ** \brief Transaction Item
69  **
70  ** This returns the transaction point object
71  **
72  */
73  auto transaction() const-> GCW::Dbo::Transactions::Item::Ptr { return m_transaction; }
74 
75  /*!
76  ** \brief Splits Vector
77  **
78  ** This returns the splits vector
79  **
80  */
81  auto splits() const-> GCW::Dbo::Splits::Item::Vector { return m_splitItems; }
82 
83  /*!
84  ** \brief Other GUID
85  **
86  ** When there are only two splits, this will return the guid of the
87  ** split item that _does not_ match the guid provided.
88  **
89  */
90  auto otherGuid() const-> std::string;
91 
92  /*!
93  ** \brief Set Date
94  **
95  ** This sets the date on the Transaction of the element.
96  **
97  */
98  auto getDate() const-> Wt::WDateTime;
99  auto setDate( const Wt::WDateTime & _value )-> void;
100 
101  /*!
102  ** \brief Set Action
103  **
104  ** This sets the Action on the split. The 'action' is stored in
105  ** the Split item and this function will apply the value to
106  ** both sides of the split.
107  */
108  auto setAction( const std::string & _value )-> void;
109 
110  /*!
111  ** \brief Set Description
112  **
113  ** This sets the description on the Transaction of the element.
114  **
115  */
116  auto getDescription() const-> std::string;
117  auto setDescription( const std::string & _value )-> void;
118 
119  /*!
120  ** \brief Set Transfer GUID
121  **
122  ** This sets the (other) split (identified by guid) to the account
123  ** given.
124  */
125  auto setTransferGuid( const std::string & _value )-> void;
126 
127  /*!
128  ** \brief
129  **
130  **
131  */
132  auto setReconcile( const std::string & _value )-> void;
133 
134  /*!
135  ** \brief
136  **
137  **
138  */
139  auto getValue() const-> GCW_NUMERIC;
140  auto getValueAsString() const-> std::string;
141  auto setValue( GCW_NUMERIC _value )-> void;
142 
143  /*!
144  ** \brief
145  **
146  **
147  */
148  auto setNotes( const std::string & _value )-> void;
149 
150  auto split( const std::string & _splitGuid ) const-> GCW::Dbo::Splits::Item::Ptr;
151 
152  auto thisSplit() const-> GCW::Dbo::Splits::Item::Ptr;
153  auto thatSplit() const-> GCW::Dbo::Splits::Item::Ptr;
154 
155  private:
156 
157  std::string m_splitGuid ;
158  GCW::Dbo:: Transactions ::Item::Ptr m_transaction ;
159  GCW::Dbo:: Splits ::Item::Vector m_splitItems ;
160 
161 }; // endclass Manager
162 
163  } // namespace Transactions {
164  } // namespace Dbo {
165 } // namespace GCW {
166 
167 #endif // #ifndef __DBO_TRANSACTIONSMANAGER_H___
168 
169 
Wt::Dbo::ptr< Item > Ptr
Definition: BaseItem.h:39
Transaction Manager.
Definition: Manager.h:30
auto setReconcile(const std::string &_value) -> void
Definition: Manager.cpp:205
auto setDate(const Wt::WDateTime &_value) -> void
Definition: Manager.cpp:161
auto getValue() const -> GCW_NUMERIC
Definition: Manager.cpp:214
auto newTransaction(const std::string &_accountGuid1, const std::string &_accountGuid2) -> void
New Transaction.
Definition: Manager.cpp:20
auto splits() const -> GCW::Dbo::Splits::Item::Vector
Splits Vector.
Definition: Manager.h:81
auto setValue(GCW_NUMERIC _value) -> void
Definition: Manager.cpp:230
auto otherGuid() const -> std::string
Other GUID.
Definition: Manager.cpp:113
auto loadTransaction(const std::string &_transactionGuid) -> void
Set Transaction.
Definition: Manager.cpp:64
auto split(const std::string &_splitGuid) const -> GCW::Dbo::Splits::Item::Ptr
Definition: Manager.cpp:125
auto loadSplit(const std::string &_splitGuid) -> void
Set Split.
Definition: Manager.cpp:92
auto thatSplit() const -> GCW::Dbo::Splits::Item::Ptr
Definition: Manager.cpp:145
auto setNotes(const std::string &_value) -> void
Definition: Manager.cpp:240
auto getDescription() const -> std::string
Set Description.
Definition: Manager.cpp:179
auto getValueAsString() const -> std::string
Definition: Manager.cpp:222
auto getDate() const -> Wt::WDateTime
Set Date.
Definition: Manager.cpp:153
auto setAction(const std::string &_value) -> void
Set Action.
Definition: Manager.cpp:170
auto deleteTransaction() -> void
Definition: Manager.cpp:80
auto setTransferGuid(const std::string &_value) -> void
Set Transfer GUID.
Definition: Manager.cpp:196
GCW::Dbo::Splits ::Item::Vector m_splitItems
Definition: Manager.h:159
auto thisSplit() const -> GCW::Dbo::Splits::Item::Ptr
Definition: Manager.cpp:137
auto transaction() const -> GCW::Dbo::Transactions::Item::Ptr
Transaction Item.
Definition: Manager.h:73
auto setDescription(const std::string &_value) -> void
Definition: Manager.cpp:187
GCW::Dbo::Transactions ::Item::Ptr m_transaction
Definition: Manager.h:158
#define GCW_NUMERIC
Internal Numeric Type.
Definition: gcwglobal.h:37
Definition: App.h:17
Definition: GncLock.h:6
Definition: guid.cpp:397