]> Dogcows Code - chaz/homebank/blob - src/hb-filter.h
import homebank-5.2.4
[chaz/homebank] / src / hb-filter.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 #ifndef __HB_FILTER_H__
21 #define __HB_FILTER_H__
22
23
24 /*
25 ** filter options
26 */
27 enum
28 {
29 FILTER_DATE,
30 FILTER_STATUS,
31 FILTER_PAYMODE,
32 FILTER_AMOUNT,
33 FILTER_ACCOUNT,
34 FILTER_CATEGORY,
35 FILTER_PAYEE,
36 FILTER_TEXT,
37 FILTER_MAX
38 };
39
40
41 enum
42 {
43 FLT_RANGE_THISMONTH = 0,
44 FLT_RANGE_LASTMONTH = 1,
45 FLT_RANGE_THISQUARTER = 2,
46 FLT_RANGE_LASTQUARTER = 3,
47 FLT_RANGE_THISYEAR = 4,
48 FLT_RANGE_LASTYEAR = 5, //was not existing on 4.5
49 // 6 separator
50 FLT_RANGE_LAST30DAYS = 7,
51 FLT_RANGE_LAST60DAYS = 8,
52 FLT_RANGE_LAST90DAYS = 9,
53 FLT_RANGE_LAST12MONTHS = 10,
54 // 11 separator
55 FLT_RANGE_OTHER = 12,
56 // 13 separator
57 FLT_RANGE_ALLDATE = 14
58 };
59
60
61 enum
62 {
63 FLT_TYPE_EXPENSE = 0,
64 FLT_TYPE_INCOME = 1,
65 // 2 separator
66 FLT_TYPE_ALL = 3
67 };
68
69
70 enum
71 {
72 FLT_STATUS_UNCATEGORIZED = 0,
73 FLT_STATUS_UNRECONCILED = 1,
74 FLT_STATUS_UNCLEARED = 2,
75 FLT_STATUS_RECONCILED = 3,
76 FLT_STATUS_CLEARED = 4,
77 // 5 separator
78 FLT_STATUS_ALL = 6
79 };
80
81
82 enum
83 {
84 FLT_QSEARCH_MEMO = 1<<0,
85 FLT_QSEARCH_INFO = 1<<1,
86 FLT_QSEARCH_PAYEE = 1<<2,
87 FLT_QSEARCH_CATEGORY = 1<<3,
88 FLT_QSEARCH_TAGS = 1<<4,
89 FLT_QSEARCH_AMOUNT = 1<<5
90 };
91
92
93 typedef struct _filter Filter;
94
95 struct _filter
96 {
97
98
99
100
101 guint32 mindate, maxdate;
102 gint range;
103
104 gshort option[FILTER_MAX];
105 gboolean reconciled;
106 gboolean cleared;
107
108 gboolean paymode[NUM_PAYMODE_MAX];
109 gdouble minamount, maxamount;
110 gboolean exact;
111 gchar *info;
112 gchar *memo;
113 gchar *tag;
114
115 /* unsaved datas */
116 gint nbdaysfuture;
117 gint type; /* ! not sure necessary to store this :: dsp_account: inc/exp used */
118 gint status; /* ! not sure necessary to store this :: dsp_account */
119 gboolean forceadd;
120 gboolean forcechg;
121 gboolean forceremind;
122 gchar last_tab[8]; /* keep last active tab */
123 };
124
125
126 Filter *da_flt_malloc(void);
127 void da_flt_free(Filter *flt);
128
129 void da_flt_destroy(void);
130 void da_flt_new(void);
131
132 void da_flt_status_acc_set(Filter *flt, guint32 kacc, gboolean status);
133 void da_flt_status_pay_set(Filter *flt, guint32 kpay, gboolean status);
134 void da_flt_status_cat_set(Filter *flt, guint32 kcat, gboolean status);
135 gboolean da_flt_status_acc_get(Filter *flt, guint32 kacc);
136 gboolean da_flt_status_pay_get(Filter *flt, guint32 kpay);
137 gboolean da_flt_status_cat_get(Filter *flt, guint32 kcat);
138
139 void filter_status_acc_clear_except(Filter *flt, guint32 selkey);
140 void filter_status_pay_clear_except(Filter *flt, guint32 selkey);
141 void filter_status_cat_clear_except(Filter *flt, guint32 selkey);
142
143 void filter_reset(Filter *flt);
144 void filter_preset_daterange_set(Filter *flt, gint range, guint32 kacc);
145 void filter_preset_type_set(Filter *flt, gint value);
146 void filter_preset_daterange_add_futuregap(Filter *filter, gint nbdays);
147
148 void filter_set_tag_by_id(Filter *flt, guint32 key);
149 void filter_preset_status_set(Filter *flt, gint value);
150
151 gchar *filter_daterange_text_get(Filter *flt);
152 gboolean filter_txn_search_match(gchar *needle, Transaction *txn, gint flags);
153
154 gint filter_txn_match(Filter *flt, Transaction *ope);
155
156 #endif
This page took 0.042168 seconds and 4 git commands to generate.