|
GnuCash 2.4.99
|
00001 /********************************************************************\ 00002 * gnc-budget.h -- Budget public handling routines. * 00003 * Copyright (C) 04 sep 2003 Darin Willits <darin@willits.ca> * 00004 * Copyright (C) 2005 Chris Shoemaker <c.shoemaker@cox.net> * 00005 * * 00006 * This program is free software; you can redistribute it and/or * 00007 * modify it under the terms of the GNU General Public License as * 00008 * published by the Free Software Foundation; either version 2 of * 00009 * the License, or (at your option) any later version. * 00010 * * 00011 * This program is distributed in the hope that it will be useful, * 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00014 * GNU General Public License for more details. * 00015 * * 00016 * You should have received a copy of the GNU General Public License* 00017 * along with this program; if not, contact: * 00018 * * 00019 * Free Software Foundation Voice: +1-617-542-5942 * 00020 * 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 * 00021 * Boston, MA 02110-1301, USA gnu@gnu.org * 00022 * * 00023 \********************************************************************/ 00024 00064 #ifndef __GNC_BUDGET_H__ 00065 #define __GNC_BUDGET_H__ 00066 00067 #include <glib.h> 00068 00070 typedef struct budget_s GncBudget; 00071 typedef struct _GncBudgetClass GncBudgetClass; 00072 00073 #include "qof.h" 00074 #include "Account.h" 00075 #include "Recurrence.h" 00076 00077 /* --- type macros --- */ 00078 #define GNC_TYPE_BUDGET (gnc_budget_get_type ()) 00079 #define GNC_BUDGET(o) \ 00080 (G_TYPE_CHECK_INSTANCE_CAST ((o), GNC_TYPE_BUDGET, GncBudget)) 00081 #define GNC_BUDGET_CLASS(k) \ 00082 (G_TYPE_CHECK_CLASS_CAST((k), GNC_TYPE_BUDGET, GncBudgetClass)) 00083 #define GNC_IS_BUDGET(o) \ 00084 (G_TYPE_CHECK_INSTANCE_TYPE ((o), GNC_TYPE_BUDGET)) 00085 #define GNC_IS_BUDGET_CLASS(k) \ 00086 (G_TYPE_CHECK_CLASS_TYPE ((k), GNC_TYPE_BUDGET)) 00087 #define GNC_BUDGET_GET_CLASS(o) \ 00088 (G_TYPE_INSTANCE_GET_CLASS ((o), GNC_TYPE_BUDGET, GncBudgetClass)) 00089 GType gnc_budget_get_type(void); 00090 00091 #define GNC_BUDGET_MAX_NUM_PERIODS_DIGITS 3 // max num periods == 999 00092 00093 gboolean gnc_budget_register(void); 00094 00098 /*@ dependent @*/ 00099 GncBudget *gnc_budget_new(QofBook *book); 00100 00102 void gnc_budget_destroy(GncBudget* budget); 00103 00104 void gnc_budget_begin_edit(GncBudget *bgt); 00105 void gnc_budget_commit_edit(GncBudget *bgt); 00106 00108 GncBudget *gnc_budget_clone(const GncBudget* budget); 00109 00110 /*@ dependent @*/ 00111 const GncGUID* gnc_budget_get_guid(const GncBudget* budget); 00112 #define gnc_budget_return_guid(X) \ 00113 (X ? *(qof_entity_get_guid(QOF_INSTANCE(X))) : *(guid_null())) 00114 00116 void gnc_budget_set_name(GncBudget* budget, const gchar* name); 00117 /*@ dependent @*/ 00118 const gchar* gnc_budget_get_name(const GncBudget* budget); 00119 00121 void gnc_budget_set_description(GncBudget* budget, const gchar* description); 00122 /*@ dependent @*/ 00123 const gchar* gnc_budget_get_description(const GncBudget* budget); 00124 00126 void gnc_budget_set_num_periods(GncBudget* budget, guint num_periods); 00127 guint gnc_budget_get_num_periods(const GncBudget* budget); 00128 00129 void gnc_budget_set_recurrence(GncBudget *budget, const Recurrence *r); 00130 /*@ dependent @*/ 00131 const Recurrence * gnc_budget_get_recurrence(const GncBudget *budget); 00132 00134 Timespec gnc_budget_get_period_start_date(const GncBudget* budget, guint period_num); 00135 00137 Timespec gnc_budget_get_period_end_date(const GncBudget* budget, guint period_num); 00138 00139 /* Period indices are zero-based. */ 00140 void gnc_budget_set_account_period_value( 00141 GncBudget* budget, const Account* account, guint period_num, gnc_numeric val); 00142 void gnc_budget_unset_account_period_value( 00143 GncBudget* budget, const Account* account, guint period_num); 00144 00145 gboolean gnc_budget_is_account_period_value_set( 00146 const GncBudget *budget, const Account *account, guint period_num); 00147 00148 gnc_numeric gnc_budget_get_account_period_value( 00149 const GncBudget *budget, const Account *account, guint period_num); 00150 gnc_numeric gnc_budget_get_account_period_actual_value( 00151 const GncBudget *budget, Account *account, guint period_num); 00152 00153 /* Returns some budget in the book, or NULL. */ 00154 GncBudget* gnc_budget_get_default(QofBook *book); 00155 00156 /* Get the budget associated with the given GncGUID from the given book. */ 00157 /*@ dependent @*/ 00158 GncBudget* gnc_budget_lookup (const GncGUID *guid, const QofBook *book); 00159 #define gnc_budget_lookup_direct(g,b) gnc_budget_lookup(&(g),(b)) 00160 00161 #endif // __BUDGET_H__ 00162
1.7.4