]> Dogcows Code - chaz/homebank/blob - src/hb-filter.h
import homebank-4.6.3
[chaz/homebank] / src / hb-filter.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_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 // 2 separator
75 FLT_STATUS_ALL = 3
76 };
77
78
79 enum
80 {
81 FLT_QSEARCH_MEMO = 1<<0,
82 FLT_QSEARCH_INFO = 1<<1,
83 FLT_QSEARCH_PAYEE = 1<<2,
84 FLT_QSEARCH_CATEGORY = 1<<3,
85 FLT_QSEARCH_TAGS = 1<<4
86 };
87
88
89 typedef struct _filter Filter;
90
91 struct _filter
92 {
93 guint32 mindate, maxdate;
94 gint range;
95 gint type;
96 gint status;
97
98 gshort option[FILTER_MAX];
99 gboolean reconciled;
100 gboolean reminded;
101 gboolean forceadd;
102 gboolean forcechg;
103 gboolean paymode[NUM_PAYMODE_MAX];
104 gdouble minamount, maxamount;
105 gboolean exact;
106 gchar *info;
107 gchar *wording;
108 gchar *tag;
109 guint last_tab;
110 };
111
112
113 Filter *da_filter_malloc(void);
114 void da_filter_free(Filter *flt);
115
116 void filter_default_all_set(Filter *flt);
117 void filter_preset_daterange_set(Filter *flt, gint range);
118 void filter_preset_type_set(Filter *flt, gint value);
119 void filter_preset_status_set(Filter *flt, gint value);
120 gchar *filter_daterange_text_get(Filter *flt);
121 gboolean filter_txn_search_match(gchar *needle, Transaction *txn, gint flags);
122
123 gint filter_test(Filter *flt, Transaction *ope);
124
125 #endif
This page took 0.039989 seconds and 5 git commands to generate.