Expenses
[Query Object Framework]


Detailed Description

Like DB, Expenses uses UTC time within QOF and sets localtime when calling pilot-link code.


Files

file  qof-expenses.h
 QOF expense definitions for pilot-link.

Data Structures

struct  GpeCurrency
 gpe-expenses currency data wrapper. More...

Defines

#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(_)

Typedefs

typedef Expense Expense_t
typedef QofExp_s QofExp
 Wraps QOF around Expense_t.
typedef void(*) GpeCurrencyCB (gpointer key, gpointer value, gpointer user_data)

Enumerations

enum  ExpenseDistance { Miles = 0, Kilometers }
enum  ExpensePayment {
  AmericanExpress = 0, Cash = 1, Cheque, CreditCard,
  MasterCard, Prepaid, VISA, Unfiled
}
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
}

Functions

void gpe_currency_foreach (GpeCurrencyCB cb, gpointer user_data)
GpeCurrencygpe_currency_lookup (QofInstance *inst, gint currency_code)
 Set details of a GpeCurrency from a currency_code.
GpeCurrencygpe_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.


Define Documentation

#define DISTANCE_LIST (  ) 

Value:

_(Miles, = 0) \
 _(Kilometers,)

Definition at line 130 of file qof-expenses.h.

#define EXPENSE_TYPE_LIST (  ) 

Value:

_(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, )

Definition at line 144 of file qof-expenses.h.

#define PAYMENT_TYPE_LIST (  ) 

Value:

_(AmericanExpress, = 0) \
 _(Cash, = 1 ) \
 _(Cheque, ) \
 _(CreditCard, ) \
 _(MasterCard, ) \
 _(Prepaid, ) \
 _(VISA, ) \
 _(Unfiled, )

Definition at line 134 of file qof-expenses.h.

#define PQ_CURRENCY_FRACTION   "expense/currency/fraction"

type: KVP_TYPE_GINT64

Definition at line 63 of file qof-expenses.h.

Referenced by gpe_currency_lookup().

#define PQ_CURRENCY_MNEMONIC   "expense/currency/mnemonic"

type: KVP_TYPE_STRING

Definition at line 59 of file qof-expenses.h.

Referenced by gpe_currency_lookup().

#define PQ_CURRENCY_SYMBOL   "expense/currency/symbol"

type: KVP_TYPE_STRING

Definition at line 61 of file qof-expenses.h.

Referenced by gpe_currency_lookup().


Typedef Documentation

typedef struct QofExp_s QofExp

Wraps QOF around Expense_t.

This allows QOF to build as an option rather than adding QofInstance to Expense_t and requiring QOF for all builds.

Definition at line 73 of file qof-expenses.h.


Enumeration Type Documentation

enum ExpenseDistance

Enumerator:
Miles 
Kilometers 

Definition at line 174 of file qof-expenses.h.

enum ExpensePayment

Enumerator:
AmericanExpress 
Cash 
Cheque 
CreditCard 
MasterCard 
Prepaid 
VISA 
Unfiled 

Definition at line 175 of file qof-expenses.h.

enum ExpenseType

Enumerator:
Airfare 
Breakfast 
Bus 
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 

Definition at line 176 of file qof-expenses.h.


Function Documentation

GpeCurrency* gpe_currency_lookup ( QofInstance *  inst,
gint  currency_code 
)

Set details of a GpeCurrency from a currency_code.

Lookup details of a GpeCurrency 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

Parameters:
inst The QofInstance to hold the KvpFrame containing the details of the currency.
currency_code The identifier of this currency.
Returns:
a pointer to the GpeCurrency identified by the currency_code or NULL on error.

Definition at line 436 of file qof-expenses.c.

References GpeCurrency::fraction, GpeCurrency::mnemonic, GpeCurrency::non_utf8, PQ_CURRENCY_FRACTION, PQ_CURRENCY_MNEMONIC, PQ_CURRENCY_SYMBOL, qof_main_make_utf8(), and GpeCurrency::symbol.

00437 {
00438         GpeCurrency *currency;
00439 
00440         currency = NULL;
00441         if(!gpe_currency_table) populate_currencies();
00442         currency = (GpeCurrency*)g_hash_table_lookup(
00443                 gpe_currency_table, GINT_TO_POINTER(currency_code));
00444         if(!currency)
00445         {
00446                 PERR (" unsupported currency! %d", currency_code);
00447                 return NULL;
00448         }
00449         kvp_frame_set_string(qof_instance_get_slots(inst),
00450                 PQ_CURRENCY_MNEMONIC, currency->mnemonic);
00451         kvp_frame_set_gint64(qof_instance_get_slots(inst),
00452                 PQ_CURRENCY_FRACTION, currency->fraction);
00453         if(currency->non_utf8)
00454         {
00455                 gchar * k_symbol = g_strdup (currency->symbol);
00456                 kvp_frame_set_string(qof_instance_get_slots(inst),
00457                         PQ_CURRENCY_SYMBOL, qof_main_make_utf8(k_symbol));
00458         }
00459         else
00460         {
00461                 kvp_frame_set_string(qof_instance_get_slots(inst),
00462                         PQ_CURRENCY_SYMBOL, currency->symbol);
00463         }
00464         return currency;
00465 }       

GpeCurrency* gpe_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.


Generated on Mon Jun 4 11:24:16 2007 for gpe-expenses by  doxygen 1.5.2