2003-10-16 23:32:04 -05:00
|
|
|
/********************************************************************\
|
|
|
|
* gncOrder.h -- the Core Business Order Interface *
|
|
|
|
* *
|
|
|
|
* 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 General Public License for more details. *
|
|
|
|
* *
|
|
|
|
* You should have received a copy of the GNU General Public License*
|
|
|
|
* along with this program; if not, contact: *
|
|
|
|
* *
|
|
|
|
* Free Software Foundation Voice: +1-617-542-5942 *
|
|
|
|
* 59 Temple Place - Suite 330 Fax: +1-617-542-2652 *
|
|
|
|
* Boston, MA 02111-1307, USA gnu@gnu.org *
|
|
|
|
* *
|
|
|
|
\********************************************************************/
|
2004-05-07 00:11:49 -05:00
|
|
|
/** @addtogroup Business
|
|
|
|
@{ */
|
|
|
|
/** @addtogroup Order
|
|
|
|
@{ */
|
|
|
|
/** @file gncOrder.h
|
|
|
|
@brief Business Order Interface
|
|
|
|
@author Copyright (C) 2001 Derek Atkins <warlord@MIT.EDU>
|
|
|
|
*/
|
2001-11-21 19:23:07 -06:00
|
|
|
|
|
|
|
#ifndef GNC_ORDER_H_
|
|
|
|
#define GNC_ORDER_H_
|
|
|
|
|
|
|
|
typedef struct _gncOrder GncOrder;
|
|
|
|
|
2001-11-29 17:04:34 -06:00
|
|
|
#include "gncEntry.h"
|
2001-12-05 23:46:42 -06:00
|
|
|
#include "gncOwner.h"
|
2003-10-17 00:15:56 -05:00
|
|
|
#include "qofbook.h"
|
2003-10-19 00:13:59 -05:00
|
|
|
#include "qofid.h"
|
2003-10-17 00:15:56 -05:00
|
|
|
#include "qofinstance.h"
|
2001-11-21 19:23:07 -06:00
|
|
|
|
2003-10-19 00:13:59 -05:00
|
|
|
#define GNC_ID_ORDER "gncOrder"
|
|
|
|
#define GNC_IS_ORDER(obj) (QOF_CHECK_TYPE((obj), GNC_ID_ORDER))
|
|
|
|
#define GNC_ORDER(obj) (QOF_CHECK_CAST((obj), GNC_ID_ORDER, GncOrder))
|
2001-11-21 19:23:07 -06:00
|
|
|
|
|
|
|
/* Create/Destroy Functions */
|
|
|
|
|
2003-06-26 22:05:25 -05:00
|
|
|
GncOrder *gncOrderCreate (QofBook *book);
|
2001-11-21 19:23:07 -06:00
|
|
|
void gncOrderDestroy (GncOrder *order);
|
|
|
|
|
|
|
|
/* Set Functions */
|
|
|
|
|
|
|
|
void gncOrderSetID (GncOrder *order, const char *id);
|
2001-12-05 23:46:42 -06:00
|
|
|
void gncOrderSetOwner (GncOrder *order, GncOwner *owner);
|
2002-02-27 18:55:34 -06:00
|
|
|
void gncOrderSetDateOpened (GncOrder *order, Timespec date);
|
|
|
|
void gncOrderSetDateClosed (GncOrder *order, Timespec date);
|
2001-11-21 19:23:07 -06:00
|
|
|
void gncOrderSetNotes (GncOrder *order, const char *notes);
|
2002-02-26 22:52:33 -06:00
|
|
|
void gncOrderSetReference (GncOrder *order, const char *reference);
|
2001-11-21 19:23:07 -06:00
|
|
|
void gncOrderSetActive (GncOrder *order, gboolean active);
|
|
|
|
|
|
|
|
/* Add an Entry to the Order */
|
|
|
|
void gncOrderAddEntry (GncOrder *order, GncEntry *entry);
|
|
|
|
void gncOrderRemoveEntry (GncOrder *order, GncEntry *entry);
|
|
|
|
|
|
|
|
/* Get Functions */
|
|
|
|
|
|
|
|
const char * gncOrderGetID (GncOrder *order);
|
2001-12-05 23:46:42 -06:00
|
|
|
GncOwner * gncOrderGetOwner (GncOrder *order);
|
2001-11-21 19:23:07 -06:00
|
|
|
Timespec gncOrderGetDateOpened (GncOrder *order);
|
|
|
|
Timespec gncOrderGetDateClosed (GncOrder *order);
|
|
|
|
const char * gncOrderGetNotes (GncOrder *order);
|
2002-02-26 22:52:33 -06:00
|
|
|
const char * gncOrderGetReference (GncOrder *order);
|
2001-11-21 19:23:07 -06:00
|
|
|
gboolean gncOrderGetActive (GncOrder *order);
|
|
|
|
|
|
|
|
/* Get the list Entries */
|
|
|
|
GList * gncOrderGetEntries (GncOrder *order);
|
|
|
|
|
|
|
|
gboolean gncOrderIsDirty (GncOrder *order);
|
2001-11-30 01:37:50 -06:00
|
|
|
void gncOrderBeginEdit (GncOrder *order);
|
2001-11-21 19:23:07 -06:00
|
|
|
void gncOrderCommitEdit (GncOrder *order);
|
2002-02-03 14:01:08 -06:00
|
|
|
int gncOrderCompare (GncOrder *a, GncOrder *b);
|
|
|
|
|
2002-02-19 12:23:53 -06:00
|
|
|
gboolean gncOrderIsClosed (GncOrder *order);
|
|
|
|
|
2003-10-19 00:13:59 -05:00
|
|
|
/** Return a pointer to the instance gncOrder that is identified
|
|
|
|
* by the guid, and is residing in the book. Returns NULL if the
|
|
|
|
* instance can't be found.
|
|
|
|
* Equivalent function prototype is
|
|
|
|
* GncOrder * gncOrderLookup (QofBook *book, const GUID *guid);
|
|
|
|
*/
|
|
|
|
#define gncOrderLookup(book,guid) \
|
|
|
|
QOF_BOOK_LOOKUP_ENTITY((book),(guid),GNC_ID_ORDER, GncOrder)
|
|
|
|
|
2002-02-08 22:18:50 -06:00
|
|
|
#define ORDER_ID "id"
|
2002-05-13 19:52:42 -05:00
|
|
|
#define ORDER_REFERENCE "reference"
|
2002-02-03 20:53:13 -06:00
|
|
|
#define ORDER_OWNER "owner"
|
2002-02-08 22:18:50 -06:00
|
|
|
#define ORDER_OPENED "date_opened"
|
|
|
|
#define ORDER_CLOSED "date_closed"
|
2002-02-19 12:23:53 -06:00
|
|
|
#define ORDER_IS_CLOSED "is_closed?"
|
2002-02-08 22:18:50 -06:00
|
|
|
#define ORDER_NOTES "notes"
|
2001-11-21 19:23:07 -06:00
|
|
|
|
2003-10-14 16:20:55 -05:00
|
|
|
/** deprecated functions */
|
|
|
|
#define gncOrderGetGUID(x) qof_instance_get_guid(QOF_INSTANCE(x))
|
|
|
|
#define gncOrderGetBook(x) qof_instance_get_book(QOF_INSTANCE(x))
|
|
|
|
|
2001-11-21 19:23:07 -06:00
|
|
|
#endif /* GNC_ORDER_H_ */
|
2004-05-07 00:11:49 -05:00
|
|
|
/** @} */
|
|
|
|
/** @} */
|