|
GnuCash 2.3.0
|
Files | |
| file | gncEntry.h |
Business Entry Interface. | |
Defines | |
| #define | GNC_ID_ENTRY "gncEntry" |
| #define | GNC_TYPE_ENTRY (gnc_entry_get_type ()) |
| #define | GNC_ENTRY(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GNC_TYPE_ENTRY, GncEntry)) |
| #define | GNC_ENTRY_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GNC_TYPE_ENTRY, GncEntryClass)) |
| #define | GNC_IS_ENTRY(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GNC_TYPE_ENTRY)) |
| #define | GNC_IS_ENTRY_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GNC_TYPE_ENTRY)) |
| #define | GNC_ENTRY_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GNC_TYPE_ENTRY, GncEntryClass)) |
| #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 struct _gncEntry | GncEntry |
| typedef struct _gncEntryClass | GncEntryClass |
Enumerations | |
| enum | GncEntryPaymentType { GNC_PAYMENT_CASH = 1, GNC_PAYMENT_CARD } |
| enum | GncDiscountHow { GNC_DISC_PRETAX = 1, GNC_DISC_SAMETIME, GNC_DISC_POSTTAX } |
Functions | |
| GType | gnc_entry_get_type (void) |
| 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) |
| GncOrder * | gncEntryGetOrder (const GncEntry *entry) |
| GncInvoice * | gncEntryGetInvoice (const GncEntry *entry) |
| GncInvoice * | gncEntryGetBill (const GncEntry *entry) |
| gboolean | gncEntryIsOpen (const GncEntry *entry) |
| void | gncEntryBeginEdit (GncEntry *entry) |
| void | gncEntryCommitEdit (GncEntry *entry) |
| int | gncEntryCompare (const GncEntry *a, const GncEntry *b) |
Create/Destroy Functions | |
| GncEntry * | gncEntryCreate (QofBook *book) |
| void | gncEntryDestroy (GncEntry *entry) |
Generic (shared) data | |
| void | gncEntrySetDateGDate (GncEntry *entry, const GDate *date) |
| 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) |
| GDate | gncEntryGetDateGDate (const GncEntry *entry) |
| Timespec | gncEntryGetDate (const GncEntry *entry) |
| Timespec | gncEntryGetDateEntered (const GncEntry *entry) |
| const char * | gncEntryGetDescription (const GncEntry *entry) |
| const char * | gncEntryGetAction (const GncEntry *entry) |
| const char * | gncEntryGetNotes (const GncEntry *notes) |
| gnc_numeric | gncEntryGetQuantity (const GncEntry *entry) |
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) |
| Account * | gncEntryGetInvAccount (const GncEntry *entry) |
| gnc_numeric | gncEntryGetInvPrice (const GncEntry *entry) |
| gnc_numeric | gncEntryGetInvDiscount (const GncEntry *entry) |
| GncAmountType | gncEntryGetInvDiscountType (const GncEntry *entry) |
| GncDiscountHow | gncEntryGetInvDiscountHow (const GncEntry *entry) |
| char * | qofEntryGetInvDiscType (const GncEntry *entry) |
| char * | qofEntryGetInvDiscHow (const GncEntry *entry) |
| gboolean | gncEntryGetInvTaxable (const GncEntry *entry) |
| gboolean | gncEntryGetInvTaxIncluded (const GncEntry *entry) |
| GncTaxTable * | gncEntryGetInvTaxTable (const GncEntry *entry) |
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) |
| Account * | gncEntryGetBillAccount (const GncEntry *entry) |
| gnc_numeric | gncEntryGetBillPrice (const GncEntry *entry) |
| gboolean | gncEntryGetBillTaxable (const GncEntry *entry) |
| gboolean | gncEntryGetBillTaxIncluded (const GncEntry *entry) |
| GncTaxTable * | gncEntryGetBillTaxTable (const GncEntry *entry) |
| gboolean | gncEntryGetBillable (const GncEntry *entry) |
| GncOwner * | gncEntryGetBillTo (GncEntry *entry) |
| GncEntryPaymentType | gncEntryGetBillPayment (const GncEntry *entry) |
employee-stuff | |
| void | gncEntrySetBillPayment (GncEntry *entry, GncEntryPaymentType type) |
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. | |
| typedef GList | AccountValueList |
| gnc_numeric | gncEntryReturnValue (GncEntry *entry, gboolean is_inv) |
| gnc_numeric | gncEntryReturnDiscountValue (GncEntry *entry, gboolean is_inv) |
| gnc_numeric | gncEntryReturnTaxValue (GncEntry *entry, gboolean is_inv) |
| AccountValueList * | 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, const GncTaxTable *tax_table, gboolean tax_included, gnc_numeric discount, GncAmountType discount_type, GncDiscountHow discount_how, int SCU, gnc_numeric *value, gnc_numeric *discount_value, GList **tax_values) |
| 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 111 of file gncEntry.c.
{
switch (how)
{
GNC_RETURN_ENUM_AS_STRING(GNC_DISC_PRETAX, "PRETAX");
GNC_RETURN_ENUM_AS_STRING(GNC_DISC_SAMETIME, "SAMETIME");
GNC_RETURN_ENUM_AS_STRING(GNC_DISC_POSTTAX, "POSTTAX");
default:
g_warning ("asked to translate unknown discount-how %d.\n", how);
break;
}
return(NULL);
}
DEPRECATED - use gncEntryGetDateGDate() instead! (Because the time-of-day is a misleading extra information. We are only dealing with the day information!
Definition at line 811 of file gncEntry.c.
{
Timespec ts;
ts.tv_sec = 0;
ts.tv_nsec = 0;
if (!entry) return ts;
return entry->date;
}
| GDate gncEntryGetDateGDate | ( | const GncEntry * | entry | ) |
Returns the day of this entry
Definition at line 820 of file gncEntry.c.
{
return timespec_to_gdate(gncEntryGetDate(entry));
}
| 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 SCU is the target denominator of the value and tax -- it should be the account or commodity SCU of the target.
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 1316 of file gncEntry.c.
{
if (!entry) return;
gncEntryRecomputeValues (entry);
if (value)
*value = (is_inv ? entry->i_value : entry->b_value);
if (discount_value)
*discount_value = (is_inv ? entry->i_disc_value : gnc_numeric_zero());
if (tax_value)
*tax_value = (is_inv ? entry->i_tax_value : entry->b_tax_value);
if (tax_values)
*tax_values = (is_inv ? entry->i_tax_values : entry->b_tax_values);
}
DEPRECATED - use gncEntrySetDateGDate() instead! (Because the time-of-day is a misleading extra information. We are only dealing with the day information!
Definition at line 424 of file gncEntry.c.
{
gboolean first_date = FALSE;
Timespec zero_time = { 0, 0 };
if (!entry) return;
if (timespec_equal (&entry->date, &date)) return;
if (timespec_equal (&entry->date, &zero_time))
first_date = TRUE;
gncEntryBeginEdit (entry);
entry->date = date;
mark_entry (entry);
gncEntryCommitEdit (entry);
/* Don't re-sort the first time we set the date on this entry */
if (!first_date)
{
if (entry->invoice)
gncInvoiceSortEntries(entry->invoice);
if (entry->bill)
gncInvoiceSortEntries(entry->bill);
}
}
| void gncEntrySetDateGDate | ( | GncEntry * | entry, |
| const GDate * | date | ||
| ) |
Set the date of this entry
Definition at line 448 of file gncEntry.c.
{
if (!entry || !date || !g_date_valid(date))
return;
/* Watch out: Here we are deviating from the initial convention that a
GDate always converts to the start time of the day. Instead, the GDate is
converted to "noon" on the respective date. This is not nice, but this
convention was used for the Timespec of GncEntry all the time, so we better
stick to it.*/
gncEntrySetDate(entry, timespecCanonicalDayTime(gdate_to_timespec(*date)));
}
1.7.4