mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Some cleanup. Add some missing scheme exports.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@5188 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
1676f8c02b
commit
aa402bb780
@ -42,6 +42,7 @@
|
|||||||
#include "gnc-component-manager.h"
|
#include "gnc-component-manager.h"
|
||||||
#include "gnc-engine.h"
|
#include "gnc-engine.h"
|
||||||
#include "gnc-engine-util.h"
|
#include "gnc-engine-util.h"
|
||||||
|
#include "gnc-module.h"
|
||||||
#include "messages.h"
|
#include "messages.h"
|
||||||
|
|
||||||
|
|
||||||
@ -246,6 +247,87 @@ gnc_ui_account_get_balance (Account *account, gboolean include_children)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static char *
|
||||||
|
gnc_ui_account_get_tax_info_string (Account *account)
|
||||||
|
{
|
||||||
|
static SCM get_form = SCM_UNDEFINED;
|
||||||
|
static SCM get_desc = SCM_UNDEFINED;
|
||||||
|
|
||||||
|
GNCAccountType atype;
|
||||||
|
const char *code;
|
||||||
|
SCM category;
|
||||||
|
SCM code_scm;
|
||||||
|
char *result;
|
||||||
|
char *form;
|
||||||
|
char *desc;
|
||||||
|
SCM scm;
|
||||||
|
|
||||||
|
if (get_form == SCM_UNDEFINED)
|
||||||
|
{
|
||||||
|
GNCModule module;
|
||||||
|
|
||||||
|
module = gnc_module_load ("gnucash/report/locale-specific/us", 0);
|
||||||
|
|
||||||
|
g_return_val_if_fail (module, NULL);
|
||||||
|
|
||||||
|
get_form = gh_eval_str ("gnc:txf-get-form");
|
||||||
|
get_desc = gh_eval_str ("gnc:txf-get-description");
|
||||||
|
}
|
||||||
|
|
||||||
|
g_return_val_if_fail (gh_procedure_p (get_form), NULL);
|
||||||
|
g_return_val_if_fail (gh_procedure_p (get_desc), NULL);
|
||||||
|
|
||||||
|
if (!account)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
if (!xaccAccountGetTaxRelated (account))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
atype = xaccAccountGetType (account);
|
||||||
|
if (atype != INCOME && atype != EXPENSE)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
code = xaccAccountGetTaxUSCode (account);
|
||||||
|
if (!code)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
category = gh_eval_str (atype == INCOME ?
|
||||||
|
"txf-income-categories" :
|
||||||
|
"txf-expense-categories");
|
||||||
|
|
||||||
|
code_scm = gh_symbol2scm (code);
|
||||||
|
|
||||||
|
scm = gh_call2 (get_form, category, code_scm);
|
||||||
|
if (!gh_string_p (scm))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
form = gh_scm2newstr (scm, NULL);
|
||||||
|
if (!form)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
scm = gh_call2 (get_desc, category, code_scm);
|
||||||
|
if (!gh_string_p (scm))
|
||||||
|
{
|
||||||
|
free (form);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
desc = gh_scm2newstr (scm, NULL);
|
||||||
|
if (!desc)
|
||||||
|
{
|
||||||
|
free (form);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
result = g_strdup_printf ("%s %s", form, desc);
|
||||||
|
|
||||||
|
free (form);
|
||||||
|
free (desc);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
char *
|
char *
|
||||||
gnc_ui_account_get_field_value_string (Account *account,
|
gnc_ui_account_get_field_value_string (Account *account,
|
||||||
AccountFieldCode field)
|
AccountFieldCode field)
|
||||||
|
@ -69,9 +69,6 @@ const char * gnc_ui_account_get_field_name (AccountFieldCode field);
|
|||||||
char * gnc_ui_account_get_field_value_string (Account *account,
|
char * gnc_ui_account_get_field_value_string (Account *account,
|
||||||
AccountFieldCode field);
|
AccountFieldCode field);
|
||||||
|
|
||||||
/* Must g_free string when done */
|
|
||||||
char * gnc_ui_account_get_tax_info_string (Account *account);
|
|
||||||
|
|
||||||
gnc_numeric gnc_ui_account_get_balance (Account *account,
|
gnc_numeric gnc_ui_account_get_balance (Account *account,
|
||||||
gboolean include_children);
|
gboolean include_children);
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
TESTS = \
|
TESTS = \
|
||||||
test-link-module \
|
test-link-module \
|
||||||
test-load-module
|
test-load-module
|
||||||
# test-exp-parser \
|
# test-exp-parser
|
||||||
|
|
||||||
TESTS_ENVIRONMENT= \
|
TESTS_ENVIRONMENT= \
|
||||||
GNC_MODULE_PATH=../../engine:../../gnc-module:../../calculation:.. \
|
GNC_MODULE_PATH=../../engine:../../gnc-module:../../calculation:.. \
|
||||||
@ -17,11 +17,12 @@ LDADD = \
|
|||||||
../../gnc-module/libgncmodule.la
|
../../gnc-module/libgncmodule.la
|
||||||
# ../libgncmod-app-utils.la \
|
# ../libgncmod-app-utils.la \
|
||||||
# ../../engine/libgw-engine.la \
|
# ../../engine/libgw-engine.la \
|
||||||
# ${top_srcdir}/src/test-core/libgncmod-test.la \
|
# ${top_srcdir}/src/engine/libgw-glib.la \
|
||||||
|
# ${top_srcdir}/src/test-core/libgncmod-test.la
|
||||||
|
|
||||||
bin_PROGRAMS = \
|
bin_PROGRAMS = \
|
||||||
test-link-module
|
test-link-module
|
||||||
# test-exp-parser \
|
# test-exp-parser
|
||||||
|
|
||||||
INCLUDES = \
|
INCLUDES = \
|
||||||
-I${top_srcdir}/src/test-core \
|
-I${top_srcdir}/src/test-core \
|
||||||
|
@ -140,70 +140,6 @@ gnc_tax_info_set_changed (TaxInfoDialog *ti_dialog, gboolean changed)
|
|||||||
ti_dialog->changed = changed;
|
ti_dialog->changed = changed;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *
|
|
||||||
gnc_ui_account_get_tax_info_string (Account *account)
|
|
||||||
{
|
|
||||||
GNCAccountType atype;
|
|
||||||
const char *code;
|
|
||||||
SCM category;
|
|
||||||
SCM code_scm;
|
|
||||||
char *result;
|
|
||||||
char *form;
|
|
||||||
char *desc;
|
|
||||||
SCM scm;
|
|
||||||
|
|
||||||
if (!account)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
if (!xaccAccountGetTaxRelated (account))
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
atype = xaccAccountGetType (account);
|
|
||||||
if (atype != INCOME && atype != EXPENSE)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
code = xaccAccountGetTaxUSCode (account);
|
|
||||||
if (!code)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
initialize_getters ();
|
|
||||||
|
|
||||||
category = gh_eval_str (atype == INCOME ?
|
|
||||||
"txf-income-categories" :
|
|
||||||
"txf-expense-categories");
|
|
||||||
|
|
||||||
code_scm = gh_symbol2scm (code);
|
|
||||||
|
|
||||||
scm = gh_call2 (getters.form, category, code_scm);
|
|
||||||
if (!gh_string_p (scm))
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
form = gh_scm2newstr (scm, NULL);
|
|
||||||
if (!form)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
scm = gh_call2 (getters.description, category, code_scm);
|
|
||||||
if (!gh_string_p (scm))
|
|
||||||
{
|
|
||||||
free (form);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
desc = gh_scm2newstr (scm, NULL);
|
|
||||||
if (!desc)
|
|
||||||
{
|
|
||||||
free (form);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
result = g_strdup_printf ("%s %s", form, desc);
|
|
||||||
|
|
||||||
free (form);
|
|
||||||
free (desc);
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
static GList *
|
static GList *
|
||||||
load_txf_info (gboolean income)
|
load_txf_info (gboolean income)
|
||||||
{
|
{
|
||||||
|
@ -36,6 +36,19 @@
|
|||||||
(use-modules (gnucash gnc-module))
|
(use-modules (gnucash gnc-module))
|
||||||
(gnc:module-load "gnucash/report/report-system" 0)
|
(gnc:module-load "gnucash/report/report-system" 0)
|
||||||
|
|
||||||
|
(export gnc:txf-get-payer-name-source)
|
||||||
|
(export gnc:txf-get-form)
|
||||||
|
(export gnc:txf-get-description)
|
||||||
|
(export gnc:txf-get-format)
|
||||||
|
(export gnc:txf-get-multiple)
|
||||||
|
(export gnc:txf-get-category-key)
|
||||||
|
(export gnc:txf-get-help)
|
||||||
|
(export gnc:txf-get-codes)
|
||||||
|
(export gnc:txf-get-code-info)
|
||||||
|
(export txf-help-categories)
|
||||||
|
(export txf-income-categories)
|
||||||
|
(export txf-expense-categories)
|
||||||
|
|
||||||
(load-from-path "txf-export.scm")
|
(load-from-path "txf-export.scm")
|
||||||
(load-from-path "txf-export-help.scm")
|
(load-from-path "txf-export-help.scm")
|
||||||
|
|
||||||
|
@ -1,3 +1,16 @@
|
|||||||
|
|
||||||
(define-module (gnucash report locale-specific us))
|
(define-module (gnucash report locale-specific us))
|
||||||
(use-modules (gnucash report taxtxf))
|
(use-modules (gnucash report taxtxf))
|
||||||
|
|
||||||
|
(export gnc:txf-get-payer-name-source)
|
||||||
|
(export gnc:txf-get-form)
|
||||||
|
(export gnc:txf-get-description)
|
||||||
|
(export gnc:txf-get-format)
|
||||||
|
(export gnc:txf-get-multiple)
|
||||||
|
(export gnc:txf-get-category-key)
|
||||||
|
(export gnc:txf-get-help)
|
||||||
|
(export gnc:txf-get-codes)
|
||||||
|
(export gnc:txf-get-code-info)
|
||||||
|
(export txf-help-categories)
|
||||||
|
(export txf-income-categories)
|
||||||
|
(export txf-expense-categories)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user