GnuCash  5.6-150-g038405b370+
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 
114 void gnc_lot_add_split (GNCLot *, Split *);
115 
118 void gnc_lot_remove_split (GNCLot *, Split *);
119 
130 SplitList * gnc_lot_get_split_list (const GNCLot *);
131 gint gnc_lot_count_splits (const GNCLot *);
132 
135 /*@ dependent @*/
136 Account * gnc_lot_get_account (const GNCLot *);
137 void gnc_lot_set_account(GNCLot*, Account*);
138 
141 /*@ dependent @*/
142 GncInvoice * gnc_lot_get_cached_invoice (const GNCLot *lot);
143 void gnc_lot_set_cached_invoice(GNCLot* lot, GncInvoice *invoice);
144 
148 gnc_numeric gnc_lot_get_balance (GNCLot *);
149 
154 void gnc_lot_get_balance_before (const GNCLot *, const Split *,
155  gnc_numeric *, gnc_numeric *);
156 
164 gboolean gnc_lot_is_closed (GNCLot *);
165 
171 Split * gnc_lot_get_earliest_split (GNCLot *lot);
172 
177 Split * gnc_lot_get_latest_split (GNCLot *lot);
178 
180 void gnc_lot_set_closed_unknown(GNCLot*);
181 
184 const char * gnc_lot_get_title (const GNCLot *);
185 const char * gnc_lot_get_notes (const GNCLot *);
186 void gnc_lot_set_title (GNCLot *, const char *);
187 void gnc_lot_set_notes (GNCLot *, const char *);
191 GNCLot * gnc_lot_make_default (Account * acc);
192 
193 #define gnc_lot_get_guid(X) qof_entity_get_guid(QOF_INSTANCE(X))
194 
195 #define LOT_IS_CLOSED "is-closed?"
196 #define LOT_BALANCE "balance"
197 #define LOT_TITLE "lot-title"
198 #define LOT_NOTES "notes"
199 
200 #ifdef __cplusplus
201 } /* extern "C" */
202 #endif
203 
204 #endif /* GNC_LOT_H */
205 
GncInvoice * gnc_lot_get_cached_invoice(const GNCLot *lot)
Returns the invoice with which this lot is associated.
Definition: gnc-lot.cpp:385
STRUCTS.
void gnc_lot_add_split(GNCLot *, Split *)
Adds a split to this lot.
Definition: gnc-lot.cpp:594
void gnc_lot_set_closed_unknown(GNCLot *)
Reset closed flag so that it will be recalculated.
Definition: gnc-lot.cpp:414
Split * gnc_lot_get_earliest_split(GNCLot *lot)
Convenience routine to identify the earliest date in the lot.
Definition: gnc-lot.cpp:673
Split * gnc_lot_get_latest_split(GNCLot *lot)
Convenience routineto identify the date this lot was closed.
Definition: gnc-lot.cpp:685
GList SplitList
GList of Split.
Definition: gnc-engine.h:207
SplitList * gnc_lot_get_split_list(const GNCLot *)
Returns a list of all the splits in this lot.
Definition: gnc-lot.cpp:425
void gnc_lot_remove_split(GNCLot *, Split *)
Adds a split from this lot.
Definition: gnc-lot.cpp:646
void gnc_lot_get_balance_before(const GNCLot *, const Split *, gnc_numeric *, gnc_numeric *)
Computes both the balance and value in the lot considering only splits in transactions prior to the o...
Definition: gnc-lot.cpp:544
All type declarations for the whole Gnucash engine.
Business Invoice Interface.
GNCLot * gnc_lot_make_default(Account *acc)
Definition: gnc-lot.cpp:780
gboolean gnc_lot_is_closed(GNCLot *)
Returns closed status of the given lot.
Definition: gnc-lot.cpp:367
Account * gnc_lot_get_account(const GNCLot *)
Returns the account with which this lot is associated.
Definition: gnc-lot.cpp:377
The type used to store guids in C.
Definition: guid.h:75
gnc_numeric gnc_lot_get_balance(GNCLot *)
Returns the lot balance.
Definition: gnc-lot.cpp:502