GnuCash c935c2f+
Loading...
Searching...
No Matches
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
34typedef struct _gncEmployee GncEmployee;
35typedef struct _gncEmployeeClass GncEmployeeClass;
36
37#include "gncAddress.h"
38#include "Account.h"
39
40#ifdef __cplusplus
41extern "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))
58GType gnc_employee_get_type(void);
59
62GncEmployee *gncEmployeeCreate (QofBook *book);
63void gncEmployeeDestroy (GncEmployee *employee);
64void gncEmployeeBeginEdit (GncEmployee *employee);
65void gncEmployeeCommitEdit (GncEmployee *employee);
66int gncEmployeeCompare (const GncEmployee *a, const GncEmployee *b);
71void gncEmployeeSetID (GncEmployee *employee, const char *id);
72void 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 */
78void gncEmployeeSetName (GncEmployee *employee, const char *name);
79void gncEmployeeSetLanguage (GncEmployee *employee, const char *language);
80void gncEmployeeSetAcl (GncEmployee *employee, const char *acl);
81void gncEmployeeSetWorkday (GncEmployee *employee, gnc_numeric workday);
82void gncEmployeeSetRate (GncEmployee *employee, gnc_numeric rate);
83void gncEmployeeSetCurrency (GncEmployee *employee, gnc_commodity * currency);
84void gncEmployeeSetActive (GncEmployee *employee, gboolean active);
85void gncEmployeeSetCCard (GncEmployee *employee, Account* ccard_acc);
86void qofEmployeeSetAddr (GncEmployee *employee, QofInstance *addr_ent);
87
92QofBook * gncEmployeeGetBook (GncEmployee *employee);
93const char * gncEmployeeGetID (const GncEmployee *employee);
94const 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 */
100const char * gncEmployeeGetName (const GncEmployee *employee);
101GncAddress * gncEmployeeGetAddr (const GncEmployee *employee);
102const char * gncEmployeeGetLanguage (const GncEmployee *employee);
103const char * gncEmployeeGetAcl (const GncEmployee *employee);
104gnc_numeric gncEmployeeGetWorkday (const GncEmployee *employee);
105gnc_numeric gncEmployeeGetRate (const GncEmployee *employee);
106gnc_commodity * gncEmployeeGetCurrency (const GncEmployee *employee);
107gboolean gncEmployeeGetActive (const GncEmployee *employee);
108Account * gncEmployeeGetCCard (const GncEmployee *employee);
116static 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
139gboolean gncEmployeeEqual(const GncEmployee* e1, const GncEmployee* e2);
140gboolean gncEmployeeIsDirty (const GncEmployee *employee);
141
142#ifdef __cplusplus
143}
144#endif
145
146#endif /* GNC_EMPLOYEE_H_ */
Account handling public routines.
an Address object
#define QOF_BOOK_RETURN_ENTITY(book, guid, e_type, c_type)
Encapsulates all the information about a dataset manipulated by QOF.
Definition qofbook.h:101
gboolean gncEmployeeEqual(const GncEmployee *e1, const GncEmployee *e2)
Test support function, used by test-dbi-business-stuff.c.
STRUCTS.
The type used to store guids in C.
Definition guid.h:75
QofBook reference.
Definition qofbook-p.hpp:47