|
GnuCash 2.4.99
|
00001 /********************************************************************\ 00002 * gncEmployee.h -- the Core Employee Interface * 00003 * * 00004 * This program is free software; you can redistribute it and/or * 00005 * modify it under the terms of the GNU General Public License as * 00006 * published by the Free Software Foundation; either version 2 of * 00007 * the License, or (at your option) any later version. * 00008 * * 00009 * This program is distributed in the hope that it will be useful, * 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00012 * GNU General Public License for more details. * 00013 * * 00014 * You should have received a copy of the GNU General Public License* 00015 * along with this program; if not, contact: * 00016 * * 00017 * Free Software Foundation Voice: +1-617-542-5942 * 00018 * 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 * 00019 * Boston, MA 02110-1301, USA gnu@gnu.org * 00020 * * 00021 \********************************************************************/ 00031 #ifndef GNC_EMPLOYEE_H_ 00032 #define GNC_EMPLOYEE_H_ 00033 00034 typedef struct _gncEmployee GncEmployee; 00035 typedef struct _gncEmployeeClass GncEmployeeClass; 00036 00037 #include "gncAddress.h" 00038 #include "Account.h" 00039 00040 #define GNC_ID_EMPLOYEE "gncEmployee" 00041 00042 /* --- type macros --- */ 00043 #define GNC_TYPE_EMPLOYEE (gnc_employee_get_type ()) 00044 #define GNC_EMPLOYEE(o) \ 00045 (G_TYPE_CHECK_INSTANCE_CAST ((o), GNC_TYPE_EMPLOYEE, GncEmployee)) 00046 #define GNC_EMPLOYEE_CLASS(k) \ 00047 (G_TYPE_CHECK_CLASS_CAST((k), GNC_TYPE_EMPLOYEE, GncEmployeeClass)) 00048 #define GNC_IS_EMPLOYEE(o) \ 00049 (G_TYPE_CHECK_INSTANCE_TYPE ((o), GNC_TYPE_EMPLOYEE)) 00050 #define GNC_IS_EMPLOYEE_CLASS(k) \ 00051 (G_TYPE_CHECK_CLASS_TYPE ((k), GNC_TYPE_EMPLOYEE)) 00052 #define GNC_EMPLOYEE_GET_CLASS(o) \ 00053 (G_TYPE_INSTANCE_GET_CLASS ((o), GNC_TYPE_EMPLOYEE, GncEmployeeClass)) 00054 GType gnc_employee_get_type(void); 00055 00058 GncEmployee *gncEmployeeCreate (QofBook *book); 00059 void gncEmployeeDestroy (GncEmployee *employee); 00060 void gncEmployeeBeginEdit (GncEmployee *employee); 00061 void gncEmployeeCommitEdit (GncEmployee *employee); 00062 int gncEmployeeCompare (const GncEmployee *a, const GncEmployee *b); 00067 void gncEmployeeSetID (GncEmployee *employee, const char *id); 00068 void gncEmployeeSetUsername (GncEmployee *employee, const char *username); 00069 /* Note: Employees don't have a name property defined, but 00070 * in order to get a consistent interface with other owner types, 00071 * this function fakes one by setting the name property of 00072 * the employee's address. 00073 */ 00074 void gncEmployeeSetName (GncEmployee *employee, const char *name); 00075 void gncEmployeeSetLanguage (GncEmployee *employee, const char *language); 00076 void gncEmployeeSetAcl (GncEmployee *employee, const char *acl); 00077 void gncEmployeeSetWorkday (GncEmployee *employee, gnc_numeric workday); 00078 void gncEmployeeSetRate (GncEmployee *employee, gnc_numeric rate); 00079 void gncEmployeeSetCurrency (GncEmployee *employee, gnc_commodity * currency); 00080 void gncEmployeeSetActive (GncEmployee *employee, gboolean active); 00081 void gncEmployeeSetCCard (GncEmployee *employee, Account* ccard_acc); 00082 void qofEmployeeSetAddr (GncEmployee *employee, QofInstance *addr_ent); 00083 00088 QofBook * gncEmployeeGetBook (GncEmployee *employee); 00089 const char * gncEmployeeGetID (const GncEmployee *employee); 00090 const char * gncEmployeeGetUsername (const GncEmployee *employee); 00091 /* Note: Employees don't have a name property defined, but 00092 * in order to get a consistent interface with other owner types, 00093 * this function fakes one by returning the name property of 00094 * the employee's address. 00095 */ 00096 const char * gncEmployeeGetName (const GncEmployee *employee); 00097 GncAddress * gncEmployeeGetAddr (const GncEmployee *employee); 00098 const char * gncEmployeeGetLanguage (const GncEmployee *employee); 00099 const char * gncEmployeeGetAcl (const GncEmployee *employee); 00100 gnc_numeric gncEmployeeGetWorkday (const GncEmployee *employee); 00101 gnc_numeric gncEmployeeGetRate (const GncEmployee *employee); 00102 gnc_commodity * gncEmployeeGetCurrency (const GncEmployee *employee); 00103 gboolean gncEmployeeGetActive (const GncEmployee *employee); 00104 Account * gncEmployeeGetCCard (const GncEmployee *employee); 00114 static inline GncEmployee * gncEmployeeLookup (const QofBook *book, const GncGUID *guid) 00115 { 00116 QOF_BOOK_RETURN_ENTITY(book, guid, GNC_ID_EMPLOYEE, GncEmployee); 00117 } 00118 00119 00120 #define EMPLOYEE_ID "id" 00121 #define EMPLOYEE_USERNAME "username" 00122 #define EMPLOYEE_NAME "name" 00123 #define EMPLOYEE_ADDR "addr" 00124 #define EMPLOYEE_LANGUAGE "native language" 00125 #define EMPLOYEE_ACL "acl" 00126 #define EMPLOYEE_WORKDAY "workday" 00127 #define EMPLOYEE_RATE "rate" 00128 #define EMPLOYEE_CC "credit_card_account" 00129 00131 #define gncEmployeeGetGUID(E) qof_entity_get_guid(QOF_INSTANCE(E)) 00132 #define gncEmployeeGetBook(E) qof_instance_get_book(QOF_INSTANCE(E)) 00133 #define gncEmployeeRetGUID(E) (E ? *(qof_entity_get_guid(QOF_INSTANCE(E))) : *(guid_null())) 00134 #define gncEmployeeLookupDirect(G,B) gncEmployeeLookup((B),&(G)) 00135 00137 gboolean gncEmployeeEqual(const GncEmployee* e1, const GncEmployee* e2); 00138 gboolean gncEmployeeIsDirty (const GncEmployee *employee); 00139 00140 #endif /* GNC_EMPLOYEE_H_ */ 00141
1.7.4