GnuCash 7574033+
Loading...
Searching...
No Matches

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

#include <time.h>
#include "gnc-commodity.h"
#include "gnc-engine.h"

Go to the source code of this file.

Macros

#define GNC_TYPE_SPLIT   (gnc_split_get_type ())
#define GNC_SPLIT(o)
#define GNC_SPLIT_CLASS(k)
#define GNC_IS_SPLIT(o)
#define GNC_IS_SPLIT_CLASS(k)
#define GNC_SPLIT_GET_CLASS(o)
#define xaccSplitGetGUID(X)
Split Reconciled field values

These define the various reconciliations states a split can be in.

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
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_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"

Functions

GType gnc_split_get_type (void)
gnc_numeric xaccSplitConvertAmount (const Split *split, const Account *account)
Split general getters/setters
Split * xaccMallocSplit (QofBook *book)
 Constructor.
void xaccSplitReinit (Split *split)
gboolean xaccSplitDestroy (Split *split)
 Destructor.
void xaccSplitCopyOnto (const Split *from_split, Split *to_split)
 This is really a helper for xaccTransCopyOnto.
QofBook * xaccSplitGetBook (const Split *split)
 Returns the book of this split, i.e.
Account * xaccSplitGetAccount (const Split *split)
 Returns the account of this split, which was set through xaccAccountInsertSplit().
void xaccSplitSetAccount (Split *s, Account *acc)
Transaction * xaccSplitGetParent (const Split *split)
 Returns the parent transaction of the split.
void xaccSplitSetParent (Split *split, Transaction *trans)
GNCLot * xaccSplitGetLot (const Split *split)
 Returns the pointer to the debited/credited Lot where this split belongs to, or NULL if it doesn't belong to any.
void xaccSplitSetLot (Split *split, GNCLot *lot)
 Assigns the split to a specific Lot.
void xaccSplitSetMemo (Split *split, const char *memo)
 The memo is an arbitrary string associated with a split.
const char * xaccSplitGetMemo (const Split *split)
 Returns the memo string.
void xaccSplitSetOnlineID (Split *split, const char *id)
 The online_id is the OFX/HBCI "FITID" recorded on a split when it is imported.
const char * xaccSplitGetOnlineID (const Split *split)
 Returns the split's online_id.
gboolean xaccSplitHasOnlineID (const Split *split)
 Returns TRUE if the split has a non-empty online_id.
void xaccSplitSetAction (Split *split, const char *action)
 The Action is an arbitrary user-assigned string.
const char * xaccSplitGetAction (const Split *split)
 Returns the action string.
Split Date getters/setters
void xaccSplitSetReconcile (Split *split, char reconciled_flag)
 Set the reconcile flag.
char xaccSplitGetReconcile (const Split *split)
 Returns the value of the reconcile flag.
void xaccSplitSetDateReconciledSecs (Split *split, time64 time)
 Set the date on which this split was reconciled by specifying the time as time64.
time64 xaccSplitGetDateReconciled (const Split *split)
 Retrieve the date when the Split was reconciled.
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)
 The xaccSplitSetAmount() method sets the amount in the account's commodity that the split should have.
gnc_numeric xaccSplitGetAmount (const Split *split)
 Returns the amount of the split in the account's commodity.
void xaccSplitSetValue (Split *split, gnc_numeric value)
 The xaccSplitSetValue() method sets the value of this split in the transaction's commodity.
gnc_numeric xaccSplitGetValue (const Split *split)
 Returns the value of this split in the transaction's commodity.
void xaccSplitSetSharePriceAndAmount (Split *split, gnc_numeric price, gnc_numeric amount)
 The xaccSplitSetSharePriceAndAmount() method will simultaneously update the share price and the number of shares.
gnc_numeric xaccSplitGetSharePrice (const Split *split)
 Returns the price of the split, that is, the value divided by the amount.
void xaccSplitSetBaseValue (Split *split, gnc_numeric value, const gnc_commodity *base_currency)
 Depending on the base_currency, set either the value or the amount of this split or both: If the base_currency is the transaction's commodity, set the value.
gnc_numeric xaccSplitGetBaseValue (const Split *split, const gnc_commodity *base_currency)
 Depending on the base_currency, return either the value or the amount of this split: If the base_curreny is the transaction's commodity, return the value.
gnc_numeric xaccSplitGetBalance (const Split *split)
 Returns the running balance up to and including the indicated split.
gnc_numeric xaccSplitGetNoclosingBalance (const Split *split)
 The noclosing-balance is the currency-denominated balance of all transactions except 'closing' transactions.
gnc_numeric xaccSplitGetClearedBalance (const Split *split)
 The cleared-balance is the currency-denominated balance of all transactions that have been marked as cleared or reconciled.
gnc_numeric xaccSplitGetReconciledBalance (const Split *split)
 Returns the reconciled-balance of this split.
void xaccSplitSetAdjustedAmount (Split *split, gnc_numeric amount)
 Sets the stock split adjusted amount of a split.
gnc_numeric xaccSplitGetAdjustedAmount (const Split *split)
 Returns the stock-split adjusted amount of the split in the account's commodity.
Split deprecated functions
void xaccSplitSetSharePrice (Split *split, gnc_numeric price)
Split voiding
gnc_numeric xaccSplitVoidFormerAmount (const Split *split)
 Returns the original pre-void amount of a split.
gnc_numeric xaccSplitVoidFormerValue (const Split *split)
 Returns the original pre-void value of a split.

Split utility functions

#define xaccSplitLookupDirect(g, b)
gboolean xaccSplitEqual (const Split *sa, const Split *sb, gboolean check_guids, gboolean check_balances, gboolean check_txn_splits)
 Equality.
Split * xaccSplitLookup (const GncGUID *guid, QofBook *book)
 The xaccSplitLookup() subroutine will return the split associated with the given id, or NULL if there is no such split.
void xaccSplitAddPeerSplit (Split *split, const Split *other_split, const time64 timestamp)
 Add a peer split to this split's lot-split list.
gboolean xaccSplitHasPeers (const Split *split)
 Does this split have peers?
gboolean xaccSplitIsPeerSplit (const Split *split, const Split *other_split)
 Report if a split is a peer of this one.
void xaccSplitRemovePeerSplit (Split *split, const Split *other_split)
 Remove a peer split from this split's lot-split list.
void xaccSplitMergePeerSplits (Split *split, const Split *other_split)
 Merge the other_split's peer splits into split's peers.
Split * xaccSplitGetOtherSplit (const Split *split)
 The xaccSplitGetOtherSplit() is a convenience routine that returns the other of a pair of splits.
const char * xaccSplitGetType (Split *s)
 Returns the split type, which is either the string "normal", or "stock-split" for a split from a stock split.
void xaccSplitMakeStockSplit (Split *s)
 Mark a split to be of type stock split - after this, you shouldn't modify the value anymore, just the amount.
gboolean xaccSplitIsStockSplit (Split *s)
 Returns true if the split is of type stock split.
gint xaccSplitOrder (const Split *sa, const Split *sb)
 The xaccSplitOrder(sa,sb) method is useful for sorting.
gint xaccSplitOrderDateOnly (const Split *sa, const Split *sb)
int xaccSplitCompareAccountFullNames (const Split *sa, const Split *sb)
 Compare two splits by full name of account.
int xaccSplitCompareAccountCodes (const Split *sa, const Split *sb)
 Compare two splits by code of account.
int xaccSplitCompareOtherAccountFullNames (const Split *sa, const Split *sb)
 Compare two splits by full name of the other account.
int xaccSplitCompareOtherAccountCodes (const Split *sa, const Split *sb)
 Compare two splits by code of the other account.
char * xaccSplitGetCorrAccountFullName (const Split *sa)
 These functions take a split, get the corresponding split on the "other side" of the transaction, and extract either the name or code of that split, reverting to returning a constant "Split" if the transaction has more than one split on the "other side".
const char * xaccSplitGetCorrAccountName (const Split *sa)
 document me
const char * xaccSplitGetCorrAccountCode (const Split *sa)
 document me

Detailed Description

API for Transactions and Splits (journal entries).

Author
Copyright (C) 1997 Robin D. Clark
Copyright (C) 1997-2001 Linas Vepstas linas.nosp@m.@lin.nosp@m.as.or.nosp@m.g

Definition in file Split.h.