2003-10-17 00:15:56 -05:00
|
|
|
/********************************************************************\
|
|
|
|
* gncVendor.h -- the Core Vendor 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 *
|
2005-11-16 23:35:02 -06:00
|
|
|
* 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 *
|
|
|
|
* Boston, MA 02110-1301, USA gnu@gnu.org *
|
2003-10-17 00:15:56 -05:00
|
|
|
* *
|
|
|
|
\********************************************************************/
|
2004-05-07 00:11:49 -05:00
|
|
|
/** @addtogroup Business
|
|
|
|
@{ */
|
|
|
|
/** @addtogroup Vendor
|
|
|
|
@{ */
|
|
|
|
/** @file gncVendor.h
|
2010-03-02 15:41:05 -06:00
|
|
|
@brief Vendor Interface
|
2004-05-07 00:11:49 -05:00
|
|
|
@author Copyright (C) 2001,2002 Derek Atkins <warlord@MIT.EDU>
|
|
|
|
*/
|
2001-11-16 19:17:06 -06:00
|
|
|
|
|
|
|
#ifndef GNC_VENDOR_H_
|
|
|
|
#define GNC_VENDOR_H_
|
|
|
|
|
|
|
|
typedef struct _gncVendor GncVendor;
|
2007-04-04 21:44:36 -05:00
|
|
|
typedef struct _gncVendorClass GncVendorClass;
|
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"
|
2002-01-22 11:16:02 -06:00
|
|
|
#include "gncJob.h"
|
2001-11-16 19:17:06 -06:00
|
|
|
|
2023-03-03 09:58:33 -06:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2003-10-19 00:13:59 -05:00
|
|
|
#define GNC_ID_VENDOR "gncVendor"
|
2007-04-04 21:44:36 -05:00
|
|
|
|
|
|
|
/* --- type macros --- */
|
|
|
|
#define GNC_TYPE_VENDOR (gnc_vendor_get_type ())
|
|
|
|
#define GNC_VENDOR(o) \
|
|
|
|
(G_TYPE_CHECK_INSTANCE_CAST ((o), GNC_TYPE_VENDOR, GncVendor))
|
|
|
|
#define GNC_VENDOR_CLASS(k) \
|
|
|
|
(G_TYPE_CHECK_CLASS_CAST((k), GNC_TYPE_VENDOR, GncVendorClass))
|
|
|
|
#define GNC_IS_VENDOR(o) \
|
|
|
|
(G_TYPE_CHECK_INSTANCE_TYPE ((o), GNC_TYPE_VENDOR))
|
|
|
|
#define GNC_IS_VENDOR_CLASS(k) \
|
|
|
|
(G_TYPE_CHECK_CLASS_TYPE ((k), GNC_TYPE_VENDOR))
|
|
|
|
#define GNC_VENDOR_GET_CLASS(o) \
|
|
|
|
(G_TYPE_INSTANCE_GET_CLASS ((o), GNC_TYPE_VENDOR, GncVendorClass))
|
|
|
|
GType gnc_vendor_get_type(void);
|
2001-11-16 19:17:06 -06:00
|
|
|
|
|
|
|
/* Create/Destroy Functions */
|
|
|
|
|
2003-06-26 22:05:25 -05:00
|
|
|
GncVendor *gncVendorCreate (QofBook *book);
|
2001-11-16 19:17:06 -06:00
|
|
|
void gncVendorDestroy (GncVendor *vendor);
|
|
|
|
|
2005-11-01 21:32:36 -06:00
|
|
|
/** @name Set Functions
|
|
|
|
@{
|
|
|
|
*/
|
2001-11-16 19:17:06 -06:00
|
|
|
|
|
|
|
void gncVendorSetID (GncVendor *vendor, const char *id);
|
|
|
|
void gncVendorSetName (GncVendor *vendor, const char *name);
|
|
|
|
void gncVendorSetNotes (GncVendor *vendor, const char *notes);
|
2002-06-21 21:38:13 -05:00
|
|
|
void gncVendorSetTerms (GncVendor *vendor, GncBillTerm *terms);
|
2002-06-23 23:59:04 -05:00
|
|
|
void gncVendorSetTaxIncluded (GncVendor *vendor, GncTaxIncluded taxincl);
|
2003-01-12 16:53:02 -06:00
|
|
|
void gncVendorSetCurrency (GncVendor *vendor, gnc_commodity *currency);
|
2001-11-16 19:17:06 -06:00
|
|
|
void gncVendorSetActive (GncVendor *vendor, gboolean active);
|
2002-09-16 23:19:57 -05:00
|
|
|
void gncVendorSetTaxTableOverride (GncVendor *vendor, gboolean override);
|
|
|
|
void gncVendorSetTaxTable (GncVendor *vendor, GncTaxTable *table);
|
|
|
|
|
2005-11-01 21:32:36 -06:00
|
|
|
/** @} */
|
|
|
|
|
2002-01-22 11:16:02 -06:00
|
|
|
void gncVendorAddJob (GncVendor *vendor, GncJob *job);
|
|
|
|
void gncVendorRemoveJob (GncVendor *vendor, GncJob *job);
|
|
|
|
|
2002-11-03 14:21:42 -06:00
|
|
|
void gncVendorBeginEdit (GncVendor *vendor);
|
2001-11-16 19:17:06 -06:00
|
|
|
void gncVendorCommitEdit (GncVendor *vendor);
|
|
|
|
|
2005-11-01 21:32:36 -06:00
|
|
|
/** @name Get Functions
|
|
|
|
@{
|
|
|
|
*/
|
2001-11-16 19:17:06 -06:00
|
|
|
|
2008-08-01 11:02:07 -05:00
|
|
|
const char * gncVendorGetID (const GncVendor *vendor);
|
|
|
|
const char * gncVendorGetName (const GncVendor *vendor);
|
|
|
|
GncAddress * gncVendorGetAddr (const GncVendor *vendor);
|
|
|
|
const char * gncVendorGetNotes (const GncVendor *vendor);
|
|
|
|
GncBillTerm * gncVendorGetTerms (const GncVendor *vendor);
|
|
|
|
GncTaxIncluded gncVendorGetTaxIncluded (const GncVendor *vendor);
|
|
|
|
gnc_commodity * gncVendorGetCurrency (const GncVendor *vendor);
|
|
|
|
gboolean gncVendorGetActive (const GncVendor *vendor);
|
|
|
|
|
|
|
|
gboolean gncVendorGetTaxTableOverride (const GncVendor *vendor);
|
|
|
|
GncTaxTable* gncVendorGetTaxTable (const GncVendor *vendor);
|
2002-09-16 23:19:57 -05:00
|
|
|
|
2005-11-01 21:32:36 -06:00
|
|
|
/** @} */
|
2003-10-14 08:46:24 -05:00
|
|
|
/** XXX should be renamed to RetJobList to be consistent with
|
2010-03-02 15:41:05 -06:00
|
|
|
* other usage, since caller must free the copied list
|
2003-10-14 08:46:24 -05:00
|
|
|
*/
|
2011-11-18 15:04:01 -06:00
|
|
|
|
2008-08-01 11:02:07 -05:00
|
|
|
int gncVendorCompare (const GncVendor *a, const GncVendor *b);
|
2002-02-03 14:01:08 -06:00
|
|
|
|
2003-10-19 00:13:59 -05:00
|
|
|
/** Return a pointer to the instance gncVendor that is identified
|
2010-03-02 15:41:05 -06:00
|
|
|
* by the guid, and is residing in the book. Returns NULL if the
|
2003-10-19 00:13:59 -05:00
|
|
|
* instance can't be found.
|
|
|
|
*/
|
2010-03-27 16:01:21 -05:00
|
|
|
static inline GncVendor * gncVendorLookup (const QofBook *book, const GncGUID *guid)
|
2010-03-06 05:01:37 -06:00
|
|
|
{
|
|
|
|
QOF_BOOK_RETURN_ENTITY(book, guid, GNC_ID_VENDOR, GncVendor);
|
|
|
|
}
|
2003-10-19 00:13:59 -05:00
|
|
|
|
2011-03-20 14:17:11 -05:00
|
|
|
#define VENDOR_ID "id"
|
|
|
|
#define VENDOR_NAME "name"
|
|
|
|
#define VENDOR_ADDR "addr"
|
|
|
|
#define VENDOR_NOTES "vendor_notes"
|
|
|
|
#define VENDOR_TERMS "vendor_terms"
|
|
|
|
#define VENDOR_TAX_INC "vendor_tax_included"
|
|
|
|
#define VENDOR_ACTIVE "vendor_is_active"
|
2005-11-01 21:32:36 -06:00
|
|
|
#define VENDOR_TAX_OVERRIDE "override_tax_table"
|
2011-03-20 14:17:11 -05:00
|
|
|
#define VENDOR_TAX_TABLE "vendor_tax_table"
|
2001-11-16 19:17:06 -06:00
|
|
|
|
2003-10-14 08:46:24 -05:00
|
|
|
/** deprecated functions */
|
|
|
|
#define gncVendorGetBook(X) qof_instance_get_book (QOF_INSTANCE(X))
|
|
|
|
#define gncVendorGetGUID(X) qof_instance_get_guid (QOF_INSTANCE(X))
|
2004-01-06 19:54:37 -06:00
|
|
|
#define gncVendorRetGUID(X) (X ? *(qof_instance_get_guid (QOF_INSTANCE(X))) : *(guid_null()))
|
2003-10-16 23:32:04 -05:00
|
|
|
#define gncVendorLookupDirect(G,B) gncVendorLookup((B),&(G))
|
2011-11-18 15:04:01 -06:00
|
|
|
/** Test support function, used by test-dbi-business-stuff.c */
|
|
|
|
gboolean gncVendorEqual(const GncVendor *a, const GncVendor *b);
|
|
|
|
gboolean gncVendorIsDirty (const GncVendor *vendor);
|
2023-01-23 07:57:38 -06:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2001-11-16 19:17:06 -06:00
|
|
|
#endif /* GNC_VENDOR_H_ */
|
2004-05-07 00:11:49 -05:00
|
|
|
/** @} */
|
|
|
|
/** @} */
|