]> Dogcows Code - chaz/homebank/blob - src/hb-transaction.h
import homebank-4.6.3
[chaz/homebank] / src / hb-transaction.h
1 /* HomeBank -- Free, easy, personal accounting for everyone.
2 * Copyright (C) 1995-2014 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 #ifndef __HB_TRANSACTION_H__
21 #define __HB_TRANSACTION_H__
22
23 #include "hb-archive.h"
24
25 #define TXN_MAX_SPLIT 10
26
27 typedef struct _split Split;
28 typedef struct _transaction Transaction;
29
30
31 struct _split
32 {
33 guint32 kcat;
34 gdouble amount;
35 gchar *memo;
36 };
37
38
39 struct _transaction
40 {
41 gdouble amount;
42 guint32 kacc;
43 gushort paymode;
44 gushort flags;
45 guint32 kpay;
46 guint32 kcat;
47 gchar *wording;
48
49 guint32 date;
50 gushort pos;
51 gchar *info;
52 guint32 *tags;
53 guint32 kxfer; //internal xfer key
54 guint32 kxferacc;
55
56 Split *splits[TXN_MAX_SPLIT+1];
57
58 /* unsaved datas */
59 GList *same; //used for import todo: change this
60 gdouble balance;
61 };
62
63 #define OF_VALID (1<<0)
64 #define OF_INCOME (1<<1)
65 #define OF_AUTO (1<<2) //tmp flag scheduled
66 #define OF_ADDED (1<<3) //tmp flag
67 #define OF_CHANGED (1<<4) //tmp flag
68 #define OF_REMIND (1<<5)
69 #define OF_CHEQ2 (1<<6)
70 #define OF_LIMIT (1<<7) //scheduled
71 #define OF_SPLIT (1<<8)
72
73
74 Transaction *da_transaction_malloc(void);
75 Transaction *da_transaction_copy(Transaction *src_txn, Transaction *dst_txn);
76 Transaction *da_transaction_init_from_template(Transaction *txn, Archive *arc);
77 Transaction *da_transaction_clone(Transaction *src_item);
78 void da_transaction_clean(Transaction *item);
79 void da_transaction_free(Transaction *item);
80
81 GList *da_transaction_new(void);
82 void da_transaction_destroy(GList *list);
83
84 GList *da_transaction_sort(GList *list);
85 gboolean da_transaction_prepend(Transaction *item);
86 gboolean da_transaction_insert_sorted(Transaction *item);
87
88 guint32 da_transaction_get_max_kxfer(void);
89
90 /*
91 ** transaction edit type
92 */
93 enum
94 {
95 TRANSACTION_EDIT_ADD,
96 TRANSACTION_EDIT_INHERIT,
97 TRANSACTION_EDIT_MODIFY
98 };
99
100 void da_transaction_splits_append(Transaction *txn, Split *split);
101 void da_transaction_splits_free(Transaction *txn);
102 guint da_transaction_splits_count(Transaction *txn);
103 void da_transaction_splits_clone(Transaction *stxn, Transaction *dtxn);
104
105 Split *da_split_new(guint32 kcat, gdouble amount, gchar *memo);
106 guint transaction_splits_parse(Transaction *ope, gchar *cats, gchar *amounts, gchar *memos);
107 guint transaction_splits_tostring(Transaction *ope, gchar **cats, gchar **amounts, gchar **memos);
108
109 void transaction_add_treeview(Transaction *ope, GtkWidget *treeview, guint32 accnum);
110 void transaction_add(Transaction *ope, GtkWidget *treeview, guint32 accnum);
111
112 Transaction *transaction_strong_get_child_transfer(Transaction *src);
113 GList *transaction_match_get_child_transfer(Transaction *src);
114 Transaction *ui_dialog_transaction_xfer_select_child(GList *matchlist);
115 void transaction_xfer_search_or_add_child(Transaction *ope, GtkWidget *treeview);
116 void transaction_xfer_create_child(Transaction *ope, GtkWidget *treeview);
117 void transaction_xfer_change_to_child(Transaction *ope, Transaction *child);
118 void transaction_xfer_sync_child(Transaction *ope, Transaction *child);
119 void transaction_xfer_delete_child(Transaction *src);
120 Transaction *transaction_old_get_child_transfer(Transaction *src);
121
122 guint transaction_tags_count(Transaction *ope);
123 guint transaction_tags_parse(Transaction *ope, const gchar *tagstring);
124 gchar *transaction_tags_tostring(Transaction *ope);
125 gint transaction_auto_assign(GList *ope_list, guint32 key);
126
127 void da_transaction_consistency(Transaction *item);
128
129 #endif
This page took 0.035252 seconds and 5 git commands to generate.