gpe-expenses
0.1.9
|
Files | |
file | qof-expenses.h |
QOF expense definitions. |
Data Structures | |
struct | QofCurrency |
qof-expenses currency data wrapper. More... |
Macros | |
#define | GPE_MOD_EXP "gpe-expenses-module" |
#define | GPE_QOF_EXPENSES "gpe_expenses" |
#define | QOF_EXPENSES_DESC "GPE QOF expenses" |
#define | EXP_DATE "expense_date" |
#define | EXP_TYPE "type_of_expense" |
#define | EXP_PAYMENT "form_of_payment" |
#define | EXP_CURRENCY "currency_code" |
#define | EXP_AMOUNT "expense_amount" |
#define | EXP_VENDOR "expense_vendor" |
#define | EXP_CITY "expense_city" |
#define | EXP_ATTENDEES "expense_attendees" |
#define | EXP_NOTE "expense_note" |
#define | EXP_CATEGORY "category" |
#define | EXP_DISTANCE "distance_unit" |
#define | EXP_KVP "currency_lookup" |
#define | PQ_CURRENCY_MNEMONIC "expense/currency/mnemonic" |
#define | PQ_CURRENCY_SYMBOL "expense/currency/symbol" |
#define | PQ_CURRENCY_FRACTION "expense/currency/fraction" |
#define | DISTANCE_LIST(_) |
#define | PAYMENT_TYPE_LIST(_) |
#define | EXPENSE_TYPE_LIST(_) |
#define | _GNU_SOURCE |
#define | _(String) dgettext (LIBRARY_GETTEXT_PACKAGE, String) |
#define | STRING(name, value) gchar * G_GNUC_UNUSED name##noop = _(#name); |
#define | MARKUP(name, list) |
Typedefs | |
typedef struct QofExp_s | QofExp |
Wraps QOF around pilot-link expenses. | |
typedef void(* | QofCurrencyCB )(gpointer key, gpointer value, gpointer user_data) |
Enumerations | |
enum | ExpenseDistance { Miles = 0, Kilometers, Miles = 0, Kilometers } |
enum | ExpensePayment { AmericanExpress = 0, Cash = 1, Cheque, CreditCard, MasterCard, Prepaid, VISA, Unfiled, AmericanExpress = 0, Cash = 1, Cheque, CreditCard, MasterCard, Prepaid, VISA, Unfiled } |
typedef for expense payment types. More... | |
enum | ExpenseType { Airfare = 0, Breakfast = 1, Bus = 2, BusinessMeals, CarRental, Dinner, Entertainment, Fax, Gas, Gifts, Hotel, Incidentals, Laundry, Limo, Lodging, Lunch, Mileage, Other, Parking, Postage, Snack, Subway, Supplies, Taxi, Telephone, Tips, Tolls, Train, Airfare = 0, Breakfast = 1, Bus = 2, BusinessMeals, CarRental, Dinner, Entertainment, Fax, Gas, Gifts, Hotel, Incidentals, Laundry, Limo, Lodging, Lunch, Mileage, Other, Parking, Postage, Snack, Subway, Supplies, Taxi, Telephone, Tips, Tolls, Train } |
typedef for expense types More... |
Functions | |
void | qof_currency_foreach (QofCurrencyCB cb, gpointer user_data) |
QofCurrency * | qof_currency_lookup (QofInstance *inst, gint currency_code) |
Set details of a QofCurrency from a currency_code. | |
QofCurrency * | qof_currency_lookup_name (QofInstance *inst, gchar *mnemonic) |
Lookup a currency by name. | |
const gchar * | ExpenseDistanceasString (ExpenseDistance n) |
ExpenseDistance | ExpenseDistancefromString (const gchar *str) |
const gchar * | ExpensePaymentasString (ExpensePayment n) |
ExpensePayment | ExpensePaymentfromString (const gchar *str) |
const gchar * | ExpenseTypeasString (ExpenseType n) |
ExpenseType | ExpenseTypefromString (const gchar *str) |
gboolean | ExpensesRegister (void) |
Register this object with QOF. | |
static void G_GNUC_UNUSED | ExpenseTypetranslate (void) |
static void G_GNUC_UNUSED | ExpensePaymenttranslate (void) |
Like ::DB, Expenses uses UTC time within QOF and sets localtime when calling pilot-link code.
Gradually becoming a standard QOF method, whilst retaining compatibility with the simple pilot-link currency handling instead of going the whole hog to GnuCash currencies. The old Expense_t has been removed for easier sharing between applications.
The typed enumerators ::ExpenseDistance, ExpenseType and ExpensePayment may look strange initially because macros are used to ensure that the enum value and a string version of the enum are always in sync. This allows the QOF backends to write human-readable data stores by specifying an ExpenseType of "Parking" as:
<string type="type_of_expense">Parking</string>
instead of:
<string type="type_of_expense">5</string>
In particular, do not let the macro syntax _(name, value)
fool you into thinking it is related to _(String)
from gettext! Note how the enumerator is handled by doxygen:
enum ExpenseType { Airfare = 0, Breakfast = 1, Bus = 2, BusinessMeals, ...
Translation must only be used to represent the string version of the enum value in the user interface and all internal handling of the enum value must remain untranslated in the QofEntity itself as this would lock the data into a specific locale.
#define DISTANCE_LIST | ( | _ | ) |
Definition at line 162 of file qof-expenses.h.
#define EXPENSE_TYPE_LIST | ( | _ | ) |
Definition at line 176 of file qof-expenses.h.
#define GPE_MOD_EXP "gpe-expenses-module" |
Definition at line 80 of file qof-expenses.h.
#define MARKUP | ( | name, | |
list | |||
) |
Definition at line 66 of file translate.c.
#define PAYMENT_TYPE_LIST | ( | _ | ) |
Definition at line 166 of file qof-expenses.h.
#define PQ_CURRENCY_FRACTION "expense/currency/fraction" |
type: KVP_TYPE_GINT64 - inherited from pilot-link via pilot-qof.
Definition at line 101 of file qof-expenses.h.
#define PQ_CURRENCY_MNEMONIC "expense/currency/mnemonic" |
type: KVP_TYPE_STRING - inherited from pilot-link via pilot-qof.
Definition at line 97 of file qof-expenses.h.
#define PQ_CURRENCY_SYMBOL "expense/currency/symbol" |
type: KVP_TYPE_STRING - inherited from pilot-link via pilot-qof.
Definition at line 99 of file qof-expenses.h.
enum ExpensePayment |
typedef for expense payment types.
dgettext
not the ordinary gettext
or the _(String)
macro.In your UI, to retrieve the translated string for an ExpensePayment, wrap ExpenseTypeasString in a call to the library translation support:
You may choose to define your own macro for this.
Other translatable strings in your application code must continue to use gettext
or the _(String)
macro as normal.
In accordance with the gettext manual, the library code does not call setlocale (LC_ALL, "")
. It is the responsibility of the main program to set the locale.
Definition at line 238 of file qof-expenses.h.
enum ExpenseType |
typedef for expense types
dgettext
not the ordinary gettext
or the _(String)
macro.In your UI, to retrieve the translated string for an ExpenseType, wrap ExpenseTypeasString in a call to the library translation support:
You may choose to define your own macro for this.
Other translatable strings in your application code must continue to use gettext
or the _(String)
macro as normal.
In accordance with the gettext manual, the library code does not call setlocale (LC_ALL, "")
. It is the responsibility of the main program to set the locale.
Definition at line 270 of file qof-expenses.h.
gboolean ExpensesRegister | ( | void | ) |
Register this object with QOF.
In accordance with the gettext manual, the library code does not call setlocale (LC_ALL, "")
. It is the responsibility of the main program to set the locale. The library just calls bindtextdomain with the domain for the library, LIBRARY_GETTEXT_PACKAGE which is exported via the libqofexpensesobjects API.
Definition at line 837 of file qof-expenses.c.
QofCurrency* qof_currency_lookup | ( | QofInstance * | inst, |
gint | currency_code | ||
) |
Set details of a QofCurrency from a currency_code.
Lookup details of a QofCurrency from a short identifier. The QofInstance will have a KvpFrame set (replacing any existing values for the same keys) containing: -PQ_CURRENCY_MNEMONIC -PQ_CURRENCY_FRACTION -PQ_CURRENCY_SYMBOL
inst | The QofInstance to hold the KvpFrame containing the details of the currency. |
currency_code | The identifier of this currency. |
Definition at line 437 of file qof-expenses.c.
QofCurrency* qof_currency_lookup_name | ( | QofInstance * | inst, |
gchar * | mnemonic | ||
) |
Lookup a currency by name.
Slower than ::gpe_currency_lookup because the entire currency hash must be searched. Otherwise, equivalent.
Definition at line 423 of file qof-expenses.c.