86#ifndef XACC_TRANSACTION_H
87#define XACC_TRANSACTION_H
103#define GNC_TYPE_TRANSACTION (gnc_transaction_get_type ())
104#define GNC_TRANSACTION(o) \
105 (G_TYPE_CHECK_INSTANCE_CAST ((o), GNC_TYPE_TRANSACTION, Transaction))
106#define GNC_TRANSACTION_CLASS(k) \
107 (G_TYPE_CHECK_CLASS_CAST((k), GNC_TYPE_TRANSACTION, TransactionClass))
108#define GNC_IS_TRANSACTION(o) \
109 (G_TYPE_CHECK_INSTANCE_TYPE ((o), GNC_TYPE_TRANSACTION))
110#define GNC_IS_TRANSACTION_CLASS(k) \
111 (G_TYPE_CHECK_CLASS_TYPE ((k), GNC_TYPE_TRANSACTION))
112#define GNC_TRANSACTION_GET_CLASS(o) \
113 (G_TYPE_INSTANCE_GET_CLASS ((o), GNC_TYPE_TRANSACTION, TransactionClass))
114GType gnc_transaction_get_type(
void);
118#define GNC_IS_TRANS(obj) GNC_IS_TRANSACTION(obj)
119#define GNC_TRANS(obj) GNC_TRANSACTION(obj)
124#define TXN_TYPE_UNCACHED '?'
125#define TXN_TYPE_NONE '\0'
126#define TXN_TYPE_INVOICE 'I'
127#define TXN_TYPE_PAYMENT 'P'
128#define TXN_TYPE_LINK 'L'
195 const Transaction *tb,
196 gboolean check_guids,
197 gboolean check_splits,
198 gboolean check_balances,
199 gboolean assume_ordered);
233#define xaccTransLookupDirect(g,b) xaccTransLookup(&(g),b)
271Split * xaccTransFindSplitByAccount(
const Transaction *trans,
380#define xaccTransAppendSplit(t, s) xaccSplitSetParent((s), (t))
419gboolean xaccTransStillHasSplit(
const Transaction *trans,
const Split *s);
443void xaccTransClearReadOnly (Transaction *trans);
533gnc_numeric xaccTransGetAccountConvRate(
const Transaction *txn,
const Account *acc);
581 const Transaction *tb,
const char *actnb);
600 int day,
int mon,
int year);
751#define TRANS_KVP "kvp"
752#define TRANS_NUM "num"
753#define TRANS_DESCRIPTION "desc"
754#define TRANS_DATE_ENTERED "date-entered"
755#define TRANS_DATE_POSTED "date-posted"
756#define TRANS_DATE_DUE "date-due"
757#define TRANS_IMBALANCE "trans-imbalance"
758#define TRANS_IS_BALANCED "trans-balanced?"
759#define TRANS_IS_CLOSING "trans-is-closing?"
760#define TRANS_NOTES "notes"
761#define TRANS_DOCLINK "doclink"
762#define TRANS_TYPE "type"
763#define TRANS_VOID_STATUS "void-p"
764#define TRANS_VOID_REASON "void-reason"
765#define TRANS_VOID_TIME "void-time"
766#define TRANS_SPLITLIST "split-list"
770void xaccTransDump (
const Transaction *trans,
const char *tag);
782#define RECONCILED_MATCH_TYPE "reconciled-match"
785#define xaccTransGetBook(X) qof_instance_get_book (QOF_INSTANCE(X))
787#define xaccTransGetGUID(X) qof_entity_get_guid(QOF_INSTANCE(X))
API for Transactions and Splits (journal entries)
Commodity handling public routines.
All type declarations for the whole Gnucash engine.
a simple price database for gnucash
gint64 time64
Most systems that are currently maintained, including Microsoft Windows, BSD-derived Unixes and Linux...
gboolean xaccTransHasSplitsInStateByAccount(const Transaction *trans, const char state, const Account *account)
FIXME: document me.
void xaccTransSetDate(Transaction *trans, int day, int mon, int year)
The xaccTransSetDate() method does the same thing as xaccTransSetDate[Posted]Secs(),...
gboolean xaccTransGetIsClosingTxn(const Transaction *trans)
Returns whether this transaction is a "closing transaction".
Transaction * xaccTransReverse(Transaction *transaction)
xaccTransReverse creates a Transaction that reverses the given transaction by inverting all the numer...
gboolean xaccTransHasSplitsInState(const Transaction *trans, const char state)
FIXME: document me.
SplitList * xaccTransGetPaymentAcctSplitList(const Transaction *trans)
The xaccTransGetPaymentAcctSplitList() method returns a GList of the splits in a transaction that bel...
const char * xaccTransGetVoidReason(const Transaction *transaction)
Returns the user supplied textual reason why a transaction was voided.
guint gnc_book_count_transactions(QofBook *book)
int xaccTransOrder(const Transaction *ta, const Transaction *tb)
The xaccTransOrder(ta,tb) method is useful for sorting.
Transaction * xaccTransCopyToClipBoard(const Transaction *from_trans)
Copy a transaction to the 'clipboard' transaction using dupe_transaction.
void xaccTransSetDescription(Transaction *trans, const char *desc)
Sets the transaction Description.
time64 xaccTransRetDateEntered(const Transaction *trans)
Retrieve the date of when the transaction was entered.
Transaction * xaccTransGetReversedBy(const Transaction *trans)
Returns the transaction that reversed the given transaction.
gnc_commodity * xaccTransGetCurrency(const Transaction *trans)
Returns the valuation commodity of this transaction.
void xaccTransSetIsClosingTxn(Transaction *trans, gboolean is_closing)
Sets whether or not this transaction is a "closing transaction".
gboolean xaccTransGetVoidStatus(const Transaction *transaction)
Retrieve information on whether or not a transaction has been voided.
char xaccTransGetTxnType(Transaction *trans)
Returns the Transaction Type: note this type will be derived from the transaction splits,...
void xaccTransDestroy(Transaction *trans)
Destroys a transaction.
void xaccTransSetDatePostedGDate(Transaction *trans, GDate date)
This method modifies posted date of the transaction, specified by a GDate.
gboolean xaccTransHasReconciledSplitsByAccount(const Transaction *trans, const Account *account)
FIXME: document me.
void xaccTransSetNum(Transaction *trans, const char *num)
Sets the transaction Number (or ID) field; rather than use this function directly,...
const char * xaccTransGetDocLink(const Transaction *trans)
Gets the transaction Document Link.
GDate xaccTransGetDatePostedGDate(const Transaction *trans)
Retrieve the posted date of the transaction.
void xaccTransSetTxnType(Transaction *trans, char type)
Set the Transaction Type: note the type will be saved into the Transaction kvp property as a backward...
void xaccTransCommitEdit(Transaction *trans)
The xaccTransCommitEdit() method indicates that the changes to the transaction and its splits are com...
const char * xaccTransGetDescription(const Transaction *trans)
Gets the transaction Description.
MonetaryList * xaccTransGetImbalance(const Transaction *trans)
The xaccTransGetImbalance method returns a list giving the value of the transaction in each currency ...
Split * xaccTransGetFirstPaymentAcctSplit(const Transaction *trans)
The xaccTransGetFirstPaymentAcctSplit() method returns a pointer to the first split in this transacti...
void xaccTransCopyFromClipBoard(const Transaction *from_trans, Transaction *to_trans, const Account *from_acc, Account *to_acc, gboolean no_date)
This function explicitly must robustly handle some unusual input.
void xaccTransClearSplits(Transaction *trans)
Remove all splits from the transaction.
gboolean xaccTransIsOpen(const Transaction *trans)
The xaccTransIsOpen() method returns TRUE if the transaction is open for editing.
gboolean xaccTransIsBalanced(const Transaction *trans)
Returns true if the transaction is balanced according to the rules currently in effect.
Transaction * xaccTransLookup(const GncGUID *guid, QofBook *book)
The xaccTransLookup() subroutine will return the transaction associated with the given id,...
int xaccTransGetSplitIndex(const Transaction *trans, const Split *split)
Inverse of xaccTransGetSplit()
gboolean xaccTransHasReconciledSplits(const Transaction *trans)
FIXME: document me.
Split * xaccTransGetSplit(const Transaction *trans, int i)
Return a pointer to the indexed split in this transaction's split list.
time64 xaccTransRetDatePosted(const Transaction *trans)
Retrieve the posted date of the transaction.
time64 xaccTransGetVoidTime(const Transaction *tr)
Returns the time that a transaction was voided.
void xaccTransSetDateEnteredSecs(Transaction *trans, time64 time)
Modify the date of when the transaction was entered.
const char * xaccTransGetNotes(const Transaction *trans)
Gets the transaction Notes.
time64 xaccTransGetDateEntered(const Transaction *trans)
Retrieve the date of when the transaction was entered.
void xaccTransUnvoid(Transaction *transaction)
xaccTransUnvoid restores a voided transaction to its original state.
void xaccTransCopyOnto(const Transaction *from_trans, Transaction *to_trans)
Copy a transaction to another using the function below without changing any account information.
int xaccTransOrder_num_action(const Transaction *ta, const char *actna, const Transaction *tb, const char *actnb)
The xaccTransOrder_num_action(ta,actna,tb,actnb) method is useful for sorting.
Transaction * xaccTransClone(const Transaction *t)
The xaccTransClone() method will create a complete copy of an existing transaction.
void xaccTransSetDatePostedSecs(Transaction *trans, time64 time)
The xaccTransSetDatePostedSecs() method will modify the posted date of the transaction,...
void xaccTransSetDocLink(Transaction *trans, const char *doclink)
Sets the transaction Document Link.
gnc_numeric xaccTransGetAccountValue(const Transaction *trans, const Account *account)
The xaccTransGetAccountValue() method returns the total value applied to a particular account.
Transaction * xaccMallocTransaction(QofBook *book)
The xaccMallocTransaction() will malloc memory and initialize it.
void xaccTransSetDatePostedSecsNormalized(Transaction *trans, time64 time)
This function sets the posted date of the transaction, specified by a time64 (see ctime(3)).
void xaccTransSetCurrency(Transaction *trans, gnc_commodity *curr)
Set the commodity of this transaction.
void xaccTransScrubGains(Transaction *trans, Account *gain_acc)
The xaccTransScrubGains() routine performs a number of cleanup functions on the indicated transaction...
gnc_numeric xaccTransGetAccountAmount(const Transaction *trans, const Account *account)
Same as xaccTransGetAccountValue, but uses the Account's commodity.
void xaccTransSortSplits(Transaction *trans)
Sorts the splits in a transaction, putting the debits first, followed by the credits.
SplitList * xaccTransGetSplitList(const Transaction *trans)
The xaccTransGetSplitList() method returns a GList of the splits in a transaction.
const char * xaccTransGetNum(const Transaction *trans)
Gets the transaction Number (or ID) field; rather than use this function directly,...
void xaccTransVoid(Transaction *transaction, const char *reason)
xaccTransVoid voids a transaction.
gboolean xaccTransUseTradingAccounts(const Transaction *trans)
Determine whether this transaction should use commodity trading accounts.
int xaccTransCountSplits(const Transaction *trans)
Returns the number of splits in this transaction.
Transaction * xaccTransCloneNoKvp(const Transaction *t)
The xaccTransCloneNoKvp() method will create a complete copy of an existing transaction except that t...
time64 xaccTransRetDateDue(const Transaction *trans)
Dates and txn-type for A/R and A/P "invoice" postings.
void xaccTransRollbackEdit(Transaction *trans)
The xaccTransRollbackEdit() routine rejects all edits made, and sets the transaction back to where it...
void xaccTransRecordPrice(Transaction *trans, PriceSource source)
The xaccTransRecordPrice() method iterates through the splits and and record the non-currency equival...
void xaccTransSetReadOnly(Transaction *trans, const char *reason)
Set the transaction to be ReadOnly by setting a non-NULL value as "reason".
Split * xaccTransGetFirstAPARAcctSplit(const Transaction *trans, gboolean strict)
The xaccTransGetFirstPaymentAcctSplit() method returns a pointer to the first split in this transacti...
void xaccTransSetDateDue(Transaction *trans, time64 time)
Dates and txn-type for A/R and A/P "invoice" postings.
gboolean xaccTransIsReadonlyByPostedDate(const Transaction *trans)
Returns TRUE if this Transaction is read-only because its posted-date is older than the "auto-readonl...
GList SplitList
GList of Split.
void xaccTransBeginEdit(Transaction *trans)
The xaccTransBeginEdit() method must be called before any changes are made to a transaction or any of...
void xaccTransSetNotes(Transaction *trans, const char *notes)
Sets the transaction Notes.
SplitList * xaccTransGetAPARAcctSplitList(const Transaction *trans, gboolean strict)
The xaccTransGetAPARSplitList() method returns a GList of the splits in a transaction that belong to ...
const char * xaccTransGetReadOnly(Transaction *trans)
Returns a non-NULL value if this Transaction was marked as read-only with some specific "reason" text...
gnc_numeric xaccTransGetAccountBalance(const Transaction *trans, const Account *account)
Get the account balance for the specified account after the last split in the specified transaction.
gnc_numeric xaccTransGetImbalanceValue(const Transaction *trans)
The xaccTransGetImbalanceValue() method returns the total value of the transaction.
time64 xaccTransGetDate(const Transaction *trans)
Retrieve the posted date of the transaction.
gboolean xaccTransEqual(const Transaction *ta, const Transaction *tb, gboolean check_guids, gboolean check_splits, gboolean check_balances, gboolean assume_ordered)
Equality.
PriceSource
Price source enum.
The type used to store guids in C.