GnuCash c935c2f+
Loading...
Searching...
No Matches
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
36typedef struct
37{
38 GncGUID *m_account_guid;
39 const char *m_credit_formula;
40 const char *m_debit_formula;
41 gnc_numeric *m_credit_numeric;
42 gnc_numeric *m_debit_numeric;
43 const char *m_shares;
44
46
47typedef struct
48{
49 Split *m_split;
50 Account *m_account;
51 Transaction *m_transaction;
52 const char *m_memo;
53 const char *m_action;
54 time64 m_reconcile_date;
55 char m_reconcile_state;
56 gnc_numeric m_value;
57 gnc_numeric m_amount;
58 gboolean m_stock_split;
59
60 FloatingTemplateSxData *m_template_sx_data;
61
63
64typedef struct
65{
66 Transaction *m_txn;
67 gnc_commodity *m_currency;
68 time64 m_date_entered;
69 time64 m_date_posted;
70 const char *m_num;
71 const char *m_description;
72 const char *m_notes;
73 const char *m_doclink;
74 SplitList *m_splits;
76
77/* accessors */
78Split *gnc_float_split_get_split(const FloatingSplit* fs);
79Account *gnc_float_split_get_account (const FloatingSplit *fs); /* direct account pointer rather than account guid */
80Transaction *gnc_float_split_get_transaction (const FloatingSplit *fs); /* direct transaction pointer rather than transaction guid */
81const char *gnc_float_split_get_memo (const FloatingSplit *fs);
82const char *gnc_float_split_get_action (const FloatingSplit *fs);
83char gnc_float_split_get_reconcile_state (const FloatingSplit *fs);
84time64 gnc_float_split_get_reconcile_date (const FloatingSplit *fs);
85gnc_numeric gnc_float_split_get_amount (const FloatingSplit *fs);
86gnc_numeric gnc_float_split_get_value (const FloatingSplit *fs);
87gboolean gnc_float_split_get_stock_split (const FloatingSplit *fs);
88
89/* modifiers */
90void gnc_float_split_set_split (FloatingSplit *fs, Split *split);
91void gnc_float_split_set_account (FloatingSplit *fs, Account *account); /* direct account pointer rather than account guid */
92void gnc_float_split_set_transaction (FloatingSplit *fs, Transaction *transaction); /* direct transaction pointer rather than transaction guid */
93void gnc_float_split_set_memo (FloatingSplit *fs, const char *memo);
94void gnc_float_split_set_action (FloatingSplit *fs, const char *action);
95void gnc_float_split_set_reconcile_state (FloatingSplit *fs, char reconcile_state);
96void gnc_float_split_set_reconcile_date (FloatingSplit *fs, time64 reconcile_date);
97void gnc_float_split_set_amount (FloatingSplit *fs, gnc_numeric amount);
98void gnc_float_split_set_value (FloatingSplit *fs, gnc_numeric value);
99void gnc_float_split_set_stock_split (FloatingSplit *fs, gboolean stock_split);
100
101FloatingSplit *gnc_split_to_float_split (Split *split, gboolean is_template);
102void gnc_float_split_to_split (const FloatingSplit *fs, Split *split, Account *template_account);
103
104void gnc_float_split_free (FloatingSplit *fs);
105
106/* accessors */
107Transaction *gnc_float_txn_get_txn (const FloatingTxn *ft);
108gnc_commodity *gnc_float_txn_get_currency (const FloatingTxn *ft);
109time64 gnc_float_txn_get_date_entered (const FloatingTxn *ft);
110time64 gnc_float_txn_get_date_posted (const FloatingTxn *ft);
111const char *gnc_float_txn_get_num (const FloatingTxn *ft);
112const char *gnc_float_txn_get_description (const FloatingTxn *ft);
113const char *gnc_float_txn_get_notes (const FloatingTxn *ft);
114const char *gnc_float_txn_get_doclink (const FloatingTxn *ft);
115SplitList *gnc_float_txn_get_splits (const FloatingTxn *ft);
116
117FloatingSplit *gnc_float_txn_get_float_split (const FloatingTxn *ft, guint index);
118FloatingSplit *gnc_float_txn_get_other_float_split (const FloatingTxn *ft, FloatingSplit *fs);
119
120/* modifiers */
121void gnc_float_txn_set_txn (FloatingTxn *ft, Transaction *txn);
122void gnc_float_txn_set_currency (FloatingTxn *ft, gnc_commodity *currency);
123void gnc_float_txn_set_date_entered (FloatingTxn *ft, time64 date_entered);
124void gnc_float_txn_set_date_posted (FloatingTxn *ft, time64 date_posted);
125void gnc_float_txn_set_num (FloatingTxn *ft, const char *num);
126void gnc_float_txn_set_description (FloatingTxn *ft, const char *description);
127void gnc_float_txn_set_notes (FloatingTxn *ft, const char *notes);
128void gnc_float_txn_set_doclink (FloatingTxn *ft, const char *doclink);
129void gnc_float_txn_set_splits (FloatingTxn *ft, SplitList *splits);
130
131void gnc_float_txn_append_float_split (FloatingTxn *ft, FloatingSplit *fs);
132
133gboolean gnc_float_txn_has_template (const FloatingTxn *ft);
134
135FloatingTxn *gnc_txn_to_float_txn (Transaction *txn, gboolean use_cut_semantics, gboolean is_template);
136
137void gnc_float_txn_to_template_txn (const FloatingTxn *ft, Transaction *txn,
138 Account *template_account, gboolean do_commit);
139
140void gnc_float_txn_to_txn (const FloatingTxn *ft, Transaction *txn, gboolean do_commit);
141void gnc_float_txn_to_txn_swap_accounts (const FloatingTxn *ft, Transaction *txn,
142 Account *acct1, Account *acct2,
143 gboolean do_commit);
144
145void gnc_float_txn_free (FloatingTxn *ft);
146
147#endif
Account handling public routines.
API for Transactions and Splits (journal entries)
API for Transactions and Splits (journal entries)
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
GList SplitList
GList of Split.
Definition gnc-engine.h:207
globally unique ID User API
STRUCTS.
The type used to store guids in C.
Definition guid.h:75