Separate the Split functions from Transaction.c into Split.c.

Introduce xaccSplitVoid() and xaccSplitUnvoid() to aid the separation.


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@13363 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Chris Shoemaker
2006-02-22 21:52:46 +00:00
parent 00ba10ef00
commit 3d6a06e208
7 changed files with 2437 additions and 2233 deletions

View File

@@ -25,6 +25,7 @@ libgncmod_engine_la_SOURCES = \
Scrub.c \
Scrub2.c \
Scrub3.c \
Split.c \
TransLog.c \
Transaction.c \
cap-gains.c \
@@ -62,6 +63,7 @@ gncinclude_HEADERS = \
Scrub.h \
Scrub2.h \
Scrub3.h \
Split.h \
TransLog.h \
Transaction.h \
cap-gains.h \
@@ -89,6 +91,7 @@ noinst_HEADERS = \
QueryP.h \
SchedXactionP.h \
ScrubP.h \
SplitP.h \
SX-book.h \
SX-ttinfo.h \
TransactionP.h \

1687
src/engine/Split.c Normal file

File diff suppressed because it is too large Load Diff

490
src/engine/Split.h Normal file
View File

@@ -0,0 +1,490 @@
/********************************************************************\
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as *
* published by the Free Software Foundation; either version 2 of *
* the License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License*
* along with this program; if not, contact: *
* *
* Free Software Foundation Voice: +1-617-542-5942 *
* 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 *
* Boston, MA 02110-1301, USA gnu@gnu.org *
* *
\********************************************************************/
/** @addtogroup Engine
@{ */
/** @addtogroup Transaction Financial Transactions
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.
@{ */
/** @file Split.h
@brief API for Transactions and Splits (journal entries)
@author Copyright (C) 1997 Robin D. Clark
@author Copyright (C) 1997-2001 Linas Vepstas <linas@linas.org>
*/
#ifndef XACC_SPLIT_H
#define XACC_SPLIT_H
#include <time.h>
#include "gnc-commodity.h"
#include "gnc-engine.h"
/** @name 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 */
/** @} */
/* Convert the amount/value of the Split for viewing in the account --
* in particular we want to convert the Split to be in to_commodity.
* Returns the amount.
*/
gnc_numeric xaccSplitConvertAmount (Split *split, Account * account);
/*-----------------------------------------------------------------------
* Splits
*-----------------------------------------------------------------------*/
/** @name Split general getters/setters
@{
*/
/** Constructor. */
Split * xaccMallocSplit (QofBook *book);
/* Reinit a previously malloc'd split. Split remains in the book it
was already in, and the QofEntity portions also remain unchanged.
It's basically the data elements that are reverted to default
values. */
void xaccSplitReinit(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.
*
* If the deletion of the split leaves the transaction with no splits,
* then the transaction will be marked for deletion. (It will not be
* deleted until the xaccTransCommitEdit() routine is called.)
*
* @return TRUE upon successful deletion of the split. FALSE when
* the parenting Transaction is a read-only one.
*/
gboolean xaccSplitDestroy (Split *split);
/** Returns the book of this split, i.e. the entity where this split
* is stored. */
QofBook * xaccSplitGetBook (const Split *split);
/** Returns the account of this split, which was set through
* xaccAccountInsertSplit(). */
Account * xaccSplitGetAccount (const Split *split);
/** Returns the parent transaction of the split, which was set through
* xaccTransAppendSplit(). */
Transaction * xaccSplitGetParent (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. */
GNCLot * xaccSplitGetLot (const Split *split);
/** Returns the KvpFrame slots of this split for direct editing.
*
* Split slots are used to store arbitrary strings, numbers, and
* structures which aren't members of the transaction struct. See
* kvp_doc.txt for reserved slot names.
*/
KvpFrame *xaccSplitGetSlots(const Split *split);
/** Set the KvpFrame slots of this split to the given frm by directly
* using the frm pointer (i.e. non-copying). */
void xaccSplitSetSlots_nc(Split *s, KvpFrame *frm);
/** 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. */
void xaccSplitSetMemo (Split *split, const char *memo);
/** Returns the memo string. */
const char * xaccSplitGetMemo (const Split *split);
/** 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 cahracter) 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. */
void xaccSplitSetAction (Split *split, const char *action);
/** Returns the action string. */
const char * xaccSplitGetAction (const Split *split);
/** @} */
/** @name Split Date getters/setters
@{
*/
/** 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). */
void xaccSplitSetReconcile (Split *split, char reconciled_flag);
/** Returns the value of the reconcile flag. */
char xaccSplitGetReconcile (const Split *split);
/** Set the date on which this split was reconciled by specifying the
* time as time_t. */
void xaccSplitSetDateReconciledSecs (Split *split, time_t time);
/** Set the date on which this split was reconciled by specifying the
* time as Timespec. */
void xaccSplitSetDateReconciledTS (Split *split, Timespec *ts);
/** Get the date on which this split was reconciled by having it
* written into the Timespec that 'ts' is pointing to. */
void xaccSplitGetDateReconciledTS (const Split *split,
Timespec *ts);
/** Returns the date (as Timespec) on which this split was reconciled. */
Timespec xaccSplitRetDateReconciledTS (const Split *split);
/** @} */
/** @name 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.
@{
*/
/** 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 beleive this order dependency
* is a bug, but I'm too lazy to find, fix & test at the moment ...
*
* @note If you use this on a newly created transaction, make sure
* that the 'value' is also set so that it doesn't remain zero.
*/
void xaccSplitSetAmount (Split *split, gnc_numeric amount);
/** 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.
*/
gnc_numeric xaccSplitGetAmount (const Split * split);
/** The xaccSplitSetValue() method sets the value of this split in the
* transaction's commodity.
*
* @note If you use this on a newly created transaction, make sure
* that the 'amount' is also set so that it doesn't remain zero.
*/
void xaccSplitSetValue (Split *split, gnc_numeric value);
/** 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.
*/
gnc_numeric xaccSplitGetValue (const Split * split);
/** 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. */
void xaccSplitSetSharePriceAndAmount (Split *split,
gnc_numeric price,
gnc_numeric amount);
/** 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. */
gnc_numeric xaccSplitGetSharePrice (const Split * split);
/** 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.
*
* @note <b>WATCH OUT:</b> When using this function and the
* transaction's and account's commodities are different, the amount
* or the value will be left as zero. This might screw up the
* multi-currency handling code in the register. So please think twice
* whether you need this function -- using xaccSplitSetValue()
* together with xaccSplitSetAmount() is definitely the better and
* safer solution!
*/
void xaccSplitSetBaseValue (Split *split, gnc_numeric value,
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().
*/
gnc_numeric xaccSplitGetBaseValue (const Split *split,
const gnc_commodity * base_currency);
/** 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.
*/
gnc_numeric xaccSplitGetBalance (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.
*/
gnc_numeric xaccSplitGetClearedBalance (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.
*/
gnc_numeric xaccSplitGetReconciledBalance (const Split *split);
/** @} */
/** @name Split utility functions
@{
*/
/* Get a GList of unique transactions containing the given list of Splits. */
GList *xaccSplitListGetUniqueTransactions(const GList *splits);
/** Equality.
*
* @param sa First split to compare
* @param sb Second split to compare
*
* @param check_guids If TRUE, try a guid_equal() on the GUIDs of both
* splits if their pointers are not equal in the first place.
*
* @param 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.
*
* @param check_txn_splits If the pointers are not equal, but
* everything else so far is equal (including memo, amount, value,
* kvp_frame), then, when comparing the parenting transactions with
* xaccTransEqual(), set its argument check_splits to be TRUE.
*/
gboolean xaccSplitEqual(const Split *sa, const Split *sb,
gboolean check_guids,
gboolean check_balances,
gboolean check_txn_splits);
/** The xaccSplitLookup() subroutine will return the
* split associated with the given id, or NULL
* if there is no such split. */
Split * xaccSplitLookup (const GUID *guid, QofBook *book);
#define xaccSplitLookupDirect(g,b) xaccSplitLookup(&(g),b)
/**
* 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.
*/
Split * xaccSplitGetOtherSplit (const Split *split);
/** The xaccIsPeerSplit() is a convenience routine that returns TRUE
* (a non-zero value) if the two splits share a common parent
* transaction, else it returns FALSE (zero).
*/
gboolean xaccIsPeerSplit (const Split *split_1, const Split *split_2);
/** Returns the split type, which is either the string "normal", or
* "stock-split" for a split from a stock split (pun intended? :-). */
const char *xaccSplitGetType(const Split *s);
/** Mark a split to be of type stock split - after this, you shouldn't
modify the value anymore, just the amount. */
void xaccSplitMakeStockSplit(Split *s);
/**
* The xaccSplitDateOrder(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.
*/
int xaccSplitDateOrder (const Split *sa, const Split *sb);
/*
* These functions compare two splits by different criteria.
*
* These functions were added because converting strings to guile
* for comparisons in the transaction report is terribly inefficient.
* More may be added here in future if it turns out that other types
* of comparisons also induces guile slowdowns.
*/
/** Compare two splits by full name of account. Returns similar to
* strcmp. */
int xaccSplitCompareAccountFullNames(const Split *sa, const Split *sb);
/** Compare two splits by code of account. Returns similar to
* strcmp. */
int xaccSplitCompareAccountCodes(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. */
int xaccSplitCompareOtherAccountFullNames(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. */
int xaccSplitCompareOtherAccountCodes(const Split *sa, const Split *sb);
/**
* 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.
*/
char * xaccSplitGetCorrAccountFullName(const Split *sa, char seperator);
/** document me */
const char * xaccSplitGetCorrAccountName(const Split *sa);
/** document me */
const char * xaccSplitGetCorrAccountCode(const Split *sa);
/** @} */
/** @name Split deprecated functions
@{
*/
/** @deprecated The xaccSplitSetSharePrice() method sets the price of the
* split. DEPRECATED - set the value and amount instead. */
void xaccSplitSetSharePrice (Split *split, gnc_numeric price);
/** @} */
/********************************************************************\
* Miscellaneous utility routines.
\********************************************************************/
/** @name Split voiding
@{
*/
/** Returns the original pre-void amount of a split.
*
* @param split The split in question.
*
* @return A gnc_numeric containing the original value of this split.
* Returns a gnc_numeric of zero upon error.
*/
gnc_numeric xaccSplitVoidFormerAmount(const Split *split);
/** Returns the original pre-void value of a split.
*
* @param split The split in question.
*
* @return A gnc_numeric containing the original amount of this split.
* Returns a gnc_numeric of zero upon error.
*/
gnc_numeric xaccSplitVoidFormerValue(const Split *split);
/** @} */
/** @name 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 */
/* used for SORTING ONLY */
#define SPLIT_ACCT_FULLNAME "acct-fullname"
#define SPLIT_CORR_ACCT_NAME "corr-acct-fullname"
#define SPLIT_CORR_ACCT_CODE "corr-acct-code"
/** @} */
/** \deprecated */
#define xaccSplitGetGUID(X) qof_entity_get_guid(QOF_ENTITY(X))
/** \deprecated */
#define xaccSplitReturnGUID(X) (X ? *(qof_entity_get_guid(QOF_ENTITY(X))) : *(guid_null()))
#endif /* XACC_SPLIT_H */
/** @} */
/** @} */

243
src/engine/SplitP.h Normal file
View File

@@ -0,0 +1,243 @@
/********************************************************************\
* SplitP.h -- private header for splits *
* Copyright (C) 1997 Robin D. Clark *
* Copyright (C) 1997-2000 Linas Vepstas <linas@linas.org> *
* Copyright (C) 2000 Bill Gribble *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as *
* published by the Free Software Foundation; either version 2 of *
* the License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License*
* along with this program; if not, contact: *
* *
* Free Software Foundation Voice: +1-617-542-5942 *
* 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 *
* Boston, MA 02110-1301, USA gnu@gnu.org *
* *
\********************************************************************/
/*
* FILE:
* SplitP.h
*
* FUNCTION:
* The is the *private* split header file. Code outside of
* engine should *not* include this file. This is because code
* outside of the engine should *never* access any of the structure
* members directly.
*
* Note that this header file also defines prototypes for various
* routines that perform sub-atomic updates of the accounting
* structures. If these routines are not used properly, they
* can result in inconsistent, unbalanced accounting structures.
* In other words, their use is dangerous, and their use outside
* of the scope of the engine is forbidden.
*
*/
#ifndef XACC_SPLIT_P_H
#define XACC_SPLIT_P_H
#include "config.h"
#include <time.h>
#include <glib.h>
#include "gnc-engine.h" /* for typedefs */
#include "qof.h"
/** STRUCTS *********************************************************/
/* A "split" is more commonly referred to as an "entry" in a "transaction".
*/
/* Flags for handling cap-gains status */
#define GAINS_STATUS_UNKNOWN 0xff
#define GAINS_STATUS_CLEAN 0x0
#define GAINS_STATUS_GAINS 0x3
#define GAINS_STATUS_DATE_DIRTY 0x10
#define GAINS_STATUS_AMNT_DIRTY 0x20
#define GAINS_STATUS_VALU_DIRTY 0x40
#define GAINS_STATUS_LOT_DIRTY 0x80
#define GAINS_STATUS_ADIRTY (GAINS_STATUS_AMNT_DIRTY|GAINS_STATUS_LOT_DIRTY)
#define GAINS_STATUS_VDIRTY (GAINS_STATUS_VALU_DIRTY)
#define GAINS_STATUS_A_VDIRTY (GAINS_STATUS_AMNT_DIRTY|GAINS_STATUS_VALU_DIRTY|GAINS_STATUS_LOT_DIRTY)
struct split_s
{
QofInstance inst;
Account *acc; /* back-pointer to debited/credited account */
GNCLot *lot; /* back-pointer to debited/credited lot */
Transaction *parent; /* parent of split */
/* The memo field is an arbitrary user-assiged value.
* It is intended to hold a short (zero to forty character) string
* that is displayed by the GUI along with this split.
*/
char * memo;
/* 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.
*/
char * action; /* Buy, Sell, Div, etc. */
Timespec date_reconciled; /* date split was reconciled */
char reconciled; /* The reconciled field */
/* gains is a flag used to track the relationship between
* capital-gains splits. Depending on its value, this flag indicates
* if this split is the source of gains, if this split is a record
* of the gains, and if values are 'dirty' and need to be recomputed.
*/
unsigned char gains;
/* 'gains_split' is a convenience pointer used to track down the
* other end of a cap-gains transaction pair. NULL if this split
* doesn't involve cap gains.
*/
Split *gains_split;
/* 'value' is the quantity of the transaction balancing commodity
* (i.e. currency) involved, 'amount' is the amount of the account's
* commodity involved. */
gnc_numeric value;
gnc_numeric amount;
/* -------------------------------------------------------------- */
/* Below follow some 'temporary' fields */
/* The various "balances" are the sum of all of the values of
* all the splits in the account, up to and including this split.
* These balances apply to a sorting order by date posted
* (not by date entered). */
gnc_numeric balance;
gnc_numeric cleared_balance;
gnc_numeric reconciled_balance;
/* -------------------------------------------------------------- */
/* Backend private expansion data */
guint32 idata; /* used by the sql backend for kvp management */
};
/* Set the split's GUID. This should only be done when reading
* a split from a datafile, or some other external source. Never
* call this on an existing split! */
#define xaccSplitSetGUID(s,g) qof_entity_set_guid(QOF_ENTITY(s),g)
/* The xaccFreeSplit() method simply frees all memory associated
* with the split. It does not verify that the split isn't
* referenced in some account. If the split is referenced by an
* account, then calling this method will leave the system in an
* inconsistent state. This *will* lead to crashes and hangs.
*/
void xaccFreeSplit (Split *split); /* frees memory */
Split * xaccSplitClone (const Split *s);
Split *xaccDupeSplit (const Split *s);
G_INLINE_FUNC void mark_split (Split *s);
G_INLINE_FUNC void gen_event (const Split *split);
void xaccSplitVoid(Split *split);
void xaccSplitUnvoid(Split *split);
/* Compute the value of a list of splits in the given currency,
* excluding the skip_me split. */
gnc_numeric xaccSplitsComputeValue (GList *splits, Split * skip_me,
const gnc_commodity * base_currency);
/* Code to register Split type with the engine */
gboolean xaccSplitRegister (void);
/* The xaccSplitDetermineGainStatus() routine will analyze the
* the split, and try to set the internal status flags
* appropriately for the split. These flags indicate if the split
* represents cap gains, and if the gains value/amount needs to be
* recomputed.
*/
void xaccSplitDetermineGainStatus (Split *split);
/* ---------------------------------------------------------------- */
/* Deprecated routines */
void DxaccSplitSetSharePriceAndAmount (Split *split,
double price,
double amount);
void DxaccSplitSetShareAmount (Split *split, double amount);
/********************************************************************\
* sorting comparison function
*
* returns a negative value if transaction a is dated earlier than b,
* returns a positive value if transaction a is dated later than b,
*
* This function tries very hard to uniquely order all transactions.
* If two transactions occur on the same date, then their "num" fields
* are compared. If the num fields are identical, then the description
* fields are compared. If these are identical, then the memo fields
* are compared. Hopefully, there will not be any transactions that
* occur on the same day that have all three of these values identical.
*
* Note that being able to establish this kind of absolute order is
* important for some of the ledger display functions.
*
* Yes, this kind of code dependency is ugly, but the alternatives seem
* ugly too.
*
\********************************************************************/
#define DATE_CMP(aaa,bbb,field) { \
/* if dates differ, return */ \
if ( (aaa->field.tv_sec) < \
(bbb->field.tv_sec)) { \
return -1; \
} else \
if ( (aaa->field.tv_sec) > \
(bbb->field.tv_sec)) { \
return +1; \
} \
\
/* else, seconds match. check nanoseconds */ \
if ( (aaa->field.tv_nsec) < \
(bbb->field.tv_nsec)) { \
return -1; \
} else \
if ( (aaa->field.tv_nsec) > \
(bbb->field.tv_nsec)) { \
return +1; \
} \
}
#define CHECK_GAINS_STATUS(s) \
if (GAINS_STATUS_UNKNOWN == s->gains) xaccSplitDetermineGainStatus(s);
#define SET_GAINS_DIRTY(s,flg) do { \
if (FALSE == (GAINS_STATUS_GAINS & s->gains)) { \
s->gains |= flg; \
} else { \
if (s->gains_split) s->gains_split->gains |= flg; \
} \
} while (0)
#define SET_GAINS_ADIRTY(s) SET_GAINS_DIRTY(s,GAINS_STATUS_ADIRTY);
#define SET_GAINS_A_VDIRTY(s) SET_GAINS_DIRTY(s,GAINS_STATUS_A_VDIRTY);
#define SET_GAINS_VDIRTY(s) SET_GAINS_DIRTY(s,GAINS_STATUS_VDIRTY);
/*@}*/
#endif /* XACC_SPLIT_P_H */

File diff suppressed because it is too large Load Diff

View File

@@ -90,21 +90,7 @@ Splits plus the value of all of its sub-Accounts.
#include "gnc-commodity.h"
#include "gnc-engine.h"
/** @name 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 */
/** @} */
#include "Split.h"
/** @name Transaction Type field values
@{
@@ -348,12 +334,6 @@ gnc_numeric xaccTransGetAccountAmount (const Transaction *trans,
*/
gnc_numeric xaccTransGetAccountConvRate(Transaction *txn, Account *acc);
/* Convert the amount/value of the Split for viewing in the account --
* in particular we want to convert the Split to be in to_commodity.
* Returns the amount.
*/
gnc_numeric xaccSplitConvertAmount (Split *split, Account * account);
/** Get the account balance for the specified account after the last
split in the specified transaction. */
gnc_numeric xaccTransGetAccountBalance (const Transaction *trans,
@@ -449,362 +429,6 @@ void xaccTransGetDateDueTS (const Transaction *trans, Timespec *ts);
/** @} */
/*-----------------------------------------------------------------------
* Splits
*-----------------------------------------------------------------------*/
/** @name Split general getters/setters
@{
*/
/** Constructor. */
Split * xaccMallocSplit (QofBook *book);
/* Reinit a previously malloc'd split. Split remains in the book it
was already in, and the QofEntity portions also remain unchanged.
It's basically the data elements that are reverted to default
values. */
void xaccSplitReinit(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.
*
* If the deletion of the split leaves the transaction with no splits,
* then the transaction will be marked for deletion. (It will not be
* deleted until the xaccTransCommitEdit() routine is called.)
*
* @return TRUE upon successful deletion of the split. FALSE when
* the parenting Transaction is a read-only one.
*/
gboolean xaccSplitDestroy (Split *split);
/** Returns the book of this split, i.e. the entity where this split
* is stored. */
QofBook * xaccSplitGetBook (const Split *split);
/** Returns the account of this split, which was set through
* xaccAccountInsertSplit(). */
Account * xaccSplitGetAccount (const Split *split);
/** Returns the parent transaction of the split, which was set through
* xaccTransAppendSplit(). */
Transaction * xaccSplitGetParent (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. */
GNCLot * xaccSplitGetLot (const Split *split);
/** Returns the KvpFrame slots of this split for direct editing.
*
* Split slots are used to store arbitrary strings, numbers, and
* structures which aren't members of the transaction struct. See
* kvp_doc.txt for reserved slot names.
*/
KvpFrame *xaccSplitGetSlots(const Split *split);
/** Set the KvpFrame slots of this split to the given frm by directly
* using the frm pointer (i.e. non-copying). */
void xaccSplitSetSlots_nc(Split *s, KvpFrame *frm);
/** 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. */
void xaccSplitSetMemo (Split *split, const char *memo);
/** Returns the memo string. */
const char * xaccSplitGetMemo (const Split *split);
/** 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 cahracter) 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. */
void xaccSplitSetAction (Split *split, const char *action);
/** Returns the action string. */
const char * xaccSplitGetAction (const Split *split);
/** @} */
/** @name Split Date getters/setters
@{
*/
/** 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). */
void xaccSplitSetReconcile (Split *split, char reconciled_flag);
/** Returns the value of the reconcile flag. */
char xaccSplitGetReconcile (const Split *split);
/** Set the date on which this split was reconciled by specifying the
* time as time_t. */
void xaccSplitSetDateReconciledSecs (Split *split, time_t time);
/** Set the date on which this split was reconciled by specifying the
* time as Timespec. */
void xaccSplitSetDateReconciledTS (Split *split, Timespec *ts);
/** Get the date on which this split was reconciled by having it
* written into the Timespec that 'ts' is pointing to. */
void xaccSplitGetDateReconciledTS (const Split *split,
Timespec *ts);
/** Returns the date (as Timespec) on which this split was reconciled. */
Timespec xaccSplitRetDateReconciledTS (const Split *split);
/** @} */
/** @name 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.
@{
*/
/** 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 beleive this order dependency
* is a bug, but I'm too lazy to find, fix & test at the moment ...
*
* @note If you use this on a newly created transaction, make sure
* that the 'value' is also set so that it doesn't remain zero.
*/
void xaccSplitSetAmount (Split *split, gnc_numeric amount);
/** 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.
*/
gnc_numeric xaccSplitGetAmount (const Split * split);
/** The xaccSplitSetValue() method sets the value of this split in the
* transaction's commodity.
*
* @note If you use this on a newly created transaction, make sure
* that the 'amount' is also set so that it doesn't remain zero.
*/
void xaccSplitSetValue (Split *split, gnc_numeric value);
/** 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.
*/
gnc_numeric xaccSplitGetValue (const Split * split);
/** 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. */
void xaccSplitSetSharePriceAndAmount (Split *split,
gnc_numeric price,
gnc_numeric amount);
/** 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. */
gnc_numeric xaccSplitGetSharePrice (const Split * split);
/** 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.
*
* @note <b>WATCH OUT:</b> When using this function and the
* transaction's and account's commodities are different, the amount
* or the value will be left as zero. This might screw up the
* multi-currency handling code in the register. So please think twice
* whether you need this function -- using xaccSplitSetValue()
* together with xaccSplitSetAmount() is definitely the better and
* safer solution!
*/
void xaccSplitSetBaseValue (Split *split, gnc_numeric value,
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().
*/
gnc_numeric xaccSplitGetBaseValue (const Split *split,
const gnc_commodity * base_currency);
/** 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.
*/
gnc_numeric xaccSplitGetBalance (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.
*/
gnc_numeric xaccSplitGetClearedBalance (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.
*/
gnc_numeric xaccSplitGetReconciledBalance (const Split *split);
/** @} */
/** @name Split utility functions
@{
*/
/* Get a GList of unique transactions containing the given list of Splits. */
GList *xaccSplitListGetUniqueTransactions(const GList *splits);
/** Equality.
*
* @param sa First split to compare
* @param sb Second split to compare
*
* @param check_guids If TRUE, try a guid_equal() on the GUIDs of both
* splits if their pointers are not equal in the first place.
*
* @param 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.
*
* @param check_txn_splits If the pointers are not equal, but
* everything else so far is equal (including memo, amount, value,
* kvp_frame), then, when comparing the parenting transactions with
* xaccTransEqual(), set its argument check_splits to be TRUE.
*/
gboolean xaccSplitEqual(const Split *sa, const Split *sb,
gboolean check_guids,
gboolean check_balances,
gboolean check_txn_splits);
/** The xaccSplitLookup() subroutine will return the
* split associated with the given id, or NULL
* if there is no such split. */
Split * xaccSplitLookup (const GUID *guid, QofBook *book);
#define xaccSplitLookupDirect(g,b) xaccSplitLookup(&(g),b)
/**
* 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.
*/
Split * xaccSplitGetOtherSplit (const Split *split);
/** The xaccIsPeerSplit() is a convenience routine that returns TRUE
* (a non-zero value) if the two splits share a common parent
* transaction, else it returns FALSE (zero).
*/
gboolean xaccIsPeerSplit (const Split *split_1, const Split *split_2);
/** Returns the split type, which is either the string "normal", or
* "stock-split" for a split from a stock split (pun intended? :-). */
const char *xaccSplitGetType(const Split *s);
/** Mark a split to be of type stock split - after this, you shouldn't
modify the value anymore, just the amount. */
void xaccSplitMakeStockSplit(Split *s);
/**
* The xaccSplitDateOrder(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.
*/
int xaccSplitDateOrder (const Split *sa, const Split *sb);
/*
* These functions compare two splits by different criteria.
*
* These functions were added because converting strings to guile
* for comparisons in the transaction report is terribly inefficient.
* More may be added here in future if it turns out that other types
* of comparisons also induces guile slowdowns.
*/
/** Compare two splits by full name of account. Returns similar to
* strcmp. */
int xaccSplitCompareAccountFullNames(const Split *sa, const Split *sb);
/** Compare two splits by code of account. Returns similar to
* strcmp. */
int xaccSplitCompareAccountCodes(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. */
int xaccSplitCompareOtherAccountFullNames(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. */
int xaccSplitCompareOtherAccountCodes(const Split *sa, const Split *sb);
/**
* 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.
*/
char * xaccSplitGetCorrAccountFullName(const Split *sa, char seperator);
/** document me */
const char * xaccSplitGetCorrAccountName(const Split *sa);
/** document me */
const char * xaccSplitGetCorrAccountCode(const Split *sa);
/** @} */
/** @name Split deprecated functions
@{
*/
/** @deprecated The xaccSplitSetSharePrice() method sets the price of the
* split. DEPRECATED - set the value and amount instead. */
void xaccSplitSetSharePrice (Split *split, gnc_numeric price);
/** @} */
/********************************************************************\
* Miscellaneous utility routines.
@@ -875,24 +499,6 @@ gboolean xaccTransGetVoidStatus(const Transaction *transaction);
*/
char *xaccTransGetVoidReason(const Transaction *transaction);
/** Returns the original pre-void amount of a split.
*
* @param split The split in question.
*
* @return A gnc_numeric containing the original value of this split.
* Returns a gnc_numeric of zero upon error.
*/
gnc_numeric xaccSplitVoidFormerAmount(const Split *split);
/** Returns the original pre-void value of a split.
*
* @param split The split in question.
*
* @return A gnc_numeric containing the original amount of this split.
* Returns a gnc_numeric of zero upon error.
*/
gnc_numeric xaccSplitVoidFormerValue(const Split *split);
/** Returns the time that a transaction was voided.
*
* @param tr The transaction in question.
@@ -903,40 +509,6 @@ gnc_numeric xaccSplitVoidFormerValue(const Split *split);
Timespec xaccTransGetVoidTime(const Transaction *tr);
/** @} */
/** @name 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 */
/* used for SORTING ONLY */
#define SPLIT_ACCT_FULLNAME "acct-fullname"
#define SPLIT_CORR_ACCT_NAME "corr-acct-fullname"
#define SPLIT_CORR_ACCT_CODE "corr-acct-code"
/** @} */
/** @name Transaction Parameter names
@{
*/
@@ -958,10 +530,6 @@ Timespec xaccTransGetVoidTime(const Transaction *tr);
#define RECONCILED_MATCH_TYPE "reconciled-match"
/** \deprecated */
#define xaccSplitGetGUID(X) qof_entity_get_guid(QOF_ENTITY(X))
/** \deprecated */
#define xaccSplitReturnGUID(X) (X ? *(qof_entity_get_guid(QOF_ENTITY(X))) : *(guid_null()))
/** \deprecated */
#define xaccTransGetBook(X) qof_instance_get_book (QOF_INSTANCE(X))
/** \deprecated */

View File

@@ -51,6 +51,7 @@
#include <glib.h>
#include "gnc-engine.h" /* for typedefs */
#include "SplitP.h"
#include "qof.h"
@@ -72,81 +73,6 @@
* A "split" is more commonly referred to as an "entry" in a "transaction".
*/
/* Flags for handling cap-gains status */
#define GAINS_STATUS_UNKNOWN 0xff
#define GAINS_STATUS_CLEAN 0x0
#define GAINS_STATUS_GAINS 0x3
#define GAINS_STATUS_DATE_DIRTY 0x10
#define GAINS_STATUS_AMNT_DIRTY 0x20
#define GAINS_STATUS_VALU_DIRTY 0x40
#define GAINS_STATUS_LOT_DIRTY 0x80
#define GAINS_STATUS_ADIRTY (GAINS_STATUS_AMNT_DIRTY|GAINS_STATUS_LOT_DIRTY)
#define GAINS_STATUS_VDIRTY (GAINS_STATUS_VALU_DIRTY)
#define GAINS_STATUS_A_VDIRTY (GAINS_STATUS_AMNT_DIRTY|GAINS_STATUS_VALU_DIRTY|GAINS_STATUS_LOT_DIRTY)
struct split_s
{
QofInstance inst;
Account *acc; /* back-pointer to debited/credited account */
GNCLot *lot; /* back-pointer to debited/credited lot */
Transaction *parent; /* parent of split */
/* The memo field is an arbitrary user-assiged value.
* It is intended to hold a short (zero to forty character) string
* that is displayed by the GUI along with this split.
*/
char * memo;
/* 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.
*/
char * action; /* Buy, Sell, Div, etc. */
Timespec date_reconciled; /* date split was reconciled */
char reconciled; /* The reconciled field */
/* gains is a flag used to track the relationship between
* capital-gains splits. Depending on its value, this flag indicates
* if this split is the source of gains, if this split is a record
* of the gains, and if values are 'dirty' and need to be recomputed.
*/
unsigned char gains;
/* 'gains_split' is a convenience pointer used to track down the
* other end of a cap-gains transaction pair. NULL if this split
* doesn't involve cap gains.
*/
Split *gains_split;
/* 'value' is the quantity of the transaction balancing commodity
* (i.e. currency) involved, 'amount' is the amount of the account's
* commodity involved. */
gnc_numeric value;
gnc_numeric amount;
/* -------------------------------------------------------------- */
/* Below follow some 'temporary' fields */
/* The various "balances" are the sum of all of the values of
* all the splits in the account, up to and including this split.
* These balances apply to a sorting order by date posted
* (not by date entered). */
gnc_numeric balance;
gnc_numeric cleared_balance;
gnc_numeric reconciled_balance;
/* -------------------------------------------------------------- */
/* Backend private expansion data */
guint32 idata; /* used by the sql backend for kvp management */
};
struct transaction_s
{
QofInstance inst; /* glbally unique id */
@@ -201,21 +127,6 @@ struct transaction_s
* call this on an existing transaction! */
#define xaccTransSetGUID(t,g) qof_entity_set_guid(QOF_ENTITY(t),g)
/* Set the split's GUID. This should only be done when reading
* a split from a datafile, or some other external source. Never
* call this on an existing split! */
#define xaccSplitSetGUID(s,g) qof_entity_set_guid(QOF_ENTITY(s),g)
/* The xaccFreeSplit() method simply frees all memory associated
* with the split. It does not verify that the split isn't
* referenced in some account. If the split is referenced by an
* account, then calling this method will leave the system in an
* inconsistent state. This *will* lead to crashes and hangs.
*/
void xaccFreeSplit (Split *split); /* frees memory */
Split * xaccSplitClone (const Split *s);
/* This routine makes a 'duplicate' of the indicated transaction.
* This routine cannot be exposed publically since the duplicate
* is wrong in many ways: it is not issued a unique guid, and thus
@@ -227,11 +138,6 @@ Split * xaccSplitClone (const Split *s);
*/
Transaction * xaccDupeTransaction (const Transaction *t);
/* Compute the value of a list of splits in the given currency,
* excluding the skip_me split. */
gnc_numeric xaccSplitsComputeValue (GList *splits, Split * skip_me,
const gnc_commodity * base_currency);
/* The xaccTransSet/GetVersion() routines set & get the version
* numbers on this transaction. The version number is used to manage
* multi-user updates. These routines are private because we don't
@@ -240,8 +146,7 @@ gnc_numeric xaccSplitsComputeValue (GList *splits, Split * skip_me,
void xaccTransSetVersion (Transaction*, gint32);
gint32 xaccTransGetVersion (const Transaction*);
/* Code to register Split and Transaction types with the engine */
gboolean xaccSplitRegister (void);
/* Code to register Transaction type with the engine */
gboolean xaccTransRegister (void);
/* The xaccTransactionGetBackend() subroutine will find the
@@ -264,22 +169,6 @@ QofBackend * xaccTransactionGetBackend (Transaction *trans);
void xaccEnableDataScrubbing(void);
void xaccDisableDataScrubbing(void);
/* The xaccSplitDetermineGainStatus() routine will analyze the
* the split, and try to set the internal status flags
* appropriately for the split. These flags indicate if the split
* represents cap gains, and if the gains value/amount needs to be
* recomputed.
*/
void xaccSplitDetermineGainStatus (Split *split);
/* ---------------------------------------------------------------- */
/* Depricated routines */
void DxaccSplitSetSharePriceAndAmount (Split *split,
double price,
double amount);
void DxaccSplitSetShareAmount (Split *split, double amount);
/** Set the KvpFrame slots of this transaction to the given frm by
* * directly using the frm pointer (i.e. non-copying).
* * XXX this is wrong, nedds to be replaced with a transactional thingy
@@ -287,6 +176,9 @@ void DxaccSplitSetShareAmount (Split *split, double amount);
* */
#define xaccTransSetSlots_nc(T,F) qof_instance_set_slots(QOF_INSTANCE(T),F)
void xaccTransRemoveSplit (Transaction *trans, const Split *split);
G_INLINE_FUNC void check_open (const Transaction *trans);
/*@}*/