gpe-expenses  0.1.9
qof-expenses.h
Go to the documentation of this file.
1 /***************************************************************************
2  * qof-expenses.h
3  *
4  * Thu Oct 21 08:18:44 2004
5  * Copyright 2004,2005,2006,2009 Neil Williams <linux@codehelp.co.uk>
6  ****************************************************************************/
7 /*
8  This package is free software; you can redistribute it and/or modify
9  it under the terms of the GNU General Public License as published by
10  the Free Software Foundation; either version 3 of the License, or
11  (at your option) any later version.
12 
13  This program is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  GNU General Public License for more details.
17 
18  You should have received a copy of the GNU General Public License
19  along with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
73 #ifndef _QOF_EXPENSES_H
74 #define _QOF_EXPENSES_H
75 
76 #include <glib.h>
77 #include <qof.h>
78 
80 #define GPE_MOD_EXP "gpe-expenses-module"
81 #define GPE_QOF_EXPENSES "gpe_expenses"
82 #define QOF_EXPENSES_DESC "GPE QOF expenses"
83 #define EXP_DATE "expense_date"
84 #define EXP_TYPE "type_of_expense"
85 #define EXP_PAYMENT "form_of_payment"
86 #define EXP_CURRENCY "currency_code"
87 #define EXP_AMOUNT "expense_amount"
88 #define EXP_VENDOR "expense_vendor"
89 #define EXP_CITY "expense_city"
90 #define EXP_ATTENDEES "expense_attendees"
91 #define EXP_NOTE "expense_note"
92 #define EXP_CATEGORY "category"
93 #define EXP_DISTANCE "distance_unit"
94 #define EXP_KVP "currency_lookup"
95 
97 #define PQ_CURRENCY_MNEMONIC "expense/currency/mnemonic"
98 
99 #define PQ_CURRENCY_SYMBOL "expense/currency/symbol"
100 
101 #define PQ_CURRENCY_FRACTION "expense/currency/fraction"
102 
103 
105 typedef struct QofExp_s QofExp;
106 
107 typedef void (*QofCurrencyCB) (gpointer key, gpointer value, gpointer user_data);
108 
109 void qof_currency_foreach(QofCurrencyCB cb, gpointer user_data);
110 
117 typedef struct
118 {
120  gint pq_code;
122  gint fraction;
124  const gchar* symbol;
126  const gchar* mnemonic;
130  gboolean non_utf8;
131 }QofCurrency;
132 
150 QofCurrency *
151 qof_currency_lookup (QofInstance* inst, gint currency_code);
152 
159 QofCurrency *
160 qof_currency_lookup_name (QofInstance* inst, gchar * mnemonic);
161 
162 #define DISTANCE_LIST(_) \
163  _(Miles, = 0) \
164  _(Kilometers,)
165 
166 #define PAYMENT_TYPE_LIST(_) \
167  _(AmericanExpress, = 0) \
168  _(Cash, = 1 ) \
169  _(Cheque, ) \
170  _(CreditCard, ) \
171  _(MasterCard, ) \
172  _(Prepaid, ) \
173  _(VISA, ) \
174  _(Unfiled, )
175 
176 #define EXPENSE_TYPE_LIST(_) \
177  _(Airfare, = 0) \
178  _(Breakfast, = 1) \
179  _(Bus, = 2) \
180  _(BusinessMeals, ) \
181  _(CarRental, ) \
182  _(Dinner, ) \
183  _(Entertainment, ) \
184  _(Fax, ) \
185  _(Gas, ) \
186  _(Gifts, ) \
187  _(Hotel, ) \
188  _(Incidentals, ) \
189  _(Laundry, ) \
190  _(Limo, ) \
191  _(Lodging, ) \
192  _(Lunch, ) \
193  _(Mileage, ) \
194  _(Other, ) \
195  _(Parking, ) \
196  _(Postage, ) \
197  _(Snack, ) \
198  _(Subway, ) \
199  _(Supplies, ) \
200  _(Taxi, ) \
201  _(Telephone, ) \
202  _(Tips, ) \
203  _(Tolls, ) \
204  _(Train, )
205 
206 DEFINE_ENUM(ExpenseDistance, DISTANCE_LIST)
239 DEFINE_ENUM(ExpensePayment, PAYMENT_TYPE_LIST)
240 
273 DEFINE_ENUM(ExpenseType, EXPENSE_TYPE_LIST)
274 
275 AS_STRING_DEC (ExpenseDistance, DISTANCE_LIST)
276 FROM_STRING_DEC(ExpenseDistance, DISTANCE_LIST)
277 AS_STRING_DEC (ExpensePayment, PAYMENT_TYPE_LIST)
278 FROM_STRING_DEC(ExpensePayment, PAYMENT_TYPE_LIST)
279 AS_STRING_DEC (ExpenseType, EXPENSE_TYPE_LIST)
280 FROM_STRING_DEC(ExpenseType, EXPENSE_TYPE_LIST)
281 
295 gboolean ExpensesRegister (void);
296 
299 #endif /* _QOF_EXPENSES_H */