GnuCash  2.6.99
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Files | Data Structures | Macros | Typedefs | Functions
Customer

Files

file  gncCustomer.h
 Core Customer Interface.
 

Data Structures

struct  GncCustomer
 

Macros

#define GNC_ID_CUSTOMER   "gncCustomer"
 
#define GNC_TYPE_CUSTOMER   (gnc_customer_get_type ())
 
#define GNC_CUSTOMER(o)   (G_TYPE_CHECK_INSTANCE_CAST ((o), GNC_TYPE_CUSTOMER, GncCustomer))
 
#define GNC_CUSTOMER_CLASS(k)   (G_TYPE_CHECK_CLASS_CAST((k), GNC_TYPE_CUSTOMER, GncCustomerClass))
 
#define GNC_IS_CUSTOMER(o)   (G_TYPE_CHECK_INSTANCE_TYPE ((o), GNC_TYPE_CUSTOMER))
 
#define GNC_IS_CUSTOMER_CLASS(k)   (G_TYPE_CHECK_CLASS_TYPE ((k), GNC_TYPE_CUSTOMER))
 
#define GNC_CUSTOMER_GET_CLASS(o)   (G_TYPE_INSTANCE_GET_CLASS ((o), GNC_TYPE_CUSTOMER, GncCustomerClass))
 
#define CUSTOMER_ID   "id"
 
#define CUSTOMER_NAME   "name"
 
#define CUSTOMER_ADDR   "addr"
 
#define CUSTOMER_SHIPADDR   "shipaddr"
 
#define CUSTOMER_NOTES   "notes"
 
#define CUSTOMER_DISCOUNT   "amount of discount"
 
#define CUSTOMER_CREDIT   "amount of credit"
 
#define CUSTOMER_TT_OVER   "tax table override"
 
#define CUSTOMER_TAX_INC   "customer_tax_included"
 
#define CUSTOMER_TERMS   "customer_terms"
 
#define CUSTOMER_ACTIVE   "customer_is_active"
 
#define CUSTOMER_SLOTS   "customer_values"
 
#define gncCustomerGetGUID(x)   qof_instance_get_guid(QOF_INSTANCE(x))
 
#define gncCustomerRetGUID(x)   (x ? *(qof_instance_get_guid(QOF_INSTANCE(x))) : *(guid_null()))
 
#define gncCustomerGetBook(x)   qof_instance_get_book(QOF_INSTANCE(x))
 
#define gncCustomerLookupDirect(g, b)   gncCustomerLookup((b), &(g))
 

Typedefs

typedef struct _gncCustomer GncCustomer
 
typedef struct _gncCustomerClass GncCustomerClass
 

Functions

GType gnc_customer_get_type (void)
 
int gncCustomerCompare (const GncCustomer *a, const GncCustomer *b)
 
gboolean gncCustomerEqual (const GncCustomer *a, const GncCustomer *b)
 
GList * gncCustomerGetJoblist (const GncCustomer *customer, gboolean show_all)
 
gboolean gncCustomerIsDirty (GncCustomer *customer)
 

Create/Destroy Functions

GncCustomergncCustomerCreate (QofBook *book)
 
void gncCustomerDestroy (GncCustomer *customer)
 
void gncCustomerBeginEdit (GncCustomer *customer)
 
void gncCustomerCommitEdit (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)
 
void gncCustomerSetTerms (GncCustomer *customer, GncBillTerm *term)
 
void gncCustomerSetTaxIncluded (GncCustomer *customer, GncTaxIncluded taxincl)
 
void gncCustomerSetActive (GncCustomer *customer, gboolean active)
 
void gncCustomerSetDiscount (GncCustomer *customer, gnc_numeric discount)
 
void gncCustomerSetCredit (GncCustomer *customer, gnc_numeric credit)
 
void gncCustomerSetCurrency (GncCustomer *customer, gnc_commodity *currency)
 
void gncCustomerSetTaxTableOverride (GncCustomer *customer, gboolean override)
 
void gncCustomerSetTaxTable (GncCustomer *customer, GncTaxTable *table)
 
void gncCustomerAddJob (GncCustomer *customer, GncJob *job)
 
void gncCustomerRemoveJob (GncCustomer *customer, GncJob *job)
 

Get Functions

const char * gncCustomerGetID (const GncCustomer *customer)
 
const char * gncCustomerGetName (const GncCustomer *customer)
 
GncAddressgncCustomerGetAddr (const GncCustomer *customer)
 
GncAddressgncCustomerGetShipAddr (const GncCustomer *customer)
 
const char * gncCustomerGetNotes (const GncCustomer *customer)
 
GncBillTermgncCustomerGetTerms (const GncCustomer *customer)
 
GncTaxIncluded gncCustomerGetTaxIncluded (const GncCustomer *customer)
 
gboolean gncCustomerGetActive (const GncCustomer *customer)
 
gnc_numeric gncCustomerGetDiscount (const GncCustomer *customer)
 
gnc_numeric gncCustomerGetCredit (const GncCustomer *customer)
 
gnc_commoditygncCustomerGetCurrency (const GncCustomer *customer)
 
gboolean gncCustomerGetTaxTableOverride (const GncCustomer *customer)
 
GncTaxTablegncCustomerGetTaxTable (const GncCustomer *customer)
 

Detailed Description

Macro Definition Documentation

#define gncCustomerGetGUID (   x)    qof_instance_get_guid(QOF_INSTANCE(x))
Deprecated:
functions, should be removed

Definition at line 156 of file gncCustomer.h.

Function Documentation

gboolean gncCustomerEqual ( const GncCustomer a,
const GncCustomer b 
)

Test support function, used in gets-dbi-business-stuff.c

Definition at line 741 of file gncCustomer.c.

742 {
743  if (a == NULL && b == NULL) return TRUE;
744  if (a == NULL || b == NULL) return FALSE;
745 
746  g_return_val_if_fail(GNC_IS_CUSTOMER(a), FALSE);
747  g_return_val_if_fail(GNC_IS_CUSTOMER(b), FALSE);
748 
749  if (g_strcmp0(a->id, b->id) != 0)
750  {
751  PWARN("IDs differ: %s vs %s", a->id, b->id);
752  return FALSE;
753  }
754 
755  if (g_strcmp0(a->name, b->name) != 0)
756  {
757  PWARN("Names differ: %s vs %s", a->name, b->name);
758  return FALSE;
759  }
760 
761  if (g_strcmp0(a->notes, b->notes) != 0)
762  {
763  PWARN("Notes differ: %s vs %s", a->notes, b->notes);
764  return FALSE;
765  }
766 
767  if (!gncBillTermEqual(a->terms, b->terms))
768  {
769  PWARN("Bill terms differ");
770  return FALSE;
771  }
772 
773  if (!gnc_commodity_equal(a->currency, b->currency))
774  {
775  PWARN("currencies differ");
776  return FALSE;
777  }
778 
779  if (!gncTaxTableEqual(a->taxtable, b->taxtable))
780  {
781  PWARN("tax tables differ");
782  return FALSE;
783  }
784 
785  if (a->taxtable_override != b->taxtable_override)
786  {
787  PWARN("Tax table override flags differ");
788  return FALSE;
789  }
790 
791  if (a->taxincluded != b->taxincluded)
792  {
793  PWARN("Tax included flags differ");
794  return FALSE;
795  }
796 
797  if (a->active != b->active)
798  {
799  PWARN("Active flags differ");
800  return FALSE;
801  }
802 
803  if (!gncAddressEqual(a->addr, b->addr))
804  {
805  PWARN("addresses differ");
806  return FALSE;
807  }
808  if (!gncAddressEqual(a->shipaddr, b->shipaddr))
809  {
810  PWARN("addresses differ");
811  return FALSE;
812  }
813 
814  if (!gnc_numeric_equal(a->credit, b->credit))
815  {
816  PWARN("Credit amounts differ");
817  return FALSE;
818  }
819 
820  if (!gnc_numeric_equal(a->discount, b->discount))
821  {
822  PWARN("Discount amounts differ");
823  return FALSE;
824  }
825 
826  /* FIXME: Need to check jobs list
827  GList * jobs;
828  */
829 
830  return TRUE;
831 }
gboolean gnc_numeric_equal(gnc_numeric a, gnc_numeric b)
gboolean gnc_commodity_equal(const gnc_commodity *a, const gnc_commodity *b)
gboolean gncBillTermEqual(const GncBillTerm *a, const GncBillTerm *b)
Definition: gncBillTerm.c:647
#define PWARN(format, args...)
Definition: qoflog.h:243
gboolean gncAddressEqual(const GncAddress *a, const GncAddress *b)
Deeply compare two addresses.
Definition: gncAddress.c:579