36 #ifndef GNC_INVOICE_H_ 37 #define GNC_INVOICE_H_ 42 typedef GList GncInvoiceList;
57 #define GNC_ID_INVOICE "gncInvoice" 61 GNC_INVOICE_UNDEFINED ,
62 GNC_INVOICE_CUST_INVOICE ,
63 GNC_INVOICE_VEND_INVOICE ,
64 GNC_INVOICE_EMPL_INVOICE ,
65 GNC_INVOICE_CUST_CREDIT_NOTE ,
66 GNC_INVOICE_VEND_CREDIT_NOTE ,
67 GNC_INVOICE_EMPL_CREDIT_NOTE ,
75 #define GNC_TYPE_INVOICE (gnc_invoice_get_type ()) 76 #define GNC_INVOICE(o) \ 77 (G_TYPE_CHECK_INSTANCE_CAST ((o), GNC_TYPE_INVOICE, GncInvoice)) 78 #define GNC_INVOICE_CLASS(k) \ 79 (G_TYPE_CHECK_CLASS_CAST((k), GNC_TYPE_INVOICE, GncInvoiceClass)) 80 #define GNC_IS_INVOICE(o) \ 81 (G_TYPE_CHECK_INSTANCE_TYPE ((o), GNC_TYPE_INVOICE)) 82 #define GNC_IS_INVOICE_CLASS(k) \ 83 (G_TYPE_CHECK_CLASS_TYPE ((k), GNC_TYPE_INVOICE)) 84 #define GNC_INVOICE_GET_CLASS(o) \ 85 (G_TYPE_INSTANCE_GET_CLASS ((o), GNC_TYPE_INVOICE, GncInvoiceClass)) 86 GType gnc_invoice_get_type(
void);
90 GncInvoice *gncInvoiceCreate (QofBook *book);
92 void gncInvoiceDestroy (GncInvoice *invoice);
105 void gncInvoiceSetID (GncInvoice *invoice,
const char *
id);
106 void gncInvoiceSetOwner (GncInvoice *invoice,
GncOwner *owner);
110 void gncInvoiceSetDateOpened (GncInvoice *invoice,
time64 date);
111 void gncInvoiceSetDatePosted (GncInvoice *invoice,
time64 date);
112 void gncInvoiceSetTerms (GncInvoice *invoice, GncBillTerm *terms);
113 void gncInvoiceSetBillingID (GncInvoice *invoice,
const char *billing_id);
114 void gncInvoiceSetNotes (GncInvoice *invoice,
const char *notes);
115 void gncInvoiceSetDocLink (GncInvoice *invoice,
const char *doclink);
116 void gncInvoiceSetCurrency (GncInvoice *invoice, gnc_commodity *currency);
117 void gncInvoiceSetActive (GncInvoice *invoice, gboolean active);
118 void gncInvoiceSetIsCreditNote (GncInvoice *invoice, gboolean credit_note);
119 void gncInvoiceSetBillTo (GncInvoice *invoice,
GncOwner *billto);
120 void gncInvoiceSetToChargeAmount (GncInvoice *invoice, gnc_numeric amount);
123 void gncInvoiceAddEntry (GncInvoice *invoice, GncEntry *entry);
124 void gncInvoiceRemoveEntry (GncInvoice *invoice, GncEntry *entry);
125 void gncInvoiceAddPrice (GncInvoice *invoice, GNCPrice *price);
129 void gncBillRemoveEntry (GncInvoice *bill, GncEntry *entry);
143 const char * gncInvoiceGetID (
const GncInvoice *invoice);
144 const GncOwner * gncInvoiceGetOwner (
const GncInvoice *invoice);
145 time64 gncInvoiceGetDateOpened (
const GncInvoice *invoice);
146 time64 gncInvoiceGetDatePosted (
const GncInvoice *invoice);
147 time64 gncInvoiceGetDateDue (
const GncInvoice *invoice);
148 GncBillTerm * gncInvoiceGetTerms (
const GncInvoice *invoice);
149 const char * gncInvoiceGetBillingID (
const GncInvoice *invoice);
150 const char * gncInvoiceGetNotes (
const GncInvoice *invoice);
151 const char * gncInvoiceGetDocLink (
const GncInvoice *invoice);
152 GncOwnerType gncInvoiceGetOwnerType (
const GncInvoice *invoice);
153 GList * gncInvoiceGetTypeListForOwnerType (
const GncOwnerType type);
154 GncInvoiceType gncInvoiceGetType (
const GncInvoice *invoice);
155 const char * gncInvoiceGetTypeString (
const GncInvoice *invoice);
156 gnc_commodity * gncInvoiceGetCurrency (
const GncInvoice *invoice);
157 GncOwner * gncInvoiceGetBillTo (GncInvoice *invoice);
158 gnc_numeric gncInvoiceGetToChargeAmount (
const GncInvoice *invoice);
159 gboolean gncInvoiceGetActive (
const GncInvoice *invoice);
160 gboolean gncInvoiceGetIsCreditNote (
const GncInvoice *invoice);
162 GNCLot * gncInvoiceGetPostedLot (
const GncInvoice *invoice);
163 Transaction * gncInvoiceGetPostedTxn (
const GncInvoice *invoice);
164 Account * gncInvoiceGetPostedAcc (
const GncInvoice *invoice);
170 gnc_numeric gncInvoiceGetTotalOf (GncInvoice *invoice, GncEntryPaymentType type);
171 gnc_numeric gncInvoiceGetTotalSubtotal (GncInvoice *invoice);
172 gnc_numeric gncInvoiceGetTotalTax (GncInvoice *invoice);
177 typedef GList EntryList;
178 EntryList * gncInvoiceGetEntries (GncInvoice *invoice);
179 GNCPrice * gncInvoiceGetPrice (GncInvoice *invoice, gnc_commodity* commodity);
222 const char *memo, gboolean accumulatesplits,
261 Account *xfer_acc, gnc_numeric amount,
262 gnc_numeric exch,
time64 date,
263 const char *memo,
const char *num);
276 static inline GncInvoice * gncInvoiceLookup (
const QofBook *book,
const GncGUID *guid)
278 if (book == NULL || guid == NULL)
return NULL;
282 void gncInvoiceBeginEdit (GncInvoice *invoice);
283 void gncInvoiceCommitEdit (GncInvoice *invoice);
284 int gncInvoiceCompare (
const GncInvoice *a,
const GncInvoice *b);
285 gboolean gncInvoiceIsPosted (
const GncInvoice *invoice);
286 gboolean gncInvoiceIsPaid (
const GncInvoice *invoice);
288 #define INVOICE_ID "id" 289 #define INVOICE_OWNER "owner" 290 #define INVOICE_OPENED "date_opened" 291 #define INVOICE_POSTED "date_posted" 292 #define INVOICE_DUE "date_due" 293 #define INVOICE_IS_POSTED "is_posted?" 294 #define INVOICE_IS_PAID "is_paid?" 295 #define INVOICE_TERMS "terms" 296 #define INVOICE_BILLINGID "billing_id" 297 #define INVOICE_NOTES "notes" 298 #define INVOICE_DOCLINK "doclink" 299 #define INVOICE_ACC "account" 300 #define INVOICE_POST_TXN "posted_txn" 301 #define INVOICE_POST_LOT "posted_lot" 302 #define INVOICE_IS_CN "credit_note" 303 #define INVOICE_TYPE "type" 304 #define INVOICE_TYPE_STRING "type_string" 305 #define INVOICE_BILLTO "bill-to" 306 #define INVOICE_ENTRIES "list_of_entries" 307 #define INVOICE_JOB "invoice_job" 309 #define INVOICE_FROM_LOT "invoice-from-lot" 310 #define INVOICE_FROM_TXN "invoice-from-txn" 312 QofBook *gncInvoiceGetBook (GncInvoice *x);
315 #define gncInvoiceGetGUID(x) qof_instance_get_guid (QOF_INSTANCE(x)) 316 #define gncInvoiceRetGUID(x) (x ? *(qof_instance_get_guid (QOF_INSTANCE(x))) : *(guid_null()))
Business Interface: Object OWNERs.
a simple price database for gnucash
void gncInvoiceRemoveEntries(GncInvoice *invoice)
Remove all entries from an invoice.
Transaction * gncInvoicePostToAccount(GncInvoice *invoice, Account *acc, time64 posted_date, time64 due_date, const char *memo, gboolean accumulatesplits, gboolean autopay)
Post this invoice to an account.
#define QOF_BOOK_RETURN_ENTITY(book, guid, e_type, c_type)
Encapsulates all the information about a dataset manipulated by QOF.
GHashTable * gncInvoiceGetForeignCurrencies(const GncInvoice *invoice)
Return an overview of amounts on this invoice that will be posted to accounts in currencies that are ...
void gncInvoiceSortEntries(GncInvoice *invoice)
Call this function when an Entry is changed and you want to re-sort the list of entries.
gnc_numeric gncInvoiceGetTotal(GncInvoice *invoice)
Return the "total" amount of the invoice as seen on the document (and shown to the user in the report...
void gncInvoiceAutoApplyPayments(GncInvoice *invoice)
Attempt to pay the invoice using open payment lots and lots for documents of the opposite sign (credi...
GncInvoice * gncInvoiceGetInvoiceFromTxn(const Transaction *txn)
Given a transaction, find and return the Invoice.
void gncBillAddEntry(GncInvoice *bill, GncEntry *entry)
Call this function when adding an entry to a bill instead of an invoice.
void gncInvoiceApplyPayment(const GncInvoice *invoice, Transaction *txn, Account *xfer_acc, gnc_numeric amount, gnc_numeric exch, time64 date, const char *memo, const char *num)
A convenience function to apply a payment to an invoice.
Encapsulate all the information about a dataset.
void gncInvoiceSetDateOpenedGDate(GncInvoice *invoice, const GDate *date)
Set the DateOpened using a GDate argument.
GncInvoice * gncInvoiceGetInvoiceFromLot(GNCLot *lot)
Given a LOT, find and return the Invoice attached to the lot.
gboolean gncInvoiceUnpost(GncInvoice *invoice, gboolean reset_tax_tables)
Unpost this invoice.
gint64 time64
Most systems that are currently maintained, including Microsoft Windows, BSD-derived Unixes and Linux...
Business Entry Interface.
gboolean gncInvoiceEqual(const GncInvoice *a, const GncInvoice *b)
Test support function used by test-dbi-business-stuff.c.
AccountValueList * gncInvoiceGetTotalTaxList(GncInvoice *invoice)
Return a list of tax totals accumulated per tax account.
The type used to store guids in C.
GncInvoice * gncInvoiceCopy(const GncInvoice *other_invoice)
Create a new GncInvoice object as a deep copy of the given other invoice.
gboolean gncInvoiceAmountPositive(const GncInvoice *invoice)
Depending on the invoice type, invoices have a different effect on the balance.