Entry
[Business]


Files

file  gncEntry.h
 Business Entry Interface.

Create/Destroy Functions

GncEntrygncEntryCreate (QofBook *book)
void gncEntryDestroy (GncEntry *entry)

Generic (shared) data

void gncEntrySetDate (GncEntry *entry, Timespec date)
void gncEntrySetDateEntered (GncEntry *entry, Timespec date)
void gncEntrySetDescription (GncEntry *entry, const char *desc)
void gncEntrySetAction (GncEntry *entry, const char *action)
void gncEntrySetNotes (GncEntry *entry, const char *notes)
void gncEntrySetQuantity (GncEntry *entry, gnc_numeric quantity)

Customer Invoices

void gncEntrySetInvAccount (GncEntry *entry, Account *acc)
void gncEntrySetInvPrice (GncEntry *entry, gnc_numeric price)
void gncEntrySetInvTaxable (GncEntry *entry, gboolean taxable)
void gncEntrySetInvTaxIncluded (GncEntry *entry, gboolean tax_included)
void gncEntrySetInvTaxTable (GncEntry *entry, GncTaxTable *table)
void gncEntrySetInvDiscount (GncEntry *entry, gnc_numeric discount)
void gncEntrySetInvDiscountType (GncEntry *entry, GncAmountType type)
void gncEntrySetInvDiscountHow (GncEntry *entry, GncDiscountHow how)
void qofEntrySetInvDiscType (GncEntry *entry, const char *type)
void qofEntrySetInvDiscHow (GncEntry *entry, const char *type)

Vendor Bills (and Employee Expenses)

void gncEntrySetBillAccount (GncEntry *entry, Account *acc)
void gncEntrySetBillPrice (GncEntry *entry, gnc_numeric price)
void gncEntrySetBillTaxable (GncEntry *entry, gboolean taxable)
void gncEntrySetBillTaxIncluded (GncEntry *entry, gboolean tax_included)
void gncEntrySetBillTaxTable (GncEntry *entry, GncTaxTable *table)
void gncEntrySetBillable (GncEntry *entry, gboolean billable)
void gncEntrySetBillTo (GncEntry *entry, GncOwner *billto)

employee-stuff

void gncEntrySetBillPayment (GncEntry *entry, GncEntryPaymentType type)

Generic (shared) data

Timespec gncEntryGetDate (GncEntry *entry)
Timespec gncEntryGetDateEntered (GncEntry *entry)
const char * gncEntryGetDescription (GncEntry *entry)
const char * gncEntryGetAction (GncEntry *entry)
const char * gncEntryGetNotes (GncEntry *notes)
gnc_numeric gncEntryGetQuantity (GncEntry *entry)

Customer Invoices

AccountgncEntryGetInvAccount (GncEntry *entry)
gnc_numeric gncEntryGetInvPrice (GncEntry *entry)
gnc_numeric gncEntryGetInvDiscount (GncEntry *entry)
GncAmountType gncEntryGetInvDiscountType (GncEntry *entry)
GncDiscountHow gncEntryGetInvDiscountHow (GncEntry *entry)
char * qofEntryGetInvDiscType (GncEntry *entry)
char * qofEntryGetInvDiscHow (GncEntry *entry)
gboolean gncEntryGetInvTaxable (GncEntry *entry)
gboolean gncEntryGetInvTaxIncluded (GncEntry *entry)
GncTaxTablegncEntryGetInvTaxTable (GncEntry *entry)

Vendor Bills (and Employee Expenses)

AccountgncEntryGetBillAccount (GncEntry *entry)
gnc_numeric gncEntryGetBillPrice (GncEntry *entry)
gboolean gncEntryGetBillTaxable (GncEntry *entry)
gboolean gncEntryGetBillTaxIncluded (GncEntry *entry)
GncTaxTablegncEntryGetBillTaxTable (GncEntry *entry)
gboolean gncEntryGetBillable (GncEntry *entry)
GncOwnergncEntryGetBillTo (GncEntry *entry)
GncEntryPaymentType gncEntryGetBillPayment (GncEntry *entry)

Getting Values

The first three return the rounded values -- the last returns the list of unrounded account-values. The list belongs to the entry and will be destroyed, so use it quickly.

gnc_numeric gncEntryReturnValue (GncEntry *entry, gboolean is_inv)
gnc_numeric gncEntryReturnDiscountValue (GncEntry *entry, gboolean is_inv)
gnc_numeric gncEntryReturnTaxValue (GncEntry *entry, gboolean is_inv)
GList * gncEntryReturnTaxValues (GncEntry *entry, gboolean is_inv)
void gncEntryGetValue (GncEntry *entry, gboolean is_inv, gnc_numeric *value, gnc_numeric *discount, gnc_numeric *tax_value, GList **tax_values)
void gncEntryComputeValue (gnc_numeric qty, gnc_numeric price, GncTaxTable *tax_table, gboolean tax_included, gnc_numeric discount, GncAmountType discount_type, GncDiscountHow discount_how, gnc_numeric *value, gnc_numeric *discount_value, GList **tax_values)

Defines

#define GNC_ID_ENTRY   "gncEntry"
#define GNC_IS_ENTRY(obj)   (QOF_CHECK_TYPE((obj), GNC_ID_ENTRY))
#define GNC_ENTRY(obj)   (QOF_CHECK_CAST((obj), GNC_ID_ENTRY, GncEntry))
#define gncEntryLookup(book, guid)   QOF_BOOK_LOOKUP_ENTITY((book),(guid),GNC_ID_ENTRY, GncEntry)
#define ENTRY_DATE   "date"
#define ENTRY_DATE_ENTERED   "date-entered"
#define ENTRY_DESC   "desc"
#define ENTRY_ACTION   "action"
#define ENTRY_NOTES   "notes"
#define ENTRY_QTY   "qty"
#define ENTRY_IPRICE   "iprice"
#define ENTRY_IACCT   "invoice-account"
#define ENTRY_BACCT   "bill-account"
#define ENTRY_BPRICE   "bprice"
#define ENTRY_BILLABLE   "billable?"
#define ENTRY_BILLTO   "bill-to"
#define ENTRY_ORDER   "order"
#define ENTRY_INVOICE   "invoice"
#define ENTRY_BILL   "bill"
#define ENTRY_INV_DISC_TYPE   "discount-type"
#define ENTRY_INV_DISC_HOW   "discount-method"
#define ENTRY_INV_TAXABLE   "invoice-taxable"
#define ENTRY_BILL_TAXABLE   "bill-taxable"
#define ENTRY_INV_TAX_INC   "invoice-tax-included"
#define ENTRY_BILL_TAX_INC   "bill-tax-included"
#define ENTRY_INV_DISCOUNT   "invoice-discount"
#define ENTRY_BILL_PAY_TYPE   "bill-payment-type"
#define gncEntryGetGUID(x)   qof_instance_get_guid(QOF_INSTANCE(x))

Typedefs

typedef _gncEntry GncEntry

Enumerations

enum  GncEntryPaymentType { GNC_PAYMENT_CASH = 1, GNC_PAYMENT_CARD }
enum  GncDiscountHow { GNC_DISC_PRETAX = 1, GNC_DISC_SAMETIME, GNC_DISC_POSTTAX }

Functions

const char * gncEntryDiscountHowToString (GncDiscountHow how)
gboolean gncEntryDiscountStringToHow (const char *str, GncDiscountHow *how)
const char * gncEntryPaymentTypeToString (GncEntryPaymentType type)
gboolean gncEntryPaymentStringToType (const char *str, GncEntryPaymentType *type)
void gncEntryCopy (const GncEntry *src, GncEntry *dest)
GncOrdergncEntryGetOrder (GncEntry *entry)
GncInvoicegncEntryGetInvoice (GncEntry *entry)
GncInvoicegncEntryGetBill (GncEntry *entry)
gboolean gncEntryIsOpen (GncEntry *entry)
void gncEntryBeginEdit (GncEntry *entry)
void gncEntryCommitEdit (GncEntry *entry)
int gncEntryCompare (GncEntry *a, GncEntry *b)


Define Documentation

#define gncEntryLookup book,
guid   )     QOF_BOOK_LOOKUP_ENTITY((book),(guid),GNC_ID_ENTRY, GncEntry)
 

Return a pointer to the instance gncEntry 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 GncEntry * gncEntryLookup (QofBook *book, const GUID *guid);

Definition at line 211 of file gncEntry.h.


Function Documentation

const char* gncEntryDiscountHowToString GncDiscountHow  how  ) 
 

How to apply the discount and taxes. There are three distinct ways to apply them:

Type: discount tax PRETAX pretax pretax-discount SAMETIME pretax pretax POSTTAX pretax+tax pretax

Definition at line 123 of file gncEntry.c.

00124 {
00125   switch(how)
00126   {
00127     GNC_RETURN_ENUM_AS_STRING(GNC_DISC_PRETAX, "PRETAX");
00128     GNC_RETURN_ENUM_AS_STRING(GNC_DISC_SAMETIME, "SAMETIME");
00129     GNC_RETURN_ENUM_AS_STRING(GNC_DISC_POSTTAX, "POSTTAX");
00130     default:
00131       g_warning ("asked to translate unknown discount-how %d.\n", how);
00132       break;
00133   }
00134   return(NULL);
00135 }

void gncEntryGetValue GncEntry entry,
gboolean  is_inv,
gnc_numeric value,
gnc_numeric discount,
gnc_numeric tax_value,
GList **  tax_values
 

Compute the Entry value, tax-value, and discount_value, based on the quantity, price, discount, tax-table, and types. The value is the amount the merchant gets, the taxes are what the gov't gets, and the discount is how much the customer saved.

The tax_values list is the property of the entry and will be destroyed automatically, so use it quickly. Note that all return values from these two functions are NOT rounded.

Definition at line 1111 of file gncEntry.c.

01114 {
01115   if (!entry) return;
01116   gncEntryRecomputeValues (entry);
01117   if (value)
01118     *value = (is_inv ? entry->i_value : entry->b_value);
01119   if (discount_value)
01120     *discount_value = (is_inv ? entry->i_disc_value : gnc_numeric_zero());
01121   if (tax_value)
01122     *tax_value = (is_inv ? entry->i_tax_value : entry->b_tax_value);
01123   if (tax_values)
01124     *tax_values = (is_inv ? entry->i_tax_values : entry->b_tax_values);
01125 }


Generated on Sun Sep 4 18:09:07 2005 for GnuCash by  doxygen 1.4.3-20050530