add gitignore
[chaz/homebank] / src / hb-account.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_ACCOUNT_H__
21 #define __HB_ACCOUNT_H__
22
23
24
25 typedef struct _account Account;
26
27
28 struct _account
29 {
30 guint32 key;
31 gushort flags;
32 gushort type;
33 guint32 pos; //position in list
34 //guint32 kcur;
35 gchar *name;
36 gchar *number;
37 gchar *bankname;
38 gdouble initial;
39 gdouble minimum;
40 guint32 cheque1;
41 guint32 cheque2;
42 //note ?
43
44 /* unsaved datas */
45 gdouble bal_bank; //bank balance (reconciled transaction)
46 gdouble bal_today; //today balance (every transaction until today)
47 gdouble bal_future; //future balance (every transaction)
48 GtkWindow *window; //dsp_account window opened
49 gboolean filter; //true if selected into filter
50
51 // import datas
52 gboolean imported;
53 guint32 imp_key;
54 gchar *imp_name;
55 };
56
57 // 0 is free
58 #define AF_CLOSED (1<<1)
59 #define AF_ADDED (1<<2)
60 #define AF_CHANGED (1<<3)
61 #define AF_NOSUMMARY (1<<4)
62 #define AF_NOBUDGET (1<<5)
63 #define AF_NOREPORT (1<<6)
64
65 #define AF_OLDBUDGET (1<<0)
66
67 enum
68 {
69 ACC_TYPE_NONE = 0,
70 ACC_TYPE_BANK = 1, //Banque
71 ACC_TYPE_CASH = 2, //Espèce
72 ACC_TYPE_ASSET = 3, //Actif (avoir)
73 ACC_TYPE_CREDITCARD = 4, //Carte crédit
74 ACC_TYPE_LIABILITY = 5, //Passif (dettes)
75 // ACC_TYPE_STOCK = 6, //Actions
76 // ACC_TYPE_MUTUALFUND = 7, //Fond de placement
77 // ACC_TYPE_INCOME = 8, //Revenus
78 // ACC_TYPE_EXPENSE = 9, //Dépenses
79 // ACC_TYPE_EQUITY = 10, //Capitaux propres
80 // ACC_TYPE_,
81 ACC_TYPE_MAXVALUE
82 };
83
84
85
86 Account *da_acc_clone(Account *src_item);
87 Account *da_acc_malloc(void);
88 void da_acc_free(Account *item);
89 Account *da_acc_malloc(void);
90
91 void da_acc_destroy(void);
92 void da_acc_new(void);
93
94 guint da_acc_length(void);
95 gboolean da_acc_create_none(void);
96 gboolean da_acc_remove(guint32 key);
97 gboolean da_acc_insert(Account *acc);
98 gboolean da_acc_append(Account *item);
99 guint32 da_acc_get_max_key(void);
100 Account *da_acc_get_by_name(gchar *name);
101 Account *da_acc_get_by_imp_name(gchar *name);
102 Account *da_acc_get(guint32 key);
103 void da_acc_consistency(Account *item);
104
105
106 gboolean account_is_used(guint32 key);
107 void account_move(guint32 key1, guint32 key2);
108 gboolean account_exists(gchar *name);
109 gboolean account_rename(Account *item, gchar *newname);
110 void account_compute_balances(void);
111 gboolean account_balances_add(Transaction *trn);
112 gboolean account_balances_sub(Transaction *trn);
113
114 GList *account_glist_sorted(gint column);
115 #endif
This page took 0.040746 seconds and 4 git commands to generate.