GnuCash  5.6-150-g038405b370+
Data Structures | Macros | Enumerations | Functions

Business Interface: Object OWNERs. More...

#include "qof.h"
#include "gncCustomer.h"
#include "gncJob.h"
#include "gncVendor.h"
#include "gncEmployee.h"
#include "gncInvoice.h"
#include "Account.h"
#include "gnc-lot.h"

Go to the source code of this file.

Data Structures

struct  GncOwner
 

Macros

#define GNC_ID_OWNER   "gncOwner"
 
#define OWNER_TYPE   "type"
 
#define OWNER_TYPE_STRING   "type-string"
 Allows the type to be handled externally. More...
 
#define OWNER_CUSTOMER   "customer"
 
#define OWNER_JOB   "job"
 
#define OWNER_VENDOR   "vendor"
 
#define OWNER_EMPLOYEE   "employee"
 
#define OWNER_PARENT   "parent"
 
#define OWNER_PARENTG   "parent-guid"
 
#define OWNER_NAME   "name"
 
#define OWNER_FROM_LOT   "owner-from-lot"
 

Enumerations

enum  GncOwnerType {
  GNC_OWNER_NONE, GNC_OWNER_UNDEFINED, GNC_OWNER_CUSTOMER, GNC_OWNER_JOB,
  GNC_OWNER_VENDOR, GNC_OWNER_EMPLOYEE
}
 

Functions

void gncOwnerCopy (const GncOwner *src, GncOwner *dest)
 
const GncGUIDgncOwnerGetGUID (const GncOwner *owner)
 Get the GncGUID of the immediate owner.
 
GncGUID gncOwnerRetGUID (GncOwner *owner)
 
const GncOwnergncOwnerGetEndOwner (const GncOwner *owner)
 Get the "parent" Owner or GncGUID thereof. More...
 
const GncGUIDgncOwnerGetEndGUID (const GncOwner *owner)
 
void gncOwnerAttachToLot (const GncOwner *owner, GNCLot *lot)
 Attach an owner to a lot.
 
gboolean gncOwnerLotMatchOwnerFunc (GNCLot *lot, gpointer user_data)
 Helper function used to filter a list of lots by owner.
 
gint gncOwnerLotsSortFunc (GNCLot *lotA, GNCLot *lotB)
 Helper function used to sort lots by date. More...
 
gboolean gncOwnerGetOwnerFromLot (GNCLot *lot, GncOwner *owner)
 Get the owner from the lot. More...
 
gboolean gncOwnerGetOwnerFromTxn (Transaction *txn, GncOwner *owner)
 Convenience function to get the owner from a transaction. More...
 
gboolean gncOwnerGetOwnerFromTypeGuid (QofBook *book, GncOwner *owner, QofIdType type, GncGUID *guid)
 
GNCLot * gncOwnerCreatePaymentLotSecs (const GncOwner *owner, Transaction **preset_txn, Account *posted_acc, Account *xfer_acc, gnc_numeric amount, gnc_numeric exch, time64 date, const char *memo, const char *num)
 Create a lot for a payment to the owner using the other parameters passed in. More...
 
void gncOwnerAutoApplyPaymentsWithLots (const GncOwner *owner, GList *lots)
 Given a list of lots, try to balance as many of them as possible by creating balancing transactions between them. More...
 
void gncOwnerApplyPaymentSecs (const GncOwner *owner, Transaction **preset_txn, GList *lots, Account *posted_acc, Account *xfer_acc, gnc_numeric amount, gnc_numeric exch, time64 date, const char *memo, const char *num, gboolean auto_pay)
 A convenience function to apply a payment to the owner. More...
 
Split * gncOwnerFindOffsettingSplit (GNCLot *lot, gnc_numeric target_amount)
 Helper function to find a split in lot that best offsets target_amount Obviously it should be of opposite sign. More...
 
gboolean gncOwnerReduceSplitTo (Split *split, gnc_numeric target_amount)
 Helper function to reduce the amount of a split to target_amount. More...
 
void gncOwnerSetLotLinkMemo (Transaction *ll_txn)
 To help a user understand what a lot link transaction does, we set the memo to name all documents involved in the link. More...
 
GList * gncOwnerGetAccountTypesList (const GncOwner *owner)
 Returns a GList of account-types based on the owner type.
 
GList * gncOwnerGetCommoditiesList (const GncOwner *owner)
 Returns a GList of currencies associated with the owner.
 
gnc_numeric gncOwnerGetBalanceInCurrency (const GncOwner *owner, const gnc_commodity *report_currency)
 Given an owner, extract the open balance from the owner and then convert it to the desired currency.
 
GncOwnergncOwnerNew (void)
 These two functions are mainly for the convenience of scheme code. More...
 
void gncOwnerFree (GncOwner *owner)
 
void gncOwnerBeginEdit (GncOwner *owner)
 These are convenience wrappers around gnc{Vendor,Customer,Job,Employee}* functions. More...
 
void gncOwnerCommitEdit (GncOwner *owner)
 
void gncOwnerDestroy (GncOwner *owner)
 
QOF handling

Whilst GncOwner is not a formal QOF object, these functions are still expected to be useful in making GncOwner transparent to QOF as they can be used by objects like GncInvoice.

QofIdTypeConst qofOwnerGetType (const GncOwner *owner)
 return the type for the collection. More...
 
const char * gncOwnerGetTypeString (const GncOwner *owner)
 return the type for the owner as an untranslated string. More...
 
QofInstanceqofOwnerGetOwner (const GncOwner *owner)
 return the owner itself as an entity. More...
 
void qofOwnerSetEntity (GncOwner *owner, QofInstance *ent)
 set the owner from the entity. More...
 
gboolean GNC_IS_OWNER (QofInstance *ent)
 Check if entity is an owner kind. More...
 
QofIdTypeConst gncOwnerTypeToQofIdType (GncOwnerType t)
 Returns the QofIdType of the given GncOwnerType, or NULL if no suitable one exists. More...
 
gboolean gncOwnerRegister (void)
 
Setup routines
void gncOwnerInitUndefined (GncOwner *owner, gpointer obj)
 
void gncOwnerInitCustomer (GncOwner *owner, GncCustomer *customer)
 
void gncOwnerInitJob (GncOwner *owner, GncJob *job)
 
void gncOwnerInitVendor (GncOwner *owner, GncVendor *vendor)
 
void gncOwnerInitEmployee (GncOwner *owner, GncEmployee *employee)
 
Get routines.
GncOwnerType gncOwnerGetType (const GncOwner *owner)
 Returns the GncOwnerType of this owner. More...
 
gboolean gncOwnerIsValid (const GncOwner *owner)
 Returns TRUE if the given owner is one of the valid objects. More...
 
gpointer gncOwnerGetUndefined (const GncOwner *owner)
 If the given owner is of type GNC_OWNER_UNDEFINED, returns the undefined pointer, which is usually NULL. More...
 
GncCustomergncOwnerGetCustomer (const GncOwner *owner)
 If the given owner is of type GNC_OWNER_CUSTOMER, returns the pointer to the customer object. More...
 
GncJob * gncOwnerGetJob (const GncOwner *owner)
 If the given owner is of type GNC_OWNER_JOB, returns the pointer to the job object. More...
 
GncVendor * gncOwnerGetVendor (const GncOwner *owner)
 If the given owner is of type GNC_OWNER_VENDOR, returns the pointer to the vendor object. More...
 
GncEmployee * gncOwnerGetEmployee (const GncOwner *owner)
 If the given owner is of type GNC_OWNER_EMPLOYEE, returns the pointer to the employee object. More...
 
const char * gncOwnerGetID (const GncOwner *owner)
 
const char * gncOwnerGetName (const GncOwner *owner)
 
GncAddressgncOwnerGetAddr (const GncOwner *owner)
 
gboolean gncOwnerGetActive (const GncOwner *owner)
 
gnc_commodity * gncOwnerGetCurrency (const GncOwner *owner)
 
Set routines.
void gncOwnerSetActive (const GncOwner *owner, gboolean active)
 
Comparison routines.
gboolean gncOwnerEqual (const GncOwner *a, const GncOwner *b)
 Assess equality by checking. More...
 
int gncOwnerGCompareFunc (const GncOwner *a, const GncOwner *b)
 Same as gncOwnerEqual, but returns 0 if equal to be used as a GList custom compare function.
 
int gncOwnerCompare (const GncOwner *a, const GncOwner *b)
 Sort on name.
 

Detailed Description

Business Interface: Object OWNERs.

Author
Copyright (C) 2001,2002 Derek Atkins warlo.nosp@m.rd@M.nosp@m.IT.ED.nosp@m.U
Copyright (c) 2005 Neil Williams linux.nosp@m.@cod.nosp@m.ehelp.nosp@m..co..nosp@m.uk
Copyright (c) 2006 David Hampton hampt.nosp@m.on@e.nosp@m.mploy.nosp@m.ees..nosp@m.org

Definition in file gncOwner.h.