2003-10-16 23:40:59 -05:00
|
|
|
/********************************************************************\
|
|
|
|
* gncEmployee.h -- the Core Employee Interface *
|
|
|
|
* *
|
|
|
|
* This program is free software; you can redistribute it and/or *
|
|
|
|
* modify it under the terms of the GNU General Public License as *
|
|
|
|
* published by the Free Software Foundation; either version 2 of *
|
|
|
|
* the License, or (at your option) any later version. *
|
|
|
|
* *
|
|
|
|
* This program is distributed in the hope that it will be useful, *
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
|
|
* GNU General Public License for more details. *
|
|
|
|
* *
|
|
|
|
* You should have received a copy of the GNU General Public License*
|
|
|
|
* along with this program; if not, contact: *
|
|
|
|
* *
|
|
|
|
* Free Software Foundation Voice: +1-617-542-5942 *
|
2005-11-16 23:35:02 -06:00
|
|
|
* 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 *
|
|
|
|
* Boston, MA 02110-1301, USA gnu@gnu.org *
|
2003-10-16 23:40:59 -05:00
|
|
|
* *
|
|
|
|
\********************************************************************/
|
2004-05-06 23:47:03 -05:00
|
|
|
/** @addtogroup Business
|
|
|
|
@{ */
|
|
|
|
/** @addtogroup Employee
|
|
|
|
@{ */
|
|
|
|
/** @file gncEmployee.h
|
|
|
|
@brief Employee Interface
|
|
|
|
@author Copyright (C) 2001 Derek Atkins <warlord@MIT.EDU>
|
|
|
|
*/
|
2001-11-16 19:17:06 -06:00
|
|
|
|
|
|
|
#ifndef GNC_EMPLOYEE_H_
|
|
|
|
#define GNC_EMPLOYEE_H_
|
|
|
|
|
|
|
|
typedef struct _gncEmployee GncEmployee;
|
2007-04-04 21:43:38 -05:00
|
|
|
typedef struct _gncEmployeeClass GncEmployeeClass;
|
2001-11-16 19:17:06 -06:00
|
|
|
|
|
|
|
#include "gncAddress.h"
|
2003-03-09 16:51:04 -06:00
|
|
|
#include "Account.h"
|
2001-11-16 19:17:06 -06:00
|
|
|
|
2023-03-03 09:58:33 -06:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2003-10-19 00:13:59 -05:00
|
|
|
#define GNC_ID_EMPLOYEE "gncEmployee"
|
2007-04-04 21:43:38 -05:00
|
|
|
|
|
|
|
/* --- type macros --- */
|
|
|
|
#define GNC_TYPE_EMPLOYEE (gnc_employee_get_type ())
|
|
|
|
#define GNC_EMPLOYEE(o) \
|
|
|
|
(G_TYPE_CHECK_INSTANCE_CAST ((o), GNC_TYPE_EMPLOYEE, GncEmployee))
|
|
|
|
#define GNC_EMPLOYEE_CLASS(k) \
|
|
|
|
(G_TYPE_CHECK_CLASS_CAST((k), GNC_TYPE_EMPLOYEE, GncEmployeeClass))
|
|
|
|
#define GNC_IS_EMPLOYEE(o) \
|
|
|
|
(G_TYPE_CHECK_INSTANCE_TYPE ((o), GNC_TYPE_EMPLOYEE))
|
|
|
|
#define GNC_IS_EMPLOYEE_CLASS(k) \
|
|
|
|
(G_TYPE_CHECK_CLASS_TYPE ((k), GNC_TYPE_EMPLOYEE))
|
|
|
|
#define GNC_EMPLOYEE_GET_CLASS(o) \
|
|
|
|
(G_TYPE_INSTANCE_GET_CLASS ((o), GNC_TYPE_EMPLOYEE, GncEmployeeClass))
|
|
|
|
GType gnc_employee_get_type(void);
|
2001-11-16 19:17:06 -06:00
|
|
|
|
2010-03-02 15:41:05 -06:00
|
|
|
/** @name Create/Destroy Functions
|
2005-11-01 21:32:36 -06:00
|
|
|
@{ */
|
2003-06-26 22:05:25 -05:00
|
|
|
GncEmployee *gncEmployeeCreate (QofBook *book);
|
2001-11-16 19:17:06 -06:00
|
|
|
void gncEmployeeDestroy (GncEmployee *employee);
|
2004-05-06 23:47:03 -05:00
|
|
|
void gncEmployeeBeginEdit (GncEmployee *employee);
|
|
|
|
void gncEmployeeCommitEdit (GncEmployee *employee);
|
2008-08-01 11:02:07 -05:00
|
|
|
int gncEmployeeCompare (const GncEmployee *a, const GncEmployee *b);
|
2004-05-06 23:47:03 -05:00
|
|
|
/** @} */
|
2001-11-16 19:17:06 -06:00
|
|
|
|
2010-03-02 15:41:05 -06:00
|
|
|
/** @name Set Functions
|
2005-11-01 21:32:36 -06:00
|
|
|
@{ */
|
2001-11-16 19:17:06 -06:00
|
|
|
void gncEmployeeSetID (GncEmployee *employee, const char *id);
|
|
|
|
void gncEmployeeSetUsername (GncEmployee *employee, const char *username);
|
2012-05-08 06:38:57 -05:00
|
|
|
/* Note: Employees don't have a name property defined, but
|
|
|
|
* in order to get a consistent interface with other owner types,
|
|
|
|
* this function fakes one by setting the name property of
|
|
|
|
* the employee's address.
|
|
|
|
*/
|
|
|
|
void gncEmployeeSetName (GncEmployee *employee, const char *name);
|
2001-11-16 19:17:06 -06:00
|
|
|
void gncEmployeeSetLanguage (GncEmployee *employee, const char *language);
|
|
|
|
void gncEmployeeSetAcl (GncEmployee *employee, const char *acl);
|
|
|
|
void gncEmployeeSetWorkday (GncEmployee *employee, gnc_numeric workday);
|
|
|
|
void gncEmployeeSetRate (GncEmployee *employee, gnc_numeric rate);
|
2003-01-12 16:53:02 -06:00
|
|
|
void gncEmployeeSetCurrency (GncEmployee *employee, gnc_commodity * currency);
|
2001-11-16 19:17:06 -06:00
|
|
|
void gncEmployeeSetActive (GncEmployee *employee, gboolean active);
|
2003-03-09 16:51:04 -06:00
|
|
|
void gncEmployeeSetCCard (GncEmployee *employee, Account* ccard_acc);
|
2007-04-01 17:18:50 -05:00
|
|
|
void qofEmployeeSetAddr (GncEmployee *employee, QofInstance *addr_ent);
|
2005-11-01 21:32:36 -06:00
|
|
|
|
2004-05-06 23:47:03 -05:00
|
|
|
/** @} */
|
2001-11-16 19:17:06 -06:00
|
|
|
|
2010-03-02 15:41:05 -06:00
|
|
|
/** @name Get Functions
|
2005-11-01 21:32:36 -06:00
|
|
|
@{ */
|
2003-06-26 22:05:25 -05:00
|
|
|
QofBook * gncEmployeeGetBook (GncEmployee *employee);
|
2008-08-01 11:02:07 -05:00
|
|
|
const char * gncEmployeeGetID (const GncEmployee *employee);
|
|
|
|
const char * gncEmployeeGetUsername (const GncEmployee *employee);
|
2012-05-08 06:38:57 -05:00
|
|
|
/* Note: Employees don't have a name property defined, but
|
|
|
|
* in order to get a consistent interface with other owner types,
|
|
|
|
* this function fakes one by returning the name property of
|
|
|
|
* the employee's address.
|
|
|
|
*/
|
|
|
|
const char * gncEmployeeGetName (const GncEmployee *employee);
|
2008-08-01 11:02:07 -05:00
|
|
|
GncAddress * gncEmployeeGetAddr (const GncEmployee *employee);
|
|
|
|
const char * gncEmployeeGetLanguage (const GncEmployee *employee);
|
|
|
|
const char * gncEmployeeGetAcl (const GncEmployee *employee);
|
|
|
|
gnc_numeric gncEmployeeGetWorkday (const GncEmployee *employee);
|
|
|
|
gnc_numeric gncEmployeeGetRate (const GncEmployee *employee);
|
|
|
|
gnc_commodity * gncEmployeeGetCurrency (const GncEmployee *employee);
|
|
|
|
gboolean gncEmployeeGetActive (const GncEmployee *employee);
|
|
|
|
Account * gncEmployeeGetCCard (const GncEmployee *employee);
|
2004-05-06 23:47:03 -05:00
|
|
|
/** @} */
|
2001-11-16 19:17:06 -06:00
|
|
|
|
2003-10-19 00:13:59 -05:00
|
|
|
|
|
|
|
/** Return a pointer to the instance gncEmployee that is identified
|
|
|
|
* by the guid, and is residing in the book. Returns NULL if the
|
|
|
|
* instance can't be found.
|
|
|
|
*/
|
2010-03-27 16:01:21 -05:00
|
|
|
static inline GncEmployee * gncEmployeeLookup (const QofBook *book, const GncGUID *guid)
|
2010-03-06 05:01:37 -06:00
|
|
|
{
|
|
|
|
QOF_BOOK_RETURN_ENTITY(book, guid, GNC_ID_EMPLOYEE, GncEmployee);
|
|
|
|
}
|
2003-10-19 00:13:59 -05:00
|
|
|
|
2001-11-16 19:17:06 -06:00
|
|
|
|
2011-03-20 14:17:11 -05:00
|
|
|
#define EMPLOYEE_ID "id"
|
|
|
|
#define EMPLOYEE_USERNAME "username"
|
2012-05-08 06:38:57 -05:00
|
|
|
#define EMPLOYEE_NAME "name"
|
2011-03-20 14:17:11 -05:00
|
|
|
#define EMPLOYEE_ADDR "addr"
|
|
|
|
#define EMPLOYEE_LANGUAGE "native language"
|
|
|
|
#define EMPLOYEE_ACL "acl"
|
|
|
|
#define EMPLOYEE_WORKDAY "workday"
|
|
|
|
#define EMPLOYEE_RATE "rate"
|
|
|
|
#define EMPLOYEE_CC "credit_card_account"
|
2001-11-16 19:17:06 -06:00
|
|
|
|
2003-10-16 23:32:04 -05:00
|
|
|
/** deprecated routines */
|
2007-06-25 12:18:28 -05:00
|
|
|
#define gncEmployeeGetGUID(E) qof_entity_get_guid(QOF_INSTANCE(E))
|
2005-11-01 21:32:36 -06:00
|
|
|
#define gncEmployeeGetBook(E) qof_instance_get_book(QOF_INSTANCE(E))
|
2007-06-25 12:18:28 -05:00
|
|
|
#define gncEmployeeRetGUID(E) (E ? *(qof_entity_get_guid(QOF_INSTANCE(E))) : *(guid_null()))
|
2003-10-16 23:32:04 -05:00
|
|
|
#define gncEmployeeLookupDirect(G,B) gncEmployeeLookup((B),&(G))
|
|
|
|
|
2011-11-18 15:04:01 -06:00
|
|
|
/** Test support function, used by test-dbi-business-stuff.c */
|
|
|
|
gboolean gncEmployeeEqual(const GncEmployee* e1, const GncEmployee* e2);
|
|
|
|
gboolean gncEmployeeIsDirty (const GncEmployee *employee);
|
|
|
|
|
2023-01-23 07:57:38 -06:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2001-11-16 19:17:06 -06:00
|
|
|
#endif /* GNC_EMPLOYEE_H_ */
|
2004-05-06 23:47:03 -05:00
|
|
|
/** @} */
|
|
|
|
/** @} */
|