2003-10-11 18:34:19 -05:00
|
|
|
/********************************************************************\
|
|
|
|
* gncCustomer.h -- the Core Customer Interface *
|
|
|
|
* *
|
|
|
|
* This program is free software; you can redistribute it and/or *
|
|
|
|
* modify it under the terms of the GNU General Public License as *
|
|
|
|
* published by the Free Software Foundation; either version 2 of *
|
|
|
|
* the License, or (at your option) any later version. *
|
|
|
|
* *
|
|
|
|
* This program is distributed in the hope that it will be useful, *
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
|
|
* GNU General Public License for more details. *
|
|
|
|
* *
|
|
|
|
* You should have received a copy of the GNU General Public License*
|
|
|
|
* along with this program; if not, contact: *
|
|
|
|
* *
|
|
|
|
* Free Software Foundation Voice: +1-617-542-5942 *
|
|
|
|
* 59 Temple Place - Suite 330 Fax: +1-617-542-2652 *
|
|
|
|
* Boston, MA 02111-1307, USA gnu@gnu.org *
|
|
|
|
* *
|
|
|
|
\********************************************************************/
|
|
|
|
|
2001-11-16 19:17:06 -06:00
|
|
|
/*
|
2002-02-03 14:01:08 -06:00
|
|
|
* Copyright (C) 2001,2002 Derek Atkins
|
2001-11-16 19:17:06 -06:00
|
|
|
* Author: Derek Atkins <warlord@MIT.EDU>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef GNC_CUSTOMER_H_
|
|
|
|
#define GNC_CUSTOMER_H_
|
|
|
|
|
|
|
|
typedef struct _gncCustomer GncCustomer;
|
|
|
|
|
2003-10-11 17:46:12 -05:00
|
|
|
#include "qofbook.h"
|
2003-10-17 00:15:56 -05:00
|
|
|
#include "qofid.h"
|
2003-10-11 17:46:12 -05:00
|
|
|
#include "qofinstance.h"
|
2001-11-16 19:17:06 -06:00
|
|
|
#include "gncAddress.h"
|
2002-06-21 21:38:13 -05:00
|
|
|
#include "gncBillTerm.h"
|
2002-06-23 23:59:04 -05:00
|
|
|
#include "gncTaxTable.h"
|
2001-11-16 19:17:06 -06:00
|
|
|
#include "gncJob.h"
|
|
|
|
|
|
|
|
#include "gnc-numeric.h"
|
2003-09-23 21:25:09 -05:00
|
|
|
#include "kvp_frame.h"
|
2001-11-16 19:17:06 -06:00
|
|
|
|
2003-10-19 00:13:59 -05:00
|
|
|
#define GNC_ID_CUSTOMER "gncCustomer"
|
|
|
|
#define GNC_IS_CUSTOMER(obj) (QOF_CHECK_TYPE((obj), GNC_ID_CUSTOMER))
|
|
|
|
#define GNC_CUSTOMER(obj) (QOF_CHECK_CAST((obj), GNC_ID_CUSTOMER, GncCustomer))
|
2001-11-16 19:17:06 -06:00
|
|
|
|
|
|
|
/* Create/Destroy Functions */
|
|
|
|
|
2003-06-26 22:05:25 -05:00
|
|
|
GncCustomer *gncCustomerCreate (QofBook *book);
|
2001-11-16 19:17:06 -06:00
|
|
|
void gncCustomerDestroy (GncCustomer *customer);
|
|
|
|
|
|
|
|
/* Set Functions */
|
|
|
|
|
|
|
|
void gncCustomerSetID (GncCustomer *customer, const char *id);
|
|
|
|
void gncCustomerSetName (GncCustomer *customer, const char *name);
|
|
|
|
void gncCustomerSetNotes (GncCustomer *customer, const char *notes);
|
2002-06-21 21:38:13 -05:00
|
|
|
void gncCustomerSetTerms (GncCustomer *customer, GncBillTerm *term);
|
2002-06-23 23:59:04 -05:00
|
|
|
void gncCustomerSetTaxIncluded (GncCustomer *customer, GncTaxIncluded taxincl);
|
2001-11-16 19:17:06 -06:00
|
|
|
void gncCustomerSetActive (GncCustomer *customer, gboolean active);
|
|
|
|
void gncCustomerSetDiscount (GncCustomer *customer, gnc_numeric discount);
|
|
|
|
void gncCustomerSetCredit (GncCustomer *customer, gnc_numeric credit);
|
2003-01-12 16:53:02 -06:00
|
|
|
void gncCustomerSetCurrency (GncCustomer *customer, gnc_commodity *currency);
|
2001-11-16 19:17:06 -06:00
|
|
|
|
2002-09-16 23:19:57 -05:00
|
|
|
void gncCustomerSetTaxTableOverride (GncCustomer *customer, gboolean override);
|
|
|
|
void gncCustomerSetTaxTable (GncCustomer *customer, GncTaxTable *table);
|
|
|
|
|
2001-11-16 19:17:06 -06:00
|
|
|
void gncCustomerAddJob (GncCustomer *customer, GncJob *job);
|
|
|
|
void gncCustomerRemoveJob (GncCustomer *customer, GncJob *job);
|
|
|
|
|
2002-11-03 14:21:42 -06:00
|
|
|
void gncCustomerBeginEdit (GncCustomer *customer);
|
2001-11-16 19:17:06 -06:00
|
|
|
void gncCustomerCommitEdit (GncCustomer *customer);
|
|
|
|
|
|
|
|
/* Get Functions */
|
2003-10-19 00:13:59 -05:00
|
|
|
/** Return a pointer to the instance gncCustomer that is identified
|
|
|
|
* by the guid, and is residing in the book. Returns NULL if the
|
|
|
|
* instance can't be found.
|
|
|
|
* Equivalent function prototype is
|
|
|
|
* GncCustomer * gncCustomerLookup (QofBook *book, const GUID *guid);
|
|
|
|
*/
|
|
|
|
#define gncCustomerLookup(book,guid) \
|
|
|
|
QOF_BOOK_LOOKUP_ENTITY((book),(guid),GNC_ID_CUSTOMER, GncCustomer)
|
2001-11-16 19:17:06 -06:00
|
|
|
|
|
|
|
const char * gncCustomerGetID (GncCustomer *customer);
|
|
|
|
const char * gncCustomerGetName (GncCustomer *customer);
|
|
|
|
GncAddress * gncCustomerGetAddr (GncCustomer *customer);
|
|
|
|
GncAddress * gncCustomerGetShipAddr (GncCustomer *customer);
|
|
|
|
const char * gncCustomerGetNotes (GncCustomer *customer);
|
2002-06-21 21:38:13 -05:00
|
|
|
GncBillTerm * gncCustomerGetTerms (GncCustomer *customer);
|
2002-06-23 23:59:04 -05:00
|
|
|
GncTaxIncluded gncCustomerGetTaxIncluded (GncCustomer *customer);
|
2001-11-16 19:17:06 -06:00
|
|
|
gboolean gncCustomerGetActive (GncCustomer *customer);
|
|
|
|
gnc_numeric gncCustomerGetDiscount (GncCustomer *customer);
|
|
|
|
gnc_numeric gncCustomerGetCredit (GncCustomer *customer);
|
2003-01-12 16:53:02 -06:00
|
|
|
gnc_commodity * gncCustomerGetCurrency (GncCustomer *customer);
|
2001-11-16 19:17:06 -06:00
|
|
|
|
2002-09-16 23:19:57 -05:00
|
|
|
gboolean gncCustomerGetTaxTableOverride (GncCustomer *customer);
|
|
|
|
GncTaxTable* gncCustomerGetTaxTable (GncCustomer *customer);
|
|
|
|
|
2003-09-23 21:25:09 -05:00
|
|
|
KvpFrame *gncCustomerGetSlots (GncCustomer *customer);
|
2001-11-16 19:17:06 -06:00
|
|
|
GList * gncCustomerGetJoblist (GncCustomer *customer, gboolean show_all);
|
|
|
|
|
2002-05-27 13:17:31 -05:00
|
|
|
|
2001-11-24 23:34:34 -06:00
|
|
|
|
2001-11-16 19:17:06 -06:00
|
|
|
gboolean gncCustomerIsDirty (GncCustomer *customer);
|
2002-02-03 14:01:08 -06:00
|
|
|
int gncCustomerCompare (GncCustomer *a, GncCustomer *b);
|
|
|
|
|
|
|
|
#define CUSTOMER_ID "id"
|
|
|
|
#define CUSTOMER_NAME "name"
|
2002-02-04 12:54:06 -06:00
|
|
|
#define CUSTOMER_ADDR "addr"
|
|
|
|
#define CUSTOMER_SHIPADDR "shipaddr"
|
2001-11-16 19:17:06 -06:00
|
|
|
|
2003-10-11 17:46:12 -05:00
|
|
|
/* deprecated functions, should be removed */
|
|
|
|
#define gncCustomerGetGUID(x) qof_instance_get_guid(QOF_INSTANCE(x))
|
2003-10-19 00:13:59 -05:00
|
|
|
#define gncCustomerRetGUID(x) (*(qof_instance_get_guid(QOF_INSTANCE(x))))
|
2003-10-11 17:46:12 -05:00
|
|
|
#define gncCustomerGetBook(x) qof_instance_get_book(QOF_INSTANCE(x))
|
2003-10-19 00:13:59 -05:00
|
|
|
#define gncCustomerLookupDirect(g,b) gncCustomerLookup((b), &(g))
|
2003-10-11 17:46:12 -05:00
|
|
|
|
2001-11-16 19:17:06 -06:00
|
|
|
#endif /* GNC_CUSTOMER_H_ */
|