automake 1.5 fixes and further work on transaction voiding

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@5456 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Robert Graham Merkel 2001-10-03 07:08:31 +00:00
parent aeff5c25de
commit 873ed2c9b3
40 changed files with 211 additions and 50 deletions

View File

@ -1,3 +1,20 @@
2001-10-03 Robert Graham Merkel <rgmerk@mira.net>
* */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 <rgmerk@mira.net>
* src/engine/Transaction.{ch} (xaccTransVoid), (xaccTransGetVoidStatus),

View File

@ -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:

View File

@ -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

View File

@ -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

View File

@ -25,4 +25,4 @@ build-help-index: build-help-index.in
chmod +x $@.tmp
mv $@.tmp $@
CLEANFILES += build-help-index
CLEANFILES = build-help-index

View File

@ -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

View File

@ -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

View File

@ -15,4 +15,4 @@ gnucash.spec: gnucash.spec.in Makefile
-e 's:@-VERSION-@:${VERSION}:'
mv $@.tmp $@
CLEANFILES += gnucash.spec
CLEANFILES = gnucash.spec

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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 *************************************/

View File

@ -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 */

View File

@ -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.")
'((<gnc:Transaction*> t))
"Return the transaction notes field.")
(gw:wrap-function
mod
'gnc:transaction-void
'(<gw:void>)
"xaccTransVoid"
'((<gnc:Transaction*> transaction)
((<gw:m-chars-caller-owned> gw:const) reason))
"Void a transaction")
(gw:wrap-function
mod
'gnc:transaction-get-void-status
'<gw:bool>
"xaccTransGetVoidStatus"
'((<gnc:Transaction*> transaction))
"Return true if a transaction has been voided")
(gw:wrap-function
mod
'gnc:transaction-get-void-reason
'<gw:m-chars-callee-owned>
"xaccTransGetVoidReason"
'((<gnc:Transaction*> transaction))
"return a string indicating reason for voiding")
(gw:wrap-function
mod
'gnc:split-void-former-amount
'<gnc:numeric>
"xaccSplitVoidFormerAmount"
'((<gnc:Split*> split))
"get what the split's amount before voiding")
(gw:wrap-function
mod
'gnc:split-void-former-value
'<gnc:numeric>
"xaccSplitVoidFormerValue"
'((<gnc:Split*> 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
'<gw:void>
"xaccQueryAddClearedMatch"
'((<gnc:Query*> q) (<gw:int> cleared-how) (<gnc:query-op> how))
'((<gnc:Query*> q) (<gnc:cleared-match-how> cleared-how) (<gnc:query-op> how))
"match the cleared state.")
(gw:wrap-function

View File

@ -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 = \

View File

@ -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

View File

@ -13,4 +13,4 @@ libincompatdep_la_LDFLAGS=-module
libagedver_la_SOURCES=agedver.c
libagedver_la_LDFLAGS=-module
CLEANFILES += *.so* *.a
CLEANFILES = *.so* *.a

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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,

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -50,4 +50,4 @@ gncscm_DATA = \
EXTRA_DIST = ${gncscmmod_DATA} ${gncscm_DATA}
CLEANFILES += gnucash report .scm-links
CLEANFILES = gnucash report .scm-links

View File

@ -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)

View File

@ -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")

View File

@ -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)))

View File

@ -35,4 +35,4 @@ gncscmmod_DATA = \
EXTRA_DIST = ${gncscmmod_DATA}
CLEANFILES += gnucash report .scm-links
CLEANFILES = gnucash report .scm-links

View File

@ -321,6 +321,9 @@
;; 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?

View File

@ -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)

View File

@ -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)
@ -491,6 +494,30 @@
(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:Split*>))
;;(gnc:warn "Splits in trep-renderer:" splits)

View File

@ -25,5 +25,5 @@ gncscmmod_DATA = \
EXTRA_DIST = ${gncscmmod_DATA}
CLEANFILES += gnucash report .scm-links
CLEANFILES = gnucash report .scm-links

View File

@ -27,4 +27,4 @@ gncscmmod_DATA = \
EXTRA_DIST = ${gncscmmod_DATA}
CLEANFILES += gnucash report .scm-links
CLEANFILES = gnucash report .scm-links

View File

@ -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}

View File

@ -27,4 +27,4 @@ EXTRA_DIST = \
${gncscmmod_DATA} \
${gncscm_DATA}
CLEANFILES += gnucash tax .scm-links
CLEANFILES = gnucash tax .scm-links