|
||||||||||||
|
This routine retrives the total balance in an account, possibly including all sub-accounts under the specified account.
Definition at line 257 of file gnc-ui-util.c. 00258 { 00259 return gnc_ui_account_get_balance_full (xaccAccountGetBalanceInCurrency, 00260 account, recurse, NULL, NULL); 00261 }
|
|
||||||||||||||||||||
|
Wrapper around gnc_ui_account_get_balance_full that converts the resulting number to a character string. The number is formatted according to the specification of the account currency. The caller is responsible for g_free'ing the returned memory.
Definition at line 304 of file gnc-ui-util.c. 00308 { 00309 GNCPrintAmountInfo print_info; 00310 gnc_numeric balance; 00311 00312 balance = gnc_ui_account_get_balance_full(fn, account, recurse, 00313 negative, NULL); 00314 print_info = gnc_account_print_info(account, TRUE); 00315 return g_strdup(xaccPrintAmount(balance, print_info)); 00316 }
|
|
||||||||||||||||||||
|
Wrapper around gnc_ui_account_get_balance_full that converts the resulting number to a character string. The number is formatted according to the specification of the default reporting currency.
Definition at line 334 of file gnc-ui-util.c. 00338 { 00339 GNCPrintAmountInfo print_info; 00340 gnc_numeric balance; 00341 gnc_commodity *report_commodity; 00342 00343 report_commodity = gnc_default_report_currency(); 00344 balance = gnc_ui_account_get_balance_full(fn, account, recurse, 00345 negative, report_commodity); 00346 print_info = gnc_commodity_print_info(report_commodity, TRUE); 00347 return g_strdup(xaccPrintAmount(balance, print_info)); 00348 }
|
|
||||||||||||
|
This routine retrives the reconciled balance in an account, possibly including all sub-accounts under the specified account.
Definition at line 281 of file gnc-ui-util.c. 00283 { 00284 return gnc_ui_account_get_balance_full (xaccAccountGetReconciledBalanceInCurrency, 00285 account, recurse, NULL, NULL); 00286 }
|
|
||||||||||||||||
|
Definition at line 1294 of file gnc-ui-util.c. 01295 { 01296 struct lconv *lc; 01297 01298 char *orig_bufp = bufp; 01299 const char *currency_symbol; 01300 const char *sign; 01301 01302 char cs_precedes; 01303 char sep_by_space; 01304 char sign_posn; 01305 01306 gboolean print_sign = TRUE; 01307 gboolean is_shares = FALSE; 01308 01309 if (!bufp) 01310 return 0; 01311 01312 lc = gnc_localeconv(); 01313 01314 if (info.use_symbol) 01315 { 01316 /* There was a bug here: don't use gnc_locale_default_currency */ 01317 if (gnc_commodity_equiv (info.commodity, 01318 gnc_locale_default_currency_nodefault ())) 01319 { 01320 currency_symbol = lc->currency_symbol; 01321 } 01322 else 01323 { 01324 if (info.commodity && !gnc_commodity_is_iso (info.commodity)) 01325 is_shares = TRUE; 01326 01327 currency_symbol = gnc_commodity_get_mnemonic (info.commodity); 01328 info.use_locale = 0; 01329 } 01330 01331 if (currency_symbol == NULL) 01332 currency_symbol = ""; 01333 } 01334 else 01335 currency_symbol = NULL; 01336 01337 if (!info.use_locale) 01338 { 01339 cs_precedes = is_shares ? 0 : 1; 01340 sep_by_space = 1; 01341 } 01342 else 01343 { 01344 if (gnc_numeric_negative_p (val)) 01345 { 01346 cs_precedes = lc->n_cs_precedes; 01347 sep_by_space = lc->n_sep_by_space; 01348 } 01349 else 01350 { 01351 cs_precedes = lc->p_cs_precedes; 01352 sep_by_space = lc->p_sep_by_space; 01353 } 01354 } 01355 01356 if (gnc_numeric_negative_p (val)) 01357 { 01358 sign = lc->negative_sign; 01359 sign_posn = lc->n_sign_posn; 01360 } 01361 else 01362 { 01363 sign = lc->positive_sign; 01364 sign_posn = lc->p_sign_posn; 01365 } 01366 01367 if (gnc_numeric_zero_p (val) || (sign == NULL) || (sign[0] == 0)) 01368 print_sign = FALSE; 01369 01370 /* See if we print sign now */ 01371 if (print_sign && (sign_posn == 1)) 01372 bufp = gnc_stpcpy(bufp, sign); 01373 01374 /* Now see if we print currency */ 01375 if (cs_precedes) 01376 { 01377 /* See if we print sign now */ 01378 if (print_sign && (sign_posn == 3)) 01379 bufp = gnc_stpcpy(bufp, sign); 01380 01381 if (info.use_symbol) 01382 { 01383 bufp = gnc_stpcpy(bufp, currency_symbol); 01384 if (sep_by_space) 01385 bufp = gnc_stpcpy(bufp, " "); 01386 } 01387 01388 /* See if we print sign now */ 01389 if (print_sign && (sign_posn == 4)) 01390 bufp = gnc_stpcpy(bufp, sign); 01391 } 01392 01393 /* Now see if we print parentheses */ 01394 if (print_sign && (sign_posn == 0)) 01395 bufp = gnc_stpcpy(bufp, "("); 01396 01397 /* Now print the value */ 01398 bufp += PrintAmountInternal(bufp, val, &info); 01399 01400 /* Now see if we print parentheses */ 01401 if (print_sign && (sign_posn == 0)) 01402 bufp = gnc_stpcpy(bufp, ")"); 01403 01404 /* Now see if we print currency */ 01405 if (!cs_precedes) 01406 { 01407 /* See if we print sign now */ 01408 if (print_sign && (sign_posn == 3)) 01409 bufp = gnc_stpcpy(bufp, sign); 01410 01411 if (info.use_symbol) 01412 { 01413 if (sep_by_space) 01414 bufp = gnc_stpcpy(bufp, " "); 01415 bufp = gnc_stpcpy(bufp, currency_symbol); 01416 } 01417 01418 /* See if we print sign now */ 01419 if (print_sign && (sign_posn == 4)) 01420 bufp = gnc_stpcpy(bufp, sign); 01421 } 01422 01423 /* See if we print sign now */ 01424 if (print_sign && (sign_posn == 2)) 01425 bufp = gnc_stpcpy(bufp, sign); 01426 01427 /* return length of printed string */ 01428 return (bufp - orig_bufp); 01429 }
|
1.4.3-20050530