GnuCash  5.6-150-g038405b370+
split-register-copy-ops.h
1 /********************************************************************\
2  * split-register-copy-ops.c -- copy/paste semantics for *
3  * transactions and splits *
4  * Port to C of engine-interface *
5  * originally written by Dave Peticolas <dave@krondo.com> *
6  * © 2019 Geert Janssens
7  * *
8  * This program is free software; you can redistribute it and/or *
9  * modify it under the terms of the GNU General Public License as *
10  * published by the Free Software Foundation; either version 2 of *
11  * the License, or (at your option) any later version. *
12  * *
13  * This program is distributed in the hope that it will be useful, *
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
16  * GNU General Public License for more details. *
17  * *
18  * You should have received a copy of the GNU General Public License*
19  * along with this program; if not, write to the Free Software *
20  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
21  * \********************************************************************/
22 
23 #ifndef SPLIT_REGISTER_COPY_OPS_H
24 #define SPLIT_REGISTER_COPY_OPS_H
25 
26 #include <glib.h>
27 
28 #include "gnc-engine.h" /* for typedefs */
29 #include "qof.h"
30 
31 #include "guid.h"
32 #include "Split.h"
33 #include "Account.h"
34 #include "Transaction.h"
35 
36 typedef struct
37 {
38  Split *m_split;
39  Account *m_account;
40  Transaction *m_transaction;
41  const char *m_memo;
42  const char *m_action;
43  time64 m_reconcile_date;
44  char m_reconcile_state;
45  gnc_numeric m_value;
46  gnc_numeric m_amount;
48 
49 typedef struct
50 {
51  Transaction *m_txn;
52  gnc_commodity *m_currency;
53  time64 m_date_entered;
54  time64 m_date_posted;
55  const char *m_num;
56  const char *m_description;
57  const char *m_notes;
58  const char *m_doclink;
59  SplitList *m_splits;
60 } FloatingTxn;
61 
62 /* accessors */
63 Split *gnc_float_split_get_split(const FloatingSplit* fs);
64 Account *gnc_float_split_get_account (const FloatingSplit *fs); /* direct account pointer rather than account guid */
65 Transaction *gnc_float_split_get_transaction (const FloatingSplit *fs); /* direct transaction pointer rather than transaction guid */
66 const char *gnc_float_split_get_memo (const FloatingSplit *fs);
67 const char *gnc_float_split_get_action (const FloatingSplit *fs);
68 char gnc_float_split_get_reconcile_state (const FloatingSplit *fs);
69 time64 gnc_float_split_get_reconcile_date (const FloatingSplit *fs);
70 gnc_numeric gnc_float_split_get_amount (const FloatingSplit *fs);
71 gnc_numeric gnc_float_split_get_value (const FloatingSplit *fs);
72 
73 /* modifiers */
74 void gnc_float_split_set_split (FloatingSplit *fs, Split *split);
75 void gnc_float_split_set_account (FloatingSplit *fs, Account *account); /* direct account pointer rather than account guid */
76 void gnc_float_split_set_transaction (FloatingSplit *fs, Transaction *transaction); /* direct transaction pointer rather than transaction guid */
77 void gnc_float_split_set_memo (FloatingSplit *fs, const char *memo);
78 void gnc_float_split_set_action (FloatingSplit *fs, const char *action);
79 void gnc_float_split_set_reconcile_state (FloatingSplit *fs, char reconcile_state);
80 void gnc_float_split_set_reconcile_date (FloatingSplit *fs, time64 reconcile_date);
81 void gnc_float_split_set_amount (FloatingSplit *fs, gnc_numeric amount);
82 void gnc_float_split_set_value (FloatingSplit *fs, gnc_numeric value);
83 
84 FloatingSplit *gnc_split_to_float_split (Split *split);
85 void gnc_float_split_to_split (const FloatingSplit *fs, Split *split);
86 
87 void gnc_float_split_free (FloatingSplit *fs);
88 
89 /* accessors */
90 Transaction *gnc_float_txn_get_txn (const FloatingTxn *ft);
91 gnc_commodity *gnc_float_txn_get_currency (const FloatingTxn *ft);
92 time64 gnc_float_txn_get_date_entered (const FloatingTxn *ft);
93 time64 gnc_float_txn_get_date_posted (const FloatingTxn *ft);
94 const char *gnc_float_txn_get_num (const FloatingTxn *ft);
95 const char *gnc_float_txn_get_description (const FloatingTxn *ft);
96 const char *gnc_float_txn_get_notes (const FloatingTxn *ft);
97 const char *gnc_float_txn_get_doclink (const FloatingTxn *ft);
98 SplitList *gnc_float_txn_get_splits (const FloatingTxn *ft);
99 
100 FloatingSplit *gnc_float_txn_get_float_split (const FloatingTxn *ft, guint index);
101 FloatingSplit *gnc_float_txn_get_other_float_split (const FloatingTxn *ft, FloatingSplit *fs);
102 
103 /* modifiers */
104 void gnc_float_txn_set_txn (FloatingTxn *ft, Transaction *txn);
105 void gnc_float_txn_set_currency (FloatingTxn *ft, gnc_commodity *currency);
106 void gnc_float_txn_set_date_entered (FloatingTxn *ft, time64 date_entered);
107 void gnc_float_txn_set_date_posted (FloatingTxn *ft, time64 date_posted);
108 void gnc_float_txn_set_num (FloatingTxn *ft, const char *num);
109 void gnc_float_txn_set_description (FloatingTxn *ft, const char *description);
110 void gnc_float_txn_set_notes (FloatingTxn *ft, const char *notes);
111 void gnc_float_txn_set_doclink (FloatingTxn *ft, const char *doclink);
112 void gnc_float_txn_set_splits (FloatingTxn *ft, SplitList *splits);
113 
114 void gnc_float_txn_append_float_split (FloatingTxn *ft, FloatingSplit *fs);
115 
116 FloatingTxn *gnc_txn_to_float_txn (Transaction *txn, gboolean use_cut_semantics);
117 
118 void gnc_float_txn_to_txn (const FloatingTxn *ft, Transaction *txn, gboolean do_commit);
119 void gnc_float_txn_to_txn_swap_accounts (const FloatingTxn *ft, Transaction *txn, Account *acct1, Account *acct2, gboolean do_commit);
120 
121 void gnc_float_txn_free (FloatingTxn *ft);
122 
123 #endif
STRUCTS.
globally unique ID User API
API for Transactions and Splits (journal entries)
GList SplitList
GList of Split.
Definition: gnc-engine.h:207
Account handling public routines.
All type declarations for the whole Gnucash engine.
gint64 time64
Most systems that are currently maintained, including Microsoft Windows, BSD-derived Unixes and Linux...
Definition: gnc-date.h:87
API for Transactions and Splits (journal entries)