26 #include "split-register-copy-ops.h" 31 g_return_val_if_fail (fs, NULL);
37 g_return_val_if_fail (fs, NULL);
41 Transaction *gnc_float_split_get_transaction (
const FloatingSplit *fs)
43 g_return_val_if_fail (fs, NULL);
44 return fs->m_transaction;
47 const char *gnc_float_split_get_memo (
const FloatingSplit *fs)
49 g_return_val_if_fail (fs, NULL);
53 const char *gnc_float_split_get_action (
const FloatingSplit *fs)
55 g_return_val_if_fail (fs, NULL);
59 char gnc_float_split_get_reconcile_state (
const FloatingSplit *fs)
61 g_return_val_if_fail (fs,
'\0');
62 return fs->m_reconcile_state;
67 g_return_val_if_fail (fs, G_MAXINT64);
68 return fs->m_reconcile_date;
71 gnc_numeric gnc_float_split_get_amount (
const FloatingSplit *fs)
73 g_return_val_if_fail (fs, gnc_numeric_zero());
77 gnc_numeric gnc_float_split_get_value (
const FloatingSplit *fs)
79 g_return_val_if_fail (fs, gnc_numeric_zero());
85 void gnc_float_split_set_split(
FloatingSplit *fs, Split *split)
87 g_return_if_fail (fs);
93 g_return_if_fail (fs);
94 fs->m_account = account;
97 void gnc_float_split_set_transaction (
FloatingSplit *fs, Transaction *transaction)
99 g_return_if_fail (fs);
100 fs->m_transaction = transaction;
103 void gnc_float_split_set_memo (
FloatingSplit *fs,
const char *memo)
105 g_return_if_fail (fs);
106 CACHE_REPLACE (fs->m_memo, memo);
109 void gnc_float_split_set_action (
FloatingSplit *fs,
const char *action)
111 g_return_if_fail (fs);
112 CACHE_REPLACE (fs->m_action, action);
115 void gnc_float_split_set_reconcile_state (
FloatingSplit *fs,
char reconcile_state)
117 g_return_if_fail (fs);
118 fs->m_reconcile_state = reconcile_state;
123 g_return_if_fail (fs);
124 fs->m_reconcile_date = reconcile_date;
127 void gnc_float_split_set_amount (
FloatingSplit *fs,
const gnc_numeric amount)
129 g_return_if_fail (fs);
131 fs->m_amount = amount;
134 void gnc_float_split_set_value (
FloatingSplit *fs,
const gnc_numeric value)
136 g_return_if_fail (fs);
149 g_return_val_if_fail (split, NULL);
171 void gnc_float_split_to_split (
const FloatingSplit *fs, Split *split)
173 g_return_if_fail(split);
184 xaccSplitSetAccount (split, fs->m_account);
191 g_return_if_fail (fs);
193 CACHE_REMOVE (fs->m_memo);
194 CACHE_REMOVE (fs->m_action);
199 Transaction *gnc_float_txn_get_txn (
const FloatingTxn *ft)
201 g_return_val_if_fail (ft, NULL);
205 gnc_commodity *gnc_float_txn_get_currency (
const FloatingTxn *ft)
207 g_return_val_if_fail (ft, NULL);
208 return ft->m_currency;
213 g_return_val_if_fail (ft, G_MAXINT64);
214 return ft->m_date_entered;
219 g_return_val_if_fail (ft, G_MAXINT64);
220 return ft->m_date_posted;
223 const char *gnc_float_txn_get_num (
const FloatingTxn *ft)
225 g_return_val_if_fail (ft, NULL);
229 const char *gnc_float_txn_get_description (
const FloatingTxn *ft)
231 g_return_val_if_fail (ft, NULL);
232 return ft->m_description;
235 const char *gnc_float_txn_get_notes (
const FloatingTxn *ft)
237 g_return_val_if_fail (ft, NULL);
241 const char *gnc_float_txn_get_doclink (
const FloatingTxn *ft)
243 g_return_val_if_fail (ft, NULL);
244 return ft->m_doclink;
249 g_return_val_if_fail (ft, NULL);
255 g_return_val_if_fail (ft, NULL);
256 g_return_val_if_fail (ft->m_splits, NULL);
257 g_return_val_if_fail (index < g_list_length (ft->m_splits) , NULL);
258 return g_list_nth_data (ft->m_splits, index);
265 g_return_val_if_fail (ft, NULL);
266 g_return_val_if_fail (ft->m_splits, NULL);
267 g_return_val_if_fail (g_list_length (ft->m_splits) == 2 , NULL);
269 if (g_list_nth_data (ft->m_splits, 0) == fs)
272 return g_list_nth_data (ft->m_splits, other);
276 void gnc_float_txn_set_txn (
FloatingTxn *ft, Transaction *txn)
278 g_return_if_fail (ft);
282 void gnc_float_txn_set_currency (
FloatingTxn *ft, gnc_commodity *currency)
284 g_return_if_fail (ft);
285 ft->m_currency = currency;
290 g_return_if_fail (ft);
291 ft->m_date_entered = date_entered;
296 g_return_if_fail (ft);
297 ft->m_date_posted = date_posted;
300 void gnc_float_txn_set_num (
FloatingTxn *ft,
const char *num)
302 g_return_if_fail (ft);
303 CACHE_REPLACE (ft->m_num, num);
306 void gnc_float_txn_set_description (
FloatingTxn *ft,
const char *description)
308 g_return_if_fail (ft);
309 CACHE_REPLACE (ft->m_description, description);
312 void gnc_float_txn_set_notes (
FloatingTxn *ft,
const char *notes)
314 g_return_if_fail (ft);
315 CACHE_REPLACE (ft->m_notes, notes);
318 void gnc_float_txn_set_doclink (
FloatingTxn *ft,
const char *doclink)
320 g_return_if_fail (ft);
321 CACHE_REPLACE (ft->m_doclink, doclink);
326 g_return_if_fail (ft);
327 ft->m_splits = splits;
332 g_return_if_fail (ft);
333 g_return_if_fail (fs);
334 ft->m_splits = g_list_append (ft->m_splits, fs);
339 FloatingTxn *gnc_txn_to_float_txn (Transaction *txn, gboolean use_cut_semantics)
348 if (use_cut_semantics)
359 Split *split = iter->data;
363 ft->m_splits = g_list_prepend (ft->m_splits, fs);
366 ft->m_splits = g_list_reverse (ft->m_splits);
371 void gnc_float_txn_to_txn (
const FloatingTxn *ft, Transaction *txn, gboolean do_commit)
373 gnc_float_txn_to_txn_swap_accounts (ft, txn, NULL, NULL, do_commit);
379 void gnc_float_txn_to_txn_swap_accounts (
const FloatingTxn *ft, Transaction *txn,
Account *acct1,
Account *acct2, gboolean do_commit)
383 g_return_if_fail (ft);
384 g_return_if_fail (txn);
391 if (ft->m_description)
399 if (ft->m_date_posted)
407 for (iter = ft->m_splits; iter; iter = iter->next)
417 old_acc = fs->m_account;
418 if (fs->m_account == acct1)
420 else if (fs->m_account == acct2)
423 new_acc = fs->m_account;
425 fs->m_account = new_acc;
426 gnc_float_split_to_split (fs, split);
427 fs->m_account = old_acc;
428 xaccSplitSetParent (split, txn);
438 g_return_if_fail (ft);
440 CACHE_REMOVE (ft->m_num);
441 CACHE_REMOVE (ft->m_description);
442 CACHE_REMOVE (ft->m_notes);
443 CACHE_REMOVE (ft->m_doclink);
444 g_list_free_full (ft->m_splits, (GDestroyNotify)gnc_float_split_free);
void xaccSplitSetValue(Split *split, gnc_numeric val)
The xaccSplitSetValue() method sets the value of this split in the transaction's commodity.
void xaccSplitSetAction(Split *split, const char *actn)
The Action is an arbitrary user-assigned string.
void xaccTransClearSplits(Transaction *trans)
Remove all splits from the transaction.
time64 xaccTransGetDate(const Transaction *trans)
Retrieve the posted date of the transaction.
gboolean xaccTransIsOpen(const Transaction *trans)
The xaccTransIsOpen() method returns TRUE if the transaction is open for editing. ...
void xaccTransSetNotes(Transaction *trans, const char *notes)
Sets the transaction Notes.
char xaccSplitGetReconcile(const Split *split)
Returns the value of the reconcile flag.
void xaccTransSetDescription(Transaction *trans, const char *desc)
Sets the transaction Description.
void xaccTransSetNum(Transaction *trans, const char *xnum)
Sets the transaction Number (or ID) field; 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.
Transaction * xaccSplitGetParent(const Split *split)
Returns the parent transaction of the split.
const char * xaccTransGetNum(const Transaction *trans)
Gets the transaction Number (or ID) field; 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.
const char * xaccTransGetDocLink(const Transaction *trans)
Gets the transaction Document Link.
void xaccTransSetCurrency(Transaction *trans, gnc_commodity *curr)
Set a new currency on a transaction.
const char * xaccTransGetNotes(const Transaction *trans)
Gets the transaction Notes.
GList SplitList
GList of Split.
void xaccSplitSetAmount(Split *split, gnc_numeric amt)
The xaccSplitSetAmount() method sets the amount in the account's commodity that the split should have...
void xaccSplitSetMemo(Split *split, const char *memo)
The memo is an arbitrary string associated with a split.
const char * xaccTransGetDescription(const Transaction *trans)
Gets the transaction Description.
#define xaccTransGetBook(X)
void xaccTransCommitEdit(Transaction *trans)
The xaccTransCommitEdit() method indicates that the changes to the transaction and its splits are com...
void xaccTransBeginEdit(Transaction *trans)
The xaccTransBeginEdit() method must be called before any changes are made to a transaction or any of...
Split * xaccMallocSplit(QofBook *book)
Constructor.
time64 xaccTransGetDateEntered(const Transaction *trans)
Retrieve the date of when the transaction was entered.
time64 xaccSplitGetDateReconciled(const Split *split)
Retrieve the date when the Split was reconciled.
void xaccTransSetDatePostedSecs(Transaction *trans, time64 secs)
The xaccTransSetDatePostedSecs() method will modify the posted date of the transaction, specified by a time64 (see ctime(3)).
gnc_numeric xaccSplitGetValue(const Split *split)
Returns the value of this split in the transaction's commodity.
void xaccAccountBeginEdit(Account *acc)
The xaccAccountBeginEdit() subroutine is the first phase of a two-phase-commit wrapper for account up...
Account * xaccSplitGetAccount(const Split *split)
Returns the account of this split, which was set through xaccAccountInsertSplit().
gnc_commodity * xaccTransGetCurrency(const Transaction *trans)
Returns the valuation commodity of this transaction.
void xaccTransSetDocLink(Transaction *trans, const char *doclink)
Sets the transaction Document Link.
const char * xaccSplitGetMemo(const Split *split)
Returns the memo string.
const char * xaccSplitGetAction(const Split *split)
Returns the action string.
gint64 time64
Most systems that are currently maintained, including Microsoft Windows, BSD-derived Unixes and Linux...
void xaccAccountCommitEdit(Account *acc)
ThexaccAccountCommitEdit() subroutine is the second phase of a two-phase-commit wrapper for account u...
SplitList * xaccTransGetSplitList(const Transaction *trans)
The xaccTransGetSplitList() method returns a GList of the splits in a transaction.
gnc_numeric xaccSplitGetAmount(const Split *split)
Returns the amount of the split in the account's commodity.