]> Dogcows Code - chaz/homebank/blob - src/hb-transaction.h
import homebank-5.1.7
[chaz/homebank] / src / hb-transaction.h
1 /* HomeBank -- Free, easy, personal accounting for everyone.
2 * Copyright (C) 1995-2018 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 struct _transaction
31 {
32 gdouble amount;
33 guint32 kacc;
34 gushort paymode;
35 gushort flags;
36 guint32 kpay;
37 guint32 kcat;
38 gchar *memo;
39
40 guint32 date;
41 gushort pos;
42 gushort status;
43 gchar *info;
44 guint32 *tags;
45 guint32 kxfer; //strong link xfer key
46 guint32 kxferacc;
47
48 Split *splits[TXN_MAX_SPLIT+1];
49
50 /* unsaved datas */
51 guint32 kcur;
52 gdouble balance;
53 gboolean overdraft;
54 GList *same; //used for import todo: change this
55 };
56
57 #include "hb-archive.h"
58
59 #define OF_OLDVALID (1<<0) //deprecated since 5.x
60 #define OF_INCOME (1<<1)
61 #define OF_AUTO (1<<2) //scheduled
62 #define OF_ADDED (1<<3) //tmp flag
63 #define OF_CHANGED (1<<4) //tmp flag
64 #define OF_OLDREMIND (1<<5) //deprecated since 5.x
65 #define OF_CHEQ2 (1<<6)
66 #define OF_LIMIT (1<<7) //scheduled
67 #define OF_SPLIT (1<<8)
68
69 typedef enum {
70 TXN_STATUS_NONE,
71 TXN_STATUS_CLEARED,
72 TXN_STATUS_RECONCILED,
73 TXN_STATUS_REMIND,
74 //TXN_VOID
75 } HbTxnStatus;
76
77
78 Transaction *da_transaction_malloc(void);
79 Transaction *da_transaction_copy(Transaction *src_txn, Transaction *dst_txn);
80 Transaction *da_transaction_init_from_template(Transaction *txn, Archive *arc);
81 Transaction *da_transaction_clone(Transaction *src_item);
82 void da_transaction_clean(Transaction *item);
83 void da_transaction_free(Transaction *item);
84
85 GList *da_transaction_new(void);
86 void da_transaction_destroy(void);
87
88 void da_transaction_queue_sort(GQueue *queue);
89 GList *da_transaction_sort(GList *list);
90 gboolean da_transaction_prepend(Transaction *item);
91 gboolean da_transaction_insert_sorted(Transaction *item);
92
93
94 /*
95 ** transaction edit type
96 */
97 enum
98 {
99 TRANSACTION_EDIT_ADD,
100 TRANSACTION_EDIT_INHERIT,
101 TRANSACTION_EDIT_MODIFY
102 };
103
104
105 guint da_transaction_length(void);
106
107 void transaction_remove(Transaction *ope);
108 gboolean da_transaction_insert_memo(Transaction *item);
109 Transaction *transaction_add(Transaction *ope);
110
111 gboolean transaction_acc_move(Transaction *txn, guint32 okacc, guint32 nkacc);
112
113 Transaction *transaction_xfer_child_strong_get(Transaction *src);
114 void transaction_xfer_search_or_add_child(GtkWindow *parentwindow, Transaction *ope, gboolean manual);
115 void transaction_xfer_change_to_child(Transaction *ope, Transaction *child);
116 void transaction_xfer_child_sync(Transaction *s_txn, Transaction *child);
117 void transaction_xfer_remove_child(Transaction *src);
118 Transaction *transaction_old_get_child_transfer(Transaction *src);
119
120 guint transaction_tags_count(Transaction *ope);
121 void transaction_tags_clone(Transaction *src_txn, Transaction *dst_txn);
122 guint transaction_tags_parse(Transaction *ope, const gchar *tagstring);
123 gchar *transaction_tags_tostring(Transaction *ope);
124 gint transaction_auto_assign(GList *ope_list, guint32 key);
125
126 void da_transaction_consistency(Transaction *item);
127
128 #endif
This page took 0.034964 seconds and 4 git commands to generate.