2000-11-01 02:52:30 -06:00
|
|
|
/********************************************************************\
|
|
|
|
* gnc-ui-util.h -- utility functions for the GnuCash UI *
|
|
|
|
* Copyright (C) 2000 Dave Peticolas <dave@krondo.com> *
|
|
|
|
* *
|
|
|
|
* 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 *
|
2000-11-01 02:52:30 -06:00
|
|
|
\********************************************************************/
|
|
|
|
|
2005-11-01 21:32:36 -06:00
|
|
|
/** @addtogroup GUI
|
2003-03-31 22:05:32 -06:00
|
|
|
@{ */
|
2005-11-01 21:32:36 -06:00
|
|
|
/** @addtogroup GuiUtility Utility functions for the GnuCash GUI
|
|
|
|
* @{ */
|
2009-12-29 14:12:48 -06:00
|
|
|
/** @file gnc-ui-util.h
|
2003-03-31 22:05:32 -06:00
|
|
|
@brief utility functions for the GnuCash UI
|
|
|
|
@author Copyright (C) 2000 Dave Peticolas <dave@krondo.com>
|
|
|
|
*/
|
|
|
|
|
2001-07-03 01:49:39 -05:00
|
|
|
#ifndef GNC_UI_UTIL_H
|
|
|
|
#define GNC_UI_UTIL_H
|
2000-11-01 02:52:30 -06:00
|
|
|
|
|
|
|
#include <glib.h>
|
2001-04-24 01:10:10 -05:00
|
|
|
#include <locale.h>
|
2000-11-01 02:52:30 -06:00
|
|
|
|
2001-11-24 06:10:42 -06:00
|
|
|
#include "Account.h"
|
2011-08-13 10:33:42 -05:00
|
|
|
#include "gncOwner.h"
|
2005-11-21 13:31:44 -06:00
|
|
|
#include "qof.h"
|
2000-11-01 02:52:30 -06:00
|
|
|
|
|
|
|
|
2003-06-26 21:38:40 -05:00
|
|
|
typedef QofSession * (*QofSessionCB) (void);
|
2001-09-18 02:26:42 -05:00
|
|
|
|
|
|
|
|
2013-10-07 09:15:18 -05:00
|
|
|
gchar *gnc_normalize_account_separator (const gchar* separator);
|
2006-02-26 14:06:15 -06:00
|
|
|
gboolean gnc_reverse_balance(const Account *account);
|
2000-11-29 14:40:25 -06:00
|
|
|
|
2010-08-05 16:27:45 -05:00
|
|
|
/* Default directory sections ***************************************/
|
2013-10-07 09:30:10 -05:00
|
|
|
#define GNC_PREFS_GROUP_OPEN_SAVE "dialogs.open-save"
|
|
|
|
#define GNC_PREFS_GROUP_EXPORT "dialogs.export-accounts"
|
2013-10-07 09:08:17 -05:00
|
|
|
#define GNC_PREFS_GROUP_REPORT "dialogs.report"
|
2013-10-07 09:30:10 -05:00
|
|
|
#define GNC_PREF_AUTO_DECIMAL_POINT "auto-decimal-point"
|
|
|
|
#define GNC_PREF_AUTO_DECIMAL_PLACES "auto-decimal-places"
|
2000-11-29 14:40:25 -06:00
|
|
|
|
2003-01-12 19:09:27 -06:00
|
|
|
/* Default directories **********************************************/
|
|
|
|
|
2013-10-07 09:08:17 -05:00
|
|
|
gchar *gnc_get_default_directory (const gchar *section);
|
|
|
|
void gnc_set_default_directory (const gchar *section,
|
2009-12-29 14:12:48 -06:00
|
|
|
const gchar *directory);
|
2003-01-12 19:09:27 -06:00
|
|
|
|
2000-11-29 14:40:25 -06:00
|
|
|
/* Engine enhancements & i18n ***************************************/
|
2003-06-26 21:38:40 -05:00
|
|
|
QofBook * gnc_get_current_book (void);
|
Implement a Book Option to give users the choice to use the transaction number field (default and current behaviour) or, alternatively, the split action field of the anchor split for 'Num' column on registers, reports, import and export, where applicable. The difference between the two is that with the default, the same 'Num' is displayed for a given transaction regardless of what register it is viewed in and with the new option, a different 'Num' can be entered/displayed for a given transaction in each register it is viewed in. In both cases, the 'next number logic' of the 'Num' cell is based on the account of the register the transaction is entered/viewed from but in one case it fills the transaction number, in the other, it fills the split action field of the anchor split (with the transaction number field displayed in the register cell labeled 'T-Num'). In both cases, both fields are visible and can be used as free-form text in double-line mode for any value the user wants. If the new option is not selected, there should be no change in Gnucash's behaviour with the exception of displaying the book options dialog in 'new book' situations.
The changes made are:
1. Implement the new book option to select source for 'num' cell:
libqof/qof/qofbookslots.h - define num source option
engine/engine.i - define 'NUM-FIELD-SOURCE' as an option name and
'SPLIT-ACTION' as a term for sorting queries
app-utils/business-prefs.scm - define book option for num-field-source
app-utils/app-utils.scm - define and export book option for num-field-source
2. Implement functions to get book option setting and to test:
libqof/qof/qofbook.c & .h - define function to get number source book option
libqof/qof/test/test-qofbook.c - test function to get number source book option
3. Implement a notification mechanism for book option changes:
engine/engine-helpers.c & .h - define functions to register callbacks,
define function to remove callbacks and
define function to initiate callbacks on book num-source option changes
core-utils/gnc-features.c & .h - define feature for num-source
app-utils/gnc-ui-util.c & .h - define gnc_book_option_num_field_source_change_cb;
include setting of feature flag on initial use
gnome-utils/gnc-main-window.c - change name of gnc_options_dialog_apply_cb
function to gnc_book_options_dialog_apply_cb and adjust function to
call function gnc_book_option_num_field_source_change_cb when book
option for num-field-source changes; change name of
gnc_options_dialog_close_cb to gnc_book_options_dialog_close_cb
4. Implement 'help' button response on Book Option Dialog:
gnome-utils/gnc-ui.h - define "book-options" section of help manual
gnome-utils/gnc-gnome-utils.c & .h - implement Book Options help callback
gnome-utils/gnc-main-window.c - use gnc_options_dialog_set_book_options_help_cb
to make help button active
5. Implement utility functions to get/set number/action based on book option:
engine/engine-helpers.c & .h - define 'gnc_get_num_action' function
define 'gnc_get_action_num' function
define 'gnc_set_num_action' function
engine/engine.i - make get/set num/action functions available to guile &
allow #f to be used in place of NULL from guile
engine/Transaction.h - add reference to utility functions in comments to
xaccTransSetNum and xaccTransGetNum functions
engine/Split.h - add reference to utility functions in comments to
xaccSplitSetAction and xaccSplitGetAction functions
6. Implement register use of num source book option; for General, Income and Search
Ledgers, since there is no anchor split, always show tran-num in transaction
cursor, but vary label to correspond to book option:
register/ledger-core/split-register.h - define TNUM_CELL
define CURSOR_DOUBLE_LEDGER_NUM_ACTN cursor name to use TNUM_CELL
define CURSOR_DOUBLE_JOURNAL_NUM_ACTN cursor name to use TNUM_CELL
add boolean to split_reg structure to hold num source book option
register/ledger-core/split-register-layout.c -
add logic to define and set up new ledger/journal cursors with TNUM_CELLs
add logic to add the new cursors to a layout
add logic to add TNUM_CELL to a layout
register/ledger-core/split-register-model.c -
define function to get TNUM_CELL label
add logic to recognize ledger/journal cursors with TNUM_CELL
modify function to get NUM_CELL value based on book option and register
type
define function to get TNUM_CELL value
adjust num help text to reflect book option choice
define function to get TNUM_CELL help
modify function to get action help to reflect book option choice
set up handlers for TNUM_CELL
register/ledger-core/split-register-model-save.c -
use 'gnc_set_num_action' function to set num/action for NUM_CELL based
on book option
define function to save TNUM_CELL using 'gnc_set_num_action' function
set save handler for TNUM_CELL
register/ledger-core/split-register-util.c -
modify logic to recognize ledger/journal cursors with tnum_cell
register/ledger-core/split-register.c -
define split_register_book_option_changed function
register split_register_book_option_changed function in register init
initialize register structure setting to book option
remove split_register_book_option_changed function in register destroy
modify gnc_split_register_save_to_scm to handle TNUM_CELL
7. Enhance transaction copy/duplicate logic to accommodate new book option:
gnome/gtkbuilder/gnc-plugin-page-register.glade -
add widgets to handle trans number and/or split action based on book option
gnome-utils/dialog-dup-trans.c & .h -
add capability to display and handle 'Num' field according to book option
gnome/gnc-plugin-page-register.c - define gnc_find_register_by_account
register/ledger-core/split-register.c -
modify gnc_split_register_duplicate_current to accomodate book option
setting
register/ledger-core/Makefile.am - add GNOME_CFLAGS
register/ledger-core/test/Makefile.am - add libgnc-gnome.la
8. Adjust register sort and sort labels related to Num/Action radio buttons to
correspond to book option for clarity:
gnome/gnc-plugin-page-register.c -
define gnc_plugin_page_register_sort_book_option_changed to adjust labels
register function in gnc_plugin_page_register_cmd_view_sort_by
and save num and action radio widgets
initialize radio widget labels to correspond to book option
remove function in gnc_plugin_page_register_sort_response_cb
and clear num and action radio widgets
gnome/gnc-split-reg.c & h. -
create versions of gnc_split_reg_sort and gnc_split_reg_set_sort to force
a re-sort to be used when num-source book option changes
engine/Transaction.c & .h -
modify default sort to use split action in place of tran num per book
option if called from xaccSplitOrder
engine/Split.c -
modify xaccSplitOrder to call xaccTransOrder_num_action to switch use of
split action and tran num per book option
engine/test/utest-Split.c -
modify test_xaccSplitOrder to call xaccTransOrder_num_action based on
book option
9. Adjust transaction find labels related to Num/Action to correspond to book option
for clarity:
gnome/dialog-find-transactions.c - adjust labels in search criteria based
on book option
gnome-search/dialog-search.c -
define gnc_search_dialog_book_option_changed to adjust labels
register function in gnc_search_dialog_init_widgets when searching
for splits
remove function in gnc_search_dialog_close_cb if registered
10. Modify new file process to allow setting of num-source (actually, all) book
option(s) during New Account Hierarchy Setup:
gnome-utils/gtkbuilder/dialog-preferences.glade - add a user preference for
the default setting for 'num-source' for new books
core-utils/gnc-gconf-utils.h - define KEY_NUM_SOURCE
gnome-utils/gnc-gnome-utils.c & h. -
define gnc_options_dialog_set_new_book_option_values to retrieve
preference values
gnome-utils/dialog-options.c & .h - define gnc_options_dialog_new_modal to
surpress apply button
gnome-utils/gnc-main-window.c - define function gnc_book_options_dialog_cb
with arguments so that the window can be called in modal mode and the
title changed and return dialog widget; call gnc_options_dialog_new_modal
instead of gnc_options_dialog_new; call this function from
gnc_main_window_cmd_file_properties with new arguments; for modal mode,
call gnc-options-dialog-set-new-book-option-values to initialize values
from preferences
app-utils/gnc-ui-util.c & h. - create function gnc_is_new_book for
determining when a new book is being created
gnome-utils/dialog-utils.c & h. - define gnc_new_book_option_display to
display book options dialog in modal mode
gnome/gtkbuilder/assistant-hierarchy.glade - add notification about book
options to currency page
gnome/assistant-hierarchy.c - add ability to set book option initialized
from preferences value for new books by using functions gnc_is_new_book
and gnc_new_book_option_display
11. Modify Import QIF process to recognize a new-book situation and allow setting
of book options during first import into a new book; also follow book option
setting for num source in importing number whether new book or not:
import-export/qif-import/assistant-qif-import.glade - add notification about
book options to currency page
import-export/qif-import/assistant-qif-import.c - using function
gnc_is_new_book to identify 'new book' situation and set flag; add
logic to handle 'new-book' situation by calling
gnc_new_book_option_display function
import-export/qif-import/qif-to-gnc.scm - use 'gnc_set_num_action' function
to import number to correct field based on book option
12. Modify Import OFX/QFX process to recognize a new-book situation and allow setting
of book options during first import into a new book; also follow book option
setting for num source in importing number whether new book or not:
import-export/ofx/gnc-ofx-import.c - use 'gnc_set_num_action' function to import
number based on book option; identify 'new book' situation using function
gnc_is_new_book and set flag; add logic to handle 'new-book' situation
by raising book options dialog by calling gnc_new_book_option_display
function
import-export/import-backend.c - use 'gnc_get_num_action' function to
retrieve number from transactions to be matched based on book option
13. Modify Import AqBanking process to recognize a new-book situation and allow
setting of book options during first import into a new book; also follow
book option setting for num source in importing number:
import-export/aqbanking/gnc-file-aqb-import.c - identify 'new book'
situation using function gnc_is_new_book and handle by raising book
options dialog by calling gnc_new_book_option_display function
import-export/aqbanking/gnc-ab-utils.c - use 'gnc_set_num_action' function
to set number based on book option
14. Modify Import Transactions from CSV process to recognize a new-book situation
and allow setting of book options during first import into a new book; also
follow book option setting for num source in importing number whether new
book or not:
import-export/csv-import/assistant-csv-trans-import.glade - modify
commments to alert user of raising book options dialog in cases of csv
import into a new book
import-export/csv-import/gnc-csv-model.c & h. - use 'gnc_set_num_action'
function to import number based on book option
import-export/csv-import/assistant-csv-trans-import.c - add logic to handle
'new-book' situation by raising book options dialog by calling
gnc_new_book_option_display function; identify 'new book' situation
using function gnc_is_new_book and set flag
15. Modify Import Accounts from CSV process to recognize a new-book situation
and allow setting of book options during first import into a new book
import-export/csv-import/assistant-csv-account-import.c & .h - add logic to
handle 'new-book' situation by raising book options dialog by calling
gnc_new_book_option_display function; identify 'new book' situation
using function gnc_is_new_book and set flag
16. Modify Export Transactions to CSV process to follow book option setting
for num source in exporting transactions:
import-export/csv-export/csv-transactions-export.c - modify headings to
reflect num-source book option and use 'gnc_get_num_action' function
to retrieve number and action
17. Modify register reporting to reflect book option setting for num source:
gnome/gnc-plugin-page-register.c - determine and pass along ledger-type?
argument to gnc:register-report-create function
gnome/gnc-plugin-page-register2.c - determine and pass along ledger-type?
argument to gnc:register-report-create function
report/standard-reports/standard-reports.scm - add ledger-type? argument
to gnc:register-report-create function; pass it along to
gnc:register-report-create-internal function
report/standard-reports/register.scm - add ledger-type? argument to
gnc:register-report-create-internal function; use 'gnc-get-num-action'
function in place of xaccTransGetNum and 'gnc-get-action-num' function
in place of xaccSplitGetAction and modify report headings and option
text accordingly
18. Modify all places that use xaccTransSetNum and/or xaccSplitSetAction to use
'gnc_set_num_action' function to set number based on book option except
engine/Transaction.c & .h, engine/test-core/test-engine-stuff.c,
engine/Split.c & .h, engine/test/utest-Split.c, engine/engine-helpers.c & .h,
engine/engine-interface.scm, backend/xml/gnc-transaction-xml-v2.c,
backend/xml/io-gncxml-v1.c, import-export/log-replay/gnc-log-replay.c:
engine/gncOwner.c - use 'gnc_set_num_action' function to set number based
on book option
engine/gncInvoice.c - use 'gnc_set_num_action' function to set number based
on book option
engine/SchedXaction.c - use 'gnc_set_num_action' function to set number and
action
engine/cap-gains.c - use 'gnc_set_num_action' function to set split-action
gnome-utils/dialog-transfer.c - use 'gnc_set_num_action' function to set
number based on book option
gnome-utils/gnc-tree-view-split-reg.c - use 'gnc_set_num_action' function
to set number/action based on book option
gnome/assistant-stock-split.c - use 'gnc_set_num_action' function to set
split-action
19. Modify all places that use xaccTransGetNum and/or xaccSplitGetAction to use
'gnc_get_num_action' or 'gnc_get_action_num' functions to get number based
on book option except engine/Transaction.c & .h,
engine/test-core/test-engine-stuff.c, engine/Split.c & h.,
engine/test/utest-Split.c, engine/engine-helpers.c,
engine/engine-interface.scm, backend/xml/gnc-transaction-xml-v2.c,
backend/xml/test/test-xml-transaction.c:
gnome/dialog-lot-viewer.c - use 'gnc_get_num_action' function to retrieve
number based on book option
gnome/dialog-sx-from-trans.c - use 'gnc_get_num_action' function to
retrieve number and action
gnome/dialog-print-check.c - use 'gnc_get_num_action' function to
retrieve number and 'gnc_get_action_num' function to retrieve action
register/ledger-core/split-register-model.c - use 'gnc_get_num_action'
function to retrieve number based on book option
register/ledger-core/split-register-load.c - use 'gnc_get_num_action'
function to retrieve number based on book option
register/ledger-core/split-register-control.c - use 'gnc_get_num_action'
function to retrieve action
register/ledger-core/split-register.c - use 'gnc_get_num_action'
function to retrieve transaction-num
engine/cap-gains.c - use 'gnc_get_num_action' function to get split-action
gnome-utils/gnc-tree-view-split-reg.c - use 'gnc_get_num_action' function
to retrieve number and 'gnc_get_action_num' function to retrieve action
gnome-utils/gnc-tree-model-split-reg.c - use 'gnc_get_num_action' function
to retrieve transaction-number but may not be getting what is expected
if book option to use split-action for 'num' is set
report/locale-specific/us/taxtxf.scm - use 'gnc-get-num-action' function in
place of xaccTransGetNum and 'gnc-get-action-num' function in place of
xaccSplitGetAction and modify report headings and option text accordingly
report/standard-reports/transaction.scm - use 'gnc-get-num-action' function
in place of xaccTransGetNum, adjust sorting based on book option and
modify report headings and option text accordingly; add 'SPLIT-ACTION'
as a term for sorting queries
report/business-reports/customer-summary.scm - use 'gnc-get-num-action'
function in place of xaccTransGetNum
report/business-reports/owner-report.scm - use 'gnc-get-num-action'
function in place of xaccTransGetNum
report/business-reports/job-report.scm - use 'gnc-get-num-action' function
in place of xaccTransGetNum
business/business-gnome/dialog-payment.c - use 'gnc_get_num_action'
function to retrieve number based on book option
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@22681 57a11ea4-9604-0410-9ed3-97b8803252fd
2012-12-22 00:00:54 -06:00
|
|
|
|
|
|
|
/* If there is no current session, there is no book and we must be dealing
|
|
|
|
* with a new book. When gnucash is started with --nofile, there is
|
|
|
|
* initially no session (and no book), but by the time we check, one
|
|
|
|
* could have been created (for example, if an empty account tree tab is
|
|
|
|
* opened, a session is created which creates a new, but empty, book).
|
|
|
|
* A session is created and a book is loaded from a backend when gnucash is
|
|
|
|
* started with a file, but selecting 'new file' keeps a session open. So we
|
|
|
|
* need to check as well for a book with no accounts (root with no children). */
|
|
|
|
gboolean gnc_is_new_book (void);
|
|
|
|
|
2019-01-27 17:58:46 -06:00
|
|
|
void gnc_set_current_book_tax_name_type (gboolean name_changed,
|
|
|
|
const gchar *tax_name,
|
|
|
|
gboolean type_changed,
|
|
|
|
const gchar *tax_type);
|
Bug #554394: Income Tax Enhancements
Patch by J. Alex Aycinena. Patch does the following:
- update the tax information in 'txf.scm', which is based on V037 of
the TXF Spec, to V041, the last version issued (bug #554394)
- provide support for multiple copies of certain tax Forms/Schedules
(e.g., Schedule C(1), Schedule C(2), etc.)
- support multiple types of tax entities: partnerships, corporations
and S corporations, in addition to individual tax payers
- support balance sheet accounts, required for these new tax entity types
- add the term 'Income' in several places to avoid confusion with
sales or VAT style taxes in the business features (e.g., change the
menu from 'Tax Options' to 'Income Tax Options')
The following files were changed, as follows, to implement these changes:
1. src/engine/Account.c and
2. src/engine/Account.h: add copy number capability (define
'xaccAccountGetTaxUSCopyNumber' and 'xaccAccountSetTaxUSCopyNumber');
modify 'xaccAccountSetTaxUSCode' to remove KVP when no tax-code
assigned, clean up tax-source descriptions
3. src/gnome/gnc-plugin-basic-commands.c: change 'Tax Options' to
'Income Tax Options'
4. src/app-utils/gnc-ui-util.c and
5. src/app-utils/gnc-ui-util.h: add setter and getter functions for
book tax name and book tax type which are stored in a book KVP, show
copy information in accounts page, tax column, show error messages for
various conditions
6. src/app-utils/app-utils.i: add 'gnc_get_current_book_tax_name' and
'gnc_get_current_book_tax_type' functions
7. src/gnome/dialog-tax-info.c: add copy number and tax entity name
and type, and balance sheet account handling capability
8. src/gnome/glade/tax.glade: add tax entity name, tax entity type,
asset, liability/equity and copy number widgets
9. src/tax/us/txf.scm: update to V041 for individuals, add V041
support for multiple additional tax entity types and balance sheet
accounts and related tax codes, add tax form line data
10. src/tax/us/us.scm: export new functions defined in txf.scm
11. src/report/locale-specific/us/taxtxf.scm: add support for multiple
copies of Forms/Schedules, add support for Format 6, use Form/Schedule
line #'s to sort report, update from "V037" to "V041", add support for
taxpayer types other than F1040, add warning messages if there are
some inconsistent codes assigned and list
12. src/tax/us/txf-de_DE.scm: make functions called from outside (e.g., from
dialog-tax-info.c) have a consistent signature with those same
functions in txf.scm (define tax-entity-type , define getters/setters,
add tax-entity-type as an argument to existing functions)
13. src/tax/us/de_DE.scm: export new functions added to txf-de_DE.scm
14. src/report/locale-specific/us/taxtxf-de_DE.scm: add "" as
tax-entity-type argument to functions
called on txf-de_DE.scm (which defaults to existing codes)
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@18413 57a11ea4-9604-0410-9ed3-97b8803252fd
2009-11-15 14:35:50 -06:00
|
|
|
const gchar * gnc_get_current_book_tax_name (void);
|
|
|
|
const gchar * gnc_get_current_book_tax_type (void);
|
Implement a Book Option to give users the choice to use the transaction number field (default and current behaviour) or, alternatively, the split action field of the anchor split for 'Num' column on registers, reports, import and export, where applicable. The difference between the two is that with the default, the same 'Num' is displayed for a given transaction regardless of what register it is viewed in and with the new option, a different 'Num' can be entered/displayed for a given transaction in each register it is viewed in. In both cases, the 'next number logic' of the 'Num' cell is based on the account of the register the transaction is entered/viewed from but in one case it fills the transaction number, in the other, it fills the split action field of the anchor split (with the transaction number field displayed in the register cell labeled 'T-Num'). In both cases, both fields are visible and can be used as free-form text in double-line mode for any value the user wants. If the new option is not selected, there should be no change in Gnucash's behaviour with the exception of displaying the book options dialog in 'new book' situations.
The changes made are:
1. Implement the new book option to select source for 'num' cell:
libqof/qof/qofbookslots.h - define num source option
engine/engine.i - define 'NUM-FIELD-SOURCE' as an option name and
'SPLIT-ACTION' as a term for sorting queries
app-utils/business-prefs.scm - define book option for num-field-source
app-utils/app-utils.scm - define and export book option for num-field-source
2. Implement functions to get book option setting and to test:
libqof/qof/qofbook.c & .h - define function to get number source book option
libqof/qof/test/test-qofbook.c - test function to get number source book option
3. Implement a notification mechanism for book option changes:
engine/engine-helpers.c & .h - define functions to register callbacks,
define function to remove callbacks and
define function to initiate callbacks on book num-source option changes
core-utils/gnc-features.c & .h - define feature for num-source
app-utils/gnc-ui-util.c & .h - define gnc_book_option_num_field_source_change_cb;
include setting of feature flag on initial use
gnome-utils/gnc-main-window.c - change name of gnc_options_dialog_apply_cb
function to gnc_book_options_dialog_apply_cb and adjust function to
call function gnc_book_option_num_field_source_change_cb when book
option for num-field-source changes; change name of
gnc_options_dialog_close_cb to gnc_book_options_dialog_close_cb
4. Implement 'help' button response on Book Option Dialog:
gnome-utils/gnc-ui.h - define "book-options" section of help manual
gnome-utils/gnc-gnome-utils.c & .h - implement Book Options help callback
gnome-utils/gnc-main-window.c - use gnc_options_dialog_set_book_options_help_cb
to make help button active
5. Implement utility functions to get/set number/action based on book option:
engine/engine-helpers.c & .h - define 'gnc_get_num_action' function
define 'gnc_get_action_num' function
define 'gnc_set_num_action' function
engine/engine.i - make get/set num/action functions available to guile &
allow #f to be used in place of NULL from guile
engine/Transaction.h - add reference to utility functions in comments to
xaccTransSetNum and xaccTransGetNum functions
engine/Split.h - add reference to utility functions in comments to
xaccSplitSetAction and xaccSplitGetAction functions
6. Implement register use of num source book option; for General, Income and Search
Ledgers, since there is no anchor split, always show tran-num in transaction
cursor, but vary label to correspond to book option:
register/ledger-core/split-register.h - define TNUM_CELL
define CURSOR_DOUBLE_LEDGER_NUM_ACTN cursor name to use TNUM_CELL
define CURSOR_DOUBLE_JOURNAL_NUM_ACTN cursor name to use TNUM_CELL
add boolean to split_reg structure to hold num source book option
register/ledger-core/split-register-layout.c -
add logic to define and set up new ledger/journal cursors with TNUM_CELLs
add logic to add the new cursors to a layout
add logic to add TNUM_CELL to a layout
register/ledger-core/split-register-model.c -
define function to get TNUM_CELL label
add logic to recognize ledger/journal cursors with TNUM_CELL
modify function to get NUM_CELL value based on book option and register
type
define function to get TNUM_CELL value
adjust num help text to reflect book option choice
define function to get TNUM_CELL help
modify function to get action help to reflect book option choice
set up handlers for TNUM_CELL
register/ledger-core/split-register-model-save.c -
use 'gnc_set_num_action' function to set num/action for NUM_CELL based
on book option
define function to save TNUM_CELL using 'gnc_set_num_action' function
set save handler for TNUM_CELL
register/ledger-core/split-register-util.c -
modify logic to recognize ledger/journal cursors with tnum_cell
register/ledger-core/split-register.c -
define split_register_book_option_changed function
register split_register_book_option_changed function in register init
initialize register structure setting to book option
remove split_register_book_option_changed function in register destroy
modify gnc_split_register_save_to_scm to handle TNUM_CELL
7. Enhance transaction copy/duplicate logic to accommodate new book option:
gnome/gtkbuilder/gnc-plugin-page-register.glade -
add widgets to handle trans number and/or split action based on book option
gnome-utils/dialog-dup-trans.c & .h -
add capability to display and handle 'Num' field according to book option
gnome/gnc-plugin-page-register.c - define gnc_find_register_by_account
register/ledger-core/split-register.c -
modify gnc_split_register_duplicate_current to accomodate book option
setting
register/ledger-core/Makefile.am - add GNOME_CFLAGS
register/ledger-core/test/Makefile.am - add libgnc-gnome.la
8. Adjust register sort and sort labels related to Num/Action radio buttons to
correspond to book option for clarity:
gnome/gnc-plugin-page-register.c -
define gnc_plugin_page_register_sort_book_option_changed to adjust labels
register function in gnc_plugin_page_register_cmd_view_sort_by
and save num and action radio widgets
initialize radio widget labels to correspond to book option
remove function in gnc_plugin_page_register_sort_response_cb
and clear num and action radio widgets
gnome/gnc-split-reg.c & h. -
create versions of gnc_split_reg_sort and gnc_split_reg_set_sort to force
a re-sort to be used when num-source book option changes
engine/Transaction.c & .h -
modify default sort to use split action in place of tran num per book
option if called from xaccSplitOrder
engine/Split.c -
modify xaccSplitOrder to call xaccTransOrder_num_action to switch use of
split action and tran num per book option
engine/test/utest-Split.c -
modify test_xaccSplitOrder to call xaccTransOrder_num_action based on
book option
9. Adjust transaction find labels related to Num/Action to correspond to book option
for clarity:
gnome/dialog-find-transactions.c - adjust labels in search criteria based
on book option
gnome-search/dialog-search.c -
define gnc_search_dialog_book_option_changed to adjust labels
register function in gnc_search_dialog_init_widgets when searching
for splits
remove function in gnc_search_dialog_close_cb if registered
10. Modify new file process to allow setting of num-source (actually, all) book
option(s) during New Account Hierarchy Setup:
gnome-utils/gtkbuilder/dialog-preferences.glade - add a user preference for
the default setting for 'num-source' for new books
core-utils/gnc-gconf-utils.h - define KEY_NUM_SOURCE
gnome-utils/gnc-gnome-utils.c & h. -
define gnc_options_dialog_set_new_book_option_values to retrieve
preference values
gnome-utils/dialog-options.c & .h - define gnc_options_dialog_new_modal to
surpress apply button
gnome-utils/gnc-main-window.c - define function gnc_book_options_dialog_cb
with arguments so that the window can be called in modal mode and the
title changed and return dialog widget; call gnc_options_dialog_new_modal
instead of gnc_options_dialog_new; call this function from
gnc_main_window_cmd_file_properties with new arguments; for modal mode,
call gnc-options-dialog-set-new-book-option-values to initialize values
from preferences
app-utils/gnc-ui-util.c & h. - create function gnc_is_new_book for
determining when a new book is being created
gnome-utils/dialog-utils.c & h. - define gnc_new_book_option_display to
display book options dialog in modal mode
gnome/gtkbuilder/assistant-hierarchy.glade - add notification about book
options to currency page
gnome/assistant-hierarchy.c - add ability to set book option initialized
from preferences value for new books by using functions gnc_is_new_book
and gnc_new_book_option_display
11. Modify Import QIF process to recognize a new-book situation and allow setting
of book options during first import into a new book; also follow book option
setting for num source in importing number whether new book or not:
import-export/qif-import/assistant-qif-import.glade - add notification about
book options to currency page
import-export/qif-import/assistant-qif-import.c - using function
gnc_is_new_book to identify 'new book' situation and set flag; add
logic to handle 'new-book' situation by calling
gnc_new_book_option_display function
import-export/qif-import/qif-to-gnc.scm - use 'gnc_set_num_action' function
to import number to correct field based on book option
12. Modify Import OFX/QFX process to recognize a new-book situation and allow setting
of book options during first import into a new book; also follow book option
setting for num source in importing number whether new book or not:
import-export/ofx/gnc-ofx-import.c - use 'gnc_set_num_action' function to import
number based on book option; identify 'new book' situation using function
gnc_is_new_book and set flag; add logic to handle 'new-book' situation
by raising book options dialog by calling gnc_new_book_option_display
function
import-export/import-backend.c - use 'gnc_get_num_action' function to
retrieve number from transactions to be matched based on book option
13. Modify Import AqBanking process to recognize a new-book situation and allow
setting of book options during first import into a new book; also follow
book option setting for num source in importing number:
import-export/aqbanking/gnc-file-aqb-import.c - identify 'new book'
situation using function gnc_is_new_book and handle by raising book
options dialog by calling gnc_new_book_option_display function
import-export/aqbanking/gnc-ab-utils.c - use 'gnc_set_num_action' function
to set number based on book option
14. Modify Import Transactions from CSV process to recognize a new-book situation
and allow setting of book options during first import into a new book; also
follow book option setting for num source in importing number whether new
book or not:
import-export/csv-import/assistant-csv-trans-import.glade - modify
commments to alert user of raising book options dialog in cases of csv
import into a new book
import-export/csv-import/gnc-csv-model.c & h. - use 'gnc_set_num_action'
function to import number based on book option
import-export/csv-import/assistant-csv-trans-import.c - add logic to handle
'new-book' situation by raising book options dialog by calling
gnc_new_book_option_display function; identify 'new book' situation
using function gnc_is_new_book and set flag
15. Modify Import Accounts from CSV process to recognize a new-book situation
and allow setting of book options during first import into a new book
import-export/csv-import/assistant-csv-account-import.c & .h - add logic to
handle 'new-book' situation by raising book options dialog by calling
gnc_new_book_option_display function; identify 'new book' situation
using function gnc_is_new_book and set flag
16. Modify Export Transactions to CSV process to follow book option setting
for num source in exporting transactions:
import-export/csv-export/csv-transactions-export.c - modify headings to
reflect num-source book option and use 'gnc_get_num_action' function
to retrieve number and action
17. Modify register reporting to reflect book option setting for num source:
gnome/gnc-plugin-page-register.c - determine and pass along ledger-type?
argument to gnc:register-report-create function
gnome/gnc-plugin-page-register2.c - determine and pass along ledger-type?
argument to gnc:register-report-create function
report/standard-reports/standard-reports.scm - add ledger-type? argument
to gnc:register-report-create function; pass it along to
gnc:register-report-create-internal function
report/standard-reports/register.scm - add ledger-type? argument to
gnc:register-report-create-internal function; use 'gnc-get-num-action'
function in place of xaccTransGetNum and 'gnc-get-action-num' function
in place of xaccSplitGetAction and modify report headings and option
text accordingly
18. Modify all places that use xaccTransSetNum and/or xaccSplitSetAction to use
'gnc_set_num_action' function to set number based on book option except
engine/Transaction.c & .h, engine/test-core/test-engine-stuff.c,
engine/Split.c & .h, engine/test/utest-Split.c, engine/engine-helpers.c & .h,
engine/engine-interface.scm, backend/xml/gnc-transaction-xml-v2.c,
backend/xml/io-gncxml-v1.c, import-export/log-replay/gnc-log-replay.c:
engine/gncOwner.c - use 'gnc_set_num_action' function to set number based
on book option
engine/gncInvoice.c - use 'gnc_set_num_action' function to set number based
on book option
engine/SchedXaction.c - use 'gnc_set_num_action' function to set number and
action
engine/cap-gains.c - use 'gnc_set_num_action' function to set split-action
gnome-utils/dialog-transfer.c - use 'gnc_set_num_action' function to set
number based on book option
gnome-utils/gnc-tree-view-split-reg.c - use 'gnc_set_num_action' function
to set number/action based on book option
gnome/assistant-stock-split.c - use 'gnc_set_num_action' function to set
split-action
19. Modify all places that use xaccTransGetNum and/or xaccSplitGetAction to use
'gnc_get_num_action' or 'gnc_get_action_num' functions to get number based
on book option except engine/Transaction.c & .h,
engine/test-core/test-engine-stuff.c, engine/Split.c & h.,
engine/test/utest-Split.c, engine/engine-helpers.c,
engine/engine-interface.scm, backend/xml/gnc-transaction-xml-v2.c,
backend/xml/test/test-xml-transaction.c:
gnome/dialog-lot-viewer.c - use 'gnc_get_num_action' function to retrieve
number based on book option
gnome/dialog-sx-from-trans.c - use 'gnc_get_num_action' function to
retrieve number and action
gnome/dialog-print-check.c - use 'gnc_get_num_action' function to
retrieve number and 'gnc_get_action_num' function to retrieve action
register/ledger-core/split-register-model.c - use 'gnc_get_num_action'
function to retrieve number based on book option
register/ledger-core/split-register-load.c - use 'gnc_get_num_action'
function to retrieve number based on book option
register/ledger-core/split-register-control.c - use 'gnc_get_num_action'
function to retrieve action
register/ledger-core/split-register.c - use 'gnc_get_num_action'
function to retrieve transaction-num
engine/cap-gains.c - use 'gnc_get_num_action' function to get split-action
gnome-utils/gnc-tree-view-split-reg.c - use 'gnc_get_num_action' function
to retrieve number and 'gnc_get_action_num' function to retrieve action
gnome-utils/gnc-tree-model-split-reg.c - use 'gnc_get_num_action' function
to retrieve transaction-number but may not be getting what is expected
if book option to use split-action for 'num' is set
report/locale-specific/us/taxtxf.scm - use 'gnc-get-num-action' function in
place of xaccTransGetNum and 'gnc-get-action-num' function in place of
xaccSplitGetAction and modify report headings and option text accordingly
report/standard-reports/transaction.scm - use 'gnc-get-num-action' function
in place of xaccTransGetNum, adjust sorting based on book option and
modify report headings and option text accordingly; add 'SPLIT-ACTION'
as a term for sorting queries
report/business-reports/customer-summary.scm - use 'gnc-get-num-action'
function in place of xaccTransGetNum
report/business-reports/owner-report.scm - use 'gnc-get-num-action'
function in place of xaccTransGetNum
report/business-reports/job-report.scm - use 'gnc-get-num-action' function
in place of xaccTransGetNum
business/business-gnome/dialog-payment.c - use 'gnc_get_num_action'
function to retrieve number based on book option
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@22681 57a11ea4-9604-0410-9ed3-97b8803252fd
2012-12-22 00:00:54 -06:00
|
|
|
/** Calls gnc_book_option_num_field_source_change to initiate registered
|
|
|
|
* callbacks when num_field_source book option changes so that
|
|
|
|
* registers/reports can update themselves; sets feature flag */
|
|
|
|
void gnc_book_option_num_field_source_change_cb (gboolean num_action);
|
2015-06-27 18:06:56 -05:00
|
|
|
|
2015-08-13 19:16:02 -05:00
|
|
|
/** Calls gnc_book_option_book_currency_selected to initiate registered
|
|
|
|
* callbacks when currency accounting book option changes to book-currency so
|
|
|
|
* that registers/reports can update themselves; sets feature flag */
|
|
|
|
void gnc_book_option_book_currency_selected_cb (gboolean use_book_currency);
|
|
|
|
|
2015-06-27 18:06:56 -05:00
|
|
|
/** Returns TRUE if both book-currency and default gain/loss policy KVPs exist
|
|
|
|
* and are valid and trading accounts are not used */
|
|
|
|
gboolean gnc_book_use_book_currency (QofBook *book);
|
|
|
|
|
|
|
|
/** Returns pointer to Book Currency name for book or NULL; determines
|
|
|
|
* that both book-currency and default gain/loss policy KVPs exist and that
|
|
|
|
* both are valid, a requirement for the 'book-currency' currency accounting
|
|
|
|
* method to apply. */
|
2016-06-17 15:48:03 -05:00
|
|
|
const gchar * gnc_book_get_book_currency_name (QofBook *book);
|
|
|
|
|
|
|
|
/** Returns pointer to Book Currency for book or NULL; determines
|
|
|
|
* that both book-currency and default gain/loss policy KVPs exist and that
|
|
|
|
* both are valid, a requirement for the 'book-currency' currency accounting
|
|
|
|
* method to apply. */
|
|
|
|
gnc_commodity * gnc_book_get_book_currency (QofBook *book);
|
2015-06-27 18:06:56 -05:00
|
|
|
|
|
|
|
/** Returns pointer to default gain/loss policy for book or NULL; determines
|
|
|
|
* that both book-currency and default gain/loss policy KVPs exist and that
|
|
|
|
* both are valid, a requirement for the 'book-currency' currency accounting
|
|
|
|
* method to apply. */
|
|
|
|
const gchar * gnc_book_get_default_gains_policy (QofBook *book);
|
|
|
|
|
2016-06-17 15:48:03 -05:00
|
|
|
/** Returns pointer to default gain/loss account for book or NULL; determines
|
|
|
|
* that both book-currency and default gain/loss policy KVPs exist and that
|
|
|
|
* both are valid, a requirement for the 'book-currency' currency accounting
|
|
|
|
* method to apply. */
|
|
|
|
Account * gnc_book_get_default_gain_loss_acct (QofBook *book);
|
|
|
|
|
2007-02-22 19:23:31 -06:00
|
|
|
Account * gnc_get_current_root_account (void);
|
2001-10-03 05:07:45 -05:00
|
|
|
gnc_commodity_table * gnc_get_current_commodities (void);
|
2001-09-18 02:26:42 -05:00
|
|
|
|
2008-07-13 16:28:45 -05:00
|
|
|
/**
|
|
|
|
* Get either the full name of the account or the simple name, depending on the
|
|
|
|
* configuration parameter general/register/show_leaf_account_names.
|
|
|
|
*
|
|
|
|
* @param account The account to retrieve the name for.
|
|
|
|
* @return A newly allocated string.
|
|
|
|
*/
|
|
|
|
gchar *gnc_get_account_name_for_register(const Account *account);
|
|
|
|
|
|
|
|
/**
|
2013-10-07 09:02:27 -05:00
|
|
|
* Retrieve the account matching the given name starting from the descendants of
|
2008-07-13 16:28:45 -05:00
|
|
|
* base_account.
|
|
|
|
* @a name is either considered to be the name of the leaf in the account tree
|
|
|
|
* or to be the full account path, depending on the configuration parameter
|
2013-10-07 09:12:39 -05:00
|
|
|
* general.register/show_leaf_account_names.
|
2008-07-13 16:28:45 -05:00
|
|
|
*
|
|
|
|
* @param base_account The account to start the search at.
|
|
|
|
* @param name The name to search for.
|
|
|
|
* @return A pointer to the account, or NULL if the account was not found.
|
|
|
|
*/
|
|
|
|
Account *gnc_account_lookup_for_register(const Account *base_account, const
|
2009-12-29 14:12:48 -06:00
|
|
|
gchar *name);
|
2008-07-13 16:28:45 -05:00
|
|
|
|
2018-02-20 18:54:49 -06:00
|
|
|
/**
|
|
|
|
* Get either the full name of the account or the simple name, depending on the
|
|
|
|
* show_leaf_accounts.
|
|
|
|
*
|
|
|
|
* @param account The account to retrieve the name for.
|
|
|
|
* @param show_leaf_accounts Whether the full name will be returned.
|
|
|
|
* @return A newly allocated string.
|
|
|
|
*/
|
|
|
|
gchar *gnc_get_account_name_for_split_register(const Account *account,
|
|
|
|
gboolean show_leaf_accounts);
|
|
|
|
|
2003-03-31 22:05:32 -06:00
|
|
|
/*
|
2005-11-01 21:32:36 -06:00
|
|
|
* This is a wrapper routine around an xaccGetBalanceInCurrency
|
|
|
|
* function that handles additional needs of the gui.
|
2003-03-31 22:05:32 -06:00
|
|
|
*
|
2005-11-01 21:32:36 -06:00
|
|
|
* @param fn The underlying function in Account.c to call to retrieve
|
|
|
|
* a specific balance from the account.
|
|
|
|
* @param account The account to retrieve data about.
|
|
|
|
* @param recurse Include all sub-accounts of this account.
|
|
|
|
* @param negative An indication of whether or not the returned value
|
|
|
|
* is negative. This can be used by the caller to
|
|
|
|
* easily decode whether or not to color the output.
|
|
|
|
* @param commodity The commodity in which the account balance should
|
|
|
|
* be returned. If NULL, the value will be returned in
|
|
|
|
* the commodity of the account. This is normally used
|
|
|
|
* to specify a currency, which forces the conversion
|
|
|
|
* of things like stock account values from share
|
|
|
|
* values to an amount the requested currency.
|
2003-03-31 22:05:32 -06:00
|
|
|
*/
|
2006-02-27 17:57:16 -06:00
|
|
|
char *gnc_ui_account_get_tax_info_string (const Account *account);
|
2005-11-01 21:32:36 -06:00
|
|
|
|
2011-01-30 14:34:55 -06:00
|
|
|
char *gnc_ui_account_get_tax_info_sub_acct_string (const Account *account);
|
|
|
|
|
2000-11-29 14:40:25 -06:00
|
|
|
const char * gnc_get_reconcile_str (char reconciled_flag);
|
2001-11-29 20:11:24 -06:00
|
|
|
const char * gnc_get_reconcile_valid_flags (void);
|
|
|
|
const char * gnc_get_reconcile_flag_order (void);
|
2000-11-29 14:40:25 -06:00
|
|
|
|
2001-04-03 05:18:59 -05:00
|
|
|
typedef enum
|
|
|
|
{
|
2009-12-29 14:12:48 -06:00
|
|
|
EQUITY_OPENING_BALANCE,
|
|
|
|
EQUITY_RETAINED_EARNINGS,
|
|
|
|
NUM_EQUITY_TYPES
|
2001-04-03 05:18:59 -05:00
|
|
|
} GNCEquityType;
|
|
|
|
|
2007-03-03 10:41:42 -06:00
|
|
|
Account * gnc_find_or_create_equity_account (Account *root,
|
2009-12-29 14:12:48 -06:00
|
|
|
GNCEquityType equity_type,
|
|
|
|
gnc_commodity *currency);
|
2001-04-03 05:18:59 -05:00
|
|
|
gboolean gnc_account_create_opening_balance (Account *account,
|
2009-12-29 14:12:48 -06:00
|
|
|
gnc_numeric balance,
|
2012-12-01 16:44:41 -06:00
|
|
|
time64 date,
|
2009-12-29 14:12:48 -06:00
|
|
|
QofBook *book);
|
2001-04-03 05:18:59 -05:00
|
|
|
|
2000-11-01 02:52:30 -06:00
|
|
|
/* Locale functions *************************************************/
|
|
|
|
|
|
|
|
|
2002-11-30 07:38:34 -06:00
|
|
|
/* Returns the default currency of the current locale, or NULL if no
|
|
|
|
* sensible currency could be identified from the locale. */
|
|
|
|
gnc_commodity * gnc_locale_default_currency_nodefault (void);
|
|
|
|
|
|
|
|
/* Returns the default currency of the current locale. WATCH OUT: If
|
|
|
|
* no currency could be identified from the locale, this one returns
|
|
|
|
* "USD", but this will have nothing to do with the actual locale. */
|
2001-02-24 18:42:44 -06:00
|
|
|
gnc_commodity * gnc_locale_default_currency (void);
|
2000-11-01 02:52:30 -06:00
|
|
|
|
2001-10-03 05:07:45 -05:00
|
|
|
/* Returns the default ISO currency string of the current locale. */
|
|
|
|
const char * gnc_locale_default_iso_currency_code (void);
|
|
|
|
|
2005-11-01 21:32:36 -06:00
|
|
|
|
|
|
|
/** Return the default currency set by the user. If the user's
|
|
|
|
* preference is invalid, then this routine will return the default
|
|
|
|
* currency for the user's locale.
|
|
|
|
*
|
|
|
|
* @return A pointer to a currency.
|
|
|
|
*/
|
|
|
|
gnc_commodity * gnc_default_currency (void);
|
|
|
|
|
2013-06-19 10:47:27 -05:00
|
|
|
/** Returns a gnc_commodity that is a currency, suitable for being a
|
|
|
|
Transaction's currency. The gnc_commodity is taken either from the current
|
|
|
|
account, or from the next parent account that has a gnc_commodity that is a
|
|
|
|
currency, or from gnc_default_currency().
|
|
|
|
|
|
|
|
If the given account or any of its parent account have a commodity that is a
|
|
|
|
currency, it is returned and the gboolean currency_from_account_found is set to
|
|
|
|
TRUE (if non-NULL). If neither this account nor any of its parent accounts have
|
|
|
|
such a commodity, gnc_default_currency() is returned and the gboolean
|
|
|
|
currency_from_account_found is set to FALSE (if non-NULL). This can be used to
|
|
|
|
show an appropriate warning message.
|
|
|
|
|
|
|
|
If account is NULL, gnc_default_currency() is returned and
|
|
|
|
currency_from_account_found is set to FALSE.
|
|
|
|
|
|
|
|
@param account The account where the currency should be looked up. May be NULL.
|
|
|
|
|
|
|
|
@param currency_from_account_found A gboolean pointer that takes the output
|
|
|
|
argument of whether the returned currency was found in the account. May be
|
|
|
|
NULL.
|
|
|
|
|
|
|
|
@return A currency pointer (and never NULL).
|
|
|
|
*/
|
|
|
|
gnc_commodity * gnc_account_or_default_currency(const Account* account, gboolean * currency_from_account_found);
|
2005-11-01 21:32:36 -06:00
|
|
|
|
|
|
|
/** Return the default currency for use in reports, as set by the
|
|
|
|
* user. If the user's preference is invalid, then this routine will
|
|
|
|
* return the default currency for the user's locale.
|
|
|
|
*
|
|
|
|
* @return A pointer to a currency.
|
|
|
|
*/
|
|
|
|
gnc_commodity * gnc_default_report_currency (void);
|
|
|
|
|
2000-11-01 02:52:30 -06:00
|
|
|
/* Amount printing and parsing **************************************/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* The xaccPrintAmount() and xaccSPrintAmount() routines provide
|
|
|
|
* i18n'ed convenience routines for printing gnc_numerics.
|
2000-11-01 05:50:12 -06:00
|
|
|
* amounts. Both routines take a gnc_numeric argument and
|
|
|
|
* a printing information object.
|
2000-11-01 02:52:30 -06:00
|
|
|
*
|
|
|
|
* The xaccPrintAmount() routine returns a pointer to a statically
|
|
|
|
* allocated buffer, and is therefore not thread-safe.
|
|
|
|
*
|
|
|
|
* The xaccSPrintAmount() routine accepts a pointer to the buffer to be
|
|
|
|
* printed to. It returns the length of the printed string.
|
|
|
|
*/
|
|
|
|
|
|
|
|
typedef struct _GNCPrintAmountInfo
|
|
|
|
{
|
2009-12-29 14:12:48 -06:00
|
|
|
const gnc_commodity *commodity; /* may be NULL */
|
2000-11-01 02:52:30 -06:00
|
|
|
|
2009-12-29 14:12:48 -06:00
|
|
|
guint8 max_decimal_places;
|
|
|
|
guint8 min_decimal_places;
|
2000-11-01 02:52:30 -06:00
|
|
|
|
2009-12-29 14:12:48 -06:00
|
|
|
unsigned int use_separators : 1; /* Print thousands separators */
|
|
|
|
unsigned int use_symbol : 1; /* Print currency symbol */
|
|
|
|
unsigned int use_locale : 1; /* Use locale for some positioning */
|
|
|
|
unsigned int monetary : 1; /* Is a monetary quantity */
|
|
|
|
unsigned int force_fit : 1; /* Don't print more than max_dp places */
|
|
|
|
unsigned int round : 1; /* Round at max_dp instead of truncating */
|
2000-11-01 02:52:30 -06:00
|
|
|
} GNCPrintAmountInfo;
|
|
|
|
|
|
|
|
|
|
|
|
GNCPrintAmountInfo gnc_default_print_info (gboolean use_symbol);
|
|
|
|
|
2001-04-30 01:56:00 -05:00
|
|
|
GNCPrintAmountInfo gnc_commodity_print_info (const gnc_commodity *commodity,
|
2009-12-29 14:12:48 -06:00
|
|
|
gboolean use_symbol);
|
2000-11-01 02:52:30 -06:00
|
|
|
|
2006-02-27 17:57:16 -06:00
|
|
|
GNCPrintAmountInfo gnc_account_print_info (const Account *account,
|
2009-12-29 14:12:48 -06:00
|
|
|
gboolean use_symbol);
|
2000-11-01 02:52:30 -06:00
|
|
|
|
2001-07-12 17:21:13 -05:00
|
|
|
GNCPrintAmountInfo gnc_split_amount_print_info (Split *split,
|
2009-12-29 14:12:48 -06:00
|
|
|
gboolean use_symbol);
|
2000-11-01 02:52:30 -06:00
|
|
|
|
2002-12-15 19:40:26 -06:00
|
|
|
GNCPrintAmountInfo gnc_share_print_info_places (int decplaces);
|
2000-11-01 02:52:30 -06:00
|
|
|
GNCPrintAmountInfo gnc_default_share_print_info (void);
|
2018-07-15 15:20:21 -05:00
|
|
|
GNCPrintAmountInfo gnc_default_price_print_info (const gnc_commodity *curr);
|
2000-11-01 02:52:30 -06:00
|
|
|
|
2000-11-09 00:09:04 -06:00
|
|
|
GNCPrintAmountInfo gnc_integral_print_info (void);
|
|
|
|
|
2006-01-06 16:28:38 -06:00
|
|
|
/* WARNING: Garbage in, garbage out. You must check the validity of
|
|
|
|
the supplied gnc_numeric. If it's invalid, the returned string
|
|
|
|
could point to ANYTHING. */
|
2000-11-01 02:52:30 -06:00
|
|
|
const char * xaccPrintAmount (gnc_numeric val, GNCPrintAmountInfo info);
|
|
|
|
int xaccSPrintAmount (char *buf, gnc_numeric val, GNCPrintAmountInfo info);
|
|
|
|
|
2007-03-12 22:43:24 -05:00
|
|
|
const gchar *printable_value(gdouble val, gint denom);
|
|
|
|
gchar *number_to_words(gdouble val, gint64 denom);
|
|
|
|
gchar *numeric_to_words(gnc_numeric val);
|
2000-11-01 02:52:30 -06:00
|
|
|
|
|
|
|
/* xaccParseAmount parses in_str to obtain a numeric result. The
|
|
|
|
* routine will parse as much of in_str as it can to obtain a single
|
|
|
|
* number. The number is parsed using the current locale information
|
|
|
|
* and the 'monetary' flag. The routine will return TRUE if it
|
|
|
|
* successfully parsed a number and FALSE otherwise. If TRUE is
|
|
|
|
* returned and result is non-NULL, the value of the parsed number
|
|
|
|
* is stored in *result. If FALSE is returned, *result is
|
|
|
|
* unchanged. If TRUE is returned and endstr is non-NULL, the
|
|
|
|
* location of the first character in in_str not used by the parser
|
|
|
|
* will be returned in *endstr. If FALSE is returned and endstr is
|
|
|
|
* non-NULL, *endstr will point to in_str. */
|
|
|
|
gboolean xaccParseAmount (const char * in_str, gboolean monetary,
|
|
|
|
gnc_numeric *result, char **endstr);
|
|
|
|
|
2018-11-18 10:23:14 -06:00
|
|
|
/*
|
|
|
|
* xaccParseAmountPosSign is just like xaccParseAmount except the
|
|
|
|
* caller can choose whether the locale's postive sign (or in absense
|
|
|
|
* the '+') character is ignored. Setting skip to TRUE will cause
|
|
|
|
* the function to ignore any positive sign. Setting it to FALSE,
|
|
|
|
* and positive signs will be treated as unrecognized characters.
|
|
|
|
* xaccParseAmount will run as if skip is FALSE for compatibility
|
|
|
|
* reasons (gnc-expression-parser depends on this behaviour).
|
|
|
|
*/
|
|
|
|
gboolean
|
|
|
|
xaccParseAmountPosSign (const char * in_str, gboolean monetary, gnc_numeric *result,
|
|
|
|
char **endstr, gboolean skip);
|
|
|
|
|
2003-07-09 22:10:08 -05:00
|
|
|
/*
|
|
|
|
* xaccParseAmountExtended is just like xaccParseAmount except the
|
|
|
|
* caller must provide all the locale-specific information.
|
|
|
|
*
|
|
|
|
* Note: if group is NULL, no group-size verification will take place.
|
2005-11-01 21:32:36 -06:00
|
|
|
* ignore_list is a list of characters that are completely ignored
|
|
|
|
* while processing the input string. If ignore_list is NULL, nothing
|
|
|
|
* is ignored.
|
2003-07-09 22:10:08 -05:00
|
|
|
*/
|
|
|
|
gboolean
|
|
|
|
xaccParseAmountExtended (const char * in_str, gboolean monetary,
|
2009-12-29 14:12:48 -06:00
|
|
|
gunichar negative_sign, gunichar decimal_point,
|
2016-01-23 08:53:11 -06:00
|
|
|
gunichar group_separator, const char *group, const char *ignore_list,
|
2009-12-29 14:12:48 -06:00
|
|
|
gnc_numeric *result, char **endstr);
|
2000-11-01 02:52:30 -06:00
|
|
|
|
2005-11-01 21:32:36 -06:00
|
|
|
/* Initialization ***************************************************/
|
2000-11-01 02:52:30 -06:00
|
|
|
|
2005-11-01 21:32:36 -06:00
|
|
|
void gnc_ui_util_init (void);
|
2001-07-01 16:09:09 -05:00
|
|
|
|
2000-11-01 02:52:30 -06:00
|
|
|
#endif
|
2003-03-31 22:05:32 -06:00
|
|
|
/** @} */
|
2005-11-01 21:32:36 -06:00
|
|
|
/** @} */
|