GnuCash c935c2f+
Loading...
Searching...
No Matches
gncCustomer.h
Go to the documentation of this file.
1/********************************************************************\
2 * gncCustomer.h -- the Core Customer 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\********************************************************************/
31#ifndef GNC_CUSTOMER_H_
32#define GNC_CUSTOMER_H_
33
57typedef struct _gncCustomer GncCustomer;
58typedef struct _gncCustomerClass GncCustomerClass;
59
60#include "gncAddress.h"
61#include "gncBillTerm.h"
62#include "gncTaxTable.h"
63#include "gncJob.h"
64
65#ifdef __cplusplus
66extern "C" {
67#endif
68
69#define GNC_ID_CUSTOMER "gncCustomer"
70
71/* --- type macros --- */
72#define GNC_TYPE_CUSTOMER (gnc_customer_get_type ())
73#define GNC_CUSTOMER(o) \
74 (G_TYPE_CHECK_INSTANCE_CAST ((o), GNC_TYPE_CUSTOMER, GncCustomer))
75#define GNC_CUSTOMER_CLASS(k) \
76 (G_TYPE_CHECK_CLASS_CAST((k), GNC_TYPE_CUSTOMER, GncCustomerClass))
77#define GNC_IS_CUSTOMER(o) \
78 (G_TYPE_CHECK_INSTANCE_TYPE ((o), GNC_TYPE_CUSTOMER))
79#define GNC_IS_CUSTOMER_CLASS(k) \
80 (G_TYPE_CHECK_CLASS_TYPE ((k), GNC_TYPE_CUSTOMER))
81#define GNC_CUSTOMER_GET_CLASS(o) \
82 (G_TYPE_INSTANCE_GET_CLASS ((o), GNC_TYPE_CUSTOMER, GncCustomerClass))
83GType gnc_customer_get_type(void);
84
87GncCustomer *gncCustomerCreate (QofBook *book);
88void gncCustomerDestroy (GncCustomer *customer);
89void gncCustomerBeginEdit (GncCustomer *customer);
90void gncCustomerCommitEdit (GncCustomer *customer);
96void gncCustomerSetID (GncCustomer *customer, const char *id);
97void gncCustomerSetName (GncCustomer *customer, const char *name);
98void gncCustomerSetNotes (GncCustomer *customer, const char *notes);
99void gncCustomerSetTerms (GncCustomer *customer, GncBillTerm *term);
100void gncCustomerSetTaxIncluded (GncCustomer *customer, GncTaxIncluded taxincl);
101void gncCustomerSetActive (GncCustomer *customer, gboolean active);
102void gncCustomerSetDiscount (GncCustomer *customer, gnc_numeric discount);
103void gncCustomerSetCredit (GncCustomer *customer, gnc_numeric credit);
104void gncCustomerSetCurrency (GncCustomer *customer, gnc_commodity *currency);
105
106void gncCustomerSetTaxTableOverride (GncCustomer *customer, gboolean override);
107void gncCustomerSetTaxTable (GncCustomer *customer, GncTaxTable *table);
108
109void gncCustomerAddJob (GncCustomer *customer, GncJob *job);
110void gncCustomerRemoveJob (GncCustomer *customer, GncJob *job);
111
120static inline GncCustomer * gncCustomerLookup (const QofBook *book, const GncGUID *guid)
121{
122 QOF_BOOK_RETURN_ENTITY(book, guid, GNC_ID_CUSTOMER, GncCustomer);
123}
124
125const char * gncCustomerGetID (const GncCustomer *customer);
126const char * gncCustomerGetName (const GncCustomer *customer);
127GncAddress * gncCustomerGetAddr (const GncCustomer *customer);
128GncAddress * gncCustomerGetShipAddr (const GncCustomer *customer);
129const char * gncCustomerGetNotes (const GncCustomer *customer);
130GncBillTerm * gncCustomerGetTerms (const GncCustomer *customer);
131GncTaxIncluded gncCustomerGetTaxIncluded (const GncCustomer *customer);
132gboolean gncCustomerGetActive (const GncCustomer *customer);
133gnc_numeric gncCustomerGetDiscount (const GncCustomer *customer);
134gnc_numeric gncCustomerGetCredit (const GncCustomer *customer);
135gnc_commodity * gncCustomerGetCurrency (const GncCustomer *customer);
136
137gboolean gncCustomerGetTaxTableOverride (const GncCustomer *customer);
138GncTaxTable* gncCustomerGetTaxTable (const GncCustomer *customer);
139
142int gncCustomerCompare (const GncCustomer *a, const GncCustomer *b);
143
144#define CUSTOMER_ID "id"
145#define CUSTOMER_NAME "name"
146#define CUSTOMER_ADDR "addr"
147#define CUSTOMER_SHIPADDR "shipaddr"
148#define CUSTOMER_NOTES "notes"
149#define CUSTOMER_DISCOUNT "amount of discount"
150#define CUSTOMER_CREDIT "amount of credit"
151#define CUSTOMER_TT_OVER "tax table override"
152#define CUSTOMER_TAX_INC "customer_tax_included"
153#define CUSTOMER_TERMS "customer_terms"
154#define CUSTOMER_ACTIVE "customer_is_active"
155#define CUSTOMER_SLOTS "customer_values"
156
158#define gncCustomerGetGUID(x) qof_instance_get_guid(QOF_INSTANCE(x))
159#define gncCustomerRetGUID(x) (x ? *(qof_instance_get_guid(QOF_INSTANCE(x))) : *(guid_null()))
160#define gncCustomerGetBook(x) qof_instance_get_book(QOF_INSTANCE(x))
161#define gncCustomerLookupDirect(g,b) gncCustomerLookup((b), &(g))
162
164gboolean gncCustomerEqual(const GncCustomer *a, const GncCustomer *b);
165
166GList * gncCustomerGetJoblist (const GncCustomer *customer, gboolean show_all);
167gboolean gncCustomerIsDirty (GncCustomer *customer);
168
169#ifdef __cplusplus
170}
171#endif
172
173
174#endif /* GNC_CUSTOMER_H_ */
an Address object
Billing Term interface.
Job Interface.
Tax Table programming interface.
#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
gboolean gncCustomerEqual(const GncCustomer *a, const GncCustomer *b)
Test support function, used in gets-dbi-business-stuff.c.
GncTaxIncluded
How to interpret the TaxIncluded.
Definition gncTaxTable.h:86
credit, discount and shipaddr are unique to GncCustomer id, name, notes, terms, addr,...
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