|
GnuCash 2.4.99
|
00001 /********************************************************************\ 00002 * gncCustomer.h -- the Core Customer 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_CUSTOMER_H_ 00032 #define GNC_CUSTOMER_H_ 00033 00057 typedef struct _gncCustomer GncCustomer; 00058 typedef struct _gncCustomerClass GncCustomerClass; 00059 00060 #include "gncAddress.h" 00061 #include "gncBillTerm.h" 00062 #include "gncTaxTable.h" 00063 #include "gncJob.h" 00064 00065 #define GNC_ID_CUSTOMER "gncCustomer" 00066 00067 /* --- type macros --- */ 00068 #define GNC_TYPE_CUSTOMER (gnc_customer_get_type ()) 00069 #define GNC_CUSTOMER(o) \ 00070 (G_TYPE_CHECK_INSTANCE_CAST ((o), GNC_TYPE_CUSTOMER, GncCustomer)) 00071 #define GNC_CUSTOMER_CLASS(k) \ 00072 (G_TYPE_CHECK_CLASS_CAST((k), GNC_TYPE_CUSTOMER, GncCustomerClass)) 00073 #define GNC_IS_CUSTOMER(o) \ 00074 (G_TYPE_CHECK_INSTANCE_TYPE ((o), GNC_TYPE_CUSTOMER)) 00075 #define GNC_IS_CUSTOMER_CLASS(k) \ 00076 (G_TYPE_CHECK_CLASS_TYPE ((k), GNC_TYPE_CUSTOMER)) 00077 #define GNC_CUSTOMER_GET_CLASS(o) \ 00078 (G_TYPE_INSTANCE_GET_CLASS ((o), GNC_TYPE_CUSTOMER, GncCustomerClass)) 00079 GType gnc_customer_get_type(void); 00080 00083 GncCustomer *gncCustomerCreate (QofBook *book); 00084 void gncCustomerDestroy (GncCustomer *customer); 00085 void gncCustomerBeginEdit (GncCustomer *customer); 00086 void gncCustomerCommitEdit (GncCustomer *customer); 00092 void gncCustomerSetID (GncCustomer *customer, const char *id); 00093 void gncCustomerSetName (GncCustomer *customer, const char *name); 00094 void gncCustomerSetNotes (GncCustomer *customer, const char *notes); 00095 void gncCustomerSetTerms (GncCustomer *customer, GncBillTerm *term); 00096 void gncCustomerSetTaxIncluded (GncCustomer *customer, GncTaxIncluded taxincl); 00097 void gncCustomerSetActive (GncCustomer *customer, gboolean active); 00098 void gncCustomerSetDiscount (GncCustomer *customer, gnc_numeric discount); 00099 void gncCustomerSetCredit (GncCustomer *customer, gnc_numeric credit); 00100 void gncCustomerSetCurrency (GncCustomer *customer, gnc_commodity *currency); 00101 00102 void gncCustomerSetTaxTableOverride (GncCustomer *customer, gboolean override); 00103 void gncCustomerSetTaxTable (GncCustomer *customer, GncTaxTable *table); 00104 00105 void gncCustomerAddJob (GncCustomer *customer, GncJob *job); 00106 void gncCustomerRemoveJob (GncCustomer *customer, GncJob *job); 00107 00118 static inline GncCustomer * gncCustomerLookup (const QofBook *book, const GncGUID *guid) 00119 { 00120 QOF_BOOK_RETURN_ENTITY(book, guid, GNC_ID_CUSTOMER, GncCustomer); 00121 } 00122 00123 const char * gncCustomerGetID (const GncCustomer *customer); 00124 const char * gncCustomerGetName (const GncCustomer *customer); 00125 GncAddress * gncCustomerGetAddr (const GncCustomer *customer); 00126 GncAddress * gncCustomerGetShipAddr (const GncCustomer *customer); 00127 const char * gncCustomerGetNotes (const GncCustomer *customer); 00128 GncBillTerm * gncCustomerGetTerms (const GncCustomer *customer); 00129 GncTaxIncluded gncCustomerGetTaxIncluded (const GncCustomer *customer); 00130 gboolean gncCustomerGetActive (const GncCustomer *customer); 00131 gnc_numeric gncCustomerGetDiscount (const GncCustomer *customer); 00132 gnc_numeric gncCustomerGetCredit (const GncCustomer *customer); 00133 gnc_commodity * gncCustomerGetCurrency (const GncCustomer *customer); 00134 00135 gboolean gncCustomerGetTaxTableOverride (const GncCustomer *customer); 00136 GncTaxTable* gncCustomerGetTaxTable (const GncCustomer *customer); 00137 00140 int gncCustomerCompare (const GncCustomer *a, const GncCustomer *b); 00141 00142 #define CUSTOMER_ID "id" 00143 #define CUSTOMER_NAME "name" 00144 #define CUSTOMER_ADDR "addr" 00145 #define CUSTOMER_SHIPADDR "shipaddr" 00146 #define CUSTOMER_NOTES "notes" 00147 #define CUSTOMER_DISCOUNT "amount of discount" 00148 #define CUSTOMER_CREDIT "amount of credit" 00149 #define CUSTOMER_TT_OVER "tax table override" 00150 #define CUSTOMER_TAX_INC "customer_tax_included" 00151 #define CUSTOMER_TERMS "customer_terms" 00152 #define CUSTOMER_ACTIVE "customer_is_active" 00153 #define CUSTOMER_SLOTS "customer_values" 00154 00156 #define gncCustomerGetGUID(x) qof_instance_get_guid(QOF_INSTANCE(x)) 00157 #define gncCustomerRetGUID(x) (x ? *(qof_instance_get_guid(QOF_INSTANCE(x))) : *(guid_null())) 00158 #define gncCustomerGetBook(x) qof_instance_get_book(QOF_INSTANCE(x)) 00159 #define gncCustomerLookupDirect(g,b) gncCustomerLookup((b), &(g)) 00160 00162 gboolean gncCustomerEqual(const GncCustomer *a, const GncCustomer *b); 00163 00164 GList * gncCustomerGetJoblist (const GncCustomer *customer, gboolean show_all); 00165 gboolean gncCustomerIsDirty (GncCustomer *customer); 00166 00167 #endif /* GNC_CUSTOMER_H_ */ 00168
1.7.4