GnuCash  2.6.99
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
gncOwner.h
Go to the documentation of this file.
1 /********************************************************************\
2  * gncOwner.h -- Business Interface: Object OWNERs *
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 [email protected] *
20  * *
21 \********************************************************************/
33 #ifndef GNC_OWNER_H_
34 #define GNC_OWNER_H_
35 
36 typedef struct _gncOwner GncOwner;
37 
38 #define GNC_ID_OWNER "gncOwner"
39 
40 typedef enum
41 {
42  GNC_OWNER_NONE ,
43  GNC_OWNER_UNDEFINED ,
44  GNC_OWNER_CUSTOMER ,
45  GNC_OWNER_JOB ,
46  GNC_OWNER_VENDOR ,
47  GNC_OWNER_EMPLOYEE ,
48 } GncOwnerType;
49 
50 #include "qof.h"
51 #include "gncCustomer.h"
52 #include "gncJob.h"
53 #include "gncVendor.h"
54 #include "gncEmployee.h"
55 #include "gncInvoice.h"
56 #include "Account.h"
57 #include "gnc-lot.h"
58 
75 gboolean GNC_IS_OWNER (QofInstance *ent);
76 
80 
81 gboolean
82 gncOwnerRegister(void);
83 
86 #ifndef SWIG
87 
89 struct _gncOwner
90 {
91  GncOwnerType type;
92  union
93  {
94  gpointer undefined;
95  GncCustomer * customer;
96  GncJob * job;
97  GncVendor * vendor;
98  GncEmployee * employee;
99  } owner;
100  gpointer qof_temp;
101 };
102 
103 #endif /* SWIG */
104 
108 void gncOwnerInitUndefined (GncOwner *owner, gpointer obj);
109 void gncOwnerInitCustomer (GncOwner *owner, GncCustomer *customer);
110 void gncOwnerInitJob (GncOwner *owner, GncJob *job);
111 void gncOwnerInitVendor (GncOwner *owner, GncVendor *vendor);
112 void gncOwnerInitEmployee (GncOwner *owner, GncEmployee *employee);
118 GncOwnerType gncOwnerGetType (const GncOwner *owner);
121 gboolean gncOwnerIsValid (const GncOwner *owner);
122 
125 gpointer gncOwnerGetUndefined (const GncOwner *owner);
128 GncCustomer * gncOwnerGetCustomer (const GncOwner *owner);
131 GncJob * gncOwnerGetJob (const GncOwner *owner);
134 GncVendor * gncOwnerGetVendor (const GncOwner *owner);
137 GncEmployee * gncOwnerGetEmployee (const GncOwner *owner);
138 
139 const char * gncOwnerGetID (const GncOwner *owner);
140 const char * gncOwnerGetName (const GncOwner *owner);
141 GncAddress * gncOwnerGetAddr (const GncOwner *owner);
142 gboolean gncOwnerGetActive (const GncOwner *owner);
143 gnc_commodity * gncOwnerGetCurrency (const GncOwner *owner);
149 void gncOwnerSetActive (const GncOwner *owner, gboolean active);
152 void gncOwnerCopy (const GncOwner *src, GncOwner *dest);
153 
161 gboolean gncOwnerEqual (const GncOwner *a, const GncOwner *b);
164 int gncOwnerGCompareFunc (const GncOwner *a, const GncOwner *b);
166 int gncOwnerCompare (const GncOwner *a, const GncOwner *b);
170 const GncGUID * gncOwnerGetGUID (const GncOwner *owner);
171 GncGUID gncOwnerRetGUID (GncOwner *owner);
172 
177 const GncOwner * gncOwnerGetEndOwner (const GncOwner *owner);
178 const GncGUID * gncOwnerGetEndGUID (const GncOwner *owner);
179 
181 void gncOwnerAttachToLot (const GncOwner *owner, GNCLot *lot);
182 
185 gboolean gncOwnerLotMatchOwnerFunc (GNCLot *lot, gpointer user_data);
186 
191 gint gncOwnerLotsSortFunc (GNCLot *lotA, GNCLot *lotB);
192 
196 gboolean gncOwnerGetOwnerFromLot (GNCLot *lot, GncOwner *owner);
197 
198 gboolean gncOwnerGetOwnerFromTypeGuid (QofBook *book, GncOwner *owner, QofIdType type, GncGUID *guid);
199 
207 GNCLot *
208 gncOwnerCreatePaymentLot (const GncOwner *owner, Transaction *txn,
209  Account *posted_acc, Account *xfer_acc,
210  gnc_numeric amount, gnc_numeric exch, Timespec date,
211  const char *memo, const char *num);
212 
247 void gncOwnerAutoApplyPaymentsWithLots (const GncOwner *owner, GList *lots);
248 
260 void
261 gncOwnerApplyPayment (const GncOwner *owner, Transaction *txn, GList *lots,
262  Account *posted_acc, Account *xfer_acc,
263  gnc_numeric amount, gnc_numeric exch, Timespec date,
264  const char *memo, const char *num, gboolean auto_pay);
265 
277 Split *gncOwnerFindOffsettingSplit (GNCLot *pay_lot, gnc_numeric target_value);
278 
285 gboolean gncOwnerReduceSplitTo (Split *split, gnc_numeric target_value);
286 
292 void gncOwnerSetLotLinkMemo (Transaction *ll_txn);
293 
295 GList * gncOwnerGetAccountTypesList (const GncOwner *owner);
296 
298 GList * gncOwnerGetCommoditiesList (const GncOwner *owner);
299 
300 
306  const gnc_commodity *report_currency);
307 
308 #define OWNER_TYPE "type"
309 #define OWNER_TYPE_STRING "type-string"
310 #define OWNER_CUSTOMER "customer"
311 #define OWNER_JOB "job"
312 #define OWNER_VENDOR "vendor"
313 #define OWNER_EMPLOYEE "employee"
314 #define OWNER_PARENT "parent"
315 #define OWNER_PARENTG "parent-guid"
316 #define OWNER_NAME "name"
317 
318 #define OWNER_FROM_LOT "owner-from-lot"
319 
325 GncOwner * gncOwnerNew (void);
326 void gncOwnerFree (GncOwner *owner);
327 
328 
334 void gncOwnerBeginEdit (GncOwner *owner);
335 void gncOwnerCommitEdit (GncOwner *owner);
336 void gncOwnerDestroy (GncOwner *owner);
337 
338 #endif /* GNC_OWNER_H_ */
339 
Core Customer Interface.
GList * gncOwnerGetCommoditiesList(const GncOwner *owner)
Definition: gncOwner.c:1401
const GncGUID * gncOwnerGetGUID(const GncOwner *owner)
Definition: gncOwner.c:496
union _gncOwner::@19 owner
GList * gncOwnerGetAccountTypesList(const GncOwner *owner)
Definition: gncOwner.c:1383
const gchar * QofIdTypeConst
Definition: qofid.h:87
gboolean gncOwnerEqual(const GncOwner *a, const GncOwner *b)
Definition: gncOwner.c:382
Use a 64-bit unsigned int timespec.
Definition: gnc-date.h:299
void gncOwnerBeginEdit(GncOwner *owner)
Definition: gncOwner.c:73
gboolean gncOwnerIsValid(const GncOwner *owner)
Definition: gncOwner.c:650
QofInstance * qofOwnerGetOwner(const GncOwner *owner)
Definition: gncOwner.c:253
Definition: guid.h:65
void gncOwnerAutoApplyPaymentsWithLots(const GncOwner *owner, GList *lots)
Definition: gncOwner.c:1199
const gchar * QofIdType
Definition: qofid.h:85
int gncOwnerGCompareFunc(const GncOwner *a, const GncOwner *b)
Definition: gncOwner.c:389
Account handling public routines.
void gncOwnerApplyPayment(const GncOwner *owner, Transaction *txn, GList *lots, Account *posted_acc, Account *xfer_acc, gnc_numeric amount, gnc_numeric exch, Timespec date, const char *memo, const char *num, gboolean auto_pay)
Definition: gncOwner.c:1348
Definition: gncJob.c:41
gint gncOwnerLotsSortFunc(GNCLot *lotA, GNCLot *lotB)
Definition: gncOwner.c:679
gboolean gncOwnerReduceSplitTo(Split *split, gnc_numeric target_value)
Definition: gncOwner.c:914
gnc_numeric gncOwnerGetBalanceInCurrency(const GncOwner *owner, const gnc_commodity *report_currency)
Definition: gncOwner.c:1417
QofIdTypeConst qofOwnerGetType(const GncOwner *owner)
Definition: gncOwner.c:208
int gncOwnerCompare(const GncOwner *a, const GncOwner *b)
Definition: gncOwner.c:568
void qofOwnerSetEntity(GncOwner *owner, QofInstance *ent)
Definition: gncOwner.c:297
void gncOwnerAttachToLot(const GncOwner *owner, GNCLot *lot)
Definition: gncOwner.c:600
QofIdTypeConst gncOwnerTypeToQofIdType(GncOwnerType t)
Definition: gncOwner.c:213
gpointer gncOwnerGetUndefined(const GncOwner *owner)
Definition: gncOwner.c:340
gboolean gncOwnerGetOwnerFromLot(GNCLot *lot, GncOwner *owner)
Definition: gncOwner.c:614
gboolean GNC_IS_OWNER(QofInstance *ent)
Definition: gncOwner.c:330
GncOwnerType gncOwnerGetType(const GncOwner *owner)
Definition: gncOwner.c:201
const GncOwner * gncOwnerGetEndOwner(const GncOwner *owner)
Definition: gncOwner.c:550
Business Invoice Interface.
GncJob * gncOwnerGetJob(const GncOwner *owner)
Definition: gncOwner.c:354
GNCLot * gncOwnerCreatePaymentLot(const GncOwner *owner, Transaction *txn, Account *posted_acc, Account *xfer_acc, gnc_numeric amount, gnc_numeric exch, Timespec date, const char *memo, const char *num)
Definition: gncOwner.c:701
Job Interface.
gboolean gncOwnerLotMatchOwnerFunc(GNCLot *lot, gpointer user_data)
Definition: gncOwner.c:657
Definition: SplitP.h:71
Employee Interface.
gpointer qof_temp
Definition: gncOwner.h:100
Split * gncOwnerFindOffsettingSplit(GNCLot *pay_lot, gnc_numeric target_value)
Definition: gncOwner.c:848
GncVendor * gncOwnerGetVendor(const GncOwner *owner)
Definition: gncOwner.c:361
GncCustomer * gncOwnerGetCustomer(const GncOwner *owner)
Definition: gncOwner.c:347
Vendor Interface.
void gncOwnerSetLotLinkMemo(Transaction *ll_txn)
Definition: gncOwner.c:946
GncOwnerType type
Definition: gncOwner.h:91
GncEmployee * gncOwnerGetEmployee(const GncOwner *owner)
Definition: gncOwner.c:368
GncOwner * gncOwnerNew(void)
Definition: gncOwner.c:58