]> Dogcows Code - chaz/homebank/blob - src/hb-transaction.h
import homebank-5.2.4
[chaz/homebank] / src / hb-transaction.h
1 /* HomeBank -- Free, easy, personal accounting for everyone.
2 * Copyright (C) 1995-2019 Maxime DOYEN
3 *
4 * This file is part of HomeBank.
5 *
6 * HomeBank is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * HomeBank is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20
21 #ifndef __HB_TRANSACTION_H__
22 #define __HB_TRANSACTION_H__
23
24 #include "hb-split.h"
25
26
27 typedef struct _transaction Transaction;
28
29
30 #include "hb-account.h"
31
32 struct _transaction
33 {
34 gdouble amount;
35 guint32 kacc;
36 gushort paymode;
37 gushort flags;
38 guint32 kpay;
39 guint32 kcat;
40 gchar *memo;
41
42 guint32 date;
43 gushort pos;
44 gushort status;
45 gchar *info;
46 guint32 *tags;
47 guint32 kxfer; //strong link xfer key
48 guint32 kxferacc;
49
50 GPtrArray *splits;
51
52 /* unsaved datas */
53 guint32 kcur;
54 gushort marker;
55 gushort pad1;
56 gdouble balance;
57 gboolean overdraft;
58 GList *same; //used for import todo: change this
59 };
60
61 #include "hb-archive.h"
62
63 #define OF_OLDVALID (1<<0) //deprecated since 5.x
64 #define OF_INCOME (1<<1)
65 #define OF_AUTO (1<<2) //scheduled
66 #define OF_ADDED (1<<3) //tmp flag
67 #define OF_CHANGED (1<<4) //tmp flag
68 #define OF_OLDREMIND (1<<5) //deprecated since 5.x
69 #define OF_CHEQ2 (1<<6)
70 #define OF_LIMIT (1<<7) //scheduled
71 #define OF_SPLIT (1<<8)
72
73 typedef enum {
74 TXN_STATUS_NONE,
75 TXN_STATUS_CLEARED,
76 TXN_STATUS_RECONCILED,
77 TXN_STATUS_REMIND,
78 //TXN_VOID
79 } HbTxnStatus;
80
81 enum {
82 TXN_MARK_NONE,
83 TXN_MARK_DUPSRC,
84 TXN_MARK_DUPDST
85 };
86
87
88
89 Transaction *da_transaction_malloc(void);
90 //Transaction *da_transaction_copy(Transaction *src_txn, Transaction *dst_txn);
91 Transaction *da_transaction_init_from_template(Transaction *txn, Archive *arc);
92 Transaction *da_transaction_set_default_template(Transaction *txn);
93 Transaction *da_transaction_clone(Transaction *src_item);
94 void da_transaction_clean(Transaction *item);
95 void da_transaction_free(Transaction *item);
96
97 GList *da_transaction_new(void);
98 void da_transaction_destroy(void);
99
100 void da_transaction_queue_sort(GQueue *queue);
101 GList *da_transaction_sort(GList *list);
102 gboolean da_transaction_prepend(Transaction *item);
103 gboolean da_transaction_insert_sorted(Transaction *item);
104
105
106 /*
107 ** transaction edit type
108 */
109 enum
110 {
111 TRANSACTION_EDIT_ADD,
112 TRANSACTION_EDIT_INHERIT,
113 TRANSACTION_EDIT_MODIFY
114 };
115
116
117 guint da_transaction_length(void);
118
119 void transaction_remove(Transaction *ope);
120 void transaction_changed(Transaction *txn);
121 gboolean da_transaction_insert_memo(Transaction *item);
122 Transaction *transaction_add(GtkWindow *parent, Transaction *ope);
123
124 gboolean transaction_acc_move(Transaction *txn, guint32 okacc, guint32 nkacc);
125
126 Transaction *transaction_xfer_child_strong_get(Transaction *src);
127 void transaction_xfer_search_or_add_child(GtkWindow *parent, Transaction *ope, guint32 kdstacc);
128 void transaction_xfer_change_to_child(Transaction *ope, Transaction *child);
129 void transaction_xfer_child_sync(Transaction *s_txn, Transaction *child);
130 void transaction_xfer_remove_child(Transaction *src);
131 Transaction *transaction_old_get_child_transfer(Transaction *src);
132
133 guint transaction_auto_assign(GList *ope_list, guint32 key);
134
135 void da_transaction_consistency(Transaction *item);
136
137
138 gint transaction_similar_mark(Account *acc, guint32 daygap);
139 void transaction_similar_unmark(Account *acc);
140
141
142 #endif
This page took 0.039884 seconds and 4 git commands to generate.