GnuCash  5.6-150-g038405b370+
gncEmployee.h
Go to the documentation of this file.
1 /********************************************************************\
2  * gncEmployee.h -- the Core Employee Interface *
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  * *
21 \********************************************************************/
31 #ifndef GNC_EMPLOYEE_H_
32 #define GNC_EMPLOYEE_H_
33 
34 typedef struct _gncEmployee GncEmployee;
35 typedef struct _gncEmployeeClass GncEmployeeClass;
36 
37 #include "gncAddress.h"
38 #include "Account.h"
39 
40 #ifdef __cplusplus
41 extern "C" {
42 #endif
43 
44 #define GNC_ID_EMPLOYEE "gncEmployee"
45 
46 /* --- type macros --- */
47 #define GNC_TYPE_EMPLOYEE (gnc_employee_get_type ())
48 #define GNC_EMPLOYEE(o) \
49  (G_TYPE_CHECK_INSTANCE_CAST ((o), GNC_TYPE_EMPLOYEE, GncEmployee))
50 #define GNC_EMPLOYEE_CLASS(k) \
51  (G_TYPE_CHECK_CLASS_CAST((k), GNC_TYPE_EMPLOYEE, GncEmployeeClass))
52 #define GNC_IS_EMPLOYEE(o) \
53  (G_TYPE_CHECK_INSTANCE_TYPE ((o), GNC_TYPE_EMPLOYEE))
54 #define GNC_IS_EMPLOYEE_CLASS(k) \
55  (G_TYPE_CHECK_CLASS_TYPE ((k), GNC_TYPE_EMPLOYEE))
56 #define GNC_EMPLOYEE_GET_CLASS(o) \
57  (G_TYPE_INSTANCE_GET_CLASS ((o), GNC_TYPE_EMPLOYEE, GncEmployeeClass))
58 GType gnc_employee_get_type(void);
59 
62 GncEmployee *gncEmployeeCreate (QofBook *book);
63 void gncEmployeeDestroy (GncEmployee *employee);
64 void gncEmployeeBeginEdit (GncEmployee *employee);
65 void gncEmployeeCommitEdit (GncEmployee *employee);
66 int gncEmployeeCompare (const GncEmployee *a, const GncEmployee *b);
71 void gncEmployeeSetID (GncEmployee *employee, const char *id);
72 void gncEmployeeSetUsername (GncEmployee *employee, const char *username);
73 /* Note: Employees don't have a name property defined, but
74  * in order to get a consistent interface with other owner types,
75  * this function fakes one by setting the name property of
76  * the employee's address.
77  */
78 void gncEmployeeSetName (GncEmployee *employee, const char *name);
79 void gncEmployeeSetLanguage (GncEmployee *employee, const char *language);
80 void gncEmployeeSetAcl (GncEmployee *employee, const char *acl);
81 void gncEmployeeSetWorkday (GncEmployee *employee, gnc_numeric workday);
82 void gncEmployeeSetRate (GncEmployee *employee, gnc_numeric rate);
83 void gncEmployeeSetCurrency (GncEmployee *employee, gnc_commodity * currency);
84 void gncEmployeeSetActive (GncEmployee *employee, gboolean active);
85 void gncEmployeeSetCCard (GncEmployee *employee, Account* ccard_acc);
86 void qofEmployeeSetAddr (GncEmployee *employee, QofInstance *addr_ent);
87 
92 QofBook * gncEmployeeGetBook (GncEmployee *employee);
93 const char * gncEmployeeGetID (const GncEmployee *employee);
94 const char * gncEmployeeGetUsername (const GncEmployee *employee);
95 /* Note: Employees don't have a name property defined, but
96  * in order to get a consistent interface with other owner types,
97  * this function fakes one by returning the name property of
98  * the employee's address.
99  */
100 const char * gncEmployeeGetName (const GncEmployee *employee);
101 GncAddress * gncEmployeeGetAddr (const GncEmployee *employee);
102 const char * gncEmployeeGetLanguage (const GncEmployee *employee);
103 const char * gncEmployeeGetAcl (const GncEmployee *employee);
104 gnc_numeric gncEmployeeGetWorkday (const GncEmployee *employee);
105 gnc_numeric gncEmployeeGetRate (const GncEmployee *employee);
106 gnc_commodity * gncEmployeeGetCurrency (const GncEmployee *employee);
107 gboolean gncEmployeeGetActive (const GncEmployee *employee);
108 Account * gncEmployeeGetCCard (const GncEmployee *employee);
116 static inline GncEmployee * gncEmployeeLookup (const QofBook *book, const GncGUID *guid)
117 {
118  QOF_BOOK_RETURN_ENTITY(book, guid, GNC_ID_EMPLOYEE, GncEmployee);
119 }
120 
121 
122 #define EMPLOYEE_ID "id"
123 #define EMPLOYEE_USERNAME "username"
124 #define EMPLOYEE_NAME "name"
125 #define EMPLOYEE_ADDR "addr"
126 #define EMPLOYEE_LANGUAGE "native language"
127 #define EMPLOYEE_ACL "acl"
128 #define EMPLOYEE_WORKDAY "workday"
129 #define EMPLOYEE_RATE "rate"
130 #define EMPLOYEE_CC "credit_card_account"
131 
133 #define gncEmployeeGetGUID(E) qof_entity_get_guid(QOF_INSTANCE(E))
134 #define gncEmployeeGetBook(E) qof_instance_get_book(QOF_INSTANCE(E))
135 #define gncEmployeeRetGUID(E) (E ? *(qof_entity_get_guid(QOF_INSTANCE(E))) : *(guid_null()))
136 #define gncEmployeeLookupDirect(G,B) gncEmployeeLookup((B),&(G))
137 
139 gboolean gncEmployeeEqual(const GncEmployee* e1, const GncEmployee* e2);
140 gboolean gncEmployeeIsDirty (const GncEmployee *employee);
141 
142 #ifdef __cplusplus
143 }
144 #endif
145 
146 #endif /* GNC_EMPLOYEE_H_ */
147 
STRUCTS.
#define QOF_BOOK_RETURN_ENTITY(book, guid, e_type, c_type)
Encapsulates all the information about a dataset manipulated by QOF.
Definition: qofbook.h:186
Account handling public routines.
an Address object
The type used to store guids in C.
Definition: guid.h:75
gboolean gncEmployeeEqual(const GncEmployee *e1, const GncEmployee *e2)
Test support function, used by test-dbi-business-stuff.c.
Definition: gncEmployee.c:737