GnuCash c935c2f+
Loading...
Searching...
No Matches
gncTaxTable.h
Go to the documentation of this file.
1/********************************************************************\
2 * gncTaxTable.h -- the Gnucash Tax Table interface *
3 * *
4 * This program is free software; you can redistribute it and/or *
5 * modify it under the terms of the GNU General Public License as *
6 * published by the Free Software Foundation; either version 2 of *
7 * the License, or (at your option) any later version. *
8 * *
9 * This program is distributed in the hope that it will be useful, *
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12 * GNU General Public License for more details. *
13 * *
14 * You should have received a copy of the GNU General Public License*
15 * along with this program; if not, contact: *
16 * *
17 * Free Software Foundation Voice: +1-617-542-5942 *
18 * 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 *
19 * Boston, MA 02110-1301, USA gnu@gnu.org *
20 * *
21\********************************************************************/
38#ifndef GNC_TAXTABLE_H_
39#define GNC_TAXTABLE_H_
40
41#ifdef __cplusplus
42extern "C" {
43#endif
44
62typedef struct _gncTaxTable GncTaxTable;
63typedef struct _gncTaxTableClass GncTaxTableClass;
64
83
91
93
94typedef struct _gncAccountValue GncAccountValue;
95
96#include "Account.h"
97#include "qof.h"
98#include "gncBusiness.h"
99#include "gncOwner.h"
100
101#define GNC_ID_TAXTABLE "gncTaxTable"
102
103/* --- type macros --- */
104#define GNC_TYPE_TAXTABLE (gnc_taxtable_get_type ())
105#define GNC_TAXTABLE(o) \
106 (G_TYPE_CHECK_INSTANCE_CAST ((o), GNC_TYPE_TAXTABLE, GncTaxTable))
107#define GNC_TAXTABLE_CLASS(k) \
108 (G_TYPE_CHECK_CLASS_CAST((k), GNC_TYPE_TAXTABLE, GncTaxTableClass))
109#define GNC_IS_TAXTABLE(o) \
110 (G_TYPE_CHECK_INSTANCE_TYPE ((o), GNC_TYPE_TAXTABLE))
111#define GNC_IS_TAXTABLE_CLASS(k) \
112 (G_TYPE_CHECK_CLASS_TYPE ((k), GNC_TYPE_TAXTABLE))
113#define GNC_TAXTABLE_GET_CLASS(o) \
114 (G_TYPE_INSTANCE_GET_CLASS ((o), GNC_TYPE_TAXTABLE, GncTaxTableClass))
115GType gnc_taxtable_get_type(void);
116
117
118const char * gncAmountTypeToString (GncAmountType type);
119gboolean gncAmountStringToType (const char *str, GncAmountType *type);
120
121const char * gncTaxIncludedTypeToString (GncTaxIncluded type);
122gboolean gncTaxIncludedStringToType (const char *str, GncTaxIncluded *type);
123
126GncTaxTable * gncTaxTableCreate (QofBook *book);
127void gncTaxTableDestroy (GncTaxTable *table);
128GncTaxTableEntry * gncTaxTableEntryCreate (void);
129void gncTaxTableEntryDestroy (GncTaxTableEntry *entry);
134void gncTaxTableSetName (GncTaxTable *table, const char *name);
135void gncTaxTableIncRef (GncTaxTable *table);
136void gncTaxTableDecRef (GncTaxTable *table);
137
138void gncTaxTableEntrySetAccount (GncTaxTableEntry *entry, Account *account);
139void gncTaxTableEntrySetType (GncTaxTableEntry *entry, GncAmountType type);
140void gncTaxTableEntrySetAmount (GncTaxTableEntry *entry, gnc_numeric amount);
142void gncTaxTableAddEntry (GncTaxTable *table, GncTaxTableEntry *entry);
143void gncTaxTableRemoveEntry (GncTaxTable *table, GncTaxTableEntry *entry);
144
145void gncTaxTableChanged (GncTaxTable *table);
146void gncTaxTableBeginEdit (GncTaxTable *table);
147void gncTaxTableCommitEdit (GncTaxTable *table);
148gboolean gncTaxTableEqual(const GncTaxTable *a, const GncTaxTable *b);
149
157static inline GncTaxTable *gncTaxTableLookup (const QofBook* book, const GncGUID *guid)
158{
159 QOF_BOOK_RETURN_ENTITY(book, guid, GNC_ID_TAXTABLE, GncTaxTable);
160}
161
162GncTaxTable *gncTaxTableLookupByName (QofBook *book, const char *name);
163GncTaxTable *gncTaxTableGetDefault (QofBook *book, GncOwnerType type);
164
165typedef GList GncTaxTableList;
166GncTaxTableList * gncTaxTableGetTables (QofBook *book);
167
168const char *gncTaxTableGetName (const GncTaxTable *table);
169GncTaxTable *gncTaxTableGetParent (const GncTaxTable *table);
170GncTaxTable *gncTaxTableReturnChild (GncTaxTable *table, gboolean make_new);
171#define gncTaxTableGetChild(t) gncTaxTableReturnChild((t),FALSE)
172typedef GList GncTaxTableEntryList;
173GncTaxTableEntryList* gncTaxTableGetEntries (const GncTaxTable *table);
174gint64 gncTaxTableGetRefcount (const GncTaxTable *table);
175time64 gncTaxTableLastModifiedSecs (const GncTaxTable *table);
176
177Account * gncTaxTableEntryGetAccount (const GncTaxTableEntry *entry);
178GncAmountType gncTaxTableEntryGetType (const GncTaxTableEntry *entry);
179gnc_numeric gncTaxTableEntryGetAmount (const GncTaxTableEntry *entry);
182int gncTaxTableCompare (const GncTaxTable *a, const GncTaxTable *b);
183int gncTaxTableEntryCompare (const GncTaxTableEntry *a, const GncTaxTableEntry *b);
184gboolean gncTaxTableEntryEqual(const GncTaxTableEntry *a, const GncTaxTableEntry *b);
185
186/************************************************/
187
189{
190 Account * account;
191 gnc_numeric value;
192};
193
198GList *gncAccountValueAdd (GList *list, Account *acc, gnc_numeric value);
199
201GList *gncAccountValueAddList (GList *l1, GList *l2);
202
204gnc_numeric gncAccountValueTotal (GList *list);
205
207void gncAccountValueDestroy (GList *list);
208
210#define GNC_TT_NAME "tax table name"
211#define GNC_TT_REFCOUNT "reference count"
212
214#define gncTaxTableGetGUID(x) qof_instance_get_guid(QOF_INSTANCE(x))
215#define gncTaxTableRetGUID(x) (x ? *(qof_instance_get_guid(QOF_INSTANCE(x))) : *(guid_null()))
216#define gncTaxTableLookupDirect(G,B) gncTaxTableLookup((B), &(G))
217
218#ifdef __cplusplus
219}
220#endif
221
222#endif /* GNC_TAXTABLE_H_ */
Account handling public routines.
-- Business Helper Functions
Business Interface: Object OWNERs.
#define QOF_BOOK_RETURN_ENTITY(book, guid, e_type, c_type)
Encapsulates all the information about a dataset manipulated by QOF.
Definition qofbook.h:101
gint64 time64
Most systems that are currently maintained, including Microsoft Windows, BSD-derived Unixes and Linux...
Definition gnc-date.h:87
void gncAccountValueDestroy(GList *list)
Destroy a list of accountvalues.
GList * gncAccountValueAdd(GList *list, Account *acc, gnc_numeric value)
This will add value to the account-value for acc, creating a new list object if necessary.
GncAmountType
How to interpret the amount.
Definition gncTaxTable.h:79
GncTaxIncluded
How to interpret the TaxIncluded.
Definition gncTaxTable.h:86
GList * gncAccountValueAddList(GList *l1, GList *l2)
Merge l2 into l1.
gnc_numeric gncAccountValueTotal(GList *list)
return the total for this list
@ GNC_AMT_TYPE_VALUE
tax is a number
Definition gncTaxTable.h:80
@ GNC_AMT_TYPE_PERCENT
tax is a percentage
Definition gncTaxTable.h:81
@ GNC_TAXINCLUDED_NO
tax is not included
Definition gncTaxTable.h:88
@ GNC_TAXINCLUDED_YES
tax is included
Definition gncTaxTable.h:87
@ GNC_TAXINCLUDED_USEGLOBAL
use the global setting
Definition gncTaxTable.h:89
STRUCTS.
The type used to store guids in C.
Definition guid.h:75
modtime is the internal date of the last modtime See libgnucash/engine/TaxTableBillTermImmutability....
QofBook reference.
Definition qofbook-p.hpp:47