/***************************************************************************
 *            qof-expenses.h
 *
 *  Thu Oct 21 08:18:44 2004-2005
 *  Copyright  2004-2005  Neil Williams  <linux@codehelp.co.uk>
 ****************************************************************************/

/*
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU Library General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 */

/** @addtogroup QOF
	@{ */
/** @addtogroup Exp Expenses

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

	@{ */
/** @file  qof-expenses.h
	@brief QOF expense definitions for pilot-link
	@author Copyright (c) 2004-2005 Neil Williams <linux@codehelp.co.uk>
*/

#ifndef _QOF_EXPENSES_H
#define _QOF_EXPENSES_H

#include <glib.h>
#include <qof.h>
#include "pi-expense.h"
#include "qof-main.h"

/** \brief 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.

*/
typedef struct
{
	QofInstance inst;
	Expense_t wrap;
	enum ExpenseDistance distance_unit;
	char *category;
} qof_exp;

/** \brief Register this object with QOF
*/
gboolean ExpensesRegister (void);

int exp_unpack(QofEntity *ent, gpointer user_data);
int exp_pack(QofEntity *ent, gpointer user_data);
int qof_exp_free(QofEntity *ent, gpointer user_data);
int exp_appinfo_unpack(QofEntity *ent, gpointer user_data);

/** \brief create a new object using QOF.
*/
qof_exp *expense_create (QofBook*);

#endif				/* _QOF_EXPENSES_H */

/** @} */
/** @} */
