mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
* Refactor a lot of the business code. Move the tax-table dialog
to its own directory/gnc-module. Move the business-gnome glade files to their own directory. Create a business-reports directory for the current and future business reports. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@6967 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
@@ -1,3 +1,10 @@
|
||||
2002-06-16 Derek Atkins <derek@ihtfp.com>
|
||||
|
||||
* Refactor a lot of the business code. Move the tax-table dialog
|
||||
to its own directory/gnc-module. Move the business-gnome glade
|
||||
files to their own directory. Create a business-reports directory
|
||||
for the current and future business reports.
|
||||
|
||||
2002-06-16 Derek Atkins <derek@ihtfp.com>
|
||||
|
||||
Integrate the tax table into the gncEntry object; change how taxes
|
||||
|
||||
@@ -968,8 +968,11 @@ AC_OUTPUT( m4/Makefile intl/Makefile
|
||||
src/business/business-core/Makefile
|
||||
src/business/business-core/test/Makefile
|
||||
src/business/business-core/file/Makefile
|
||||
src/business/dialog-tax-table/Makefile
|
||||
src/business/business-gnome/Makefile
|
||||
src/business/business-gnome/glade/Makefile
|
||||
src/business/business-ledger/Makefile
|
||||
src/business/business-reports/Makefile
|
||||
|
||||
dnl # non-makefiles
|
||||
dnl # Please read doc/build-system before adding *anything* here
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
SUBDIRS = \
|
||||
business-core \
|
||||
dialog-tax-table \
|
||||
business-ledger \
|
||||
business-gnome
|
||||
business-gnome \
|
||||
business-reports
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
SUBDIRS = . glade
|
||||
|
||||
pkglib_LTLIBRARIES = libgncmod-business-gnome.la libgw-business-gnome.la
|
||||
|
||||
AM_CFLAGS = \
|
||||
@@ -33,7 +35,6 @@ libgncmod_business_gnome_la_SOURCES = \
|
||||
dialog-job.c \
|
||||
dialog-order.c \
|
||||
dialog-payment.c \
|
||||
dialog-tax-table.c \
|
||||
dialog-vendor.c \
|
||||
search-owner.c \
|
||||
gnc-business-utils.c
|
||||
@@ -47,7 +48,6 @@ noinst_HEADERS = \
|
||||
dialog-job.h \
|
||||
dialog-order.h \
|
||||
dialog-payment.h \
|
||||
dialog-tax-table.h \
|
||||
dialog-vendor.h \
|
||||
search-owner.h \
|
||||
gnc-business-utils.h
|
||||
@@ -79,18 +79,6 @@ gncscm_DATA = \
|
||||
gncmoddir = ${GNC_SHAREDIR}/guile-modules/gnucash
|
||||
gncmod_DATA = business-gnome.scm
|
||||
|
||||
gladedir = $(GNC_GLADE_DIR)
|
||||
glade_DATA = \
|
||||
customer.glade \
|
||||
date-close.glade \
|
||||
employee.glade \
|
||||
invoice.glade \
|
||||
job.glade \
|
||||
order.glade \
|
||||
payment.glade \
|
||||
tax-tables.glade \
|
||||
vendor.glade
|
||||
|
||||
gwmoddir = ${GNC_GWRAP_LIBDIR}
|
||||
gwmod_DATA = \
|
||||
gw-business-gnome.scm \
|
||||
@@ -98,7 +86,6 @@ gwmod_DATA = \
|
||||
|
||||
EXTRA_DIST = \
|
||||
.cvsignore \
|
||||
${glade_DATA} \
|
||||
${gncmod_DATA} \
|
||||
${gwmod_DATA} \
|
||||
${gncscm_DATA} \
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
(gnc:module-load "gnucash/business-core" 0)
|
||||
(gnc:module-load "gnucash/gnome-search" 0)
|
||||
(gnc:module-load "gnucash/business-core-file" 0)
|
||||
(gnc:module-load "gnucash/dialog-tax-table" 0)
|
||||
|
||||
(define top-level "_Business")
|
||||
(define new-label "New")
|
||||
|
||||
2
src/business/business-gnome/glade/.cvsignore
Normal file
2
src/business/business-gnome/glade/.cvsignore
Normal file
@@ -0,0 +1,2 @@
|
||||
Makefile
|
||||
Makefile.in
|
||||
14
src/business/business-gnome/glade/Makefile.am
Normal file
14
src/business/business-gnome/glade/Makefile.am
Normal file
@@ -0,0 +1,14 @@
|
||||
gladedir = $(GNC_GLADE_DIR)
|
||||
glade_DATA = \
|
||||
customer.glade \
|
||||
date-close.glade \
|
||||
employee.glade \
|
||||
invoice.glade \
|
||||
job.glade \
|
||||
order.glade \
|
||||
payment.glade \
|
||||
vendor.glade
|
||||
|
||||
EXTRA_DIST = \
|
||||
.cvsignore \
|
||||
${glade_DATA}
|
||||
@@ -38,7 +38,6 @@
|
||||
"#include <dialog-job.h>\n"
|
||||
"#include <dialog-order.h>\n"
|
||||
"#include <dialog-payment.h>\n"
|
||||
"#include <dialog-tax-table.h>\n"
|
||||
"#include <dialog-vendor.h>\n"
|
||||
)))
|
||||
|
||||
@@ -206,18 +205,6 @@
|
||||
'((<gnc:GncOwner*> owner) (<gnc:Book*> book))
|
||||
"Dialog: Enter a payment. The owner may be NULL.")
|
||||
|
||||
;;
|
||||
;; dialog-tax-table.h
|
||||
;;
|
||||
|
||||
(gw:wrap-function
|
||||
ws
|
||||
'gnc:tax-table-new
|
||||
'<gw:void>
|
||||
"gnc_ui_tax_table_window_new"
|
||||
'((<gnc:Book*> book))
|
||||
"Dialog: Edit the Tax Tables.")
|
||||
|
||||
;;
|
||||
;; dialog-vendor.h
|
||||
;;
|
||||
|
||||
@@ -22,10 +22,12 @@ libgnc_business_ledger_la_LIBADD = \
|
||||
${top_builddir}/src/gnome-utils/libgncmod-gnome-utils.la \
|
||||
${top_builddir}/src/app-utils/libgncmod-app-utils.la \
|
||||
${top_builddir}/src/register/register-core/libgncmod-register-core.la \
|
||||
${top_builddir}/src/register/register-gnome/libgncmod-register-gnome.la
|
||||
${top_builddir}/src/register/register-gnome/libgncmod-register-gnome.la \
|
||||
${top_builddir}/src/business/dialog-tax-table/libgncmod-dialog-tax-table.la
|
||||
|
||||
AM_CFLAGS = \
|
||||
-I${top_srcdir}/src/business/business-core \
|
||||
-I${top_srcdir}/src/business/dialog-tax-table \
|
||||
-I${top_srcdir}/src \
|
||||
-I${top_srcdir}/src/engine \
|
||||
-I${top_srcdir}/src/gnc-module \
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include "messages.h"
|
||||
#include "table-allgui.h"
|
||||
#include "pricecell.h"
|
||||
#include "dialog-tax-table.h"
|
||||
|
||||
#include "gncEntryLedgerP.h"
|
||||
#include "gncEntryLedgerControl.h"
|
||||
@@ -341,7 +342,7 @@ static gboolean gnc_entry_ledger_traverse (VirtualLocation *p_new_virt_loc,
|
||||
|
||||
ledger->full_refresh = FALSE;
|
||||
|
||||
// table = gnc_ui_new_tax_table_from_name (name); XXX
|
||||
table = gnc_ui_tax_table_new_from_name (ledger->book, name);
|
||||
if (!table)
|
||||
break;
|
||||
|
||||
|
||||
@@ -85,6 +85,16 @@ gnc_entry_ledger_set_watches (GncEntryLedger *ledger, GList *entries)
|
||||
type,
|
||||
GNC_EVENT_MODIFY | GNC_EVENT_DESTROY);
|
||||
|
||||
/* To make sure the xfer cell is up to date */
|
||||
gnc_gui_component_watch_entity_type (ledger->component_id,
|
||||
GNC_ID_ACCOUNT,
|
||||
GNC_EVENT_MODIFY | GNC_EVENT_DESTROY);
|
||||
|
||||
/* To make sure the taxtable cell is up to date */
|
||||
gnc_gui_component_watch_entity_type (ledger->component_id,
|
||||
GNC_TAXTABLE_MODULE_NAME,
|
||||
GNC_EVENT_MODIFY | GNC_EVENT_DESTROY);
|
||||
|
||||
for (node = entries; node; node = node->next)
|
||||
{
|
||||
GncEntry *entry = node->data;
|
||||
|
||||
2
src/business/business-reports/.cvsignore
Normal file
2
src/business/business-reports/.cvsignore
Normal file
@@ -0,0 +1,2 @@
|
||||
Makefile
|
||||
Makefile.in
|
||||
2
src/business/business-reports/Makefile.am
Normal file
2
src/business/business-reports/Makefile.am
Normal file
@@ -0,0 +1,2 @@
|
||||
EXTRA_DIST= \
|
||||
.cvsignore
|
||||
11
src/business/dialog-tax-table/.cvsignore
Normal file
11
src/business/dialog-tax-table/.cvsignore
Normal file
@@ -0,0 +1,11 @@
|
||||
*.la
|
||||
*.lo
|
||||
.deps
|
||||
.libs
|
||||
.scm-links
|
||||
Makefile
|
||||
Makefile.in
|
||||
gw-dialog-tax-table.c
|
||||
gw-dialog-tax-table.h
|
||||
gw-dialog-tax-table.html
|
||||
gw-dialog-tax-table.scm
|
||||
88
src/business/dialog-tax-table/Makefile.am
Normal file
88
src/business/dialog-tax-table/Makefile.am
Normal file
@@ -0,0 +1,88 @@
|
||||
pkglib_LTLIBRARIES = libgncmod-dialog-tax-table.la libgw-dialog-tax-table.la
|
||||
|
||||
AM_CFLAGS = \
|
||||
-I${top_srcdir}/src \
|
||||
-I${top_srcdir}/src/engine \
|
||||
-I${top_srcdir}/src/gnc-module \
|
||||
-I${top_srcdir}/src/gnome-utils \
|
||||
-I${top_srcdir}/src/app-utils \
|
||||
-I${top_srcdir}/src/business/business-core \
|
||||
${GNOME_PRINT_CFLAGS} \
|
||||
${GNOME_INCLUDEDIR} \
|
||||
${GLADE_CFLAGS} \
|
||||
${GTKHTML_CFLAGS} \
|
||||
${GDK_PIXBUF_CFLAGS} \
|
||||
${GLIB_CFLAGS} \
|
||||
${G_WRAP_COMPILE_ARGS} \
|
||||
${GUILE_INCS}
|
||||
|
||||
libgncmod_dialog_tax_table_la_SOURCES = \
|
||||
gncmod-dialog-tax-table.c \
|
||||
dialog-tax-table.c
|
||||
|
||||
noinst_HEADERS = \
|
||||
dialog-tax-table.h
|
||||
|
||||
libgncmod_dialog_tax_table_la_LDFLAGS = -module
|
||||
|
||||
libgncmod_dialog_tax_table_la_LIBADD = \
|
||||
${top_builddir}/src/gnc-module/libgncmodule.la \
|
||||
${GUILE_LIBS} \
|
||||
${GNOMEUI_LIBS} \
|
||||
${G_WRAP_LINK_ARGS} \
|
||||
${GLIB_LIBS} \
|
||||
${EFENCE_LIBS}
|
||||
|
||||
libgw_dialog_tax_table_la_SOURCES = gw-dialog-tax-table.c
|
||||
libgw_dialog_tax_table_la_LDFLAGS = -module ${G_WRAP_LINK_ARGS}
|
||||
|
||||
gwmoddir = ${GNC_GWRAP_LIBDIR}
|
||||
gwmod_DATA = \
|
||||
gw-dialog-tax-table.scm \
|
||||
gw-dialog-tax-table-spec.scm
|
||||
|
||||
gncmoddir = ${GNC_SHAREDIR}/guile-modules/gnucash
|
||||
gncmod_DATA = dialog-tax-table.scm
|
||||
|
||||
gladedir = $(GNC_GLADE_DIR)
|
||||
glade_DATA = tax-tables.glade
|
||||
|
||||
EXTRA_DIST = \
|
||||
.cvsignore \
|
||||
${glade_DATA} \
|
||||
${gwmod_DATA} \
|
||||
${gncmod_DATA}
|
||||
|
||||
if GNUCASH_SEPARATE_BUILDDIR
|
||||
#Only needed when srcdir and builddir are different
|
||||
SCM_FILE_LINKS = gw-dialog-tax-table-spec.scm
|
||||
endif
|
||||
|
||||
.scm-links:
|
||||
rm -f gnucash g-wrapped
|
||||
ln -sf . gnucash
|
||||
ln -sf . g-wrapped
|
||||
if GNUCASH_SEPARATE_BUILDDIR
|
||||
for X in ${SCM_FILE_LINKS} ; do \
|
||||
ln -sf ${srcdir}/$$X . ; \
|
||||
done
|
||||
endif
|
||||
touch .scm-links
|
||||
|
||||
gncmod-dialog-tax-table.c: gw-dialog-tax-table.h
|
||||
|
||||
gw-dialog-tax-table.scm gw-dialog-tax-table.c gw-dialog-tax-table.h: .scm-links gw-dialog-tax-table-spec.scm
|
||||
FLAVOR=gnome guile -c \
|
||||
"(set! %load-path (cons \"${G_WRAP_MODULE_DIR}\" %load-path)) \
|
||||
(set! %load-path (cons \"${PWD}\" %load-path)) \
|
||||
(set! %load-path (cons \"../business-core\" %load-path)) \
|
||||
(set! %load-path (cons \"../../engine\" %load-path)) \
|
||||
(set! %load-path (cons \"../../app-utils\" %load-path)) \
|
||||
(set! %load-path (cons \"../../gnome-utils\" %load-path)) \
|
||||
(primitive-load \"./gw-dialog-tax-table-spec.scm\") \
|
||||
(gw:generate-wrapset \"gw-dialog-tax-table\")"
|
||||
|
||||
BUILT_SOURCES = gw-dialog-tax-table.scm gw-dialog-tax-table.c \
|
||||
gw-dialog-tax-table.h
|
||||
CLEANFILES = ${BUILT_SOURCES} gw-dialog-tax-table.html \
|
||||
${SCM_FILE_LINKS} g-wrapped gnucash .scm-links
|
||||
@@ -41,6 +41,7 @@ typedef struct _new_taxtable {
|
||||
GtkWidget * amount_entry;
|
||||
GtkWidget * acct_tree;
|
||||
|
||||
GncTaxTable * created_table;
|
||||
TaxTableWindow * ttw;
|
||||
GncTaxTableEntry * entry;
|
||||
gint type;
|
||||
@@ -113,6 +114,7 @@ new_tax_table_ok_cb (GtkWidget *widget, gpointer data)
|
||||
gncTaxTableSetName (table, name);
|
||||
/* Reset the current table */
|
||||
ttw->current_table = table;
|
||||
ntt->created_table = table;
|
||||
}
|
||||
|
||||
/* Create/edit the entry */
|
||||
@@ -686,3 +688,50 @@ gnc_ui_tax_table_window_destroy (TaxTableWindow *ttw)
|
||||
|
||||
gnc_close_gui_component (ttw->component_id);
|
||||
}
|
||||
|
||||
static int
|
||||
from_name_close_cb (GnomeDialog *dialog, gpointer data)
|
||||
{
|
||||
NewTaxTable *ntt;
|
||||
GncTaxTable **created_table = data;
|
||||
|
||||
ntt = gtk_object_get_data (GTK_OBJECT (dialog), "dialog_info");
|
||||
|
||||
*created_table = ntt->created_table;
|
||||
|
||||
gtk_main_quit ();
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Create a new tax-table by name */
|
||||
GncTaxTable *
|
||||
gnc_ui_tax_table_new_from_name (GNCBook *book, const char *name)
|
||||
{
|
||||
GncTaxTable *created_table = NULL;
|
||||
TaxTableWindow *ttw;
|
||||
NewTaxTable *ntt;
|
||||
|
||||
if (!book) return NULL;
|
||||
|
||||
ttw = gnc_ui_tax_table_window_new (book);
|
||||
if (!ttw) return NULL;
|
||||
|
||||
ntt = new_tax_table_dialog (ttw, TRUE, NULL);
|
||||
if (!ntt) return NULL;
|
||||
|
||||
gtk_object_set_data (GTK_OBJECT (ntt->dialog), "dialog_info", ntt);
|
||||
gtk_signal_connect (GTK_OBJECT (ntt->dialog), "close",
|
||||
GTK_SIGNAL_FUNC (from_name_close_cb), &created_table);
|
||||
|
||||
/* Preset the name in the new dialog */
|
||||
if (name)
|
||||
gtk_entry_set_text (GTK_ENTRY (ntt->name_entry), name);
|
||||
|
||||
/* I know that NTT is already modal, no need to reset it here */
|
||||
|
||||
/* Now run the dialog -- wait for it to close */
|
||||
gtk_main ();
|
||||
|
||||
return created_table;
|
||||
}
|
||||
@@ -10,6 +10,10 @@
|
||||
typedef struct _taxtable_window TaxTableWindow;
|
||||
|
||||
#include "gnc-book.h"
|
||||
#include "gncTaxTable.h"
|
||||
|
||||
/* Create a new tax-table by name */
|
||||
GncTaxTable * gnc_ui_tax_table_new_from_name (GNCBook *book, const char *name);
|
||||
|
||||
/* Create a tax-table window */
|
||||
TaxTableWindow * gnc_ui_tax_table_window_new (GNCBook *book);
|
||||
2
src/business/dialog-tax-table/dialog-tax-table.scm
Normal file
2
src/business/dialog-tax-table/dialog-tax-table.scm
Normal file
@@ -0,0 +1,2 @@
|
||||
(define-module (gnucash dialog-tax-table))
|
||||
(use-modules (g-wrapped gw-dialog-tax-table))
|
||||
61
src/business/dialog-tax-table/gncmod-dialog-tax-table.c
Normal file
61
src/business/dialog-tax-table/gncmod-dialog-tax-table.c
Normal file
@@ -0,0 +1,61 @@
|
||||
/*********************************************************************
|
||||
* gncmod-dialog-tax-table.c
|
||||
* module definition/initialization for the Business Tax Table Dialog module
|
||||
*
|
||||
* Copyright (c) 2002 Derek Atkins <warlord@MIT.EDU>
|
||||
*********************************************************************/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <guile/gh.h>
|
||||
#include <glib.h>
|
||||
|
||||
#include "gnc-module.h"
|
||||
#include "gnc-module-api.h"
|
||||
#include "gw-dialog-tax-table.h"
|
||||
|
||||
/* version of the gnc module system interface we require */
|
||||
int libgncmod_dialog_tax_table_LTX_gnc_module_system_interface = 0;
|
||||
|
||||
/* module versioning uses libtool semantics. */
|
||||
int libgncmod_dialog_tax_table_LTX_gnc_module_current = 0;
|
||||
int libgncmod_dialog_tax_table_LTX_gnc_module_revision = 0;
|
||||
int libgncmod_dialog_tax_table_LTX_gnc_module_age = 0;
|
||||
|
||||
char *
|
||||
libgncmod_dialog_tax_table_LTX_gnc_module_path(void)
|
||||
{
|
||||
return g_strdup("gnucash/dialog-tax-table");
|
||||
}
|
||||
|
||||
char *
|
||||
libgncmod_dialog_tax_table_LTX_gnc_module_description(void)
|
||||
{
|
||||
return g_strdup("The Gnucash tax-table GNOME UI module");
|
||||
}
|
||||
|
||||
int
|
||||
libgncmod_dialog_tax_table_LTX_gnc_module_init(int refcount)
|
||||
{
|
||||
/* load business-core: we depend on it -- and it depends on the engine */
|
||||
if (!gnc_module_load ("gnucash/business-core", 0)) {
|
||||
return FALSE;
|
||||
}
|
||||
/* We also depend on app-utils and gnome-utils modules */
|
||||
if (!gnc_module_load ("gnucash/app-utils", 0)) {
|
||||
return FALSE;
|
||||
}
|
||||
if (!gnc_module_load ("gnucash/gnome-utils", 0)) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gh_eval_str("(use-modules (g-wrapped gw-dialog-tax-table))");
|
||||
// gh_eval_str("(use-modules (gnucash dialog-tax-table))");
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
int
|
||||
libgncmod_dialog_tax_table_LTX_gnc_module_end(int refcount) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
56
src/business/dialog-tax-table/gw-dialog-tax-table-spec.scm
Normal file
56
src/business/dialog-tax-table/gw-dialog-tax-table-spec.scm
Normal file
@@ -0,0 +1,56 @@
|
||||
;;; -*-scheme-*-
|
||||
|
||||
;(debug-enable 'backtrace)
|
||||
;(debug-enable 'debug)
|
||||
;(read-enable 'positions)
|
||||
|
||||
(debug-set! maxdepth 100000)
|
||||
(debug-set! stack 2000000)
|
||||
|
||||
(define-module (g-wrapped gw-dialog-tax-table-spec)
|
||||
:use-module (g-wrap))
|
||||
|
||||
(use-modules (g-wrap))
|
||||
|
||||
(use-modules (g-wrap gw-standard-spec))
|
||||
(use-modules (g-wrap gw-wct-spec))
|
||||
|
||||
(use-modules (g-wrapped gw-business-core-spec))
|
||||
(use-modules (g-wrapped gw-gnome-utils-spec))
|
||||
|
||||
(let ((ws (gw:new-wrapset "gw-dialog-tax-table")))
|
||||
|
||||
(gw:wrapset-depends-on ws "gw-standard")
|
||||
|
||||
(gw:wrapset-depends-on ws "gw-business-core")
|
||||
(gw:wrapset-depends-on ws "gw-engine")
|
||||
(gw:wrapset-depends-on ws "gw-gnome-utils")
|
||||
|
||||
(gw:wrapset-set-guile-module! ws '(g-wrapped gw-dialog-tax-table))
|
||||
|
||||
(gw:wrapset-add-cs-declarations!
|
||||
ws
|
||||
(lambda (wrapset client-wrapset)
|
||||
(list
|
||||
"#include <dialog-tax-table.h>\n"
|
||||
)))
|
||||
|
||||
(gw:wrapset-add-cs-initializers!
|
||||
ws
|
||||
(lambda (wrapset client-wrapset status-var)
|
||||
(if client-wrapset
|
||||
'()
|
||||
(gw:inline-scheme '(use-modules (gnucash dialog-tax-table))))))
|
||||
|
||||
;;
|
||||
;; dialog-tax-table.h
|
||||
;;
|
||||
|
||||
(gw:wrap-function
|
||||
ws
|
||||
'gnc:tax-table-new
|
||||
'<gw:void>
|
||||
"gnc_ui_tax_table_window_new"
|
||||
'((<gnc:Book*> book))
|
||||
"Dialog: Edit the Tax Tables.")
|
||||
)
|
||||
Reference in New Issue
Block a user