1 /* HomeBank -- Free, easy, personal accounting for everyone. 2 * Copyright (C) 1995-2021 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 gchar *fullname; 38 gboolean flt_select; 39 guint16 nb_use_txn; 40 guint16 nb_use_txncat; //cat usage only 41 guint16 nb_use_all; 42 guint16 nb_use_allcat; //cat usage only 43 }; 44 45 #define GF_SUB (1<<0) //? useful as we can check item->parent= 0 46 #define GF_INCOME (1<<1) 47 #define GF_CUSTOM (1<<2) 48 #define GF_BUDGET (1<<3) 49 #define GF_FORCED (1<<4) 50 #define GF_MIXED (1<<5) //#1740368 if cat has mixed exp/inc type 51 52 53 Category *da_cat_clone(Category *src_item); 54 void da_cat_free(Category *item); 55 Category *da_cat_malloc(void); 56 57 void da_cat_destroy(void); 58 void da_cat_new(void); 59 60 guint da_cat_length(void); 61 guint32 da_cat_get_max_key(void); 62 63 guint32 da_cat_delete(guint32 key); 64 gboolean da_cat_insert(Category *acc); 65 gboolean da_cat_append(Category *cat); 66 Category *da_cat_append_ifnew_by_fullname(gchar *rawfullname); 67 68 Category *da_cat_get(guint32 key); 69 gchar *da_cat_get_name(Category *item); 70 Category *da_cat_get_by_fullname(gchar *rawfullname); 71 72 void da_cat_consistency(Category *item); 73 74 GList *category_glist_sorted(gint column); 75 76 guint32 category_report_id(guint32 key, gboolean subcat); 77 78 gint category_delete_unused(void); 79 void category_fill_usage(void); 80 81 void category_move(guint32 srckey, guint32 newkey, gboolean dosubcat); 82 gboolean category_rename(Category *item, const gchar *newname); 83 84 gchar *category_find_preset(gchar **lang); 85 gint category_type_get(Category *item); 86 gchar category_get_type_char(Category *item); 87 gint category_change_type(Category *item, gboolean isIncome, gboolean doChild); 88 89 gboolean category_load_csv(gchar *filename, gchar **error); 90 gboolean category_save_csv(gchar *filename, gchar **error); 91 92 #endif 93