1 /* gncBusiness.h -- Business Helper Functions
2  *
3  * This program is free software; you can redistribute it and/or
4  * modify it under the terms of the GNU General Public License as
5  * published by the Free Software Foundation; either version 2 of
6  * the License, or (at your option) any later version.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program; if not, contact:
15  *
16  * Free Software Foundation           Voice:  +1-617-542-5942
17  * 51 Franklin Street, Fifth Floor    Fax:    +1-617-542-2652
18  * Boston, MA  02110-1301,  USA       gnu@gnu.org
19  */
20 /** @addtogroup Engine
21     @{ */
22 /** @addtogroup Business
23     The Business Engine provides a set of structures for
24     that provide small-business accounting features.
25     @{ */
26 
27 /** @file gncBusiness.h -- Business Helper Functions
28  *  @author Copyright (C) 2002 Derek Atkins
29  *  @author Derek Atkins <warlord@MIT.EDU>
30  */
31 
32 /** @} */
33 /** @} */
34 #ifndef GNC_BUSINESS_H_
35 #define GNC_BUSINESS_H_
36 
37 #ifdef __cplusplus
38 extern "C++" {
39 #include <glib.h>
40 }
41 #endif
42 #include "qof.h"
43 #include "Account.h"
44 
45 /* KVP key for report PDF directories */
46 #define OWNER_EXPORT_PDF_DIRNAME "export-pdf-directory"
47 #define LAST_POSTED_TO_ACCT "last-posted-to-acct"
48 #define GNC_PAYMENT "payment"
49 #define GNC_LAST_ACCOUNT "last_acct"
50 
51 /* @deprecated backwards-compat definitions */
52 #define GNC_BILLTERM_MODULE_NAME GNC_ID_BILLTERM
53 #define GNC_CUSTOMER_MODULE_NAME GNC_ID_CUSTOMER
54 #define GNC_EMPLOYEE_MODULE_NAME GNC_ID_EMPLOYEE
55 #define GNC_ENTRY_MODULE_NAME    GNC_ID_ENTRY
56 #define GNC_INVOICE_MODULE_NAME  GNC_ID_INVOICE
57 #define GNC_JOB_MODULE_NAME      GNC_ID_JOB
58 #define GNC_ORDER_MODULE_NAME    GNC_ID_ORDER
59 #define GNC_OWNER_MODULE_NAME    GNC_ID_OWNER
60 #define GNC_TAXTABLE_MODULE_NAME GNC_ID_TAXTABLE
61 #define GNC_VENDOR_MODULE_NAME   GNC_ID_VENDOR
62 
63 /* The initialization of the business objects is done in
64  * cashobjects_register() of <engine/cashobjects.h>. */
65 
66 #ifndef DI
67 # ifdef _MSC_VER
68 /* MSVC compiler doesn't have C99 "designated initializers"
69  * so we wrap them in a macro that is empty on MSVC. */
70 #  define DI(x) /* */
71 # else
72 #  define DI(x) x
73 # endif
74 #endif
75 
76 /** Returns a GList of all objects of the given type_name in the given
77  * book. */
78 GList * gncBusinessGetList (QofBook *book, QofIdTypeConst type_name,
79                             gboolean all_including_inactive);
80 
81 /** For SWIG: A GList containing GncOwner. */
82 typedef GList OwnerList;
83 
84 /** Returns a GList of all objects of the given type_name in the given
85  * book, but each object is wrapped in a GncOwner object.
86  *
87  * The wrapping was done by qofOwnerSetEntity(), hence the owner will
88  * contain data only for {CUSTOMER, JOB, VENDOR, EMPLOYEE}, otherwise
89  * the owner will be of type GNC_OWNER_NONE and not contain the
90  * original data. */
91 OwnerList * gncBusinessGetOwnerList (QofBook *book, QofIdTypeConst type_name,
92                                      gboolean all_including_inactive);
93 
94 /** Returns whether the given account type is a valid type to use in
95  * business payments. Currently payments are allowed to/from assets,
96  * liabilities and equity accounts. */
97 gboolean gncBusinessIsPaymentAcctType (GNCAccountType type);
98 
99 
100 #endif /* GNC_BUSINESS_H_ */
101