import homebank-5.1.2
[chaz/homebank] / src / hb-category.h
1 /* HomeBank -- Free, easy, personal accounting for everyone.
2 * Copyright (C) 1995-2016 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_CATEGORY_H__
21 #define __HB_CATEGORY_H__
22
23
24 typedef struct _category Category;
25
26
27 struct _category
28 {
29 guint32 key;
30 guint32 parent;
31 gushort flags;
32 gushort _pad1;
33 gchar *name;
34 gdouble budget[13]; //0:is same value, 1 ..12 are months
35
36 /* unsaved datas */
37 gboolean filter;
38 guint usage_count;
39 gboolean imported;
40 };
41
42 #define GF_SUB (1<<0)
43 #define GF_INCOME (1<<1)
44 #define GF_CUSTOM (1<<2)
45 #define GF_BUDGET (1<<3)
46 #define GF_FORCED (1<<4)
47
48 Category *da_cat_clone(Category *src_item);
49 void da_cat_free(Category *item);
50 Category *da_cat_malloc(void);
51 void da_cat_destroy(void);
52 void da_cat_new(void);
53
54 guint da_cat_length(void);
55 guint32 da_cat_remove(guint32 key);
56 gboolean da_cat_insert(Category *acc);
57 gboolean da_cat_append(Category *cat);
58 guint32 da_cat_get_max_key(void);
59 gchar *da_cat_get_fullname(Category *cat);
60
61 guint32 da_cat_get_key_by_name(gchar *name);
62
63 guint32 category_report_id(guint32 key, gboolean subcat);
64
65 Category *da_cat_get_by_name(gchar *name);
66 Category *da_cat_get(guint32 key);
67 Category *da_cat_get_by_fullname(gchar *fullname);
68 Category *da_cat_append_ifnew_by_fullname(gchar *fullname, gboolean imported);
69 void da_cat_consistency(Category *item);
70
71 GList *category_glist_sorted(gint column);
72
73 void category_delete_unused(void);
74 void category_fill_usage(void);
75 void category_move(guint32 key1, guint32 key2);
76 gboolean category_rename(Category *item, const gchar *newname);
77 gint category_change_type(Category *item, gboolean isIncome);
78
79 gboolean category_load_csv(gchar *filename, gchar **error);
80 gboolean category_save_csv(gchar *filename, gchar **error);
81 gchar *category_find_preset(gchar **lang);
82 gint category_type_get(Category *item);
83
84 #endif
This page took 0.041036 seconds and 4 git commands to generate.