GnuCash 2.4.99
gncOrder.h
00001 /********************************************************************\
00002  * gncOrder.h -- the Core Business Order Interface                  *
00003  *                                                                  *
00004  * This program is free software; you can redistribute it and/or    *
00005  * modify it under the terms of the GNU General Public License as   *
00006  * published by the Free Software Foundation; either version 2 of   *
00007  * the License, or (at your option) any later version.              *
00008  *                                                                  *
00009  * This program is distributed in the hope that it will be useful,  *
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of   *
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the    *
00012  * GNU General Public License for more details.                     *
00013  *                                                                  *
00014  * You should have received a copy of the GNU General Public License*
00015  * along with this program; if not, contact:                        *
00016  *                                                                  *
00017  * Free Software Foundation           Voice:  +1-617-542-5942       *
00018  * 51 Franklin Street, Fifth Floor    Fax:    +1-617-542-2652       *
00019  * Boston, MA  02110-1301,  USA       gnu@gnu.org                   *
00020  *                                                                  *
00021 \********************************************************************/
00022 /* NOTE: Removed from doxygen by warlord on 2004-05-07 because
00023  * this module is not fully implemented at this time.
00024  */
00025 /* @addtogroup Business
00026     @{ */
00027 /* @addtogroup Order
00028     @{ */
00029 /* @file gncOrder.h
00030     @brief Business Order Interface
00031     @author Copyright (C) 2001 Derek Atkins <warlord@MIT.EDU>
00032 */
00033 
00034 #ifndef GNC_ORDER_H_
00035 #define GNC_ORDER_H_
00036 
00037 typedef struct _gncOrder GncOrder;
00038 typedef struct _gncOrderClass GncOrderClass;
00039 
00040 #include "gncEntry.h"
00041 #include "gncOwner.h"
00042 #include "qof.h"
00043 
00044 #define GNC_ID_ORDER "gncOrder"
00045 
00046 /* --- type macros --- */
00047 #define GNC_TYPE_ORDER            (gnc_order_get_type ())
00048 #define GNC_ORDER(o)              \
00049      (G_TYPE_CHECK_INSTANCE_CAST ((o), GNC_TYPE_ORDER, GncOrder))
00050 #define GNC_ORDER_CLASS(k)        \
00051      (G_TYPE_CHECK_CLASS_CAST((k), GNC_TYPE_ORDER, GncOrderClass))
00052 #define GNC_IS_ORDER(o)           \
00053      (G_TYPE_CHECK_INSTANCE_TYPE ((o), GNC_TYPE_ORDER))
00054 #define GNC_IS_ORDER_CLASS(k)     \
00055      (G_TYPE_CHECK_CLASS_TYPE ((k), GNC_TYPE_ORDER))
00056 #define GNC_ORDER_GET_CLASS(o)    \
00057      (G_TYPE_INSTANCE_GET_CLASS ((o), GNC_TYPE_ORDER, GncOrderClass))
00058 GType gnc_order_get_type(void);
00059 
00060 /* Create/Destroy Functions */
00061 
00062 GncOrder *gncOrderCreate (QofBook *book);
00063 void gncOrderDestroy (GncOrder *order);
00064 
00065 /* Set Functions */
00066 
00067 void gncOrderSetID (GncOrder *order, const char *id);
00068 void gncOrderSetOwner (GncOrder *order, GncOwner *owner);
00069 void gncOrderSetDateOpened (GncOrder *order, Timespec date);
00070 void gncOrderSetDateClosed (GncOrder *order, Timespec date);
00071 void gncOrderSetNotes (GncOrder *order, const char *notes);
00072 void gncOrderSetReference (GncOrder *order, const char *reference);
00073 void gncOrderSetActive (GncOrder *order, gboolean active);
00074 
00075 /* Add an Entry to the Order */
00076 void gncOrderAddEntry (GncOrder *order, GncEntry *entry);
00077 void gncOrderRemoveEntry (GncOrder *order, GncEntry *entry);
00078 
00079 /* Get Functions */
00080 
00081 const char * gncOrderGetID (const GncOrder *order);
00082 GncOwner * gncOrderGetOwner (GncOrder *order);
00083 Timespec gncOrderGetDateOpened (const GncOrder *order);
00084 Timespec gncOrderGetDateClosed (const GncOrder *order);
00085 const char * gncOrderGetNotes (const GncOrder *order);
00086 const char * gncOrderGetReference (const GncOrder *order);
00087 gboolean gncOrderGetActive (const GncOrder *order);
00088 
00089 /* Get the list Entries */
00090 GList * gncOrderGetEntries (GncOrder *order);
00091 
00092 void gncOrderBeginEdit (GncOrder *order);
00093 void gncOrderCommitEdit (GncOrder *order);
00094 int gncOrderCompare (const GncOrder *a, const GncOrder *b);
00095 
00096 gboolean gncOrderIsClosed (const GncOrder *order);
00097 
00104 static inline GncOrder * gncOrderLookup (const QofBook *book, const GncGUID *guid)
00105 {
00106     QOF_BOOK_RETURN_ENTITY(book, guid, GNC_ID_ORDER, GncOrder);
00107 }
00108 
00109 #define ORDER_ID        "id"
00110 #define ORDER_REFERENCE "reference"
00111 #define ORDER_OWNER     "owner"
00112 #define ORDER_OPENED    "date_opened"
00113 #define ORDER_CLOSED    "date_closed"
00114 #define ORDER_IS_CLOSED "is_closed?"
00115 #define ORDER_NOTES     "notes"
00116 
00118 #define gncOrderGetGUID(x) qof_instance_get_guid(QOF_INSTANCE(x))
00119 #define gncOrderGetBook(x) qof_instance_get_book(QOF_INSTANCE(x))
00120 
00121 #endif /* GNC_ORDER_H_ */
00122 
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines