|
GnuCash c935c2f+
|
A good overview of transactions, splits and accounts can be found in the texinfo documentation, together with an overview of how to use this API. More...
Files | |
| file | Split.h |
| API for Transactions and Splits (journal entries) | |
Macros | |
| #define | GNC_TYPE_SPLIT (gnc_split_get_type ()) |
| #define | GNC_SPLIT(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GNC_TYPE_SPLIT, Split)) |
| #define | GNC_SPLIT_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GNC_TYPE_SPLIT, SplitClass)) |
| #define | GNC_IS_SPLIT(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GNC_TYPE_SPLIT)) |
| #define | GNC_IS_SPLIT_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GNC_TYPE_SPLIT)) |
| #define | GNC_SPLIT_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GNC_TYPE_SPLIT, SplitClass)) |
| #define | xaccSplitGetGUID(X) qof_entity_get_guid(QOF_INSTANCE(X)) |
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 utility functions | |
| 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 | |
| #define | xaccSplitLookupDirect(g, b) xaccSplitLookup(&(g),b) |
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 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" |
A good overview of transactions, splits and accounts can be found in the texinfo documentation, together with an overview of how to use this API.
Splits, or "Ledger Entries" are the fundamental accounting units. Each Split consists of an amount (number of dollar bills, number of shares, etc.), the value of that amount expressed in a (possibly) different currency than the amount, a Memo, a pointer to the parent Transaction, a pointer to the debited Account, a reconciled flag and timestamp, an "Action" field, and a key-value frame which can store arbitrary data.
Transactions embody the notion of "double entry" accounting. A Transaction consists of a date, a description, an ID number, a list of one or more Splits, and a key-value frame. The transaction also specifies the currency with which all of the splits will be valued. When double-entry rules are enforced, the sum total value of the splits are zero. If there are only two splits, then the value of one must be positive, the other negative: this denotes that one account is debited, and another is credited by an equal amount. By forcing the value of the splits to always 'add up' to zero, we can guarantee that the balances of the accounts are always correctly balanced.
The engine does not enforce double-entry accounting, but provides an API to enable user-code to find unbalanced transactions and 'repair' them so that they are in balance.
Note the sum of the values of Splits in a Transaction is always computed with respect to a currency; thus splits can be balanced even when they are in different currencies, as long as they share a common currency. This feature allows currency-trading accounts to be established.
Every Split must point to its parent Transaction, and that Transaction must in turn include that Split in the Transaction's list of Splits. A Split can belong to at most one Transaction. These relationships are enforced by the engine. The engine user cannot accidentally destroy this relationship as long as they stick to using the API and never access internal structures directly.
Splits are grouped into Accounts which are also known as "Ledgers" in accounting practice. Each Account consists of a list of Splits that debit that Account. To ensure consistency, if a Split points to an Account, then the Account must point to the Split, and vice-versa. A Split can belong to at most one Account. Besides merely containing a list of Splits, the Account structure also gives the Account a name, a code number, description and notes fields, a key-value frame, a pointer to the commodity that is used for all splits in this account. The commodity can be the name of anything traded and tradable: a stock (e.g. "IBM", "McDonald's"), a currency (e.g. "USD", "GBP"), or anything added to the commodity table.
Accounts can be arranged in a hierarchical tree. The nodes of the tree are called "Account Groups". By accounting convention, the value of an Account is equal to the value of all of its Splits plus the value of all of its sub-Accounts.
@{
| #define GNC_IS_SPLIT | ( | o | ) | (G_TYPE_CHECK_INSTANCE_TYPE ((o), GNC_TYPE_SPLIT)) |
| #define GNC_IS_SPLIT_CLASS | ( | k | ) | (G_TYPE_CHECK_CLASS_TYPE ((k), GNC_TYPE_SPLIT)) |
| #define GNC_SPLIT | ( | o | ) | (G_TYPE_CHECK_INSTANCE_CAST ((o), GNC_TYPE_SPLIT, Split)) |
| #define GNC_SPLIT_CLASS | ( | k | ) | (G_TYPE_CHECK_CLASS_CAST((k), GNC_TYPE_SPLIT, SplitClass)) |
| #define GNC_SPLIT_GET_CLASS | ( | o | ) | (G_TYPE_INSTANCE_GET_CLASS ((o), GNC_TYPE_SPLIT, SplitClass)) |
| #define SPLIT_ACCOUNT_GUID "account-guid" |
| #define xaccSplitGetGUID | ( | X | ) | qof_entity_get_guid(QOF_INSTANCE(X)) |
| #define xaccSplitLookupDirect | ( | g, | |
| b | |||
| ) | xaccSplitLookup(&(g),b) |
| GType gnc_split_get_type | ( | void | ) |
Definition at line 31 of file gmock-Split.cpp.
| Split * xaccMallocSplit | ( | QofBook * | book | ) |
Constructor.
Definition at line 37 of file gmock-Split.cpp.
| void xaccSplitAddPeerSplit | ( | Split * | split, |
| const Split * | other_split, | ||
| const time64 | timestamp | ||
| ) |
Add a peer split to this split's lot-split list.
| other_split | The split whose guid to add |
| timestamp | The time to be recorded for the split. |
Definition at line 2084 of file Split.cpp.
| int xaccSplitCompareAccountCodes | ( | const Split * | sa, |
| const Split * | sb | ||
| ) |
Compare two splits by code of account.
Returns similar to strcmp.
Definition at line 1712 of file Split.cpp.
| int xaccSplitCompareAccountFullNames | ( | const Split * | sa, |
| const Split * | sb | ||
| ) |
Compare two splits by full name of account.
Returns similar to strcmp.
Definition at line 1688 of file Split.cpp.
| int xaccSplitCompareOtherAccountCodes | ( | const Split * | sa, |
| const Split * | sb | ||
| ) |
Compare two splits by code of the other account.
Returns similar to strcmp. This function attempts to find the split on the other side of a transaction and compare on it.
Definition at line 1747 of file Split.cpp.
| int xaccSplitCompareOtherAccountFullNames | ( | const Split * | sa, |
| const Split * | sb | ||
| ) |
Compare two splits by full name of the other account.
Returns similar to strcmp. This function attempts to find the split on the other side of a transaction and compare on it.
Definition at line 1726 of file Split.cpp.
| gnc_numeric xaccSplitConvertAmount | ( | const Split * | split, |
| const Account * | account | ||
| ) |
Definition at line 1433 of file Split.cpp.
| void xaccSplitCopyOnto | ( | const Split * | from_split, |
| Split * | to_split | ||
| ) |
This is really a helper for xaccTransCopyOnto.
It doesn't reparent the 'to' split to from's transaction, because xaccTransCopyOnto is responsible for parenting the split to the correct transaction. Also, from's parent transaction may not even be a valid transaction, so this function may not modify anything about 'from' or from's transaction.
Definition at line 648 of file Split.cpp.
| gboolean xaccSplitDestroy | ( | Split * | split | ) |
Destructor.
The xaccSplitDestroy() method will update its parent account and transaction in a consistent manner, resulting in the complete unlinking of the split, and the freeing of its associated memory. The goal of this routine is to perform the removal and destruction of the split in an atomic fashion, with no chance of accidentally leaving the accounting structure out-of-balance or otherwise inconsistent.
It begins and commits an edit on the transaction, so if after the split is removed the transaction has no more splits and if is not open it too will be destroyed, as it will if the outer edits are committed without adding transactions.
Definition at line 1506 of file Split.cpp.
| gboolean xaccSplitEqual | ( | const Split * | sa, |
| const Split * | sb, | ||
| gboolean | check_guids, | ||
| gboolean | check_balances, | ||
| gboolean | check_txn_splits | ||
| ) |
Equality.
| sa | First split to compare |
| sb | Second split to compare |
| check_guids | If TRUE, try a guid_equal() on the GUIDs of both splits if their pointers are not equal in the first place. |
| check_balances | If TRUE, compare balances between the two splits. Balances are recalculated whenever a split is added or removed from an account, so YMMV on whether this should be set. |
| check_txn_splits | If the pointers are not equal, but everything else so far is equal (including memo, amount, value, kvp), then, when comparing the parenting transactions with xaccTransEqual(), set its argument check_splits to be TRUE. |
Definition at line 819 of file Split.cpp.
| Account * xaccSplitGetAccount | ( | const Split * | split | ) |
Returns the account of this split, which was set through xaccAccountInsertSplit().
Definition at line 53 of file gmock-Split.cpp.
| const char * xaccSplitGetAction | ( | const Split * | split | ) |
Returns the action string.
Rather than use this function directly, see 'gnc_get_num_action' and 'gnc_get_action_num'in engine/engine-helpers.c & .h which takes a user-set book option for selecting the source for the num-cell (the transaction-number or the split-action field) in registers/reports into account automatically
Definition at line 151 of file gmock-Split.cpp.
| gnc_numeric xaccSplitGetAdjustedAmount | ( | const Split * | split | ) |
| gnc_numeric xaccSplitGetAmount | ( | const Split * | split | ) |
Returns the amount of the split in the account's commodity.
Note that for cap-gains splits, this is slaved to the transaction that is causing the gains to occur.
Definition at line 69 of file gmock-Split.cpp.
| gnc_numeric xaccSplitGetBalance | ( | const Split * | split | ) |
Returns the running balance up to and including the indicated split.
The balance is the currency-denominated balance. For accounts with non-unit share prices, it is correctly adjusted for share prices.
Returns the running balance up to & including the indicated split.
Definition at line 1316 of file Split.cpp.
| 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.
If it is the account's commodity, return the amount. If it is neither print a warning message and return gnc_numeric_zero().
Definition at line 1410 of file Split.cpp.
| QofBook * xaccSplitGetBook | ( | const Split * | split | ) |
Returns the book of this split, i.e.
the entity where this split is stored.
Definition at line 45 of file gmock-Split.cpp.
| 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.
It is correctly adjusted for price fluctuations.
Returns the running balance up to & including the indicated split.
Definition at line 1328 of file Split.cpp.
| const char * xaccSplitGetCorrAccountCode | ( | const Split * | sa | ) |
document me
Definition at line 1671 of file Split.cpp.
| 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".
These were added for the transaction report, and is in C because the code was already written in C for the above functions and duplication is silly.
Note that this will only return a real value in case of a two-split transaction as that is the only situation in which a reliable value can be returned. In other situations "-- Split Transaction --" will be returned as Account Name or "Split" for Account Code.
Definition at line 1655 of file Split.cpp.
| const char * xaccSplitGetCorrAccountName | ( | const Split * | sa | ) |
| time64 xaccSplitGetDateReconciled | ( | const Split * | split | ) |
| GNCLot * xaccSplitGetLot | ( | const Split * | split | ) |
| const char * xaccSplitGetMemo | ( | const Split * | split | ) |
Returns the memo string.
Definition at line 99 of file gmock-Split.cpp.
| gnc_numeric xaccSplitGetNoclosingBalance | ( | const Split * | split | ) |
The noclosing-balance is the currency-denominated balance of all transactions except 'closing' transactions.
It is correctly adjusted for price fluctuations.
Returns the running balance up to & including the indicated split.
Definition at line 1322 of file Split.cpp.
| const char * xaccSplitGetOnlineID | ( | const Split * | split | ) |
Returns the split's online_id.
The returned string is owned by the split and must NOT be freed; it is valid until the online_id is changed or the split is destroyed. Returns NULL if no online_id is set.
Definition at line 114 of file gmock-Split.cpp.
| Split * xaccSplitGetOtherSplit | ( | const Split * | split | ) |
The xaccSplitGetOtherSplit() is a convenience routine that returns the other of a pair of splits.
If there are more than two splits, it returns NULL.
Definition at line 159 of file gmock-Split.cpp.
| Transaction * xaccSplitGetParent | ( | const Split * | split | ) |
Returns the parent transaction of the split.
Definition at line 167 of file gmock-Split.cpp.
| char xaccSplitGetReconcile | ( | const Split * | split | ) |
Returns the value of the reconcile flag.
Definition at line 129 of file gmock-Split.cpp.
| gnc_numeric xaccSplitGetReconciledBalance | ( | const Split * | split | ) |
Returns the reconciled-balance of this split.
The reconciled-balance is the currency-denominated balance of all transactions that have been marked as reconciled.
Returns the running balance up to & including the indicated split.
Definition at line 1334 of file Split.cpp.
| gnc_numeric xaccSplitGetSharePrice | ( | const Split * | split | ) |
Returns the price of the split, that is, the value divided by the amount.
If the amount is zero, returns a gnc_numeric of value one.
Definition at line 1995 of file Split.cpp.
| 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.
Definition at line 2039 of file Split.cpp.
| gnc_numeric xaccSplitGetValue | ( | const Split * | split | ) |
Returns the value of this split in the transaction's commodity.
Note that for cap-gains splits, this is slaved to the transaction that is causing the gains to occur.
Definition at line 84 of file gmock-Split.cpp.
| gboolean xaccSplitHasOnlineID | ( | const Split * | split | ) |
Returns TRUE if the split has a non-empty online_id.
Definition at line 1963 of file Split.cpp.
| gboolean xaccSplitHasPeers | ( | const Split * | split | ) |
| gboolean xaccSplitIsPeerSplit | ( | const Split * | split, |
| const Split * | other_split | ||
| ) |
Report if a split is a peer of this one.
| other_split | The split to test for being a peer of this one. |
Definition at line 2108 of file Split.cpp.
| gboolean xaccSplitIsStockSplit | ( | Split * | s | ) |
Returns true if the split is of type stock split.
Definition at line 2078 of file Split.cpp.
The xaccSplitLookup() subroutine will return the split associated with the given id, or NULL if there is no such split.
Definition at line 1091 of file Split.cpp.
| 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.
Definition at line 2063 of file Split.cpp.
| void xaccSplitMergePeerSplits | ( | Split * | split, |
| const Split * | other_split | ||
| ) |
Merge the other_split's peer splits into split's peers.
| other_split | The split donating the peer splits. |
Definition at line 2138 of file Split.cpp.
| gint xaccSplitOrder | ( | const Split * | sa, |
| const Split * | sb | ||
| ) |
The xaccSplitOrder(sa,sb) method is useful for sorting.
if sa and sb have different transactions, return their xaccTransOrder return a negative value if split sa has a smaller currency-value than sb, return a positive value if split sa has a larger currency-value than sb, return a negative value if split sa has a smaller share-price than sb, return a positive value if split sa has a larger share-price than sb, then compares memo and action using the strcmp() c-library routine, returning what strcmp would return. Then it compares the reconciled flags, then the reconciled dates, Finally, it returns zero if all of the above match.
Definition at line 1536 of file Split.cpp.
| gint xaccSplitOrderDateOnly | ( | const Split * | sa, |
| const Split * | sb | ||
| ) |
Definition at line 1600 of file Split.cpp.
| void xaccSplitReinit | ( | Split * | split | ) |
Definition at line 505 of file Split.cpp.
| void xaccSplitRemovePeerSplit | ( | Split * | split, |
| const Split * | other_split | ||
| ) |
Remove a peer split from this split's lot-split list.
| other_split | The split whose guid to remove |
Definition at line 2121 of file Split.cpp.
| void xaccSplitSetAccount | ( | Split * | s, |
| Account * | acc | ||
| ) |
Definition at line 61 of file gmock-Split.cpp.
| void xaccSplitSetAction | ( | Split * | split, |
| const char * | action | ||
| ) |
The Action is an arbitrary user-assigned string.
The action field is an arbitrary user-assigned value. It is meant to be a very short (one to ten character) string that signifies the "type" of this split, such as e.g. Buy, Sell, Div, Withdraw, Deposit, ATM, Check, etc. The idea is that this field can be used to create custom reports or graphs of data. Note that the business features auto-fill this value, but doesn't depend on it. Rather than use this function directly, see 'gnc_set_num_action' in engine/engine-helpers.c & .h which takes a user-set book option for selecting the source for the num-cell (the transaction-number or the split-action field) in registers/reports into account automatically
Definition at line 1786 of file Split.cpp.
| void xaccSplitSetAdjustedAmount | ( | Split * | split, |
| gnc_numeric | amount | ||
| ) |
| void xaccSplitSetAmount | ( | Split * | split, |
| gnc_numeric | amount | ||
| ) |
The xaccSplitSetAmount() method sets the amount in the account's commodity that the split should have.
The following four setter functions set the prices and amounts. All of the routines always maintain balance: that is, invoking any of them will cause other splits in the transaction to be modified so that the net value of the transaction is zero.
IMPORTANT: The split should be parented by an account before any of these routines are invoked! This is because the actual setting of amounts/values requires SCU settings from the account. If these are not available, then amounts/values will be set to -1/0, which is an invalid value. I believe this order dependency is a bug, but I'm too lazy to find, fix & test at the moment ...
Definition at line 77 of file gmock-Split.cpp.
| 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.
If it is the account's commodity, set the amount. If both, set both.
Definition at line 1355 of file Split.cpp.
| void xaccSplitSetDateReconciledSecs | ( | Split * | split, |
| time64 | time | ||
| ) |
Set the date on which this split was reconciled by specifying the time as time64.
Definition at line 144 of file gmock-Split.cpp.
| void xaccSplitSetLot | ( | Split * | split, |
| GNCLot * | lot | ||
| ) |
Assigns the split to a specific Lot.
Definition at line 1926 of file Split.cpp.
| void xaccSplitSetMemo | ( | Split * | split, |
| const char * | memo | ||
| ) |
The memo is an arbitrary string associated with a split.
It is intended to hold a short (zero to forty character) string that is displayed by the GUI along with this split. Users typically type in free form text from the GUI.
Definition at line 107 of file gmock-Split.cpp.
| void xaccSplitSetOnlineID | ( | Split * | split, |
| const char * | id | ||
| ) |
The online_id is the OFX/HBCI "FITID" recorded on a split when it is imported.
It is used to recognise the split on re-import so that overlapping or re-downloaded statements don't create duplicates. This is the same value (engine KVP slot "online_id") that the desktop OFX/HBCI importer reads and writes.
The setter only changes engine data: call it inside the parent transaction's edit (xaccTransBeginEdit()/xaccTransCommitEdit()), and a session save persists it. Passing NULL or "" clears the online_id.
Definition at line 122 of file gmock-Split.cpp.
| void xaccSplitSetParent | ( | Split * | split, |
| Transaction * | trans | ||
| ) |
Definition at line 175 of file gmock-Split.cpp.
| void xaccSplitSetReconcile | ( | Split * | split, |
| char | reconciled_flag | ||
| ) |
Set the reconcile flag.
The Reconcile flag is a single char, whose values are typically are 'n', 'y', 'c'. In Transaction.h, macros are defined for typical values (e.g. CREC, YREC).
Definition at line 137 of file gmock-Split.cpp.
| void xaccSplitSetSharePrice | ( | Split * | split, |
| gnc_numeric | price | ||
| ) |
Definition at line 1205 of file Split.cpp.
| void xaccSplitSetSharePriceAndAmount | ( | Split * | split, |
| gnc_numeric | price, | ||
| gnc_numeric | amount | ||
| ) |
The xaccSplitSetSharePriceAndAmount() method will simultaneously update the share price and the number of shares.
This is a utility routine that is equivalent to a xaccSplitSetSharePrice() followed by and xaccSplitSetAmount(), except that it incurs the processing overhead of balancing only once, instead of twice.
Definition at line 1177 of file Split.cpp.
| void xaccSplitSetValue | ( | Split * | split, |
| gnc_numeric | value | ||
| ) |
The xaccSplitSetValue() method sets the value of this split in the transaction's commodity.
Definition at line 92 of file gmock-Split.cpp.
| gnc_numeric xaccSplitVoidFormerAmount | ( | const Split * | split | ) |
Returns the original pre-void amount of a split.
| split | The split in question. |
Definition at line 2191 of file Split.cpp.
| gnc_numeric xaccSplitVoidFormerValue | ( | const Split * | split | ) |
Returns the original pre-void value of a split.
| split | The split in question. |
Definition at line 2199 of file Split.cpp.