00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00033 #ifndef GNC_OWNER_H_
00034 #define GNC_OWNER_H_
00035
00036 typedef struct _gncOwner GncOwner;
00037
00038 #define GNC_ID_OWNER "gncOwner"
00039
00040 #include "qof.h"
00041 #include "gncCustomer.h"
00042 #include "gncJob.h"
00043 #include "gncVendor.h"
00044 #include "gncEmployee.h"
00045 #include "gnc-lot.h"
00046
00047 typedef enum {
00048 GNC_OWNER_NONE ,
00049 GNC_OWNER_UNDEFINED ,
00050 GNC_OWNER_CUSTOMER ,
00051 GNC_OWNER_JOB ,
00052 GNC_OWNER_VENDOR ,
00053 GNC_OWNER_EMPLOYEE ,
00054 }GncOwnerType;
00055
00064 QofIdType qofOwnerGetType(const GncOwner *owner);
00066 QofInstance* qofOwnerGetOwner (const GncOwner *owner);
00068 void qofOwnerSetEntity (GncOwner *owner, QofInstance *ent);
00069
00070 gboolean
00071 gncOwnerRegister(void);
00072
00075 #ifndef SWIG
00076
00078 struct _gncOwner {
00079 GncOwnerType type;
00080 union {
00081 gpointer undefined;
00082 GncCustomer * customer;
00083 GncJob * job;
00084 GncVendor * vendor;
00085 GncEmployee * employee;
00086 } owner;
00087 gpointer qof_temp;
00088 };
00089
00090 #endif
00091
00095 void gncOwnerInitUndefined (GncOwner *owner, gpointer obj);
00096 void gncOwnerInitCustomer (GncOwner *owner, GncCustomer *customer);
00097 void gncOwnerInitJob (GncOwner *owner, GncJob *job);
00098 void gncOwnerInitVendor (GncOwner *owner, GncVendor *vendor);
00099 void gncOwnerInitEmployee (GncOwner *owner, GncEmployee *employee);
00104 GncOwnerType gncOwnerGetType (const GncOwner *owner);
00105 gpointer gncOwnerGetUndefined (const GncOwner *owner);
00106 GncCustomer * gncOwnerGetCustomer (const GncOwner *owner);
00107 GncJob * gncOwnerGetJob (const GncOwner *owner);
00108 GncVendor * gncOwnerGetVendor (const GncOwner *owner);
00109 GncEmployee * gncOwnerGetEmployee (const GncOwner *owner);
00111 void gncOwnerCopy (const GncOwner *src, GncOwner *dest);
00112 gboolean gncOwnerEqual (const GncOwner *a, const GncOwner *b);
00113 int gncOwnerCompare (const GncOwner *a, const GncOwner *b);
00114
00115 const char * gncOwnerGetName (const GncOwner *owner);
00116 gnc_commodity * gncOwnerGetCurrency (const GncOwner *owner);
00117
00119 const GUID * gncOwnerGetGUID (const GncOwner *owner);
00120 GUID gncOwnerRetGUID (GncOwner *owner);
00121
00122 gboolean gncOwnerIsValid (const GncOwner *owner);
00123
00128 GncOwner * gncOwnerGetEndOwner (GncOwner *owner);
00129 const GUID * gncOwnerGetEndGUID (GncOwner *owner);
00130
00132 void gncOwnerAttachToLot (const GncOwner *owner, GNCLot *lot);
00133
00137 gboolean gncOwnerGetOwnerFromLot (GNCLot *lot, GncOwner *owner);
00138
00139 gboolean gncOwnerGetOwnerFromTypeGuid (QofBook *book, GncOwner *owner, QofIdType type, GUID *guid);
00140
00142 KvpFrame* gncOwnerGetSlots(GncOwner* owner);
00143
00144 #define OWNER_TYPE "type"
00145 #define OWNER_TYPE_STRING "type-string"
00146 #define OWNER_CUSTOMER "customer"
00147 #define OWNER_JOB "job"
00148 #define OWNER_VENDOR "vendor"
00149 #define OWNER_EMPLOYEE "employee"
00150 #define OWNER_PARENT "parent"
00151 #define OWNER_PARENTG "parent-guid"
00152 #define OWNER_NAME "name"
00153
00154 #define OWNER_FROM_LOT "owner-from-lot"
00155
00161 GncOwner * gncOwnerCreate (void);
00162 void gncOwnerDestroy (GncOwner *owner);
00163
00164 #endif
00165