GnuCashew ~ Web Application compatible with GnuCash sql data files.
GCW
Loading...
Searching...
No Matches
SessionGnuCash.h
Go to the documentation of this file.
1#line 2 "src/Dbo/SessionGnucash.h"
2
3#ifdef NEVER
4#ifndef __DBO_SESSIONGNUCASH_H___
5#define __DBO_SESSIONGNUCASH_H___
6
7#include <glib.h>
8
9//#include <gnucash/gnc-session.h>
10//#include <gnucash/Account.h>
11//#include <gnucash/Transaction.h>
12//#include <gnucash/qofsession.h>
13
14#include "AbstractSession.h"
15
16namespace GCW {
17 namespace Dbo {
18 namespace GnuCash {
19
20class Session;
21class Account;
22class Book;
23
24class Account
25{
26 public:
27
28 /*
29 ** standard constructor
30 **
31 */
32 Account(){}
33 Account( Account * _gncAccount, Book * _book );
34
35 /*
36 ** copy constructor
37 **
38 */
39 Account( const Account & );
40
41 std::string guid();
42 std::string name();
43 std::string code();
44 std::string description();
45 std::string notes();
46
47 std::vector< Account > children();
48
49 Book * book();
50 Account * gncAccount();
51
52#ifdef ALL_THESE_FUNCTIONS_NEED_TO_BE_PACKED_INTO_THIS_OBJECT
53
54// Set the account's notes.
55void xaccAccountSetNotes (Account *account, const char *notes);
56
57// Set the account's type.
58void xaccAccountSetType (Account *account, GNCAccountType)
59
60// Set the account's name.
61void xaccAccountSetName (Account *account, const char *name)
62
63// Set the account's accounting code.
64void xaccAccountSetCode (Account *account, const char *code)
65
66// Set the account's description.
67void xaccAccountSetDescription (Account *account, const char *desc)
68
69// Set the account's Color.
70void xaccAccountSetColor (Account *account, const char *color)
71
72// Set the account's Filter.
73void xaccAccountSetFilter (Account *account, const char *filter)
74
75// Set the account's Sort Order.
76void xaccAccountSetSortOrder (Account *account, const char *sortorder)
77
78// Set the account's Sort Order direction.
79void xaccAccountSetSortReversed (Account *account, gboolean sortreversed)
80
81// Set the account's associated account e.g. More...
82void xaccAccountSetAssociatedAccount (Account *acc, const char *tag, const Account *assoc_acct)
83
84// Set the last num field of an Account.
85void xaccAccountSetLastNum (Account *account, const char *num)
86
87// Set the account's lot order policy.
88void gnc_account_set_policy (Account *account, GNCPolicy *policy)
89
90// Returns the account's account type. More...
91GNCAccountType xaccAccountGetType (const Account *account)
92
93// Returns true if the account is a stock, mutual fund or currency, otherwise false. More...
94gboolean xaccAccountIsPriced (const Account *acc)
95
96// This function will set the starting commodity balance for this account. More...
97void gnc_account_set_start_balance (Account *acc, const gnc_numeric start_baln)
98
99// This function will set the starting cleared commodity balance for this account. More...
100void gnc_account_set_start_cleared_balance (Account *acc, const gnc_numeric start_baln)
101
102// This function will set the starting reconciled commodity balance for this account. More...
103void gnc_account_set_start_reconciled_balance (Account *acc, const gnc_numeric start_baln)
104
105// Tell the account that the running balances may be incorrect and need to be recomputed. More...
106void gnc_account_set_balance_dirty (Account *acc)
107
108// Tell the account believes that the splits may be incorrectly sorted and need to be resorted. More...
109void gnc_account_set_sort_dirty (Account *acc)
110
111// Set the defer balance flag. More...
112void gnc_account_set_defer_bal_computation (Account *acc, gboolean defer)
113
114// Insert the given split from an account. More...
115gboolean gnc_account_insert_split (Account *acc, Split *s)
116
117// Remove the given split from an account. More...
118gboolean gnc_account_remove_split (Account *acc, Split *s)
119
120// Get the account's name.
121const char * xaccAccountGetName (const Account *account);
122
123// Get the account's accounting code.
124const char * xaccAccountGetCode (const Account *account)
125
126// Get the account's description.
127const char * xaccAccountGetDescription (const Account *account)
128
129// Get the account's color.
130const char * xaccAccountGetColor (const Account *account)
131
132// Get the account's filter.
133const char * xaccAccountGetFilter (const Account *account)
134
135// Get the account's Sort Order.
136const char * xaccAccountGetSortOrder (const Account *account)
137
138// Get the account's Sort Order direction.
139gboolean xaccAccountGetSortReversed (const Account *account)
140
141// Get the account's associated account e.g. More...
142Account * xaccAccountGetAssociatedAccount (const Account *acc, const char *tag)
143
144// Get the last num field of an Account.
145const char * xaccAccountGetLastNum (const Account *account)
146
147// Get the account's lot order policy.
148GNCPolicy * gnc_account_get_policy (Account *account)
149
150// Get the account's flag for deferred balance computation.
151gboolean gnc_account_get_defer_bal_computation (Account *acc)
152
153// The following recompute the partial balances (stored with the transaction) and the total balance, for this account.
154void xaccAccountRecomputeBalance (Account *)
155
156// The xaccAccountSortSplits() routine will resort the account's splits if the sort is dirty. More...
157void xaccAccountSortSplits (Account *acc, gboolean force)
158
159// The gnc_account_get_full_name routine returns the fully qualified name of the account using the given separator char. More...
160gchar * gnc_account_get_full_name (const Account *account)
161
162// Retrieve the gains account used by this account for the indicated currency, creating and recording a new one if necessary. More...
163Account * xaccAccountGainsAccount (Account *acc, gnc_commodity *curr)
164
165// Set a string that identifies the Finance::Quote backend that should be used to retrieve online prices. More...
166void dxaccAccountSetPriceSrc (Account *account, const char *src)
167
168// Get a string that identifies the Finance::Quote backend that should be used to retrieve online prices. More...
169const char * dxaccAccountGetPriceSrc (const Account *account)
170
171#endif
172
173 private:
174
175 Book * m_book = nullptr;
176
177 Account * m_gncAccount = nullptr;
178
179}; // endclass Account
180
181class Book
182{
183 public:
184
185 Book( Session * _session );
186
187 Account rootAccount();
188 Account accountByGuid( const std::string _guid );
189
190 guint count_transactions();
191
192 private:
193
194 QofBook * m_book = nullptr;
195 Session * m_session = nullptr;
196
197}; // endclass Book
198
199/*!
200** \brief GnuCash Native Session
201**
202** This session controller is designed to work through the
203** libgnucash back-end library.
204**
205*/
206class Session
208{
209 public:
210
211 Session() {}
212 ~Session();
213
214 QofSession * qofSession();
215
216 /*!
217 ** \brief Open a database
218 **
219 */
220 bool open( const std::string & _path );
221
222 Book book();
223
224 private:
225
226 void closeGnuCash();
227
228 void init();
229
230 QofSession * m_session = nullptr;
231
232}; // endclass Session
233
234} // endnamespace GnuCash {
235
236
237 } // endnamespace Dbo {
238} // endnamespace GCW {
239
240#endif // end#ifndef __SESSIONGNUCASH_H___
241#endif
242
const Wt::WFormModel::Field name
const Wt::WFormModel::Field guid
endGCW::Dbo::Accounts::s_accountDefs
const Wt::WFormModel::Field description
const Wt::WFormModel::Field code
auto rootAccount() -> Item::Ptr
Load Root Account.
Wt::WFormModel::Field notes
Definition Customers.cpp:11
Definition App.h:18