GnuCash  4.8a-80-g9825132ea+
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 #define GNC_ID_EMPLOYEE "gncEmployee"
41 
42 /* --- type macros --- */
43 #define GNC_TYPE_EMPLOYEE (gnc_employee_get_type ())
44 #define GNC_EMPLOYEE(o) \
45  (G_TYPE_CHECK_INSTANCE_CAST ((o), GNC_TYPE_EMPLOYEE, GncEmployee))
46 #define GNC_EMPLOYEE_CLASS(k) \
47  (G_TYPE_CHECK_CLASS_CAST((k), GNC_TYPE_EMPLOYEE, GncEmployeeClass))
48 #define GNC_IS_EMPLOYEE(o) \
49  (G_TYPE_CHECK_INSTANCE_TYPE ((o), GNC_TYPE_EMPLOYEE))
50 #define GNC_IS_EMPLOYEE_CLASS(k) \
51  (G_TYPE_CHECK_CLASS_TYPE ((k), GNC_TYPE_EMPLOYEE))
52 #define GNC_EMPLOYEE_GET_CLASS(o) \
53  (G_TYPE_INSTANCE_GET_CLASS ((o), GNC_TYPE_EMPLOYEE, GncEmployeeClass))
54 GType gnc_employee_get_type(void);
55 
58 GncEmployee *gncEmployeeCreate (QofBook *book);
59 void gncEmployeeDestroy (GncEmployee *employee);
60 void gncEmployeeBeginEdit (GncEmployee *employee);
61 void gncEmployeeCommitEdit (GncEmployee *employee);
62 int gncEmployeeCompare (const GncEmployee *a, const GncEmployee *b);
67 void gncEmployeeSetID (GncEmployee *employee, const char *id);
68 void gncEmployeeSetUsername (GncEmployee *employee, const char *username);
69 /* Note: Employees don't have a name property defined, but
70  * in order to get a consistent interface with other owner types,
71  * this function fakes one by setting the name property of
72  * the employee's address.
73  */
74 void gncEmployeeSetName (GncEmployee *employee, const char *name);
75 void gncEmployeeSetLanguage (GncEmployee *employee, const char *language);
76 void gncEmployeeSetAcl (GncEmployee *employee, const char *acl);
77 void gncEmployeeSetWorkday (GncEmployee *employee, gnc_numeric workday);
78 void gncEmployeeSetRate (GncEmployee *employee, gnc_numeric rate);
79 void gncEmployeeSetCurrency (GncEmployee *employee, gnc_commodity * currency);
80 void gncEmployeeSetActive (GncEmployee *employee, gboolean active);
81 void gncEmployeeSetCCard (GncEmployee *employee, Account* ccard_acc);
82 void qofEmployeeSetAddr (GncEmployee *employee, QofInstance *addr_ent);
83 
88 QofBook * gncEmployeeGetBook (GncEmployee *employee);
89 const char * gncEmployeeGetID (const GncEmployee *employee);
90 const char * gncEmployeeGetUsername (const GncEmployee *employee);
91 /* Note: Employees don't have a name property defined, but
92  * in order to get a consistent interface with other owner types,
93  * this function fakes one by returning the name property of
94  * the employee's address.
95  */
96 const char * gncEmployeeGetName (const GncEmployee *employee);
97 GncAddress * gncEmployeeGetAddr (const GncEmployee *employee);
98 const char * gncEmployeeGetLanguage (const GncEmployee *employee);
99 const char * gncEmployeeGetAcl (const GncEmployee *employee);
100 gnc_numeric gncEmployeeGetWorkday (const GncEmployee *employee);
101 gnc_numeric gncEmployeeGetRate (const GncEmployee *employee);
102 gnc_commodity * gncEmployeeGetCurrency (const GncEmployee *employee);
103 gboolean gncEmployeeGetActive (const GncEmployee *employee);
104 Account * gncEmployeeGetCCard (const GncEmployee *employee);
114 static inline GncEmployee * gncEmployeeLookup (const QofBook *book, const GncGUID *guid)
115 {
116  QOF_BOOK_RETURN_ENTITY(book, guid, GNC_ID_EMPLOYEE, GncEmployee);
117 }
118 
119 
120 #define EMPLOYEE_ID "id"
121 #define EMPLOYEE_USERNAME "username"
122 #define EMPLOYEE_NAME "name"
123 #define EMPLOYEE_ADDR "addr"
124 #define EMPLOYEE_LANGUAGE "native language"
125 #define EMPLOYEE_ACL "acl"
126 #define EMPLOYEE_WORKDAY "workday"
127 #define EMPLOYEE_RATE "rate"
128 #define EMPLOYEE_CC "credit_card_account"
129 
131 #define gncEmployeeGetGUID(E) qof_entity_get_guid(QOF_INSTANCE(E))
132 #define gncEmployeeGetBook(E) qof_instance_get_book(QOF_INSTANCE(E))
133 #define gncEmployeeRetGUID(E) (E ? *(qof_entity_get_guid(QOF_INSTANCE(E))) : *(guid_null()))
134 #define gncEmployeeLookupDirect(G,B) gncEmployeeLookup((B),&(G))
135 
137 gboolean gncEmployeeEqual(const GncEmployee* e1, const GncEmployee* e2);
138 gboolean gncEmployeeIsDirty (const GncEmployee *employee);
139 
140 #endif /* GNC_EMPLOYEE_H_ */
141 
#define QOF_BOOK_RETURN_ENTITY(book, guid, e_type, c_type)
Encapsulates all the information about a dataset manipulated by QOF.
Definition: qofbook.h:183
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