00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00032 #ifndef GNC_UI_UTIL_H
00033 #define GNC_UI_UTIL_H
00034
00035 #include <glib.h>
00036 #include <locale.h>
00037
00038 #include "Account.h"
00039 #include "qof.h"
00040
00041
00042 typedef QofSession * (*QofSessionCB) (void);
00043
00044
00045 gboolean gnc_reverse_balance(const Account *account);
00046 gboolean gnc_reverse_balance_type(GNCAccountType type);
00047
00048
00049
00050
00051 gchar *gnc_get_default_directory (const gchar *gconf_section);
00052 void gnc_set_default_directory (const gchar *gconf_section,
00053 const gchar *directory);
00054
00055
00056 QofBook * gnc_get_current_book (void);
00057 Account * gnc_get_current_root_account (void);
00058 gnc_commodity_table * gnc_get_current_commodities (void);
00059
00067 gchar *gnc_get_account_name_for_register(const Account *account);
00068
00080 Account *gnc_account_lookup_for_register(const Account *base_account, const
00081 gchar *name);
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101 gnc_numeric
00102 gnc_ui_account_get_balance_full (xaccGetBalanceInCurrencyFn fn,
00103 const Account *account,
00104 gboolean recurse,
00105 gboolean *negative,
00106 const gnc_commodity *commodity);
00107
00115 gnc_numeric gnc_ui_account_get_balance (const Account *account,
00116 gboolean include_children);
00117
00118 gnc_numeric gnc_ui_account_get_balance_in_currency (const Account *account,
00119 const gnc_commodity *currency,
00120 gboolean recurse);
00128 gnc_numeric gnc_ui_account_get_reconciled_balance(const Account *account,
00129 gboolean include_children);
00130
00144 gchar *
00145 gnc_ui_account_get_print_balance (xaccGetBalanceInCurrencyFn fn,
00146 const Account *account,
00147 gboolean recurse,
00148 gboolean *negative);
00149
00164 gchar *
00165 gnc_ui_account_get_print_report_balance (xaccGetBalanceInCurrencyFn fn,
00166 const Account *account,
00167 gboolean recurse,
00168 gboolean *negative);
00169
00170 char *gnc_ui_account_get_tax_info_string (const Account *account);
00171
00172 gnc_numeric gnc_ui_account_get_balance_as_of_date (Account *account,
00173 time_t date,
00174 gboolean include_children);
00175
00176 const char * gnc_get_reconcile_str (char reconciled_flag);
00177 const char * gnc_get_reconcile_valid_flags (void);
00178 const char * gnc_get_reconcile_flag_order (void);
00179
00180 typedef enum
00181 {
00182 EQUITY_OPENING_BALANCE,
00183 EQUITY_RETAINED_EARNINGS,
00184 NUM_EQUITY_TYPES
00185 } GNCEquityType;
00186
00187 Account * gnc_find_or_create_equity_account (Account *root,
00188 GNCEquityType equity_type,
00189 gnc_commodity *currency);
00190 gboolean gnc_account_create_opening_balance (Account *account,
00191 gnc_numeric balance,
00192 time_t date,
00193 QofBook *book);
00194
00195 char * gnc_account_get_full_name (const Account *account);
00196
00197
00198
00199
00200
00201
00202
00203 struct lconv * gnc_localeconv (void);
00204
00205
00206
00207 gnc_commodity * gnc_locale_default_currency_nodefault (void);
00208
00209
00210
00211
00212 gnc_commodity * gnc_locale_default_currency (void);
00213
00214
00215 const char * gnc_locale_default_iso_currency_code (void);
00216
00217
00224 gnc_commodity * gnc_default_currency (void);
00225
00226
00233 gnc_commodity * gnc_default_report_currency (void);
00234
00235
00236
00237 int gnc_locale_decimal_places (void);
00238
00239
00240
00241
00242 void gnc_push_locale (const char *locale);
00243 void gnc_pop_locale (void);
00244
00245
00246
00247
00248
00249
00250
00251
00252
00253
00254
00255
00256
00257
00258
00259
00260 typedef struct _GNCPrintAmountInfo
00261 {
00262 const gnc_commodity *commodity;
00263
00264 guint8 max_decimal_places;
00265 guint8 min_decimal_places;
00266
00267 unsigned int use_separators : 1;
00268 unsigned int use_symbol : 1;
00269 unsigned int use_locale : 1;
00270 unsigned int monetary : 1;
00271 unsigned int force_fit : 1;
00272 unsigned int round : 1;
00273 } GNCPrintAmountInfo;
00274
00275
00276 GNCPrintAmountInfo gnc_default_print_info (gboolean use_symbol);
00277
00278 GNCPrintAmountInfo gnc_commodity_print_info (const gnc_commodity *commodity,
00279 gboolean use_symbol);
00280
00281 GNCPrintAmountInfo gnc_account_print_info (const Account *account,
00282 gboolean use_symbol);
00283
00284 GNCPrintAmountInfo gnc_split_amount_print_info (Split *split,
00285 gboolean use_symbol);
00286 GNCPrintAmountInfo gnc_split_value_print_info (Split *split,
00287 gboolean use_symbol);
00288
00289 GNCPrintAmountInfo gnc_share_print_info_places (int decplaces);
00290 GNCPrintAmountInfo gnc_default_share_print_info (void);
00291 GNCPrintAmountInfo gnc_default_price_print_info (void);
00292
00293 GNCPrintAmountInfo gnc_integral_print_info (void);
00294
00295
00296
00297
00298 const char * xaccPrintAmount (gnc_numeric val, GNCPrintAmountInfo info);
00299 int xaccSPrintAmount (char *buf, gnc_numeric val, GNCPrintAmountInfo info);
00300
00301 const gchar *printable_value(gdouble val, gint denom);
00302 gchar *number_to_words(gdouble val, gint64 denom);
00303 gchar *numeric_to_words(gnc_numeric val);
00304
00305
00306
00307
00308
00309
00310
00311
00312
00313
00314
00315
00316 gboolean xaccParseAmount (const char * in_str, gboolean monetary,
00317 gnc_numeric *result, char **endstr);
00318
00319
00320
00321
00322
00323
00324
00325
00326
00327
00328 gboolean
00329 xaccParseAmountExtended (const char * in_str, gboolean monetary,
00330 gunichar negative_sign, gunichar decimal_point,
00331 gunichar group_separator, char *group, char *ignore_list,
00332 gnc_numeric *result, char **endstr);
00333
00334
00335
00336 void gnc_ui_util_init (void);
00337
00338
00339
00340 #ifndef HAVE_TOWUPPER
00341 gint32 towupper (gint32 wc);
00342 int iswlower (gint32 wc);
00343 #endif
00344
00345 #endif
00346