diff --git a/ChangeLog b/ChangeLog index b8452b19a3..1094fbf412 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,20 @@ +2001-10-03 Robert Graham Merkel + + * */Makefile.am: changes for automake 1.5 compatibility (still not + perfect). + + * configure.in: changes for automake 1.5 compatibility + + * src/engine/transaction.c: store values as well as amounts in voided splits' + kvp frames + + * src/engine/gw-engine-spec.scm: wrap voiding functions + + * src/report/report-system/report-utilities.scm: added some convenience functions + for adding voiding checks to queries and checking the voiding status of splits. + + * src/report/standard-reports/*: fixed up queries to exclude voids as appropriate. + 2001-10-01 Robert Graham Merkel * src/engine/Transaction.{ch} (xaccTransVoid), (xaccTransGetVoidStatus), diff --git a/Makefile.am b/Makefile.am index 293acae001..fde5587342 100644 --- a/Makefile.am +++ b/Makefile.am @@ -52,7 +52,7 @@ EXTRA_DIST = \ bin_SCRIPTS = gnucash-config BUILT_SOURCES = gnucash-config -CLEANFILES += gnucash-config +CLEANFILES = gnucash-config ## We borrow guile's convention and use @-...-@ as the substitution ## brackets here, instead of the usual @...@. This prevents autoconf @@ -90,7 +90,7 @@ gnucash-config: gnucash-config.in mv $@.tmp $@ -DISTCLEANFILES += \ +DISTCLEANFILES = \ cscope.files cscope.out etags.files make-gnucash-patch cscope.files: diff --git a/accounts/C/Makefile.am b/accounts/C/Makefile.am index 4a73a14616..e1906f818d 100644 --- a/accounts/C/Makefile.am +++ b/accounts/C/Makefile.am @@ -33,8 +33,6 @@ EXTRA_DIST = \ acctlist_renter.gnucash-xea \ acctlist_retiremt.gnucash-xea \ acctlist_spouseinc.gnucash-xea \ - acctlist_spouseretire.gnucash-xea - -EXTRA_DIST = \ + acctlist_spouseretire.gnucash-xea \ ${account_DATA} \ .cvsignore diff --git a/configure.in b/configure.in index c975320949..b79bd66b45 100644 --- a/configure.in +++ b/configure.in @@ -18,6 +18,9 @@ dnl Process this file with autoconf to produce a configure script. # Libraries - Check for libraries # Footer - Autoconf footer stuff + +## Do this first, because the other tests depend on it: + ### -------------------------------------------------------------------------- ### Headers ### check for various programs, and stuff (do this first because later @@ -25,6 +28,8 @@ dnl Process this file with autoconf to produce a configure script. AC_INIT(src/guile/gnucash.h) +AC_PROG_CC + GNUCASH_MAJOR_VERSION=1 GNUCASH_MINOR_VERSION=7 GNUCASH_MICRO_VERSION=0 @@ -35,6 +40,7 @@ AC_SUBST(GNUCASH_MINOR_VERSION) AC_SUBST(GNUCASH_MICRO_VERSION) AM_INIT_AUTOMAKE(gnucash,$GNUCASH_VERSION) +AM_PROG_XML_I18N_TOOLS AM_CONFIG_HEADER(config.h) AC_DEFINE_UNQUOTED(GNUCASH_MAJOR_VERSION, $GNUCASH_MAJOR_VERSION) @@ -45,13 +51,11 @@ dnl Set of available languages. ALL_LINGUAS="da de en_GB es fr it ja no pt_PT ru sv" AM_GNU_GETTEXT -AM_PROG_XML_I18N_TOOLS AC_CANONICAL_HOST AM_MAINTAINER_MODE AM_ACLOCAL_INCLUDE(macros) -AC_PROG_CC AC_PROG_INSTALL AM_PROG_LIBTOOL diff --git a/doc-tools/Makefile.am b/doc-tools/Makefile.am index f8e84d5634..a727db0486 100644 --- a/doc-tools/Makefile.am +++ b/doc-tools/Makefile.am @@ -25,4 +25,4 @@ build-help-index: build-help-index.in chmod +x $@.tmp mv $@.tmp $@ -CLEANFILES += build-help-index +CLEANFILES = build-help-index diff --git a/intl-scm/Makefile.am b/intl-scm/Makefile.am index f3f55912f9..5a5a1a1f6e 100644 --- a/intl-scm/Makefile.am +++ b/intl-scm/Makefile.am @@ -6,6 +6,6 @@ EXTRA_DIST = \ guile-strings.c: rm -f guile-strings.c guile -s ./xgettext.scm `find ../src -name '*.scm'` -CLEANFILES += guile-strings.c +CLEANFILES = guile-strings.c all-local: guile-strings.c diff --git a/macros/autogen.sh b/macros/autogen.sh index a3eece2ed9..4c69a06cc2 100644 --- a/macros/autogen.sh +++ b/macros/autogen.sh @@ -167,7 +167,7 @@ do automake --add-missing --gnu $am_opt || { echo "**Error**: automake failed."; exit 1; } echo "Running autoconf ..." - autoconf || { echo "**Error**: autoconf failed."; exit 1; } + autoconf2.50 || { echo "**Error**: autoconf failed."; exit 1; } ) || exit 1 fi done diff --git a/rpm/Makefile.am b/rpm/Makefile.am index 4b92f1074f..8f342d0282 100644 --- a/rpm/Makefile.am +++ b/rpm/Makefile.am @@ -15,4 +15,4 @@ gnucash.spec: gnucash.spec.in Makefile -e 's:@-VERSION-@:${VERSION}:' mv $@.tmp $@ -CLEANFILES += gnucash.spec +CLEANFILES = gnucash.spec diff --git a/src/Makefile.am b/src/Makefile.am index ceed7a2ce2..3a9b2eca21 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -108,7 +108,7 @@ gnucash-run-script: gnucash-run-script.in -e 's:@-G_WRAP_MODULE_DIR-@:${G_WRAP_MODULE_DIR}:' mv $@.tmp $@ BUILT_SOURCES = gnucash-run-script -CLEANFILES += gnucash-run-script +CLEANFILES = gnucash-run-script gnucash-make-guids: gnucash-make-guids.in rm -f $@.tmp diff --git a/src/app-file/Makefile.am b/src/app-file/Makefile.am index ce1e0dae11..2f5e74b409 100644 --- a/src/app-file/Makefile.am +++ b/src/app-file/Makefile.am @@ -62,6 +62,6 @@ gw-app-file.c gw-app-file.h: .scm-links gw-app-file-spec.scm (primitive-load \"./gw-app-file-spec.scm\") \ (gw:generate-module \"gw-app-file\")" -BUILT_SOURCES += gw-app-file.c gw-app-file.h -CLEANFILES += gw-app-file.c gw-app-file.h gw-app-file.html \ +BUILT_SOURCES = gw-app-file.c gw-app-file.h +CLEANFILES = gw-app-file.c gw-app-file.h gw-app-file.html \ gnucash g-wrapped .scm-links diff --git a/src/app-utils/Makefile.am b/src/app-utils/Makefile.am index 8a92ca3aba..0124b37e47 100644 --- a/src/app-utils/Makefile.am +++ b/src/app-utils/Makefile.am @@ -88,6 +88,6 @@ gw-app-utils.c gw-app-utils.h: .scm-links gw-app-utils-spec.scm (primitive-load \"./gw-app-utils-spec.scm\") \ (gw:generate-module \"gw-app-utils\")" -BUILT_SOURCES += gw-app-utils.c gw-app-utils.h -CLEANFILES += gw-app-utils.c gw-app-utils.h gw-app-utils.html \ +BUILT_SOURCES = gw-app-utils.c gw-app-utils.h +CLEANFILES = gw-app-utils.c gw-app-utils.h gw-app-utils.html \ gnucash g-wrapped .scm-links diff --git a/src/engine/Makefile.am b/src/engine/Makefile.am index c17d437b34..fbe05c8d12 100644 --- a/src/engine/Makefile.am +++ b/src/engine/Makefile.am @@ -139,5 +139,5 @@ gw-kvp.c gw-kvp.h: .scm-links gw-kvp-spec.scm (primitive-load \"./gw-kvp-spec.scm\") \ (gw:generate-module \"gw-kvp\")" -BUILT_SOURCES += gw-engine.c gw-engine.h gw-glib.c gw-glib.h gw-kvp.c gw-kvp.h -CLEANFILES += gw-engine.c gw-engine.h gw-engine.html gw-glib.c gw-glib.h gw-glib.html gnucash g-wrapped .scm-links gw-kvp.c gw-kvp.h +BUILT_SOURCES = gw-engine.c gw-engine.h gw-glib.c gw-glib.h gw-kvp.c gw-kvp.h +CLEANFILES = gw-engine.c gw-engine.h gw-engine.html gw-glib.c gw-glib.h gw-glib.html gnucash g-wrapped .scm-links gw-kvp.c gw-kvp.h diff --git a/src/engine/Transaction.c b/src/engine/Transaction.c index e812f33de2..8f920431fe 100644 --- a/src/engine/Transaction.c +++ b/src/engine/Transaction.c @@ -67,6 +67,7 @@ int force_double_entry = 0; const char *void_reason_str = "void-reason"; const char *void_former_amt_str = "void-former-amount"; +const char *void_former_val_str = "void-former-value"; #define PRICE_SIGFIGS 6 @@ -2590,6 +2591,10 @@ xaccTransVoid(Transaction *transaction, kvp_frame_set_slot_nc(frame, void_former_amt_str, val); + amt = xaccSplitGetValue(split); + val = kvp_value_new_gnc_numeric(amt); + kvp_frame_set_slot_nc(frame, void_former_val_str, val); + xaccSplitSetAmount(split, zero); xaccSplitSetReconcile(split, VREC); } @@ -2651,5 +2656,24 @@ gnc_numeric xaccSplitVoidFormerAmount(Split *split) return amt; } + +gnc_numeric xaccSplitVoidFormerValue(Split *split) +{ + kvp_frame *frame; + kvp_value *val; + gnc_numeric amt = gnc_numeric_zero(); + g_return_val_if_fail(split, amt); + + frame = xaccSplitGetSlots(split); + + val = kvp_frame_get_slot(frame, void_former_val_str); + + if(val) + { + amt = kvp_value_get_numeric(val); + } + + return amt; +} /************************ END OF ************************************\ \************************* FILE *************************************/ diff --git a/src/engine/Transaction.h b/src/engine/Transaction.h index a9355db0aa..9f2c317841 100644 --- a/src/engine/Transaction.h +++ b/src/engine/Transaction.h @@ -495,5 +495,6 @@ gboolean xaccTransGetVoidStatus(Transaction *transaction); char *xaccTransGetVoidReason(Transaction *transaction); gnc_numeric xaccSplitVoidFormerAmount(Split *split); +gnc_numeric xaccSplitVoidFormerValue(Split *split); #endif /* XACC_TRANSACTION_H */ diff --git a/src/engine/gw-engine-spec.scm b/src/engine/gw-engine-spec.scm index 40ab034154..adda38b6b7 100644 --- a/src/engine/gw-engine-spec.scm +++ b/src/engine/gw-engine-spec.scm @@ -356,7 +356,7 @@ "QueryOp" "const QueryOp"))) (gw:enum-add-value! wt "QUERY_AND" 'query-and) (gw:enum-add-value! wt "QUERY_OR" 'query-or) - (gw:enum-add-value! wt "QUERY_NAND" 'query-nadd) + (gw:enum-add-value! wt "QUERY_NAND" 'query-nand) (gw:enum-add-value! wt "QUERY_NOR" 'query-nor) (gw:enum-add-value! wt "QUERY_XOR" 'query-xor)) @@ -733,6 +733,47 @@ value. It is meant to be a short descriptive phrase.") '(( t)) "Return the transaction notes field.") + (gw:wrap-function + mod + 'gnc:transaction-void + '() + "xaccTransVoid" + '(( transaction) + (( gw:const) reason)) + "Void a transaction") + + (gw:wrap-function + mod + 'gnc:transaction-get-void-status + ' + "xaccTransGetVoidStatus" + '(( transaction)) + "Return true if a transaction has been voided") + + (gw:wrap-function + mod + 'gnc:transaction-get-void-reason + ' + "xaccTransGetVoidReason" + '(( transaction)) + "return a string indicating reason for voiding") + + (gw:wrap-function + mod + 'gnc:split-void-former-amount + ' + "xaccSplitVoidFormerAmount" + '(( split)) + "get what the split's amount before voiding") + + (gw:wrap-function + mod + 'gnc:split-void-former-value + ' + "xaccSplitVoidFormerValue" + '(( split)) + "get what the split's value was before voiding") + (gw:wrap-function mod 'gnc:dmy2timespec @@ -1944,7 +1985,7 @@ of having a parent transaction with which one is working...") 'gnc:query-add-cleared-match ' "xaccQueryAddClearedMatch" - '(( q) ( cleared-how) ( how)) + '(( q) ( cleared-how) ( how)) "match the cleared state.") (gw:wrap-function diff --git a/src/experimental/cgi-bin/Makefile.am b/src/experimental/cgi-bin/Makefile.am index bf241bac4a..1737760ab5 100644 --- a/src/experimental/cgi-bin/Makefile.am +++ b/src/experimental/cgi-bin/Makefile.am @@ -5,13 +5,13 @@ bin_PROGRAMS = hello hello2 fastcgi-hello hello3 gnc-server EXTRA_DIST = .cvsignore -CFLAGS = @CFLAGS@ ${GLIB_CFLAGS} +CFLAGS = ${GLIB_CFLAGS} LDADD = \ ../../engine/libgncengine.la \ -lxml -lghttp -lglib -lfcgi -ldl -INCLUDES = +#INCLUDES = hello_SOURCES = \ hello.c @@ -31,11 +31,11 @@ gnc_server_SOURCES = \ noinst_HEADERS = -EXTRA_DIST = \ +EXTRA_DIST += \ .cvsignore \ README -CFLAGS = @CFLAGS@ +#CFLAGS = @CFLAGS@ # glib puts its header files in a bizarre place ... INCLUDES = \ diff --git a/src/gnc-module/Makefile.am b/src/gnc-module/Makefile.am index ab2b7f5645..11253668dd 100644 --- a/src/gnc-module/Makefile.am +++ b/src/gnc-module/Makefile.am @@ -42,6 +42,6 @@ gw-gnc-module.c gw-gnc-module.h: gw-gnc-module-spec.scm (primitive-load \"./gw-gnc-module-spec.scm\") \ (gw:generate-module \"gw-gnc-module\")" -BUILT_SOURCES += gw-gnc-module.h gw-gnc-module.c -CLEANFILES += gw-gnc-module.h gw-gnc-module.c gw-gnc-module.html g-wrapped \ +BUILT_SOURCES = gw-gnc-module.h gw-gnc-module.c +CLEANFILES = gw-gnc-module.h gw-gnc-module.c gw-gnc-module.html g-wrapped \ gnucash .scm-links diff --git a/src/gnc-module/test/misc-mods/Makefile.am b/src/gnc-module/test/misc-mods/Makefile.am index e00b6a72d7..cd053cc2ee 100644 --- a/src/gnc-module/test/misc-mods/Makefile.am +++ b/src/gnc-module/test/misc-mods/Makefile.am @@ -13,4 +13,4 @@ libincompatdep_la_LDFLAGS=-module libagedver_la_SOURCES=agedver.c libagedver_la_LDFLAGS=-module -CLEANFILES += *.so* *.a +CLEANFILES = *.so* *.a diff --git a/src/gnc-module/test/mod-bar/Makefile.am b/src/gnc-module/test/mod-bar/Makefile.am index 58b59376ab..7f953a44c6 100644 --- a/src/gnc-module/test/mod-bar/Makefile.am +++ b/src/gnc-module/test/mod-bar/Makefile.am @@ -24,5 +24,5 @@ bar-gwrap.c bar-gwrap.h: bar-gwrap.scm (primitive-load \"./bar-gwrap.scm\") \ (gw:generate-module \"bar-gwrap\")" -BUILT_SOURCES += bar-gwrap.c bar-gwrap.h -CLEANFILES += *.so* *.a bar-gwrap.c bar-gwrap.h bar-gwrap.html +BUILT_SOURCES = bar-gwrap.c bar-gwrap.h +CLEANFILES = *.so* *.a bar-gwrap.c bar-gwrap.h bar-gwrap.html diff --git a/src/gnc-module/test/mod-baz/Makefile.am b/src/gnc-module/test/mod-baz/Makefile.am index 06351cce31..ff50113ecc 100644 --- a/src/gnc-module/test/mod-baz/Makefile.am +++ b/src/gnc-module/test/mod-baz/Makefile.am @@ -26,5 +26,5 @@ baz-gwrap.c baz-gwrap.h: baz-gwrap.scm (primitive-load \"./baz-gwrap.scm\") \ (gw:generate-module \"baz-gwrap\")" -BUILT_SOURCES += baz-gwrap.c baz-gwrap.h -CLEANFILES += *.so* *.a baz-gwrap.c baz-gwrap.h baz-gwrap.html +BUILT_SOURCES = baz-gwrap.c baz-gwrap.h +CLEANFILES = *.so* *.a baz-gwrap.c baz-gwrap.h baz-gwrap.html diff --git a/src/gnc-module/test/mod-foo/Makefile.am b/src/gnc-module/test/mod-foo/Makefile.am index fe9e97edf7..05ae6519ee 100644 --- a/src/gnc-module/test/mod-foo/Makefile.am +++ b/src/gnc-module/test/mod-foo/Makefile.am @@ -24,5 +24,5 @@ foo-gwrap.c foo-gwrap.h: foo-gwrap.scm (primitive-load \"./foo-gwrap.scm\") \ (gw:generate-module \"foo-gwrap\")" -BUILT_SOURCES += foo-gwrap.c foo-gwrap.h -CLEANFILES += *.so* *.a foo-gwrap.c foo-gwrap.h foo-gwrap.html +BUILT_SOURCES = foo-gwrap.c foo-gwrap.h +CLEANFILES = *.so* *.a foo-gwrap.c foo-gwrap.h foo-gwrap.html diff --git a/src/gnome-utils/Makefile.am b/src/gnome-utils/Makefile.am index 43f10108f7..669e745292 100644 --- a/src/gnome-utils/Makefile.am +++ b/src/gnome-utils/Makefile.am @@ -104,7 +104,7 @@ gnc-dir.h: gnc-dir.h.in -e 's:@-GNC_GLADE_DIR-@:${GNC_GLADE_DIR}:g' \ -e 's:@-GNC_PIXMAP_DIR-@:${GNC_PIXMAP_DIR}:g' mv $@.tmp $@ -BUILT_SOURCES += gnc-dir.h +BUILT_SOURCES = gnc-dir.h # We have to do this because otherwise automake insists on putting # these files into the dist tarfile. If there's a a better way, diff --git a/src/gnome/Makefile.am b/src/gnome/Makefile.am index 34d030c8d8..81ee842e9e 100644 --- a/src/gnome/Makefile.am +++ b/src/gnome/Makefile.am @@ -118,7 +118,9 @@ INCLUDES = \ # We build this in an earlier directory. -OMIT_DEPENDENCIES = gnc-dir.h + +# The line below breaks automake 1.5. +##OMIT_DEPENDENCIES = gnc-dir.h ## We borrow guile's convention and use @-...-@ as the substitution ## brackets here, instead of the usual @...@. This prevents autoconf diff --git a/src/import-export/binary-import/Makefile.am b/src/import-export/binary-import/Makefile.am index a6c8d404fa..05fdefae9a 100644 --- a/src/import-export/binary-import/Makefile.am +++ b/src/import-export/binary-import/Makefile.am @@ -88,6 +88,6 @@ gw-binary-import.c gw-binary-import.h: .scm-links gw-binary-import-spec.scm (primitive-load \"./gw-binary-import-spec.scm\") \ (gw:generate-module \"gw-binary-import\")" -BUILT_SOURCES += gw-binary-import.c gw-binary-import.h -CLEANFILES += gw-binary-import.c gw-binary-import.h gw-binary-import.html \ +BUILT_SOURCES = gw-binary-import.c gw-binary-import.h +CLEANFILES = gw-binary-import.c gw-binary-import.h gw-binary-import.html \ gnucash g-wrapped .scm-links diff --git a/src/import-export/qif-io-core/Makefile.am b/src/import-export/qif-io-core/Makefile.am index a1aa8af419..657af0b4f3 100644 --- a/src/import-export/qif-io-core/Makefile.am +++ b/src/import-export/qif-io-core/Makefile.am @@ -30,4 +30,4 @@ gncscm_DATA = \ qif-parse.scm \ qif-record-xform.scm -CLEANFILES += gnucash import-export .scm-links +CLEANFILES = gnucash import-export .scm-links diff --git a/src/optional/swig/Makefile.am b/src/optional/swig/Makefile.am index 414a5eb2a4..788849193c 100644 --- a/src/optional/swig/Makefile.am +++ b/src/optional/swig/Makefile.am @@ -90,7 +90,7 @@ gnucash.engine.i: ${SWIG_INPUT_HDRS} perl5_typemaps.i echo "%include \"`basename $$file`\"" >> $@; \ done -CLEANFILES += gnucash.engine.i +CLEANFILES = gnucash.engine.i gnucash.engine_wrap.doc gnucash-engine-perl5_wrap_int.c: gnucash.engine.i ${SWIG} -perl5 -I.. -I${top_srcdir}/src/engine -o $@ gnucash.engine.i diff --git a/src/quotes/Makefile.am b/src/quotes/Makefile.am index fd81389753..31cc376379 100644 --- a/src/quotes/Makefile.am +++ b/src/quotes/Makefile.am @@ -23,7 +23,7 @@ finance-quote-helper: finance-quote-helper.in -e 's:@-PERLINCL-@:${PERLINCL}:g' chmod +x $@.tmp mv $@.tmp $@ -CLEANFILES += finance-quote-helper +CLEANFILES = finance-quote-helper update-finance-quote: update-finance-quote.in rm -f $@.tmp diff --git a/src/report/locale-specific/us/Makefile.am b/src/report/locale-specific/us/Makefile.am index d36d24430f..d1bc94d6ff 100644 --- a/src/report/locale-specific/us/Makefile.am +++ b/src/report/locale-specific/us/Makefile.am @@ -29,4 +29,4 @@ EXTRA_DIST = \ ${gncscmmod_DATA} \ ${gncscmothermod_DATA} -CLEANFILES += gnucash report locale-specific us .scm-links +CLEANFILES = gnucash report locale-specific us .scm-links diff --git a/src/report/report-system/Makefile.am b/src/report/report-system/Makefile.am index 769e49b0f8..22a1a0d30d 100644 --- a/src/report/report-system/Makefile.am +++ b/src/report/report-system/Makefile.am @@ -50,4 +50,4 @@ gncscm_DATA = \ EXTRA_DIST = ${gncscmmod_DATA} ${gncscm_DATA} -CLEANFILES += gnucash report .scm-links +CLEANFILES = gnucash report .scm-links diff --git a/src/report/report-system/commodity-utilities.scm b/src/report/report-system/commodity-utilities.scm index 5341044558..262b96af1c 100644 --- a/src/report/report-system/commodity-utilities.scm +++ b/src/report/report-system/commodity-utilities.scm @@ -42,6 +42,7 @@ (splits #f)) (gnc:query-set-group query (gnc:get-current-group)) + (gnc:query-set-match-non-voids-only! query (gnc:get-current-group)) (gnc:query-add-account-match query (gnc:list->glist currency-accounts) 'acct-match-any 'query-and) diff --git a/src/report/report-system/report-system.scm b/src/report/report-system/report-system.scm index a2b064bf9b..e558d1fd6d 100644 --- a/src/report/report-system/report-system.scm +++ b/src/report/report-system/report-system.scm @@ -535,6 +535,9 @@ (export gnc:account-get-balance-interval) (export gnc:account-get-comm-balance-interval) (export gnc:group-get-comm-balance-interval) +(export gnc:query-set-match-non-voids-only!) +(export gnc:query-set-match-voids-only!) +(export gnc:split-voided?) (load-from-path "commodity-utilities.scm") (load-from-path "html-barchart.scm") diff --git a/src/report/report-system/report-utilities.scm b/src/report/report-system/report-utilities.scm index 2af5dfac7e..fa6eaee3c0 100644 --- a/src/report/report-system/report-utilities.scm +++ b/src/report/report-system/report-utilities.scm @@ -579,3 +579,34 @@ (gnc:account-get-comm-balance-interval account from to #t)) group)) this-collector)) + +;; utility function - ensure that a query matches only non-voids. Destructive. +(define (gnc:query-set-match-non-voids-only! query group) + (let ((temp-query (gnc:malloc-query))) + (gnc:query-set-group temp-query group) + + (gnc:query-add-cleared-match + temp-query + 'cleared-match-voided + 'query-and) + + (set! temp-query (gnc:query-invert temp-query)) + + (set! query (gnc:query-merge query temp-query 'query-and)))) + +;; utility function - ensure that a query matches only voids. Destructive + +(define (gnc:query-set-match-voids-only! query group) + (let ((temp-query (gnc:malloc-query))) + (gnc:query-set-group temp-query group) + + (gnc:query-add-cleared-match + temp-query + 'cleared-match-voided + 'query-and) + + (set! query (gnc:query-merge query temp-query 'query-and)))) + +(define (gnc:split-voided? split) + (let ((trans (gnc:split-get-parent split))) + (gnc:transaction-get-void-status trans))) \ No newline at end of file diff --git a/src/report/standard-reports/Makefile.am b/src/report/standard-reports/Makefile.am index 3d060b0a22..d30fa3459b 100644 --- a/src/report/standard-reports/Makefile.am +++ b/src/report/standard-reports/Makefile.am @@ -35,4 +35,4 @@ gncscmmod_DATA = \ EXTRA_DIST = ${gncscmmod_DATA} -CLEANFILES += gnucash report .scm-links +CLEANFILES = gnucash report .scm-links diff --git a/src/report/standard-reports/average-balance.scm b/src/report/standard-reports/average-balance.scm index e8a91bf8f2..efd5bd0a93 100644 --- a/src/report/standard-reports/average-balance.scm +++ b/src/report/standard-reports/average-balance.scm @@ -320,7 +320,10 @@ ;; initialize the query to find splits in the right ;; date range and accounts (gnc:query-set-group query (gnc:get-current-group)) - + + ;; for balance purposes, we don't need to do this, but it cleans up + ;; the table display. + (gnc:query-set-match-non-voids-only! query (gnc:get-current-group)) ;; add accounts to the query (include subaccounts ;; if requested) (if dosubs? diff --git a/src/report/standard-reports/payables.scm b/src/report/standard-reports/payables.scm index 00c3bf97f7..2d8110cbe1 100644 --- a/src/report/standard-reports/payables.scm +++ b/src/report/standard-reports/payables.scm @@ -262,6 +262,7 @@ more than one currency. This report is not designed to cope with this possibili (gnc:debug "begindate" begindate) (gnc:debug "date" date) (gnc:query-set-group query (gnc:get-current-group)) + (gnc:query-set-match-non-voids-only! query (gnc:get-current-group)) (gnc:query-add-single-account-match query account 'query-and) (gnc:query-add-date-match-timepair query #t begindate #t date 'query-and) (gnc:query-set-sort-order query 'by-date 'by-none 'by-none) diff --git a/src/report/standard-reports/transaction.scm b/src/report/standard-reports/transaction.scm index 2a1746894f..001d20a1f9 100644 --- a/src/report/standard-reports/transaction.scm +++ b/src/report/standard-reports/transaction.scm @@ -49,6 +49,7 @@ (define optname-sec-sortkey (N_ "Secondary Key")) (define optname-sec-subtotal (N_ "Secondary Subtotal")) (define optname-sec-date-subtotal (N_ "Secondary Subtotal for Date Key")) +(define optname-void-transactions (N_ "Void Transactions?")) (define def:grand-total-style "grand-total") (define def:normal-row-style "normal-row") (define def:alternate-row-style "alternate-row") @@ -336,7 +337,9 @@ (currency (if account (gnc:account-get-commodity account) (gnc:default-currency))) - (damount (gnc:split-get-amount split)) + (damount (if (gnc:split-voided? split) + (gnc:split-void-former-amount split) + (gnc:split-get-amount split))) (split-value (gnc:make-gnc-monetary currency (if (member account-type account-types-to-reverse) @@ -490,7 +493,31 @@ (N_ "Exclude Transactions to/from Filter Accounts") (N_ "Exclude transactions to/from all filter accounts")) ))) - + + + ;; + + (gnc:register-trep-option + (gnc:make-multichoice-option + gnc:pagename-accounts optname-void-transactions + "d" (N_ "how to handle void transactions") + 'non-void-only + (list (vector + 'non-void-only + (N_ "Non-void only") + (N_ "Show only non-voided transactions")) + (vector + 'void-only + (N_ "Void only") + (N_ "Show only voided transactions")) + (vector + 'both + (N_ "Both") + (N_ "Show both (and include void transactions in totals)"))))) + + + 'void-only + 'all ;; Sorting options @@ -1045,6 +1072,7 @@ and Income accounts"))))) (primary-order (opt-val pagename-sorting "Primary Sort Order")) (secondary-key (opt-val pagename-sorting optname-sec-sortkey)) (secondary-order (opt-val pagename-sorting "Secondary Sort Order")) + (void-status (opt-val gnc:pagename-accounts optname-void-transactions)) (splits '()) (query (gnc:malloc-query))) @@ -1069,6 +1097,13 @@ and Income accounts"))))) (eq? secondary-order 'ascend) #t) + (case void-status + (('non-void-only) + (gnc:query-set-match-non-voids-only! query (gnc:get-current-group))) + (('void-only) + (gnc:query-set-match-voids-only! query (gnc:get-current-group))) + (else #f)) + (set! splits (gnc:glist->list (gnc:query-get-splits query) )) ;;(gnc:warn "Splits in trep-renderer:" splits) diff --git a/src/report/stylesheets/Makefile.am b/src/report/stylesheets/Makefile.am index 1a7f948113..678baedc8e 100644 --- a/src/report/stylesheets/Makefile.am +++ b/src/report/stylesheets/Makefile.am @@ -25,5 +25,5 @@ gncscmmod_DATA = \ EXTRA_DIST = ${gncscmmod_DATA} -CLEANFILES += gnucash report .scm-links +CLEANFILES = gnucash report .scm-links diff --git a/src/report/utility-reports/Makefile.am b/src/report/utility-reports/Makefile.am index 9ea6f8d614..860393b013 100644 --- a/src/report/utility-reports/Makefile.am +++ b/src/report/utility-reports/Makefile.am @@ -27,4 +27,4 @@ gncscmmod_DATA = \ EXTRA_DIST = ${gncscmmod_DATA} -CLEANFILES += gnucash report .scm-links +CLEANFILES = gnucash report .scm-links diff --git a/src/scm/Makefile.am b/src/scm/Makefile.am index c9733a5243..a68bc05d2e 100644 --- a/src/scm/Makefile.am +++ b/src/scm/Makefile.am @@ -35,7 +35,7 @@ noinst_DATA = .scm-links ln -sf . gnucash touch .scm-links -CLEANFILES += .scm-links gnucash +CLEANFILES = .scm-links gnucash SCM_FILES = ${gncscm_DATA} ${gncscmmod_DATA} diff --git a/src/tax/us/Makefile.am b/src/tax/us/Makefile.am index 24030f1f2d..5f6ee5b0a4 100644 --- a/src/tax/us/Makefile.am +++ b/src/tax/us/Makefile.am @@ -27,4 +27,4 @@ EXTRA_DIST = \ ${gncscmmod_DATA} \ ${gncscm_DATA} -CLEANFILES += gnucash tax .scm-links +CLEANFILES = gnucash tax .scm-links