2001-11-21 19:23:07 -06:00
|
|
|
/*
|
|
|
|
* gncEntry.h -- the Core Business Entry Interface
|
|
|
|
* Copyright (C) 2001 Derek Atkins
|
|
|
|
* Author: Derek Atkins <warlord@MIT.EDU>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef GNC_ENTRY_H_
|
|
|
|
#define GNC_ENTRY_H_
|
|
|
|
|
|
|
|
typedef struct _gncEntry GncEntry;
|
|
|
|
|
|
|
|
#include "date.h"
|
2001-11-24 23:34:34 -06:00
|
|
|
#include "gnc-book.h"
|
2001-11-21 19:23:07 -06:00
|
|
|
#include "gncOrder.h"
|
|
|
|
#include "gncInvoice.h"
|
|
|
|
|
|
|
|
#define GNC_ENTRY_MODULE_NAME "gncEntry"
|
|
|
|
|
2001-11-23 23:35:08 -06:00
|
|
|
/* How to interpret the Discount and Tax numbers.. You can interpret
|
|
|
|
* the as a VALUE or a PERCENT. Similarly, you can set the PRETAX
|
|
|
|
* bit if you want the discount to be applied before a percentage-tax.
|
|
|
|
*/
|
|
|
|
#define GNC_ENTRY_INTERP_VALUE 0x00
|
|
|
|
#define GNC_ENTRY_INTERP_PERCENT 0x01
|
2001-11-26 17:30:33 -06:00
|
|
|
#define GNC_ENTRY_PRETAX_FLAG 0x02
|
2001-11-23 23:35:08 -06:00
|
|
|
|
|
|
|
#define GNC_ENTRY_INTERP_IS_VALUE(x) (((x)&0x01) == GNC_ENTRY_INTERP_VALUE)
|
|
|
|
#define GNC_ENTRY_INTERP_IS_PERCENT(x) (((x)&0x01) == GNC_ENTRY_INTERP_PERCENT)
|
|
|
|
|
2001-11-21 19:23:07 -06:00
|
|
|
/* Create/Destroy Functions */
|
|
|
|
|
2001-11-24 23:34:34 -06:00
|
|
|
GncEntry *gncEntryCreate (GNCBook *book);
|
2001-11-21 19:23:07 -06:00
|
|
|
void gncEntryDestroy (GncEntry *entry);
|
|
|
|
|
|
|
|
/* Set Functions */
|
|
|
|
|
|
|
|
void gncEntrySetDate (GncEntry *entry, Timespec *date);
|
|
|
|
void gncEntrySetDescription (GncEntry *entry, const char *desc);
|
|
|
|
void gncEntrySetAction (GncEntry *entry, const char *action);
|
|
|
|
void gncEntrySetQuantity (GncEntry *entry, gnc_numeric quantity);
|
|
|
|
void gncEntrySetPrice (GncEntry *entry, gnc_numeric price);
|
|
|
|
void gncEntrySetTax (GncEntry *entry, gnc_numeric tax);
|
2001-11-23 23:35:08 -06:00
|
|
|
void gncEntrySetTaxType (GncEntry *entry, gint type);
|
2001-11-21 19:23:07 -06:00
|
|
|
void gncEntrySetDiscount (GncEntry *entry, gnc_numeric discount);
|
2001-11-23 23:35:08 -06:00
|
|
|
void gncEntrySetDiscountType (GncEntry *entry, gint type);
|
2001-11-21 19:23:07 -06:00
|
|
|
|
|
|
|
void gncEntrySetAccount (GncEntry *entry, Account *acc);
|
|
|
|
void gncEntrySetTaxAccount (GncEntry *entry, Account *acc);
|
|
|
|
|
|
|
|
/* Get Functions */
|
|
|
|
|
2001-11-24 23:34:34 -06:00
|
|
|
GNCBook * gncEntryGetBook (GncEntry *entry);
|
2001-11-21 19:23:07 -06:00
|
|
|
const GUID * gncEntryGetGUID (GncEntry *entry);
|
|
|
|
Timespec gncEntryGetDate (GncEntry *entry);
|
|
|
|
const char * gncEntryGetDescription (GncEntry *entry);
|
|
|
|
const char * gncEntryGetAction (GncEntry *entry);
|
|
|
|
gnc_numeric gncEntryGetQuantity (GncEntry *entry);
|
|
|
|
gnc_numeric gncEntryGetPrice (GncEntry *entry);
|
|
|
|
gnc_numeric gncEntryGetTax (GncEntry *entry);
|
2001-11-23 23:35:08 -06:00
|
|
|
gint gncEntryGetTaxType (GncEntry *entry);
|
2001-11-26 17:30:33 -06:00
|
|
|
const char * gncEntryGetTaxTypeStr (gint type);
|
2001-11-21 19:23:07 -06:00
|
|
|
gnc_numeric gncEntryGetDiscount (GncEntry *entry);
|
2001-11-23 23:35:08 -06:00
|
|
|
gint gncEntryGetDiscountType (GncEntry *entry);
|
2001-11-26 17:30:33 -06:00
|
|
|
const char * gncEntryGetDiscountTypeStr (gint type);
|
2001-11-23 23:35:08 -06:00
|
|
|
|
2001-11-26 17:30:33 -06:00
|
|
|
gint gncEntryGetTypeFromStr (const char *type);
|
2001-11-21 19:23:07 -06:00
|
|
|
|
|
|
|
Account * gncEntryGetAccount (GncEntry *entry);
|
|
|
|
Account * gncEntryGetTaxAccount (GncEntry *entry);
|
|
|
|
|
|
|
|
GncOrder * gncEntryGetOrder (GncEntry *entry);
|
|
|
|
GncInvoice * gncEntryGetInvoice (GncEntry *entry);
|
|
|
|
|
2001-11-24 23:34:34 -06:00
|
|
|
GncEntry * gncEntryLookup (GNCBook *book, const GUID *guid);
|
2001-11-21 19:23:07 -06:00
|
|
|
|
|
|
|
void gncEntryCommitEdit (GncEntry *entry);
|
|
|
|
|
|
|
|
#endif /* GNC_ENTRY_H_ */
|