GnuCash 2.4.99
gncVendor.h
Go to the documentation of this file.
00001 /********************************************************************\
00002  * gncVendor.h -- the Core Vendor Interface                         *
00003  *                                                                  *
00004  * This program is free software; you can redistribute it and/or    *
00005  * modify it under the terms of the GNU General Public License as   *
00006  * published by the Free Software Foundation; either version 2 of   *
00007  * the License, or (at your option) any later version.              *
00008  *                                                                  *
00009  * This program is distributed in the hope that it will be useful,  *
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of   *
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the    *
00012  * GNU General Public License for more details.                     *
00013  *                                                                  *
00014  * You should have received a copy of the GNU General Public License*
00015  * along with this program; if not, contact:                        *
00016  *                                                                  *
00017  * Free Software Foundation           Voice:  +1-617-542-5942       *
00018  * 51 Franklin Street, Fifth Floor    Fax:    +1-617-542-2652       *
00019  * Boston, MA  02110-1301,  USA       gnu@gnu.org                   *
00020  *                                                                  *
00021 \********************************************************************/
00031 #ifndef GNC_VENDOR_H_
00032 #define GNC_VENDOR_H_
00033 
00034 typedef struct _gncVendor GncVendor;
00035 typedef struct _gncVendorClass GncVendorClass;
00036 
00037 #include "gncAddress.h"
00038 #include "gncBillTerm.h"
00039 #include "gncTaxTable.h"
00040 #include "gncJob.h"
00041 
00042 #define GNC_ID_VENDOR       "gncVendor"
00043 
00044 /* --- type macros --- */
00045 #define GNC_TYPE_VENDOR            (gnc_vendor_get_type ())
00046 #define GNC_VENDOR(o)              \
00047      (G_TYPE_CHECK_INSTANCE_CAST ((o), GNC_TYPE_VENDOR, GncVendor))
00048 #define GNC_VENDOR_CLASS(k)        \
00049      (G_TYPE_CHECK_CLASS_CAST((k), GNC_TYPE_VENDOR, GncVendorClass))
00050 #define GNC_IS_VENDOR(o)           \
00051      (G_TYPE_CHECK_INSTANCE_TYPE ((o), GNC_TYPE_VENDOR))
00052 #define GNC_IS_VENDOR_CLASS(k)     \
00053      (G_TYPE_CHECK_CLASS_TYPE ((k), GNC_TYPE_VENDOR))
00054 #define GNC_VENDOR_GET_CLASS(o)    \
00055      (G_TYPE_INSTANCE_GET_CLASS ((o), GNC_TYPE_VENDOR, GncVendorClass))
00056 GType gnc_vendor_get_type(void);
00057 
00058 /* Create/Destroy Functions */
00059 
00060 GncVendor *gncVendorCreate (QofBook *book);
00061 void gncVendorDestroy (GncVendor *vendor);
00062 
00067 void gncVendorSetID (GncVendor *vendor, const char *id);
00068 void gncVendorSetName (GncVendor *vendor, const char *name);
00069 void gncVendorSetNotes (GncVendor *vendor, const char *notes);
00070 void gncVendorSetTerms (GncVendor *vendor, GncBillTerm *terms);
00071 void gncVendorSetTaxIncluded (GncVendor *vendor, GncTaxIncluded taxincl);
00072 void gncVendorSetCurrency (GncVendor *vendor, gnc_commodity *currency);
00073 void gncVendorSetActive (GncVendor *vendor, gboolean active);
00074 void gncVendorSetTaxTableOverride (GncVendor *vendor, gboolean override);
00075 void gncVendorSetTaxTable (GncVendor *vendor, GncTaxTable *table);
00076 
00079 void gncVendorAddJob (GncVendor *vendor, GncJob *job);
00080 void gncVendorRemoveJob (GncVendor *vendor, GncJob *job);
00081 
00082 void gncVendorBeginEdit (GncVendor *vendor);
00083 void gncVendorCommitEdit (GncVendor *vendor);
00084 
00089 const char * gncVendorGetID (const GncVendor *vendor);
00090 const char * gncVendorGetName (const GncVendor *vendor);
00091 GncAddress * gncVendorGetAddr (const GncVendor *vendor);
00092 const char * gncVendorGetNotes (const GncVendor *vendor);
00093 GncBillTerm * gncVendorGetTerms (const GncVendor *vendor);
00094 GncTaxIncluded gncVendorGetTaxIncluded (const GncVendor *vendor);
00095 gnc_commodity * gncVendorGetCurrency (const GncVendor *vendor);
00096 gboolean gncVendorGetActive (const GncVendor *vendor);
00097 
00098 gboolean gncVendorGetTaxTableOverride (const GncVendor *vendor);
00099 GncTaxTable* gncVendorGetTaxTable (const GncVendor *vendor);
00100 
00106 int gncVendorCompare (const GncVendor *a, const GncVendor *b);
00107 
00114 static inline GncVendor * gncVendorLookup (const QofBook *book, const GncGUID *guid)
00115 {
00116     QOF_BOOK_RETURN_ENTITY(book, guid, GNC_ID_VENDOR, GncVendor);
00117 }
00118 
00119 #define VENDOR_ID           "id"
00120 #define VENDOR_NAME         "name"
00121 #define VENDOR_ADDR         "addr"
00122 #define VENDOR_NOTES        "vendor_notes"
00123 #define VENDOR_TERMS        "vendor_terms"
00124 #define VENDOR_TAX_INC      "vendor_tax_included"
00125 #define VENDOR_ACTIVE       "vendor_is_active"
00126 #define VENDOR_TAX_OVERRIDE "override_tax_table"
00127 #define VENDOR_TAX_TABLE    "vendor_tax_table"
00128 
00130 #define gncVendorGetBook(X) qof_instance_get_book (QOF_INSTANCE(X))
00131 #define gncVendorGetGUID(X) qof_instance_get_guid (QOF_INSTANCE(X))
00132 #define gncVendorRetGUID(X) (X ? *(qof_instance_get_guid (QOF_INSTANCE(X))) : *(guid_null()))
00133 #define gncVendorLookupDirect(G,B) gncVendorLookup((B),&(G))
00134 
00135 gboolean gncVendorEqual(const GncVendor *a, const GncVendor *b);
00136 gboolean gncVendorIsDirty (const GncVendor *vendor);
00137 #endif /* GNC_VENDOR_H_ */
00138 
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines