Main Page Modules Alphabetical List Data Structures File List Data Fields Globals

# Transaction.h File Reference

API for Transactions and Splits (journal entries). More...

`#include <time.h>`
`#include "gnc-commodity.h"`
`#include "gnc-engine.h"`
`#include "kvp_frame.h"`
`#include "GNCId.h"`
`#include "date.h"`

## Split Reconciled field values
If you change these be sure to change gnc-ui-util.c:gnc_get_reconciled_str() and associated functions
#define | CREC 'c' /**< The Split has been cleared */
#define | YREC 'y' /**< The Split has been reconciled */
#define | FREC 'f' /**< frozen into accounting period */
#define | NREC 'n' /**< not reconciled or cleared */
#define | VREC 'v' /**< split is void */
## Transaction Type field values
#define | TXN_TYPE_NONE '\0' /**< No transaction type */
#define | TXN_TYPE_INVOICE 'I' /**< Transaction is an invoice */
#define | TXN_TYPE_PAYMENT 'P' /**< Transaction is a payment */
## Split Parameter names
Note, if you want to get the equivalent of "ACCT_MATCH_ALL" you need to create a search on the following parameter list: SPLIT->SPLIT_TRANS->TRANS_SPLITLIST->SPLIT_ACCOUNT_GUID. If you do this, you might want to use the ACCOUNT_MATCH_ALL_TYPE as the override so the gnome-search dialog displays the right type.
#define | SPLIT_KVP "kvp"
#define | SPLIT_DATE_RECONCILED "date-reconciled"
#define | SPLIT_BALANCE "balance"
#define | SPLIT_CLEARED_BALANCE "cleared-balance"
#define | SPLIT_RECONCILED_BALANCE "reconciled-balance"
#define | SPLIT_MEMO "memo"
#define | SPLIT_ACTION "action"
#define | SPLIT_RECONCILE "reconcile-flag"
#define | SPLIT_AMOUNT "amount"
#define | SPLIT_SHARE_PRICE "share-price"
#define | SPLIT_VALUE "value"
#define | SPLIT_TYPE "type"
#define | SPLIT_VOIDED_AMOUNT "voided-amount"
#define | SPLIT_VOIDED_VALUE "voided-value"
#define | SPLIT_LOT "lot"
#define | SPLIT_TRANS "trans"
#define | SPLIT_ACCOUNT "account"
#define | SPLIT_ACCOUNT_GUID "account-guid" /**< for guid_match_all */
#define | SPLIT_ACCT_FULLNAME "acct-fullname"
#define | SPLIT_CORR_ACCT_NAME "corr-acct-fullname"
#define | SPLIT_CORR_ACCT_CODE "corr-acct-code"
## Transaction Parameter names
#define | TRANS_KVP "kvp"
#define | TRANS_NUM "num"
#define | TRANS_DESCRIPTION "desc"
#define | TRANS_DATE_ENTERED "date-entered"
#define | TRANS_DATE_POSTED "date-posted"
#define | TRANS_DATE_DUE "date-due"
#define | TRANS_IMBALANCE "trans-imbalance"
#define | TRANS_IS_BALANCED "trans-balanced?"
#define | TRANS_NOTES "notes"
#define | TRANS_TYPE "type"
#define | TRANS_VOID_STATUS "void-p"
#define | TRANS_VOID_REASON "void-reason"
#define | TRANS_VOID_TIME "void-time"
#define | TRANS_SPLITLIST "split-list"
## Configuration ForceDoubleEntry getters/setters
void | xaccConfigSetForceDoubleEntry (int force)
int | xaccConfigGetForceDoubleEntry (void)
## Transaction creation and editing
Transaction * | xaccMallocTransaction (GNCBook *book)
void | xaccTransDestroy (Transaction *trans)
gboolean | xaccTransEqual (const Transaction *ta, const Transaction *tb, gboolean check_guids, gboolean check_splits)
| DOCUMENT ME!
void | xaccTransBeginEdit (Transaction *trans)
void | xaccTransCommitEdit (Transaction *trans)
void | xaccTransRollbackEdit (Transaction *trans)
gboolean | xaccTransIsOpen (const Transaction *trans)
Transaction * | xaccTransLookup (const GUID *guid, GNCBook *book)
Transaction * | xaccTransLookupDirect (GUID guid, GNCBook *book)
## Transaction general getters/setters
const GUID * | xaccTransGetGUID (const Transaction *trans)
GUID | xaccTransReturnGUID (const Transaction *trans)
GNCBook * | xaccTransGetBook (const Transaction *trans)
kvp_frame * | xaccTransGetSlots (const Transaction *trans)
void | xaccTransSetSlots_nc (Transaction *t, kvp_frame *frm)
void | xaccTransSetTxnType (Transaction *trans, char type)
char | xaccTransGetTxnType (const Transaction *trans)
void | xaccTransSetNum (Transaction *trans, const char *num)
| Sets the transaction Number (or ID) field.
void | xaccTransSetDescription (Transaction *trans, const char *desc)
| Sets the transaction Description.
void | xaccTransSetNotes (Transaction *trans, const char *notes)
| Sets the transaction Notes. More...
const char * | xaccTransGetNum (const Transaction *trans)
| Gets the transaction Number (or ID) field.
const char * | xaccTransGetDescription (const Transaction *trans)
| Gets the transaction Description.
const char * | xaccTransGetNotes (const Transaction *trans)
| Gets the transaction Notes. More...
void | xaccTransAppendSplit (Transaction *trans, Split *split)
| Add a split to the transaction. More...
Split * | xaccTransGetSplit (const Transaction *trans, int i)
SplitList * | xaccTransGetSplitList (const Transaction *trans)
void | xaccTransSetReadOnly (Transaction *trans, const char *reason)
void | xaccTransClearReadOnly (Transaction *trans)
const char * | xaccTransGetReadOnly (const Transaction *trans)
gboolean | xaccTransWarnReadOnly (const Transaction *trans)
int | xaccTransCountSplits (const Transaction *trans)
gboolean | xaccTransHasReconciledSplits (const Transaction *trans)
gboolean | xaccTransHasReconciledSplitsByAccount (const Transaction *trans, const Account *account)
gnc_commodity * | xaccTransGetCurrency (const Transaction *trans)
void | xaccTransSetCurrency (Transaction *trans, gnc_commodity *curr)
gnc_numeric | xaccTransGetImbalance (const Transaction *trans)
gnc_numeric | xaccTransGetAccountValue (const Transaction *trans, const Account *account)
int | xaccTransOrder (const Transaction *ta, const Transaction *tb)
## Transaction date setters/getters
void | xaccTransSetDate (Transaction *trans, int day, int mon, int year)
void | xaccTransSetDateSecs (Transaction *trans, time_t time)
void | xaccTransSetDatePostedSecs (Transaction *trans, time_t time)
void | xaccTransSetDatePostedTS (Transaction *trans, const Timespec *ts)
void | xaccTransSetDateEnteredSecs (Transaction *trans, time_t time)
| Modify the date of when the transaction was entered.
void | xaccTransSetDateEnteredTS (Transaction *trans, const Timespec *ts)
| Modify the date of when the transaction was entered.
void | xaccTransSetDateDueTS (Transaction *trans, const Timespec *ts)
time_t | xaccTransGetDate (const Transaction *trans)
void | xaccTransGetDatePostedTS (const Transaction *trans, Timespec *ts)
Timespec | xaccTransRetDatePostedTS (const Transaction *trans)
void | xaccTransGetDateEnteredTS (const Transaction *trans, Timespec *ts)
Timespec | xaccTransRetDateEnteredTS (const Transaction *trans)
Timespec | xaccTransRetDateDueTS (const Transaction *trans)
void | xaccTransGetDateDueTS (const Transaction *trans, Timespec *ts)
## Split general getters/setters
Split * | xaccMallocSplit (GNCBook *book)
gboolean | xaccSplitDestroy (Split *split)
GNCBook * | xaccSplitGetBook (const Split *split)
Account * | xaccSplitGetAccount (const Split *split)
Transaction * | xaccSplitGetParent (const Split *split)
GNCLot * | xaccSplitGetLot (const Split *split)
kvp_frame * | xaccSplitGetSlots (const Split *split)
void | xaccSplitSetSlots_nc (Split *s, kvp_frame *frm)
const GUID * | xaccSplitGetGUID (const Split *split)
GUID | xaccSplitReturnGUID (const Split *split)
void | xaccSplitSetMemo (Split *split, const char *memo)
const char * | xaccSplitGetMemo (const Split *split)
void | xaccSplitSetAction (Split *split, const char *action)
const char * | xaccSplitGetAction (const Split *split)
## Split Date getters/setters
void | xaccSplitSetReconcile (Split *split, char reconciled_flag)
char | xaccSplitGetReconcile (const Split *split)
void | xaccSplitSetDateReconciledSecs (Split *split, time_t time)
void | xaccSplitSetDateReconciledTS (Split *split, Timespec *ts)
void | xaccSplitGetDateReconciledTS (const Split *split, Timespec *ts)
Timespec | xaccSplitRetDateReconciledTS (const Split *split)
## Split amount getters/setters
'value' vs. 'amount' of a Split: The 'value' is the amount of the _transaction_ balancing commodity (i.e. currency) involved, 'amount' is the amount of the _account's_ commodity involved.
void | xaccSplitSetAmount (Split *split, gnc_numeric amount)
gnc_numeric | xaccSplitGetAmount (const Split *split)
void | xaccSplitSetValue (Split *split, gnc_numeric value)
gnc_numeric | xaccSplitGetValue (const Split *split)
void | xaccSplitSetSharePriceAndAmount (Split *split, gnc_numeric price, gnc_numeric amount)
gnc_numeric | xaccSplitGetSharePrice (const Split *split)
void | xaccSplitSetBaseValue (Split *split, gnc_numeric value, const gnc_commodity *base_currency)
gnc_numeric | xaccSplitGetBaseValue (const Split *split, const gnc_commodity *base_currency)
gnc_numeric | xaccSplitGetBalance (const Split *split)
gnc_numeric | xaccSplitGetClearedBalance (const Split *split)
gnc_numeric | xaccSplitGetReconciledBalance (const Split *split)
## Split utility functions
gboolean | xaccSplitEqual (const Split *sa, const Split *sb, gboolean check_guids, gboolean check_txn_splits)
Split * | xaccSplitLookup (const GUID *guid, GNCBook *book)
Split * | xaccSplitLookupDirect (GUID guid, GNCBook *book)
Split * | xaccSplitGetOtherSplit (const Split *split)
gboolean | xaccIsPeerSplit (const Split *split_1, const Split *split_2)
const char * | xaccSplitGetType (const Split *s)
void | xaccSplitMakeStockSplit (Split *s)
int | xaccSplitDateOrder (const Split *sa, const Split *sb)
int | xaccSplitCompareAccountFullNames (Split *sa, Split *sb)
int | xaccSplitCompareAccountCodes (Split *sa, Split *sb)
int | xaccSplitCompareOtherAccountFullNames (Split *sa, Split *sb)
int | xaccSplitCompareOtherAccountCodes (Split *sa, Split *sb)
char * | xaccSplitGetCorrAccountFullName (const Split *sa, char seperator)
const char * | xaccSplitGetCorrAccountName (const Split *sa)
const char * | xaccSplitGetCorrAccountCode (const Split *sa)
## Split deprecated functions
void | xaccSplitSetSharePrice (Split *split, gnc_numeric price)
void | DxaccSplitSetAmount (Split *s, double damt)
void | DxaccSplitSetValue (Split *split, double value)
double | DxaccSplitGetValue (const Split *split)
void | DxaccSplitSetSharePriceAndAmount (Split *split, double price, double amount)
void | DxaccSplitSetShareAmount (Split *split, double amount)
double | DxaccSplitGetShareAmount (const Split *split)
void | DxaccSplitSetSharePrice (Split *split, double price)
double | DxaccSplitGetSharePrice (const Split *split)
void | DxaccSplitSetBaseValue (Split *split, double value, const gnc_commodity *base_currency)
## Transaction voiding
void | xaccTransVoid (Transaction *transaction, const char *reason)
gboolean | xaccTransGetVoidStatus (const Transaction *transaction)
char * | xaccTransGetVoidReason (const Transaction *transaction)
gnc_numeric | xaccSplitVoidFormerAmount (const Split *split)
gnc_numeric | xaccSplitVoidFormerValue (const Split *split)
Timespec | xaccTransGetVoidTime (const Transaction *tr)
## Defines
#define | RECONCILED_MATCH_TYPE "reconciled-match"
## Functions
Account * | xaccGetAccountByName (Transaction *trans, const char *name)
Account * | xaccGetAccountByFullName (Transaction *trans, const char *name, const char separator)

## Detailed Description

API for Transactions and Splits (journal entries).

Author:
  Copyright (C) 1997 Robin D. Clark , Copyright (C) 1997-2001 Linas Vepstas <linas@linas.org>