GnuCash  4.8a-80-g9825132ea+
gnc-lot.h
Go to the documentation of this file.
1 /********************************************************************\
2  * gnc-lot.h -- AR/AP invoices; inventory lots; stock lots *
3  * *
4  * This program is free software; you can redistribute it and/or *
5  * modify it under the terms of the GNU General Public License as *
6  * published by the Free Software Foundation; either version 2 of *
7  * the License, or (at your option) any later version. *
8  * *
9  * This program is distributed in the hope that it will be useful, *
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12  * GNU General Public License for more details. *
13  * *
14  * You should have received a copy of the GNU General Public License*
15  * along with this program; if not, contact: *
16  * *
17  * Free Software Foundation Voice: +1-617-542-5942 *
18  * 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 *
19  * Boston, MA 02110-1301, USA gnu@gnu.org *
20 \********************************************************************/
59 #ifndef GNC_LOT_H
60 #define GNC_LOT_H
61 
62 //typedef struct _GncLotClass GNCLotClass;
63 
64 #include "qof.h"
65 #include "gnc-engine.h"
66 /*#include "gnc-lot-p.h"*/
67 #include "gncInvoice.h"
68 
69 #ifdef __cplusplus
70 extern "C" {
71 #endif
72 
73 typedef struct
74 {
75  QofInstanceClass parent_class;
76 } GncLotClass;
77 #define GNCLotClass GncLotClass
78 
79 /* --- type macros --- */
80 #define GNC_TYPE_LOT (gnc_lot_get_type ())
81 #define GNC_LOT(o) \
82  (G_TYPE_CHECK_INSTANCE_CAST ((o), GNC_TYPE_LOT, GNCLot))
83 #define GNC_LOT_CLASS(k) \
84  (G_TYPE_CHECK_CLASS_CAST((k), GNC_TYPE_LOT, GNCLotClass))
85 #define GNC_IS_LOT(o) \
86  (G_TYPE_CHECK_INSTANCE_TYPE ((o), GNC_TYPE_LOT))
87 #define GNC_IS_LOT_CLASS(k) \
88  (G_TYPE_CHECK_CLASS_TYPE ((k), GNC_TYPE_LOT))
89 #define GNC_LOT_GET_CLASS(o) \
90  (G_TYPE_INSTANCE_GET_CLASS ((o), GNC_TYPE_LOT, GNCLotClass))
91 GType gnc_lot_get_type(void);
92 
93 
94 /*@ dependent @*/
95 GNCLot * gnc_lot_new (QofBook *);
96 void gnc_lot_destroy (GNCLot *);
97 
98 /*@ dependent @*/
99 GNCLot * gnc_lot_lookup (const GncGUID *guid, QofBook *book);
100 QofBook * gnc_lot_get_book (GNCLot *);
101 
102 void gnc_lot_begin_edit (GNCLot *lot);
103 void gnc_lot_commit_edit (GNCLot *lot);
104 
112 void gnc_lot_add_split (GNCLot *, Split *);
113 void gnc_lot_remove_split (GNCLot *, Split *);
114 
122 SplitList * gnc_lot_get_split_list (const GNCLot *);
123 gint gnc_lot_count_splits (const GNCLot *);
124 
127 /*@ dependent @*/
128 Account * gnc_lot_get_account (const GNCLot *);
129 void gnc_lot_set_account(GNCLot*, Account*);
130 
133 /*@ dependent @*/
134 GncInvoice * gnc_lot_get_cached_invoice (const GNCLot *lot);
135 void gnc_lot_set_cached_invoice(GNCLot* lot, GncInvoice *invoice);
136 
140 gnc_numeric gnc_lot_get_balance (GNCLot *);
141 
146 void gnc_lot_get_balance_before (const GNCLot *, const Split *,
147  gnc_numeric *, gnc_numeric *);
148 
154 gboolean gnc_lot_is_closed (GNCLot *);
155 
162 Split * gnc_lot_get_earliest_split (GNCLot *lot);
163 
169 Split * gnc_lot_get_latest_split (GNCLot *lot);
170 
172 void gnc_lot_set_closed_unknown(GNCLot*);
173 
175 const char * gnc_lot_get_title (const GNCLot *);
176 const char * gnc_lot_get_notes (const GNCLot *);
177 void gnc_lot_set_title (GNCLot *, const char *);
178 void gnc_lot_set_notes (GNCLot *, const char *);
179 
181 GNCLot * gnc_lot_make_default (Account * acc);
182 
183 #define gnc_lot_get_guid(X) qof_entity_get_guid(QOF_INSTANCE(X))
184 
185 #define LOT_IS_CLOSED "is-closed?"
186 #define LOT_BALANCE "balance"
187 #define LOT_TITLE "lot-title"
188 #define LOT_NOTES "notes"
189 
190 #ifdef __cplusplus
191 } /* extern "C" */
192 #endif
193 
194 #endif /* GNC_LOT_H */
195 
GncInvoice * gnc_lot_get_cached_invoice(const GNCLot *lot)
The gnc_lot_get_cached_invoice() routine returns the invoice with which this lot is associated...
Definition: gnc-lot.c:400
void gnc_lot_add_split(GNCLot *, Split *)
The gnc_lot_add_split() routine adds a split to this lot.
Definition: gnc-lot.c:622
void gnc_lot_set_closed_unknown(GNCLot *)
Reset closed flag so that it will be recalculated.
Definition: gnc-lot.c:425
Split * gnc_lot_get_earliest_split(GNCLot *lot)
The gnc_lot_get_earliest_split() routine is a convenience routine that helps identify the earliest da...
Definition: gnc-lot.c:701
const char * gnc_lot_get_title(const GNCLot *)
Get and set the account title, or the account notes, or the marker.
Definition: gnc-lot.c:456
Split * gnc_lot_get_latest_split(GNCLot *lot)
The gnc_lot_get_latest_split() routine is a convenience routine that helps identify the date this lot...
Definition: gnc-lot.c:713
GList SplitList
GList of Split.
Definition: gnc-engine.h:211
SplitList * gnc_lot_get_split_list(const GNCLot *)
The gnc_lot_get_split_list() routine returns a GList of all the splits in this lot.
Definition: gnc-lot.c:436
void gnc_lot_get_balance_before(const GNCLot *, const Split *, gnc_numeric *, gnc_numeric *)
The gnc_lot_get_balance_before routine computes both the balance and value in the lot considering onl...
Definition: gnc-lot.c:572
All type declarations for the whole Gnucash engine.
Business Invoice Interface.
GNCLot * gnc_lot_make_default(Account *acc)
XXX: Document?
Definition: gnc-lot.c:808
gboolean gnc_lot_is_closed(GNCLot *)
The gnc_lot_is_closed() routine returns a boolean flag: is this lot closed? A lot is closed if its ba...
Definition: gnc-lot.c:382
Account * gnc_lot_get_account(const GNCLot *)
The gnc_lot_get_account() routine returns the account with which this lot is associated.
Definition: gnc-lot.c:392
The type used to store guids in C.
Definition: guid.h:75
gnc_numeric gnc_lot_get_balance(GNCLot *)
The gnc_lot_get_balance() routine returns the balance of the lot.
Definition: gnc-lot.c:530