mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
*** empty log message ***
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@2192 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
20
ChangeLog
20
ChangeLog
@@ -1,5 +1,25 @@
|
||||
2000-04-21 Dave Peticolas <peticola@cs.ucdavis.edu>
|
||||
|
||||
* src/gnome/dialog-edit.c: figure out all the accounts affected
|
||||
by a currency/security/type change and ask the user whether the
|
||||
needed changes should be made.
|
||||
|
||||
* src/gnome/dialog-utils.c (gnc_fill_menu_with_data): also recurse
|
||||
for GNOME_APP_UI_SUBTREE_STOCK.
|
||||
|
||||
* src/gnome/top-level.c (gnc_configure_reverse_balance): change
|
||||
asset-expense to all debit accounts.
|
||||
|
||||
* src/register/numcell.c: include <limits.h> per Eric Hanchrow's
|
||||
fix.
|
||||
|
||||
2000-04-16 Dave Peticolas <peticola@cs.ucdavis.edu>
|
||||
|
||||
* src/g-wrap/gnc.gwp: wrap functions for getting account guids and
|
||||
looking up accounts by guids.
|
||||
|
||||
* src/g-wrap/gnc-helpers.c: add helper functions for using guids.
|
||||
|
||||
* src/scm/prefs.scm: add an assets-expense choice to which kinds of
|
||||
accounts are sign-reversed.
|
||||
|
||||
|
||||
111
configure
vendored
111
configure
vendored
@@ -3803,7 +3803,7 @@ fi
|
||||
|
||||
|
||||
### --------------------------------------------------------------------------
|
||||
# The XmHTML widget is used by motif and gnome alike.
|
||||
# The XmHTML widget is used by motif.
|
||||
|
||||
# Check whether --with-xmhtml-includes or --without-xmhtml-includes was given.
|
||||
if test "${with_xmhtml_includes+set}" = set; then
|
||||
@@ -4001,13 +4001,17 @@ cat >> confdefs.h <<\EOF
|
||||
#define HAVE_XPM 0
|
||||
EOF
|
||||
|
||||
echo "configure: warning: Cannot find Xpm library -- gnome build disabled (not required for motif)" 1>&2
|
||||
GNOME_TARGET="gnome.disabled"
|
||||
GNOME_STATIC_TARGET="gnome.disabled"
|
||||
fi
|
||||
|
||||
|
||||
|
||||
|
||||
# Don't build the xmhtml source if user already has it installed...
|
||||
# this is ugly, there must be a nicer way of setting this up ...
|
||||
echo $ac_n "checking for XmHTMLTextScrollToLine in -lXmHTML""... $ac_c" 1>&6
|
||||
echo "configure:4011: checking for XmHTMLTextScrollToLine in -lXmHTML" >&5
|
||||
echo "configure:4015: checking for XmHTMLTextScrollToLine in -lXmHTML" >&5
|
||||
ac_lib_var=`echo XmHTML'_'XmHTMLTextScrollToLine | sed 'y%./+-%__p_%'`
|
||||
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
@@ -4015,7 +4019,7 @@ else
|
||||
ac_save_LIBS="$LIBS"
|
||||
LIBS="-lXmHTML $X_PRE_LIBS $MOTIF_LIBS $X_EXTRA_LIBS $X_LIBS $LIBS"
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 4019 "configure"
|
||||
#line 4023 "configure"
|
||||
#include "confdefs.h"
|
||||
/* Override any gcc2 internal prototype to avoid an error. */
|
||||
/* We use char because int might match the return type of a gcc2
|
||||
@@ -4026,7 +4030,7 @@ int main() {
|
||||
XmHTMLTextScrollToLine()
|
||||
; return 0; }
|
||||
EOF
|
||||
if { (eval echo configure:4030: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||
if { (eval echo configure:4034: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||
rm -rf conftest*
|
||||
eval "ac_cv_lib_$ac_lib_var=yes"
|
||||
else
|
||||
@@ -4073,14 +4077,14 @@ GNOME_STATIC_TARGET="gnome.static.real"
|
||||
#AC_CHECK_HEADER might work, but I'm not sure it uses CPPFLAGS
|
||||
# this guarantees it - it works. Promise!!
|
||||
echo $ac_n "checking gtk-xmhtml/gtk-xmhtml.h""... $ac_c" 1>&6
|
||||
echo "configure:4077: checking gtk-xmhtml/gtk-xmhtml.h" >&5
|
||||
echo "configure:4081: checking gtk-xmhtml/gtk-xmhtml.h" >&5
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 4079 "configure"
|
||||
#line 4083 "configure"
|
||||
#include "confdefs.h"
|
||||
#include <gtk-xmhtml/gtk-xmhtml.h>
|
||||
EOF
|
||||
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
|
||||
{ (eval echo configure:4084: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
|
||||
{ (eval echo configure:4088: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
|
||||
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
|
||||
if test -z "$ac_err"; then
|
||||
rm -rf conftest*
|
||||
@@ -4102,7 +4106,7 @@ CPPFLAGS="$OLDCPPFLAGS"
|
||||
### --------------------------------------------------------------------------
|
||||
# If readline exists, just assume that guile needs it. It probably does.
|
||||
echo $ac_n "checking for readline in -lreadline""... $ac_c" 1>&6
|
||||
echo "configure:4106: checking for readline in -lreadline" >&5
|
||||
echo "configure:4110: checking for readline in -lreadline" >&5
|
||||
ac_lib_var=`echo readline'_'readline | sed 'y%./+-%__p_%'`
|
||||
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
@@ -4110,7 +4114,7 @@ else
|
||||
ac_save_LIBS="$LIBS"
|
||||
LIBS="-lreadline $LIBS"
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 4114 "configure"
|
||||
#line 4118 "configure"
|
||||
#include "confdefs.h"
|
||||
/* Override any gcc2 internal prototype to avoid an error. */
|
||||
/* We use char because int might match the return type of a gcc2
|
||||
@@ -4121,7 +4125,7 @@ int main() {
|
||||
readline()
|
||||
; return 0; }
|
||||
EOF
|
||||
if { (eval echo configure:4125: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||
if { (eval echo configure:4129: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||
rm -rf conftest*
|
||||
eval "ac_cv_lib_$ac_lib_var=yes"
|
||||
else
|
||||
@@ -4155,7 +4159,7 @@ EXTRALIBS=`$GNOME_CONFIG_BIN --libs gtkxmhtml`
|
||||
|
||||
#check for gtkxmhtml, export library link to variable GTK_XMHTML
|
||||
echo $ac_n "checking for gtk_xmhtml_new in -lgtkxmhtml""... $ac_c" 1>&6
|
||||
echo "configure:4159: checking for gtk_xmhtml_new in -lgtkxmhtml" >&5
|
||||
echo "configure:4163: checking for gtk_xmhtml_new in -lgtkxmhtml" >&5
|
||||
ac_lib_var=`echo gtkxmhtml'_'gtk_xmhtml_new | sed 'y%./+-%__p_%'`
|
||||
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
@@ -4163,7 +4167,7 @@ else
|
||||
ac_save_LIBS="$LIBS"
|
||||
LIBS="-lgtkxmhtml $EXTRALIBS $LIBS"
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 4167 "configure"
|
||||
#line 4171 "configure"
|
||||
#include "confdefs.h"
|
||||
/* Override any gcc2 internal prototype to avoid an error. */
|
||||
/* We use char because int might match the return type of a gcc2
|
||||
@@ -4174,7 +4178,7 @@ int main() {
|
||||
gtk_xmhtml_new()
|
||||
; return 0; }
|
||||
EOF
|
||||
if { (eval echo configure:4178: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||
if { (eval echo configure:4182: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||
rm -rf conftest*
|
||||
eval "ac_cv_lib_$ac_lib_var=yes"
|
||||
else
|
||||
@@ -4200,13 +4204,69 @@ fi
|
||||
|
||||
|
||||
|
||||
### --------------------------------------------------------------------------
|
||||
EXTRALIBS=`$GNOME_CONFIG_BIN --libs xml`
|
||||
|
||||
#check for libxml
|
||||
echo $ac_n "checking for xmlDefaultSAXHandlerInit in -lxml""... $ac_c" 1>&6
|
||||
echo "configure:4213: checking for xmlDefaultSAXHandlerInit in -lxml" >&5
|
||||
ac_lib_var=`echo xml'_'xmlDefaultSAXHandlerInit | sed 'y%./+-%__p_%'`
|
||||
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
ac_save_LIBS="$LIBS"
|
||||
LIBS="-lxml $EXTRALIBS $LIBS"
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 4221 "configure"
|
||||
#include "confdefs.h"
|
||||
/* Override any gcc2 internal prototype to avoid an error. */
|
||||
/* We use char because int might match the return type of a gcc2
|
||||
builtin and then its argument prototype would still apply. */
|
||||
char xmlDefaultSAXHandlerInit();
|
||||
|
||||
int main() {
|
||||
xmlDefaultSAXHandlerInit()
|
||||
; return 0; }
|
||||
EOF
|
||||
if { (eval echo configure:4232: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||
rm -rf conftest*
|
||||
eval "ac_cv_lib_$ac_lib_var=yes"
|
||||
else
|
||||
echo "configure: failed program was:" >&5
|
||||
cat conftest.$ac_ext >&5
|
||||
rm -rf conftest*
|
||||
eval "ac_cv_lib_$ac_lib_var=no"
|
||||
fi
|
||||
rm -f conftest*
|
||||
LIBS="$ac_save_LIBS"
|
||||
|
||||
fi
|
||||
if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
|
||||
echo "$ac_t""yes" 1>&6
|
||||
ac_tr_lib=HAVE_LIB`echo xml | sed -e 's/[^a-zA-Z0-9_]/_/g' \
|
||||
-e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
|
||||
cat >> confdefs.h <<EOF
|
||||
#define $ac_tr_lib 1
|
||||
EOF
|
||||
|
||||
LIBS="-lxml $LIBS"
|
||||
|
||||
else
|
||||
echo "$ac_t""no" 1>&6
|
||||
echo "configure: warning: Cannotfind libxml -- gnome build disabled (not required for motif)" 1>&2
|
||||
GNOME_TARGET="gnome.disabled"
|
||||
GNOME_STATIC_TARGET="gnome.disabled"
|
||||
fi
|
||||
|
||||
|
||||
|
||||
### --------------------------------------------------------------------------
|
||||
EXTRALIBS=`$GNOME_CONFIG_BIN --libs print`
|
||||
|
||||
# check for gnome-print and enable it via HAVE_LIBGNOMEPRINT
|
||||
# if found
|
||||
echo $ac_n "checking for gnome_print_context_new in -lgnomeprint""... $ac_c" 1>&6
|
||||
echo "configure:4210: checking for gnome_print_context_new in -lgnomeprint" >&5
|
||||
echo "configure:4270: checking for gnome_print_context_new in -lgnomeprint" >&5
|
||||
ac_lib_var=`echo gnomeprint'_'gnome_print_context_new | sed 'y%./+-%__p_%'`
|
||||
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
@@ -4214,7 +4274,7 @@ else
|
||||
ac_save_LIBS="$LIBS"
|
||||
LIBS="-lgnomeprint $EXTRALIBS $LIBS"
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 4218 "configure"
|
||||
#line 4278 "configure"
|
||||
#include "confdefs.h"
|
||||
/* Override any gcc2 internal prototype to avoid an error. */
|
||||
/* We use char because int might match the return type of a gcc2
|
||||
@@ -4225,7 +4285,7 @@ int main() {
|
||||
gnome_print_context_new()
|
||||
; return 0; }
|
||||
EOF
|
||||
if { (eval echo configure:4229: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||
if { (eval echo configure:4289: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||
rm -rf conftest*
|
||||
eval "ac_cv_lib_$ac_lib_var=yes"
|
||||
else
|
||||
@@ -4254,7 +4314,6 @@ fi
|
||||
|
||||
|
||||
|
||||
# XXX - should we export these here or later in the configure script?
|
||||
|
||||
|
||||
|
||||
@@ -4276,7 +4335,7 @@ fi
|
||||
if test "${with_guile_config+set}" = set; then
|
||||
withval="$with_guile_config"
|
||||
echo $ac_n "checking for guile-config""... $ac_c" 1>&6
|
||||
echo "configure:4280: checking for guile-config" >&5
|
||||
echo "configure:4339: checking for guile-config" >&5
|
||||
echo "$ac_t""${with_guile_config}" 1>&6
|
||||
GUILE_CONFIG="$with_guile_config"
|
||||
LIBS="`${GUILE_CONFIG} link` ${LIBS}"
|
||||
@@ -4289,7 +4348,7 @@ if test x"$GUILE_CONFIG" = x; then
|
||||
# Extract the first word of "guile-config", so it can be a program name with args.
|
||||
set dummy guile-config; ac_word=$2
|
||||
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
|
||||
echo "configure:4293: checking for $ac_word" >&5
|
||||
echo "configure:4352: checking for $ac_word" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_path_GUILE_CONFIG'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
@@ -4345,7 +4404,7 @@ if test x"$GUILE_CONFIG" = x; then
|
||||
|
||||
GNC_LIBS_SAFE=${LIBS}
|
||||
echo $ac_n "checking for guile""... $ac_c" 1>&6
|
||||
echo "configure:4349: checking for guile" >&5
|
||||
echo "configure:4408: checking for guile" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_lib_guile'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
@@ -4358,14 +4417,14 @@ else
|
||||
else
|
||||
LIBS="${GNC_TEST_LIBS} ${GNC_LIBS_SAFE}"
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 4362 "configure"
|
||||
#line 4421 "configure"
|
||||
#include "confdefs.h"
|
||||
#include<guile/gh.h>
|
||||
int main() {
|
||||
gh_eval_file;
|
||||
; return 0; }
|
||||
EOF
|
||||
if { (eval echo configure:4369: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||
if { (eval echo configure:4428: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||
rm -rf conftest*
|
||||
GUILELIBS="${GNC_TEST_LIBS}"
|
||||
else
|
||||
@@ -4392,7 +4451,7 @@ if test x"$GUILE_CONFIG" != x; then
|
||||
# Extract the first word of "guile", so it can be a program name with args.
|
||||
set dummy guile; ac_word=$2
|
||||
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
|
||||
echo "configure:4396: checking for $ac_word" >&5
|
||||
echo "configure:4455: checking for $ac_word" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_path_GUILE_BIN'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
@@ -4431,7 +4490,7 @@ if test x"$GUILE_BIN" = x && test x"$with_guile" != x; then
|
||||
# Extract the first word of "guile", so it can be a program name with args.
|
||||
set dummy guile; ac_word=$2
|
||||
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
|
||||
echo "configure:4435: checking for $ac_word" >&5
|
||||
echo "configure:4494: checking for $ac_word" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_path_GUILE_BIN'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
@@ -4470,7 +4529,7 @@ if test x"${GUILE_BIN}" = x; then
|
||||
# Extract the first word of "guile", so it can be a program name with args.
|
||||
set dummy guile; ac_word=$2
|
||||
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
|
||||
echo "configure:4474: checking for $ac_word" >&5
|
||||
echo "configure:4533: checking for $ac_word" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_path_GUILE_BIN'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
|
||||
22
configure.in
22
configure.in
@@ -291,7 +291,7 @@ AC_ARG_WITH( imlib,
|
||||
X_LIBS="${X_LIBS} -L$with_imlib/lib" X_CFLAGS="$X_CFLAGS -I$with_imlib/include" )
|
||||
|
||||
### --------------------------------------------------------------------------
|
||||
# The XmHTML widget is used by motif and gnome alike.
|
||||
# The XmHTML widget is used by motif.
|
||||
|
||||
AC_ARG_WITH( xmhtml-includes,
|
||||
[ --with-xmhtml-includes=DIR specify where to look for xmhtml headers],
|
||||
@@ -317,7 +317,12 @@ AC_CHECK_LIB(png, png_read_image,
|
||||
|
||||
AC_CHECK_LIB(Xpm, XpmReadFileToXpmImage,
|
||||
AC_DEFINE(HAVE_XPM,1) X_LIBS="-lXpm $X_LIBS",
|
||||
AC_DEFINE(HAVE_XPM,0), $X_PRE_LIBS -lX11 $X_LIBS $X_EXTRA_LIBS)
|
||||
AC_DEFINE(HAVE_XPM,0)
|
||||
AC_MSG_WARN([Cannot find Xpm library -- gnome build disabled (not required for motif)])
|
||||
GNOME_TARGET="gnome.disabled"
|
||||
GNOME_STATIC_TARGET="gnome.disabled",
|
||||
$X_PRE_LIBS -lX11 $X_LIBS $X_EXTRA_LIBS)
|
||||
|
||||
|
||||
# Don't build the xmhtml source if user already has it installed...
|
||||
# this is ugly, there must be a nicer way of setting this up ...
|
||||
@@ -378,6 +383,18 @@ AC_CHECK_LIB(gtkxmhtml, gtk_xmhtml_new,
|
||||
AC_SUBST(GTK_XMHTML)
|
||||
|
||||
|
||||
### --------------------------------------------------------------------------
|
||||
EXTRALIBS=`$GNOME_CONFIG_BIN --libs xml`
|
||||
|
||||
#check for libxml
|
||||
AC_CHECK_LIB(xml, xmlDefaultSAXHandlerInit,
|
||||
,
|
||||
AC_MSG_WARN([Cannotfind libxml -- gnome build disabled (not required for motif)])
|
||||
GNOME_TARGET="gnome.disabled"
|
||||
GNOME_STATIC_TARGET="gnome.disabled",
|
||||
$EXTRALIBS)
|
||||
|
||||
|
||||
### --------------------------------------------------------------------------
|
||||
EXTRALIBS=`$GNOME_CONFIG_BIN --libs print`
|
||||
|
||||
@@ -386,7 +403,6 @@ EXTRALIBS=`$GNOME_CONFIG_BIN --libs print`
|
||||
AC_CHECK_LIB(gnomeprint, gnome_print_context_new, , , $EXTRALIBS)
|
||||
|
||||
|
||||
# XXX - should we export these here or later in the configure script?
|
||||
AC_SUBST(GNOME_TARGET)
|
||||
AC_SUBST(GNOME_STATIC_TARGET)
|
||||
|
||||
|
||||
156
doc/html/C/xacc-find-transactions.html
Normal file
156
doc/html/C/xacc-find-transactions.html
Normal file
@@ -0,0 +1,156 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>Locating transactions with the "Find Transactions" dialog</title>
|
||||
<meta name="description" content=
|
||||
"The Find Transactions dialog allows you to search for transactions matching your criteria. By using multiple searches and the Search Results window, you can make queries that are arbitrarily specific."
|
||||
<meta name="keywords" content=
|
||||
"search, find">
|
||||
</head>
|
||||
|
||||
<body bgcolor="#eeeeee">
|
||||
<h1>Locating transactions with the "Find Transactions" dialog</h1>
|
||||
<h3>Bill Gribble <grib@billgribble.com></h3>
|
||||
|
||||
<a name="toc"><h2>Table of Contents</h2></a>
|
||||
<ul>
|
||||
<li> <a href="#overview">Overview
|
||||
<li> <a href="#how-to">How to use the Find Transactions dialog</a>
|
||||
<li> <a href="#setup">Setting up a search</a>
|
||||
<ul>
|
||||
<li> <a href="#accounts">Account searches</a>
|
||||
<li> <a href="#date">Date searches</a>
|
||||
<li> <a href="#amount">Amount searches</a>
|
||||
<li> <a href="#string">String searches</a>
|
||||
</ul>
|
||||
<li> <a href="#results">The Search Results Register</a>
|
||||
<li> <a href="#modify">Modifying your search</a>
|
||||
<li> <a href="#hints">Hints</a>
|
||||
<ul>
|
||||
</ul>
|
||||
</ul>
|
||||
|
||||
<a name="overview"><h2>Overview</h2></a>
|
||||
|
||||
<p>The Find Transactions dialog allows you to search for
|
||||
transactions which match criteria that you specify, including
|
||||
account(s) affected by the transaction, the value of the transaction,
|
||||
the date, the memo, the description, etc. You can bring up the Find
|
||||
Transactions dialog by clicking on the "Find" button in the main
|
||||
GnuCash window or any register display window. The results of your
|
||||
search will be shown in a register display similar to the ones used to
|
||||
display your accounts, with the window title "Search Results".
|
||||
|
||||
<p>Clicking the "Find" button again within a Search Results
|
||||
register window allows you to add additional terms to the query whose
|
||||
results are displayed in that window. By combining multiple searches,
|
||||
you can create very sophisticated queries to show you exactly the
|
||||
subset of your transactions that you want to see.
|
||||
|
||||
<a name="how-to"><h2>How to use the Find Transactions dialog</h2></a>
|
||||
|
||||
<p>The Find Transactions dialog has two main parts. The upper
|
||||
part of the dialog is a Notebook with tabs that allow you to specify
|
||||
the conditions of your search. See <a href="#setup">Setting up a
|
||||
search</a> for details on each search type. The lower part of the
|
||||
dialog is a selector which allows you to specify how the results of
|
||||
the search are to be combined with any previous search.
|
||||
|
||||
<p>If you get the Find Transactions dialog by clicking the Find
|
||||
button in the main GnuCash window or any normal account display
|
||||
register, the only option available will be "New Search". If you
|
||||
select Find from within a Search Results register the other options
|
||||
will be available; see <a href="#modify">Modifying your search</a> for
|
||||
details.
|
||||
|
||||
<p>Most simple queries can be directly handled by a single
|
||||
invocation of the Find Transactions dialog. The dialog has nine tabs,
|
||||
each of which represents a particular field of the transaction (or
|
||||
split) that you can search on. If you specify conditions on multiple
|
||||
fields (for example, selecting one or more accounts in the Accounts
|
||||
tab and also entering a date range in the Date tab), a transaction
|
||||
must match all the conditions you specify in order to be displayed.
|
||||
|
||||
<p>If simple searches are not specific enough, you can combine
|
||||
them by clicking the Find button in a search results window and
|
||||
selecting any "Type of Search" except "New search".
|
||||
|
||||
<a name="setup"><h2>Setting up a search</h2></a>
|
||||
|
||||
<p>You can find transactions by any or all of the following
|
||||
criteria. Each one has a tab in the dialog where you may enter
|
||||
the match value(s) and comparison method.
|
||||
<ul>
|
||||
<li> Accounts affected by the transaction
|
||||
<li> Date the transaction took place
|
||||
<li> The string in the Description field
|
||||
<li> The string in the Number field
|
||||
<li> Amount of the transaction's splits
|
||||
<li> The string in the Memo field
|
||||
<li> Number of shares in a stock transaction
|
||||
<li> Share price in a stock transaction
|
||||
<li> The string in the Action field
|
||||
</ul>
|
||||
|
||||
<p>If you specify multiple criteria in the search, all of the
|
||||
criteria must be true for the transaction to be dispalyed.
|
||||
|
||||
<a name="accounts"><h3>Account searches</a></h3>
|
||||
|
||||
<p>In the Account tab, select any accounts of interest and then
|
||||
choose whether transactions affecting Any, All, or None of these
|
||||
accounts is to be displayed.
|
||||
|
||||
<p>If you select "All" accounts from the picker at the top of the
|
||||
tab, the only transactions that will be show are those which affect
|
||||
all the selected accounts. For example, if you select "My Checking
|
||||
Account" and "My VISA Account" and then choose "All", only transfers
|
||||
from Checking to Visa will be shown.
|
||||
|
||||
<p>If you select "Any" from the picker, transactions affecting any
|
||||
selected avvount will be shown. For example, if you select "My
|
||||
Checking Account" and "My VISA Account" and then choose "Any", your
|
||||
entire checking account and your entire Visa account will be shown
|
||||
together in the Search Results window.
|
||||
|
||||
<a name="accounts"><h3>Date searches</a></h3>
|
||||
|
||||
<p>In the Date tab, you can specify a date range for the
|
||||
transactions you wish to find. The year, month, and day fields are in
|
||||
the order you specify in Preferences:International:Date Format.
|
||||
|
||||
<p>If you want to locate any transaction before a certain date,
|
||||
specify your date in the second date entry and put a very early date
|
||||
in the first date entry. The default date is January 1, 1900, which
|
||||
should be early enough for most purposes. Similarly, if you want to
|
||||
find any transaction after a certain date, put the date in the first
|
||||
date entry and put a date after your last transaction in the second
|
||||
entry.
|
||||
|
||||
<a name="amount"><h3>Amount searches</a></h3>
|
||||
|
||||
<p>The searches in the Amount, Shares, and Price tabs allow you to
|
||||
search for particular quantities in various transaction fields. You
|
||||
need to enter both the amount (in the entry box) and the type of
|
||||
comparison (with the option menu to the left of the entry box). The
|
||||
amount in the entry box is always positive.
|
||||
|
||||
<p>For the Amount tab, you need to indicate whether you are
|
||||
interested in debits, credits, or both.
|
||||
|
||||
<a name="string"><h3>String searches</a></h3>
|
||||
|
||||
<p>In the Description, Number, Memo, and Action tabs, you can
|
||||
specify a string which is matched against the respective fields of
|
||||
splits and transactions. By default, the match used is a
|
||||
case-insensitive substring match. If you select the "Case sensitive"
|
||||
toggle button, the search is a case-sensitive substring match. If the
|
||||
"Regular expression" button is selected, the match interprets the
|
||||
string you enter as a POSIX extended regular expression; case
|
||||
sensitivity is still determined by the "Case sensitive" button.
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
@@ -191,34 +191,62 @@ balance is a whopping $0.00). In the
|
||||
<a href="#dialog-accounts">Accounts Tab</a> section there's a discussion
|
||||
of what we do with them.
|
||||
|
||||
<h3>Multi-account Quicken exports</h3>
|
||||
|
||||
<p>Quicken and some other programs who use QIF as an export format
|
||||
know how to put the history of multiple accounts into a single QIF
|
||||
file. They do this by prepending an "!Account" record before the
|
||||
set of transactions to/from that account.
|
||||
|
||||
<p>The QIF Importer should be able to handle these files fine.
|
||||
You may notice that the "Default QIF Account" seems somewhat
|
||||
arbitrary; for multiple-account exports, the guessed account is the
|
||||
first one with an Opening Balance record. However, since Quicken
|
||||
explicitly lists the account for every transaction in multi-account
|
||||
exports, you aren't likely to get any transactions in the default
|
||||
account other than those that are supposed to be there.
|
||||
|
||||
<p><a href="#toc">Table of Contents</a>
|
||||
|
||||
<a name="how-to"><h2>How to use the QIF Import dialog</h2></a>
|
||||
|
||||
<p>QIF files describe only one account, and try to be "complete"
|
||||
in representing all the transactions involving that account. This is
|
||||
fine if you only have one account, but if you have multiple Quicken
|
||||
accounts and transfers between them, transactions will show up in
|
||||
multiple files. This means that if you aren't smart about catching
|
||||
duplicate transactions you will end up with wrong balances in GnuCash.
|
||||
Definitely a bad thing.
|
||||
<p>The "Quick Start" guide: To load your files, click the "Select
|
||||
..." button in the Files tab to find the file, then click the "Load
|
||||
File" button at the bottom of the Files tab to actually load it.
|
||||
Repeat this until all your files are loaded (read the explanation
|
||||
below to see why you should load all your files at the same time).
|
||||
Check the Accounts and Categories dialogs and make corrections if
|
||||
necessary. Then click the big OK button.
|
||||
|
||||
|
||||
<p>Why you need to load all your files at the same time:
|
||||
|
||||
<p>There are two different types of QIF files: those that describe
|
||||
single accounts and those that describe multiple accounts. Both kinds
|
||||
to try to be "complete" in representing all the transactions involving
|
||||
each account that they represent. What this means is that if you have
|
||||
multiple Quicken accounts, with transfers between them, transactions
|
||||
will show up in multiple accounts. This means that if you aren't
|
||||
smart about catching duplicate transactions you will end up with wrong
|
||||
balances in GnuCash. Definitely a bad thing.
|
||||
|
||||
<p>In order to get the best possible replication of your Quicken
|
||||
account tree, export everything you can from Quicken and then import
|
||||
it all in one session. The importer's
|
||||
<a href="#dialog-files">Files tab</a> will allow you to load
|
||||
as many QIF files as you want, and to make sure that the currency,
|
||||
Quicken account name, and so on are right for each one. Then the
|
||||
importer can do a really good job of catching cross-references and
|
||||
marking them.
|
||||
it all in one session, either as a single QIF file representing all
|
||||
your accounts together or as a single file for each account. The
|
||||
importer's <a href="#dialog-files">Files tab</a> will allow you to
|
||||
load as many QIF files as you want, and to make sure that the
|
||||
currency, Quicken account name, and so on are right for each one. The
|
||||
importer can do a really good job of catching cross-references (which
|
||||
and marking them.
|
||||
|
||||
<p>The importer is written mostly in Guile, and it can be a little
|
||||
slow on large QIF files. Load File takes 5-6 seconds for a QIF file
|
||||
with 1000 or so transactions on my machine.
|
||||
|
||||
<p>Once you have loaded all the files into the importer, go to the
|
||||
<a href="#dialog-accounts">Accounts tab</a>, and then to the
|
||||
<a href="#dialog-categories">Categories tab</a>, and check that the
|
||||
<a href="#dialog-accounts">Accounts tab</a>, and then to the <a
|
||||
href="#dialog-categories">Categories tab</a>, and check that the
|
||||
importer is going to put your Quicken transactions in the right place.
|
||||
You can click to pop up a dialog and change the GnuCash destination
|
||||
account name/type for any QIF account. Don't be afraid to change
|
||||
@@ -281,21 +309,6 @@ yourself manually re-entering the name, save the file with a name that
|
||||
will get guessed correctly (i.e. save the account "My Bank Account" as
|
||||
My-Bank-Account.qif or My_Bank_Account.qif).
|
||||
|
||||
<p>GnuCash makes a hearty effort to interpret any QIF file that
|
||||
you throw at it, but you need to make sure that it's a normal DOS or
|
||||
Unix text file before trying to import. The Mac version of Quicken
|
||||
saves files with Macintosh newline conventions, which really confuses
|
||||
the Guile reader. Macintoshes use the carriage-return only (which
|
||||
usually prints as ^M), and the Unix convention requires a line feed
|
||||
(usually prints as ^J). You can use "tr" to fix this problem, or a
|
||||
search and replace in your favorite text editor. With tr,
|
||||
the command might look like
|
||||
<pre>
|
||||
cat macfile | tr 015 012 > unixfile
|
||||
</pre>
|
||||
|
||||
<p><a href="#toc">Table of Contents</a>
|
||||
|
||||
<a name=dialog-accounts><h2>The "Accounts" and "Categories" Tabs</h2>
|
||||
|
||||
<p>Each line in the Accounts tab display represents a mapping from
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
#include "Query.h"
|
||||
#include "SplitLedger.h"
|
||||
#include "Transaction.h"
|
||||
#include "FileDialog.h"
|
||||
#include "util.h"
|
||||
|
||||
|
||||
@@ -371,13 +372,20 @@ xaccLedgerDisplayGeneral (Account *lead_acc, Account **acclist,
|
||||
|
||||
/* set up the query filter */
|
||||
regData->query = xaccMallocQuery();
|
||||
xaccQuerySetAccounts (regData->query, regData->displayed_accounts);
|
||||
xaccQuerySetGroup(regData->query, gncGetCurrentGroup());
|
||||
if(regData->displayed_accounts) {
|
||||
xaccQueryAddAccountMatch(regData->query,
|
||||
regData->displayed_accounts,
|
||||
ACCT_MATCH_ANY, QUERY_OR);
|
||||
}
|
||||
if ((regData->leader != NULL) &&
|
||||
!accListHasAccount(regData->displayed_accounts, regData->leader))
|
||||
xaccQueryAddAccount (regData->query, regData->leader);
|
||||
|
||||
!accListHasAccount(regData->displayed_accounts, regData->leader)) {
|
||||
xaccQueryAddSingleAccountMatch(regData->query, regData->leader,
|
||||
QUERY_OR);
|
||||
}
|
||||
|
||||
/* by default, display only thirty transactions */
|
||||
xaccQuerySetMaxSplits (regData->query, MAX_QUERY_SPLITS);
|
||||
/* xaccQuerySetMaxSplits (regData->query, MAX_QUERY_SPLITS); */
|
||||
|
||||
/* add this register to the list of registers */
|
||||
fullList = ledgerListAdd (fullList, regData);
|
||||
@@ -427,7 +435,8 @@ xaccLedgerDisplayRefresh (xaccLedgerDisplay *regData)
|
||||
* If the GUI wants to display yet other stuff, it's on its own. */
|
||||
regData->balance = xaccAccountGetBalance (regData->leader);
|
||||
regData->clearedBalance = xaccAccountGetClearedBalance (regData->leader);
|
||||
regData->reconciledBalance = xaccAccountGetReconciledBalance (regData->leader);
|
||||
regData->reconciledBalance =
|
||||
xaccAccountGetReconciledBalance(regData->leader);
|
||||
|
||||
/* OK, now tell this specific GUI window to redraw itself ... */
|
||||
if (regData->redraw)
|
||||
|
||||
2389
src/engine/Query.c
2389
src/engine/Query.c
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,7 @@
|
||||
/********************************************************************\
|
||||
* Query.h : api for finding transactions *
|
||||
* Copyright 2000 Bill Gribble <grib@billgribble.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 *
|
||||
@@ -14,31 +17,26 @@
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
|
||||
\********************************************************************/
|
||||
|
||||
/*
|
||||
* FILE:
|
||||
* Query.h
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* Provide a simple query engine interface.
|
||||
*
|
||||
* HISTORY:
|
||||
* created by Linas Vepstas Sept 1998
|
||||
* Copyright (c) 1998-2000 Linas Vepstas
|
||||
*/
|
||||
|
||||
#ifndef __GNUCASH_QUERY_H__
|
||||
#define __GNUCASH_QUERY_H__
|
||||
|
||||
#include <time.h>
|
||||
#include <glib.h>
|
||||
#include <regex.h>
|
||||
|
||||
#include "gnc-common.h"
|
||||
#include "Account.h"
|
||||
#include "Transaction.h"
|
||||
#include "gnc-common.h"
|
||||
#include "Account.h"
|
||||
#include "Transaction.h"
|
||||
|
||||
typedef struct _Query Query;
|
||||
typedef enum {
|
||||
QUERY_AND,
|
||||
QUERY_OR,
|
||||
QUERY_NAND,
|
||||
QUERY_NOR,
|
||||
QUERY_XOR
|
||||
} QueryOp;
|
||||
|
||||
/* sorting orders */
|
||||
enum {
|
||||
typedef enum {
|
||||
BY_STANDARD,
|
||||
BY_DATE,
|
||||
BY_NUM,
|
||||
@@ -46,63 +44,179 @@ enum {
|
||||
BY_MEMO,
|
||||
BY_DESC,
|
||||
BY_NONE
|
||||
};
|
||||
} sort_type_t;
|
||||
|
||||
Query * xaccMallocQuery (void);
|
||||
void xaccInitQuery (Query *);
|
||||
void xaccFreeQuery (Query *);
|
||||
typedef enum { PD_DATE, PD_AMOUNT, PD_ACCOUNT, PD_STRING, PD_MISC } pd_type_t;
|
||||
|
||||
/* The xaccSetAccountList() method is used to define the set
|
||||
* of accounts the should be queried.
|
||||
*/
|
||||
void xaccQuerySetAccounts (Query *, Account **list);
|
||||
void xaccQueryAddAccount (Query *, Account *acc);
|
||||
typedef enum { ACCT_MATCH_ALL, ACCT_MATCH_ANY, ACCT_MATCH_NONE } acct_match_t;
|
||||
typedef enum { AMT_MATCH_ATLEAST, AMT_MATCH_ATMOST,
|
||||
AMT_MATCH_EXACTLY } amt_match_t;
|
||||
typedef enum { AMT_SGN_MATCH_EITHER, AMT_SGN_MATCH_CREDIT,
|
||||
AMT_SGN_MATCH_DEBIT } amt_match_sgn_t;
|
||||
enum { STRING_MATCH_CASE=1, STRING_MATCH_REGEXP=2};
|
||||
|
||||
/* the Query makes a subset of all splits based on 3 things:
|
||||
* - an AND-OR tree of predicates which combine to make a
|
||||
* split filter
|
||||
* - a sorting order for the matched splits
|
||||
* - a chop limit which gives the maximum number of sorted
|
||||
* splits to return. */
|
||||
|
||||
typedef struct {
|
||||
/* terms is a list of the OR-terms in a sum-of-products
|
||||
* logical expression. */
|
||||
GList * terms;
|
||||
|
||||
/* sorting and chopping is independent of the search filter */
|
||||
sort_type_t primary_sort;
|
||||
sort_type_t secondary_sort;
|
||||
sort_type_t tertiary_sort;
|
||||
int max_splits;
|
||||
|
||||
/* cache the results so we don't have to run the whole search
|
||||
* again until it's really necessary */
|
||||
int changed;
|
||||
AccountGroup * acct_group;
|
||||
Split ** split_list;
|
||||
} Query;
|
||||
|
||||
typedef struct {
|
||||
pd_type_t type;
|
||||
Timespec start;
|
||||
Timespec end;
|
||||
} DatePredicateData;
|
||||
|
||||
typedef struct {
|
||||
pd_type_t type;
|
||||
amt_match_t how;
|
||||
amt_match_sgn_t amt_sgn;
|
||||
double amount;
|
||||
} AmountPredicateData;
|
||||
|
||||
typedef struct {
|
||||
pd_type_t type;
|
||||
acct_match_t how;
|
||||
Account ** accounts;
|
||||
} AccountPredicateData;
|
||||
|
||||
typedef struct {
|
||||
pd_type_t type;
|
||||
int case_sens;
|
||||
int use_regexp;
|
||||
char * matchstring;
|
||||
regex_t compiled;
|
||||
} StringPredicateData;
|
||||
|
||||
typedef struct {
|
||||
pd_type_t type;
|
||||
int how;
|
||||
int data;
|
||||
} MiscPredicateData;
|
||||
|
||||
typedef union {
|
||||
pd_type_t type;
|
||||
DatePredicateData date;
|
||||
AmountPredicateData amount;
|
||||
AccountPredicateData acct;
|
||||
StringPredicateData str;
|
||||
MiscPredicateData misc;
|
||||
} PredicateData;
|
||||
|
||||
typedef int (* Predicate)(Split * foo, PredicateData * bar);
|
||||
|
||||
typedef struct {
|
||||
Predicate p;
|
||||
PredicateData data;
|
||||
int sense;
|
||||
} QueryTerm;
|
||||
|
||||
|
||||
Query * xaccMallocQuery(void);
|
||||
void xaccInitQuery(Query * q, QueryTerm * initial_term);
|
||||
void xaccFreeQuery(Query *);
|
||||
|
||||
Query * xaccQueryInvert(Query * q1);
|
||||
Query * xaccQueryMerge(Query * q1, Query * q2, QueryOp op);
|
||||
void xaccQuerySetGroup(Query * q, AccountGroup * group);
|
||||
void xaccQuerySwapTerms(Query * q1, Query * q2);
|
||||
void xaccQuerySingleTerm(Query * q, QueryTerm * qt);
|
||||
void xaccQueryClear(Query * q);
|
||||
void xaccQueryPurgeTerms(Query * q, pd_type_t type);
|
||||
|
||||
int xaccQueryHasTerms(Query * q);
|
||||
|
||||
Split ** xaccQueryGetSplits(Query * q);
|
||||
|
||||
/*******************************************************************
|
||||
* match-adding API
|
||||
*******************************************************************/
|
||||
|
||||
void xaccQueryAddAccountMatch(Query * q, Account ** acclist,
|
||||
acct_match_t how, QueryOp op);
|
||||
void xaccQueryAddSingleAccountMatch(Query * q, Account * acct,
|
||||
QueryOp op);
|
||||
|
||||
void xaccQueryAddDescriptionMatch(Query * q, char * matchstring,
|
||||
int case_sens, int use_regexp, QueryOp op);
|
||||
void xaccQueryAddNumberMatch(Query * q, char * matchstring,
|
||||
int case_sens, int use_regexp, QueryOp op);
|
||||
void xaccQueryAddActionMatch(Query * q, char * matchstring,
|
||||
int case_sens, int use_regexp, QueryOp op);
|
||||
void xaccQueryAddAmountMatch(Query * q, double amount,
|
||||
amt_match_sgn_t amt_sgn,
|
||||
amt_match_t how, QueryOp op);
|
||||
void xaccQueryAddSharePriceMatch(Query * q, double amount,
|
||||
amt_match_t how, QueryOp op);
|
||||
void xaccQueryAddSharesMatch(Query * q, double amount,
|
||||
amt_match_t how, QueryOp op);
|
||||
void xaccQueryAddDateMatch(Query * q,
|
||||
int syear, int smonth, int sday,
|
||||
int eyear, int emonth, int eday,
|
||||
QueryOp op);
|
||||
void xaccQueryAddDateMatchTS(Query * q,
|
||||
Timespec sts, Timespec ets,
|
||||
QueryOp op);
|
||||
void xaccQueryAddDateMatchTT(Query * q,
|
||||
time_t stt, time_t ett,
|
||||
QueryOp op);
|
||||
void xaccQueryAddMemoMatch(Query * q, char * matchstring,
|
||||
int case_sens, int use_regexp, QueryOp op);
|
||||
void xaccQueryAddMiscMatch(Query * q, Predicate p, int how, int data,
|
||||
QueryOp op);
|
||||
|
||||
|
||||
/*******************************************************************
|
||||
* predicates for standard match types
|
||||
*******************************************************************/
|
||||
|
||||
int xaccAccountMatchPredicate(Split * s, PredicateData * pd);
|
||||
int xaccDescriptionMatchPredicate(Split * s, PredicateData * pd);
|
||||
int xaccActionMatchPredicate(Split * s, PredicateData * pd);
|
||||
int xaccNumberMatchPredicate(Split * s, PredicateData * pd);
|
||||
int xaccAmountMatchPredicate(Split * s, PredicateData * pd);
|
||||
int xaccDateMatchPredicate(Split * s, PredicateData * pd);
|
||||
int xaccMemoMatchPredicate(Split * s, PredicateData * pd);
|
||||
int xaccMiscMatchPredicate(Split * s, PredicateData * pd);
|
||||
int xaccSharePriceMatchPredicate(Split * s, PredicateData * pd);
|
||||
int xaccSharesMatchPredicate(Split * s, PredicateData * pd);
|
||||
|
||||
/*******************************************************************
|
||||
* sort-related functions
|
||||
*******************************************************************/
|
||||
|
||||
void xaccQuerySetSortOrder(Query * q, sort_type_t primary,
|
||||
sort_type_t secondary, sort_type_t tertiary);
|
||||
void xaccQuerySetMaxSplits(Query * q, int n);
|
||||
|
||||
|
||||
/*******************************************************************
|
||||
* compatibility interface with old Query API
|
||||
*******************************************************************/
|
||||
time_t xaccQueryGetEarliestDateFound(Query * q);
|
||||
time_t xaccQueryGetLatestDateFound(Query * q);
|
||||
|
||||
/* The xaccQuerySetMaxSplits() method sets the maximum number
|
||||
* of splits to return as a result of a query.
|
||||
*/
|
||||
void xaccQuerySetMaxSplits (Query *, int);
|
||||
|
||||
/* The xaccQuerySetDateRange() method sets the date range
|
||||
* for the query. The query will return only those splits
|
||||
* that are within this date range. The arguments "earliest"
|
||||
* and "latest" are seconds before or since 00:00:00 Jan 1 1970.
|
||||
*/
|
||||
void xaccQuerySetDateRange (Query *, time_t earliest, time_t latest);
|
||||
#ifndef SWIG /* swig chokes on long long */
|
||||
void xaccQuerySetDateRangeL (Query *, long long earliest, long long latest);
|
||||
#endif
|
||||
|
||||
void xaccQuerySetEarliest (Query *, time_t earliest);
|
||||
void xaccQuerySetLatest (Query *, time_t latest);
|
||||
|
||||
void xaccQuerySetEarliestTS (Query *, Timespec earliest);
|
||||
void xaccQuerySetLatestTS (Query *, Timespec latest);
|
||||
|
||||
time_t xaccQueryGetEarliest (Query *);
|
||||
time_t xaccQueryGetLatest (Query *);
|
||||
|
||||
/* The xaccQueryShowEarliestDateFound function and its partner tell
|
||||
* the Query to use the earliest (resp. latest) splits found. */
|
||||
void xaccQueryShowEarliestDateFound (Query *);
|
||||
void xaccQueryShowLatestDateFound (Query *);
|
||||
|
||||
/* The xaccQuerySetSortOrder() method sets the sort order that
|
||||
* should be used on the splits. The three arguments should
|
||||
* be chosen from the enums above. The first argument has the
|
||||
* sort priority, the next the next, etc.
|
||||
*/
|
||||
void xaccQuerySetSortOrder (Query *, int, int, int);
|
||||
|
||||
/* The xaccQueryGetSplits() method returns a list of splits
|
||||
* matching the query and sorting criteria previously set up.
|
||||
*/
|
||||
Split ** xaccQueryGetSplits (Query *);
|
||||
|
||||
/* The xaccQueryGetEaliestDateFound() routine will return the
|
||||
* earliest date that appears in the list of returned splits.
|
||||
*/
|
||||
time_t xaccQueryGetEarliestDateFound (Query *);
|
||||
time_t xaccQueryGetLatestDateFound (Query *);
|
||||
|
||||
#endif /* __GNUCASH_QUERY_H__ */
|
||||
|
||||
@@ -37,6 +37,11 @@ typedef struct _GUID
|
||||
} GUID;
|
||||
|
||||
|
||||
/* number of characters needed to encode a guid as a string
|
||||
* not including the null terminator. */
|
||||
#define GUID_ENCODING_LENGTH 32
|
||||
|
||||
|
||||
/* Three functions to initialize the id generator. Only one needs to
|
||||
* be called. Calling any initialization function a second time will
|
||||
* reset the generator and erase the effect of the first call.
|
||||
|
||||
@@ -418,7 +418,7 @@ PrintAmt(char *buf, double val, int prec,
|
||||
|
||||
int
|
||||
xaccSPrintAmountGeneral (char * bufp, double val, short shrs, int precision,
|
||||
int min_trailing_zeros)
|
||||
int min_trailing_zeros, char *curr_sym)
|
||||
{
|
||||
struct lconv *lc;
|
||||
|
||||
@@ -447,7 +447,14 @@ xaccSPrintAmountGeneral (char * bufp, double val, short shrs, int precision,
|
||||
}
|
||||
else
|
||||
{
|
||||
currency_symbol = lc->currency_symbol;
|
||||
if(curr_sym == NULL)
|
||||
{
|
||||
currency_symbol = lc->currency_symbol;
|
||||
}
|
||||
else
|
||||
{
|
||||
currency_symbol = curr_sym;
|
||||
}
|
||||
if (val < 0.0)
|
||||
{
|
||||
cs_precedes = lc->n_cs_precedes;
|
||||
@@ -556,7 +563,7 @@ xaccSPrintAmount (char * bufp, double val, short shrs)
|
||||
}
|
||||
|
||||
return xaccSPrintAmountGeneral(bufp, val, shrs, precision,
|
||||
min_trailing_zeros);
|
||||
min_trailing_zeros, NULL);
|
||||
}
|
||||
|
||||
char *
|
||||
|
||||
@@ -168,7 +168,8 @@ char * gnc_locale_default_currency();
|
||||
* printed to. It returns the length of the printed string.
|
||||
*
|
||||
* The xaccSPrintAmountGeneral() routine is a more general version that
|
||||
* allows the user to set the precision and the minimum trailing zeros.
|
||||
* allows the user to set the precision, the minimum trailing zeros,
|
||||
* and the currency symbol.
|
||||
*
|
||||
* The xaccPrintAmountArgs() routine is identical to xaccPrintAmount,
|
||||
* except that the arguments are given as boolean values intead of
|
||||
@@ -183,7 +184,8 @@ char * gnc_locale_default_currency();
|
||||
char * xaccPrintAmount (double val, short shrs);
|
||||
int xaccSPrintAmount (char *buf, double val, short shrs);
|
||||
int xaccSPrintAmountGeneral (char * bufp, double val, short shrs,
|
||||
int precision, int min_trailing_zeros);
|
||||
int precision, int min_trailing_zeros,
|
||||
char *curr_sym);
|
||||
char * xaccPrintAmountArgs (double val,
|
||||
gncBoolean print_currency_symbol,
|
||||
gncBoolean print_separators,
|
||||
|
||||
@@ -72,7 +72,7 @@ GNOME_SRCS := top-level.c window-main.c window-register.c window-adjust.c \
|
||||
window-report.c global-options.c \
|
||||
dialog-qif-import.c glade-gnc-dialogs.c \
|
||||
dialog-account-picker.c print-session.c \
|
||||
dialog-print-check.c
|
||||
dialog-print-check.c dialog-find-transactions.c
|
||||
######################################################################
|
||||
|
||||
all: gnome
|
||||
|
||||
@@ -131,9 +131,15 @@ gnc_account_tree_init(GNCAccountTree *tree)
|
||||
gtk_clist_set_column_justification(GTK_CLIST(tree),
|
||||
tree->balance_column,
|
||||
GTK_JUSTIFY_RIGHT);
|
||||
gtk_clist_set_column_justification(GTK_CLIST(tree),
|
||||
tree->balance_column + 1,
|
||||
GTK_JUSTIFY_RIGHT);
|
||||
gtk_clist_set_column_justification(GTK_CLIST(tree),
|
||||
tree->total_column,
|
||||
GTK_JUSTIFY_RIGHT);
|
||||
gtk_clist_set_column_justification(GTK_CLIST(tree),
|
||||
tree->total_column + 1,
|
||||
GTK_JUSTIFY_RIGHT);
|
||||
|
||||
{
|
||||
GtkStyle *style = gtk_widget_get_style(GTK_WIDGET(tree));
|
||||
@@ -738,9 +744,11 @@ gnc_account_tree_set_view_info_real(GNCAccountTree *tree)
|
||||
|
||||
tree->balance_column = i;
|
||||
tree->column_fields[i++] = ACCOUNT_BALANCE;
|
||||
tree->column_fields[i++] = ACCOUNT_BALANCE_EURO;
|
||||
|
||||
tree->total_column = i;
|
||||
tree->column_fields[i++] = ACCOUNT_TOTAL;
|
||||
tree->column_fields[i++] = ACCOUNT_TOTAL_EURO;
|
||||
|
||||
tree->column_fields[i++] = ACCOUNT_NOTES;
|
||||
|
||||
@@ -966,8 +974,12 @@ gnc_account_tree_insert_row(GNCAccountTree *tree,
|
||||
style = gtk_widget_get_style(GTK_WIDGET(tree));
|
||||
|
||||
if (style != NULL)
|
||||
{
|
||||
gtk_ctree_node_set_cell_style(GTK_CTREE(tree), node,
|
||||
tree->total_column, style);
|
||||
gtk_ctree_node_set_cell_style(GTK_CTREE(tree), node,
|
||||
tree->total_column + 1, style);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -89,11 +89,9 @@ accountPickerBox(char * initial_selection, int initial_type) {
|
||||
|
||||
AccountGroup * topgroup;
|
||||
Account * selected;
|
||||
int i;
|
||||
GtkWidget * treeitem = gtk_tree_item_new_with_label(_("All Accounts"));
|
||||
GtkWidget * subtree = gtk_tree_new();
|
||||
SCM infolist;
|
||||
GtkWidget * active, * menu;
|
||||
|
||||
wind = g_new0(QIFAccountPickerDialog, 1);
|
||||
|
||||
@@ -125,18 +123,7 @@ accountPickerBox(char * initial_selection, int initial_type) {
|
||||
gtk_tree_set_view_lines(GTK_TREE(wind->treeview), TRUE);
|
||||
gtk_tree_item_expand(GTK_TREE_ITEM(treeitem));
|
||||
|
||||
/* this is a pain in the butt but there's no other way to easily
|
||||
* find out the index of the optionmeny selection */
|
||||
menu = gtk_option_menu_get_menu(GTK_OPTION_MENU(wind->type_picker));
|
||||
for(i = 0; i < 11; i++) {
|
||||
gtk_option_menu_set_history(GTK_OPTION_MENU(wind->type_picker), i);
|
||||
active = gtk_menu_get_active(GTK_MENU(menu));
|
||||
gtk_object_set_data(GTK_OBJECT(active),
|
||||
"option_index",
|
||||
GINT_TO_POINTER(i));
|
||||
}
|
||||
|
||||
gtk_option_menu_set_history(GTK_OPTION_MENU(wind->type_picker), 0);
|
||||
gnc_option_menu_init(wind->type_picker);
|
||||
|
||||
if(initial_selection) {
|
||||
selected = xaccGetAccountFromFullName(topgroup, initial_selection, ':');
|
||||
@@ -223,8 +210,6 @@ void
|
||||
gnc_ui_account_picker_ok_cb(GtkButton *button,
|
||||
gpointer user_data) {
|
||||
QIFAccountPickerDialog * wind;
|
||||
GtkWidget * type_menu;
|
||||
GtkWidget * menuitem;
|
||||
|
||||
char * selected_acct;
|
||||
char * description;
|
||||
@@ -237,16 +222,9 @@ gnc_ui_account_picker_ok_cb(GtkButton *button,
|
||||
selected_acct = gtk_entry_get_text(GTK_ENTRY(wind->acct_entry));
|
||||
description = gtk_entry_get_text(GTK_ENTRY(wind->descript_entry));
|
||||
|
||||
type_menu = gtk_option_menu_get_menu(GTK_OPTION_MENU(wind->type_picker));
|
||||
menuitem = gtk_menu_get_active(GTK_MENU(type_menu));
|
||||
acct_type = (int)(gtk_object_get_data(GTK_OBJECT(menuitem),
|
||||
"option_index"));
|
||||
|
||||
acct_type = gnc_option_menu_get_active(wind->type_picker);
|
||||
gtk_entry_set_text(GTK_ENTRY(wind->descript_entry),
|
||||
description);
|
||||
gtk_option_menu_set_history(GTK_OPTION_MENU(wind->type_picker),
|
||||
acct_type);
|
||||
|
||||
infolist = SCM_LIST3(gh_str02scm(selected_acct),
|
||||
gh_int2scm(acct_type),
|
||||
gh_str02scm(description));
|
||||
|
||||
@@ -130,26 +130,19 @@ gnc_ui_EditAccWindow_help_cb(GtkWidget *widget, gpointer data)
|
||||
}
|
||||
|
||||
static void
|
||||
gnc_edit_change_account_types(Account *account, Account *except, int type)
|
||||
gnc_edit_change_account_types(GHashTable *change_type, Account *account,
|
||||
Account *except, int type)
|
||||
{
|
||||
AccountGroup *children;
|
||||
int i, num_children;
|
||||
|
||||
if (account == NULL)
|
||||
if ((change_type == NULL) || (account == NULL))
|
||||
return;
|
||||
|
||||
if (account == except)
|
||||
return;
|
||||
|
||||
if (xaccAccountGetType(account) != type)
|
||||
{
|
||||
/* Just refreshing won't work. */
|
||||
xaccDestroyLedgerDisplay(account);
|
||||
|
||||
xaccAccountBeginEdit(account, GNC_F);
|
||||
xaccAccountSetType(account, type);
|
||||
xaccAccountCommitEdit(account);
|
||||
}
|
||||
g_hash_table_insert(change_type, account, GINT_TO_POINTER(type));
|
||||
|
||||
children = xaccAccountGetChildren(account);
|
||||
if (children == NULL)
|
||||
@@ -159,7 +152,327 @@ gnc_edit_change_account_types(Account *account, Account *except, int type)
|
||||
for (i = 0; i < num_children; i++)
|
||||
{
|
||||
account = xaccGroupGetAccount(children, i);
|
||||
gnc_edit_change_account_types(account, except, type);
|
||||
gnc_edit_change_account_types(change_type, account, except, type);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
change_func(gpointer key, gpointer value, gpointer field_code)
|
||||
{
|
||||
Account *account = key;
|
||||
AccountFieldCode field = GPOINTER_TO_INT(field_code);
|
||||
|
||||
if (account == NULL)
|
||||
return;
|
||||
|
||||
xaccAccountBeginEdit(account, GNC_T);
|
||||
|
||||
switch (field)
|
||||
{
|
||||
case ACCOUNT_CURRENCY:
|
||||
{
|
||||
char * string = value;
|
||||
|
||||
xaccAccountSetCurrency(account, string);
|
||||
}
|
||||
break;
|
||||
case ACCOUNT_SECURITY:
|
||||
{
|
||||
char * string = value;
|
||||
|
||||
xaccAccountSetSecurity(account, string);
|
||||
}
|
||||
break;
|
||||
case ACCOUNT_TYPE:
|
||||
{
|
||||
int type = GPOINTER_TO_INT(value);
|
||||
|
||||
if (type == xaccAccountGetType(account))
|
||||
break;
|
||||
|
||||
/* Just refreshing won't work. */
|
||||
xaccDestroyLedgerDisplay(account);
|
||||
|
||||
xaccAccountSetType(account, type);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
g_warning("unexpected account field code");
|
||||
break;
|
||||
}
|
||||
|
||||
xaccAccountCommitEdit(account);
|
||||
}
|
||||
|
||||
static void
|
||||
make_account_changes(GHashTable *change_currency,
|
||||
GHashTable *change_security,
|
||||
GHashTable *change_type)
|
||||
{
|
||||
if (change_currency != NULL)
|
||||
g_hash_table_foreach(change_currency, change_func,
|
||||
GINT_TO_POINTER(ACCOUNT_CURRENCY));
|
||||
|
||||
if (change_security != NULL)
|
||||
g_hash_table_foreach(change_security, change_func,
|
||||
GINT_TO_POINTER(ACCOUNT_SECURITY));
|
||||
|
||||
if (change_type != NULL)
|
||||
g_hash_table_foreach(change_type, change_func,
|
||||
GINT_TO_POINTER(ACCOUNT_TYPE));
|
||||
}
|
||||
|
||||
static void
|
||||
gnc_account_change_currency_security(Account *account,
|
||||
GHashTable *change_currency,
|
||||
GHashTable *change_security,
|
||||
const char *currency,
|
||||
const char *security)
|
||||
{
|
||||
char *old_currency;
|
||||
char *old_security;
|
||||
gboolean new_currency;
|
||||
gboolean new_security;
|
||||
GSList *stack;
|
||||
|
||||
if ((account == NULL) || (currency == NULL) || (security == NULL))
|
||||
return;
|
||||
|
||||
old_currency = xaccAccountGetCurrency(account);
|
||||
old_security = xaccAccountGetSecurity(account);
|
||||
|
||||
if ((safe_strcmp(currency, old_currency) == 0) &&
|
||||
(safe_strcmp(security, old_security) == 0))
|
||||
return;
|
||||
|
||||
if (safe_strcmp(currency, old_currency) != 0)
|
||||
{
|
||||
g_hash_table_insert(change_currency, account, (char *) currency);
|
||||
new_currency = TRUE;
|
||||
}
|
||||
else
|
||||
new_currency = FALSE;
|
||||
|
||||
if (safe_strcmp(security, old_security) != 0)
|
||||
{
|
||||
g_hash_table_insert(change_security, account, (char *) security);
|
||||
new_security = TRUE;
|
||||
}
|
||||
else
|
||||
new_security = FALSE;
|
||||
|
||||
stack = g_slist_prepend(NULL, account);
|
||||
|
||||
while (stack != NULL)
|
||||
{
|
||||
Split *split;
|
||||
GSList *pop;
|
||||
gint i;
|
||||
|
||||
pop = stack;
|
||||
account = pop->data;
|
||||
stack = g_slist_remove_link(stack, pop);
|
||||
g_slist_free_1(pop);
|
||||
|
||||
i = 0;
|
||||
while ((split = xaccAccountGetSplit(account, i++)) != NULL)
|
||||
{
|
||||
Transaction *trans;
|
||||
Split *s;
|
||||
gint j;
|
||||
|
||||
trans = xaccSplitGetParent(split);
|
||||
if (trans == NULL)
|
||||
continue;
|
||||
|
||||
if (xaccTransIsCommonCurrency(trans, currency))
|
||||
continue;
|
||||
|
||||
if (xaccTransIsCommonCurrency(trans, security))
|
||||
continue;
|
||||
|
||||
j = 0;
|
||||
while ((s = xaccTransGetSplit(trans, j++)) != NULL)
|
||||
{
|
||||
gboolean add_it = FALSE;
|
||||
Account *a;
|
||||
|
||||
a = xaccSplitGetAccount(s);
|
||||
|
||||
if ((a == NULL) || (a == account))
|
||||
continue;
|
||||
|
||||
if (g_hash_table_lookup(change_currency, a) != NULL)
|
||||
continue;
|
||||
|
||||
if (g_hash_table_lookup(change_security, a) != NULL)
|
||||
continue;
|
||||
|
||||
if (new_currency &&
|
||||
(safe_strcmp(old_currency, xaccAccountGetCurrency(a)) == 0))
|
||||
{
|
||||
g_hash_table_insert(change_currency, a, (char *) currency);
|
||||
add_it = TRUE;
|
||||
}
|
||||
|
||||
if (new_security &&
|
||||
(safe_strcmp(old_security, xaccAccountGetSecurity(a)) == 0))
|
||||
{
|
||||
g_hash_table_insert(change_security, a, (char *) security);
|
||||
add_it = TRUE;
|
||||
}
|
||||
|
||||
if (add_it)
|
||||
stack = g_slist_prepend(stack, a);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
typedef struct
|
||||
{
|
||||
Account *account;
|
||||
AccountFieldCode field;
|
||||
GtkCList *list;
|
||||
guint count;
|
||||
} FillStruct;
|
||||
|
||||
static void
|
||||
fill_helper(gpointer key, gpointer value, gpointer data)
|
||||
{
|
||||
Account *account = key;
|
||||
FillStruct *fs = data;
|
||||
gchar *strings[5];
|
||||
|
||||
if (fs == NULL)
|
||||
return;
|
||||
|
||||
if (fs->account == account)
|
||||
return;
|
||||
|
||||
strings[0] = xaccAccountGetFullName(account, gnc_get_account_separator());
|
||||
strings[1] = gnc_ui_get_account_field_name(fs->field);
|
||||
strings[2] = gnc_ui_get_account_field_value_string(account, fs->field);
|
||||
strings[4] = NULL;
|
||||
|
||||
switch (fs->field)
|
||||
{
|
||||
case ACCOUNT_CURRENCY:
|
||||
case ACCOUNT_SECURITY:
|
||||
strings[3] = value;
|
||||
break;
|
||||
case ACCOUNT_TYPE:
|
||||
strings[3] = xaccAccountGetTypeStr(GPOINTER_TO_INT(value));
|
||||
break;
|
||||
default:
|
||||
g_warning("unexpected field type");
|
||||
free(strings[0]);
|
||||
return;
|
||||
}
|
||||
|
||||
gtk_clist_append(fs->list, strings);
|
||||
free(strings[0]);
|
||||
fs->count++;
|
||||
}
|
||||
|
||||
static guint
|
||||
fill_list(Account *account, GtkCList *list,
|
||||
GHashTable *change, AccountFieldCode field)
|
||||
{
|
||||
FillStruct fs;
|
||||
|
||||
if (change == NULL)
|
||||
return 0;
|
||||
|
||||
fs.account = account;
|
||||
fs.field = field;
|
||||
fs.list = list;
|
||||
fs.count = 0;
|
||||
|
||||
g_hash_table_foreach(change, fill_helper, &fs);
|
||||
|
||||
return fs.count;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
extra_change_verify(EditAccWindow *editAccData,
|
||||
GHashTable *change_currency,
|
||||
GHashTable *change_security,
|
||||
GHashTable *change_type)
|
||||
{
|
||||
Account *account;
|
||||
GtkCList *list;
|
||||
gchar *titles[5];
|
||||
guint size;
|
||||
|
||||
if (editAccData == NULL)
|
||||
return FALSE;
|
||||
|
||||
account = editAccData->account;
|
||||
|
||||
titles[0] = ACCOUNT_STR;
|
||||
titles[1] = FIELD_STR;
|
||||
titles[2] = OLD_VALUE_STR;
|
||||
titles[3] = NEW_VALUE_STR;
|
||||
titles[4] = NULL;
|
||||
|
||||
list = GTK_CLIST(gtk_clist_new_with_titles(4, titles));
|
||||
|
||||
size = 0;
|
||||
size += fill_list(account, list, change_currency, ACCOUNT_CURRENCY);
|
||||
size += fill_list(account, list, change_security, ACCOUNT_SECURITY);
|
||||
size += fill_list(account, list, change_type, ACCOUNT_TYPE);
|
||||
|
||||
if (size == 0)
|
||||
{
|
||||
gtk_widget_destroy(GTK_WIDGET(list));
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gtk_clist_column_titles_passive(list);
|
||||
gtk_clist_set_sort_column(list, 0);
|
||||
gtk_clist_sort(list);
|
||||
gtk_clist_columns_autosize(list);
|
||||
|
||||
{
|
||||
GtkWidget *dialog;
|
||||
GtkWidget *scroll;
|
||||
GtkWidget *label;
|
||||
GtkWidget *frame;
|
||||
GtkWidget *vbox;
|
||||
|
||||
dialog = gnome_dialog_new(VERIFY_CHANGES_STR,
|
||||
GNOME_STOCK_BUTTON_OK,
|
||||
GNOME_STOCK_BUTTON_CANCEL,
|
||||
NULL);
|
||||
|
||||
gnome_dialog_set_default(GNOME_DIALOG(dialog), 0);
|
||||
gnome_dialog_close_hides(GNOME_DIALOG(dialog), FALSE);
|
||||
gnome_dialog_set_parent(GNOME_DIALOG(dialog),
|
||||
GTK_WINDOW(editAccData->dialog));
|
||||
gtk_window_set_policy(GTK_WINDOW(dialog), TRUE, TRUE, TRUE);
|
||||
gtk_window_set_default_size(GTK_WINDOW(dialog), 0, 300);
|
||||
|
||||
vbox = GNOME_DIALOG(dialog)->vbox;
|
||||
|
||||
label = gtk_label_new(VERIFY_CHANGE_MSG);
|
||||
gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);
|
||||
|
||||
frame = gtk_frame_new(NULL);
|
||||
gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, TRUE, 0);
|
||||
|
||||
scroll = gtk_scrolled_window_new(NULL, NULL);
|
||||
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scroll),
|
||||
GTK_POLICY_NEVER,
|
||||
GTK_POLICY_AUTOMATIC);
|
||||
|
||||
gtk_container_add(GTK_CONTAINER(frame), scroll);
|
||||
gtk_container_border_width(GTK_CONTAINER(scroll), 5);
|
||||
gtk_container_add(GTK_CONTAINER(scroll), GTK_WIDGET(list));
|
||||
|
||||
gtk_widget_show_all(vbox);
|
||||
|
||||
return gnome_dialog_run_and_close(GNOME_DIALOG(dialog)) == 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -169,6 +482,10 @@ gnc_ui_EditAccWindow_ok_cb(GtkWidget * widget, gpointer data)
|
||||
EditAccWindow *editAccData = (EditAccWindow *) data;
|
||||
AccountFieldStrings strings;
|
||||
|
||||
GHashTable *change_currency;
|
||||
GHashTable *change_security;
|
||||
GHashTable *change_type;
|
||||
|
||||
gboolean change_children;
|
||||
gboolean has_children;
|
||||
gboolean change_all;
|
||||
@@ -181,8 +498,6 @@ gnc_ui_EditAccWindow_ok_cb(GtkWidget * widget, gpointer data)
|
||||
|
||||
int current_type;
|
||||
|
||||
char *old;
|
||||
|
||||
gnc_ui_extract_field_strings(&strings, &editAccData->edit_info);
|
||||
|
||||
/* check for valid name */
|
||||
@@ -216,6 +531,16 @@ gnc_ui_EditAccWindow_ok_cb(GtkWidget * widget, gpointer data)
|
||||
|
||||
account = editAccData->account;
|
||||
|
||||
change_currency = g_hash_table_new(NULL, NULL);
|
||||
change_security = g_hash_table_new(NULL, NULL);
|
||||
change_type = g_hash_table_new(NULL, NULL);
|
||||
|
||||
gnc_account_change_currency_security(account,
|
||||
change_currency,
|
||||
change_security,
|
||||
strings.currency,
|
||||
strings.security);
|
||||
|
||||
children = xaccAccountGetChildren(account);
|
||||
if (children == NULL)
|
||||
has_children = FALSE;
|
||||
@@ -226,50 +551,6 @@ gnc_ui_EditAccWindow_ok_cb(GtkWidget * widget, gpointer data)
|
||||
|
||||
current_type = xaccAccountGetType(account);
|
||||
|
||||
/* currency check */
|
||||
old = xaccAccountGetCurrency(account);
|
||||
if (old == NULL)
|
||||
old = "";
|
||||
if ((safe_strcmp(old, strings.currency) != 0) &&
|
||||
(safe_strcmp(old, "") != 0))
|
||||
{
|
||||
gchar * s;
|
||||
gboolean result;
|
||||
|
||||
s = g_strdup_printf(EDIT_CURRENCY_MSG, old, strings.currency);
|
||||
result = gnc_verify_dialog_parented(GTK_WINDOW(editAccData->dialog),
|
||||
s, GNC_T);
|
||||
g_free(s);
|
||||
|
||||
if (!result)
|
||||
{
|
||||
gnc_ui_free_field_strings(&strings);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/* security check */
|
||||
old = xaccAccountGetSecurity(account);
|
||||
if (old == NULL)
|
||||
old = "";
|
||||
if ((safe_strcmp(old, strings.security) != 0) &&
|
||||
(safe_strcmp(old, "") != 0))
|
||||
{
|
||||
gchar * s;
|
||||
gboolean result;
|
||||
|
||||
s = g_strdup_printf(EDIT_SECURITY_MSG, old, strings.security);
|
||||
result = gnc_verify_dialog_parented(GTK_WINDOW(editAccData->dialog),
|
||||
s, GNC_T);
|
||||
g_free(s);
|
||||
|
||||
if (!result)
|
||||
{
|
||||
gnc_ui_free_field_strings(&strings);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/* If the account has children and the new type isn't compatible
|
||||
* with the old type, the children's types must be changed. */
|
||||
change_children = (has_children &&
|
||||
@@ -292,34 +573,36 @@ gnc_ui_EditAccWindow_ok_cb(GtkWidget * widget, gpointer data)
|
||||
else
|
||||
change_all = FALSE;
|
||||
|
||||
if (change_children || change_all)
|
||||
if (change_children)
|
||||
gnc_edit_change_account_types(change_type, account,
|
||||
NULL, editAccData->type);
|
||||
|
||||
if (change_all)
|
||||
{
|
||||
gchar *format_str;
|
||||
gchar *warning_str;
|
||||
gchar *type_str;
|
||||
gboolean result;
|
||||
Account *ancestor;
|
||||
Account *temp;
|
||||
|
||||
if (change_all)
|
||||
format_str = TYPE_WARN1_MSG;
|
||||
else
|
||||
format_str = TYPE_WARN2_MSG;
|
||||
temp = new_parent;
|
||||
|
||||
type_str = xaccAccountGetTypeStr(editAccData->type);
|
||||
|
||||
warning_str = g_strdup_printf(format_str, type_str);
|
||||
|
||||
result = gnc_verify_dialog_parented(GTK_WINDOW(editAccData->dialog),
|
||||
warning_str, GNC_T);
|
||||
|
||||
g_free(warning_str);
|
||||
|
||||
if (!result)
|
||||
do
|
||||
{
|
||||
gnc_ui_free_field_strings(&strings);
|
||||
return;
|
||||
}
|
||||
ancestor = temp;
|
||||
temp = xaccAccountGetParentAccount(ancestor);
|
||||
} while (temp != NULL);
|
||||
|
||||
gnc_edit_change_account_types(change_type, ancestor,
|
||||
account, editAccData->type);
|
||||
}
|
||||
|
||||
if (!extra_change_verify(editAccData, change_currency,
|
||||
change_security, change_type))
|
||||
{
|
||||
gnc_ui_free_field_strings(&strings);
|
||||
g_hash_table_destroy(change_currency);
|
||||
g_hash_table_destroy(change_security);
|
||||
g_hash_table_destroy(change_type);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Everything checked out, perform the changes */
|
||||
xaccAccountBeginEdit(account, GNC_F);
|
||||
@@ -343,30 +626,17 @@ gnc_ui_EditAccWindow_ok_cb(GtkWidget * widget, gpointer data)
|
||||
|
||||
xaccAccountCommitEdit(account);
|
||||
|
||||
if (change_children)
|
||||
gnc_edit_change_account_types(account, NULL, editAccData->type);
|
||||
|
||||
if (change_all)
|
||||
{
|
||||
Account *ancestor;
|
||||
Account *temp;
|
||||
|
||||
temp = xaccAccountGetParentAccount(account);
|
||||
do
|
||||
{
|
||||
ancestor = temp;
|
||||
temp = xaccAccountGetParentAccount(ancestor);
|
||||
} while (temp != NULL);
|
||||
|
||||
gnc_edit_change_account_types(ancestor, account, editAccData->type);
|
||||
}
|
||||
|
||||
gnc_ui_free_field_strings(&strings);
|
||||
make_account_changes(change_currency, change_security, change_type);
|
||||
|
||||
gnc_refresh_main_window();
|
||||
gnc_group_ui_refresh(gncGetCurrentGroup());
|
||||
|
||||
gnome_dialog_close(GNOME_DIALOG(editAccData->dialog));
|
||||
|
||||
gnc_ui_free_field_strings(&strings);
|
||||
g_hash_table_destroy(change_currency);
|
||||
g_hash_table_destroy(change_security);
|
||||
g_hash_table_destroy(change_type);
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
734
src/gnome/dialog-find-transactions.c
Normal file
734
src/gnome/dialog-find-transactions.c
Normal file
@@ -0,0 +1,734 @@
|
||||
/********************************************************************\
|
||||
* dialog-find-transactions.c : locate transactions and show them *
|
||||
* Copyright (C) 2000 Bill Gribble <grib@billgribble.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, write to the Free Software *
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
|
||||
\********************************************************************/
|
||||
|
||||
#define _GNU_SOURCE
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <gnome.h>
|
||||
#include <guile/gh.h>
|
||||
#include <time.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "top-level.h"
|
||||
#include "messages_i18n.h"
|
||||
#include "ui-callbacks.h"
|
||||
#include "RegWindow.h"
|
||||
#include "window-register.h"
|
||||
#include "account-tree.h"
|
||||
#include "MultiLedger.h"
|
||||
#include "FileDialog.h"
|
||||
#include "splitreg.h"
|
||||
#include "dialog-find-transactions.h"
|
||||
#include "window-help.h"
|
||||
|
||||
|
||||
/********************************************************************\
|
||||
* gnc_ui_find_transactions_dialog_create
|
||||
* make a new print check dialog and wait for it.
|
||||
\********************************************************************/
|
||||
|
||||
FindTransactionsDialog *
|
||||
gnc_ui_find_transactions_dialog_create(xaccLedgerDisplay * orig_ledg) {
|
||||
FindTransactionsDialog * ftd = g_new0(FindTransactionsDialog, 1);
|
||||
SCM lookup_option, lookup_value;
|
||||
|
||||
/* call the glade-defined creator */
|
||||
ftd->dialog = create_Find_Transactions();
|
||||
ftd->ledger = orig_ledg;
|
||||
|
||||
if(orig_ledg) {
|
||||
ftd->q = orig_ledg->query;
|
||||
}
|
||||
else {
|
||||
ftd->q = NULL;
|
||||
}
|
||||
|
||||
/* initialize the radiobutton state vars */
|
||||
ftd->search_type_radiobutton = 0;
|
||||
|
||||
/* find the important widgets */
|
||||
ftd->new_search_radiobutton =
|
||||
gtk_object_get_data(GTK_OBJECT(ftd->dialog), "new_search_radiobutton");
|
||||
ftd->narrow_search_radiobutton =
|
||||
gtk_object_get_data(GTK_OBJECT(ftd->dialog), "narrow_search_radiobutton");
|
||||
ftd->add_search_radiobutton =
|
||||
gtk_object_get_data(GTK_OBJECT(ftd->dialog), "add_search_radiobutton");
|
||||
ftd->delete_search_radiobutton =
|
||||
gtk_object_get_data(GTK_OBJECT(ftd->dialog), "delete_search_radiobutton");
|
||||
|
||||
ftd->match_accounts_scroller =
|
||||
gtk_object_get_data(GTK_OBJECT(ftd->dialog), "account_match_scroller");
|
||||
ftd->match_accounts_picker =
|
||||
gtk_object_get_data(GTK_OBJECT(ftd->dialog), "account_match_picker");
|
||||
|
||||
ftd->date_start_entry_1 =
|
||||
gtk_object_get_data(GTK_OBJECT(ftd->dialog), "date_start_entry_1");
|
||||
ftd->date_start_entry_2 =
|
||||
gtk_object_get_data(GTK_OBJECT(ftd->dialog), "date_start_entry_2");
|
||||
ftd->date_start_entry_3 =
|
||||
gtk_object_get_data(GTK_OBJECT(ftd->dialog), "date_start_entry_3");
|
||||
ftd->date_end_entry_1 =
|
||||
gtk_object_get_data(GTK_OBJECT(ftd->dialog), "date_end_entry_1");
|
||||
ftd->date_end_entry_2 =
|
||||
gtk_object_get_data(GTK_OBJECT(ftd->dialog), "date_end_entry_2");
|
||||
ftd->date_end_entry_3 =
|
||||
gtk_object_get_data(GTK_OBJECT(ftd->dialog), "date_end_entry_3");
|
||||
|
||||
ftd->description_entry =
|
||||
gtk_object_get_data(GTK_OBJECT(ftd->dialog), "description_entry");
|
||||
ftd->description_case_toggle =
|
||||
gtk_object_get_data(GTK_OBJECT(ftd->dialog), "description_case_toggle");
|
||||
ftd->description_regexp_toggle =
|
||||
gtk_object_get_data(GTK_OBJECT(ftd->dialog), "description_regexp_toggle");
|
||||
|
||||
ftd->number_entry =
|
||||
gtk_object_get_data(GTK_OBJECT(ftd->dialog), "number_entry");
|
||||
ftd->number_case_toggle =
|
||||
gtk_object_get_data(GTK_OBJECT(ftd->dialog), "number_case_toggle");
|
||||
ftd->number_regexp_toggle =
|
||||
gtk_object_get_data(GTK_OBJECT(ftd->dialog), "number_regexp_toggle");
|
||||
|
||||
ftd->credit_debit_picker =
|
||||
gtk_object_get_data(GTK_OBJECT(ftd->dialog), "credit_debit_picker");
|
||||
ftd->amount_comp_picker =
|
||||
gtk_object_get_data(GTK_OBJECT(ftd->dialog), "amount_comp_picker");
|
||||
ftd->amount_entry =
|
||||
gtk_object_get_data(GTK_OBJECT(ftd->dialog), "amount_entry");
|
||||
|
||||
ftd->memo_entry =
|
||||
gtk_object_get_data(GTK_OBJECT(ftd->dialog), "memo_entry");
|
||||
ftd->memo_case_toggle =
|
||||
gtk_object_get_data(GTK_OBJECT(ftd->dialog), "memo_case_toggle");
|
||||
ftd->memo_regexp_toggle =
|
||||
gtk_object_get_data(GTK_OBJECT(ftd->dialog), "memo_regexp_toggle");
|
||||
|
||||
ftd->shares_comp_picker =
|
||||
gtk_object_get_data(GTK_OBJECT(ftd->dialog), "shares_comp_picker");
|
||||
ftd->shares_entry =
|
||||
gtk_object_get_data(GTK_OBJECT(ftd->dialog), "shares_entry");
|
||||
|
||||
ftd->price_comp_picker =
|
||||
gtk_object_get_data(GTK_OBJECT(ftd->dialog), "price_comp_picker");
|
||||
ftd->price_entry =
|
||||
gtk_object_get_data(GTK_OBJECT(ftd->dialog), "price_entry");
|
||||
|
||||
ftd->action_entry =
|
||||
gtk_object_get_data(GTK_OBJECT(ftd->dialog), "action_entry");
|
||||
ftd->action_case_toggle =
|
||||
gtk_object_get_data(GTK_OBJECT(ftd->dialog), "action_case_toggle");
|
||||
ftd->action_regexp_toggle =
|
||||
gtk_object_get_data(GTK_OBJECT(ftd->dialog), "action_regexp_toggle");
|
||||
|
||||
|
||||
/* add an account picker to the first tab */
|
||||
ftd->account_tree = gnc_account_tree_new();
|
||||
gtk_clist_column_titles_hide(GTK_CLIST(ftd->account_tree));
|
||||
gnc_account_tree_hide_all_but_name(GNC_ACCOUNT_TREE(ftd->account_tree));
|
||||
gnc_account_tree_refresh(GNC_ACCOUNT_TREE(ftd->account_tree));
|
||||
|
||||
gtk_container_add(GTK_CONTAINER(ftd->match_accounts_scroller),
|
||||
ftd->account_tree);
|
||||
gtk_clist_set_selection_mode(GTK_CLIST(ftd->account_tree),
|
||||
GTK_SELECTION_MULTIPLE);
|
||||
gtk_widget_set_usize(GTK_WIDGET(ftd->match_accounts_scroller),
|
||||
300, 300);
|
||||
|
||||
/* initialize optionmenus with data indicating which option */
|
||||
/* is selected */
|
||||
gnc_option_menu_init(ftd->match_accounts_picker);
|
||||
gnc_option_menu_init(ftd->credit_debit_picker);
|
||||
gnc_option_menu_init(ftd->amount_comp_picker);
|
||||
gnc_option_menu_init(ftd->shares_comp_picker);
|
||||
gnc_option_menu_init(ftd->price_comp_picker);
|
||||
|
||||
/* initialize the date to something reasonable */
|
||||
lookup_option = gh_eval_str("gnc:lookup-global-option");
|
||||
lookup_value = gh_eval_str("gnc:option-value");
|
||||
|
||||
ftd->ymd_format =
|
||||
gh_symbol2newstr(gh_call1(lookup_value,
|
||||
gh_call2(lookup_option,
|
||||
gh_str02scm("International"),
|
||||
gh_str02scm("Date Format"))),
|
||||
NULL);
|
||||
if(!strcmp(ftd->ymd_format, "us") ||
|
||||
!strcmp(ftd->ymd_format, "uk") ||
|
||||
!strcmp(ftd->ymd_format, "europe")) {
|
||||
gtk_spin_button_set_value(GTK_SPIN_BUTTON(ftd->date_start_entry_1),
|
||||
1.0);
|
||||
gtk_spin_button_set_value(GTK_SPIN_BUTTON(ftd->date_start_entry_2),
|
||||
1.0);
|
||||
gtk_spin_button_set_value(GTK_SPIN_BUTTON(ftd->date_start_entry_3),
|
||||
1900.0);
|
||||
gtk_spin_button_set_value(GTK_SPIN_BUTTON(ftd->date_end_entry_1),
|
||||
1.0);
|
||||
gtk_spin_button_set_value(GTK_SPIN_BUTTON(ftd->date_end_entry_2),
|
||||
1.0);
|
||||
gtk_spin_button_set_value(GTK_SPIN_BUTTON(ftd->date_end_entry_3),
|
||||
2100.0);
|
||||
}
|
||||
else {
|
||||
gtk_spin_button_set_value(GTK_SPIN_BUTTON(ftd->date_start_entry_1),
|
||||
1900.0);
|
||||
gtk_spin_button_set_value(GTK_SPIN_BUTTON(ftd->date_start_entry_2),
|
||||
1.0);
|
||||
gtk_spin_button_set_value(GTK_SPIN_BUTTON(ftd->date_start_entry_3),
|
||||
1.0);
|
||||
gtk_spin_button_set_value(GTK_SPIN_BUTTON(ftd->date_end_entry_1),
|
||||
2100.0);
|
||||
gtk_spin_button_set_value(GTK_SPIN_BUTTON(ftd->date_end_entry_2),
|
||||
1.0);
|
||||
gtk_spin_button_set_value(GTK_SPIN_BUTTON(ftd->date_end_entry_3),
|
||||
1.0);
|
||||
}
|
||||
|
||||
/* set data so we can find the struct in callbacks */
|
||||
gtk_object_set_data(GTK_OBJECT(ftd->dialog), "find_transactions_structure",
|
||||
ftd);
|
||||
|
||||
|
||||
|
||||
|
||||
/* if there's no original query, make the narrow, add, delete
|
||||
* buttons inaccessible */
|
||||
if(!ftd->q) {
|
||||
gtk_widget_set_sensitive(GTK_WIDGET(ftd->narrow_search_radiobutton),
|
||||
0);
|
||||
gtk_widget_set_sensitive(GTK_WIDGET(ftd->add_search_radiobutton),
|
||||
0);
|
||||
gtk_widget_set_sensitive(GTK_WIDGET(ftd->delete_search_radiobutton),
|
||||
0);
|
||||
}
|
||||
else {
|
||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON
|
||||
(ftd->new_search_radiobutton),
|
||||
0);
|
||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON
|
||||
(ftd->narrow_search_radiobutton),
|
||||
1);
|
||||
}
|
||||
|
||||
gtk_widget_show_all(ftd->dialog);
|
||||
return ftd;
|
||||
}
|
||||
|
||||
|
||||
/********************************************************************\
|
||||
* gnc_ui_find_transactions_dialog_destroy
|
||||
\********************************************************************/
|
||||
|
||||
void
|
||||
gnc_ui_find_transactions_dialog_destroy(FindTransactionsDialog * ftd) {
|
||||
gnome_dialog_close(GNOME_DIALOG(ftd->dialog));
|
||||
|
||||
ftd->dialog = NULL;
|
||||
g_free(ftd->ymd_format);
|
||||
g_free(ftd);
|
||||
}
|
||||
|
||||
|
||||
/********************************************************************\
|
||||
* callbacks for radio button selections
|
||||
\********************************************************************/
|
||||
|
||||
void
|
||||
gnc_ui_find_transactions_dialog_search_type_cb(GtkToggleButton * tb,
|
||||
gpointer user_data) {
|
||||
GSList * buttongroup =
|
||||
gtk_radio_button_group(GTK_RADIO_BUTTON(tb));
|
||||
|
||||
FindTransactionsDialog * ftd =
|
||||
gtk_object_get_data(GTK_OBJECT(user_data), "find_transactions_structure");
|
||||
|
||||
if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(tb))) {
|
||||
ftd->search_type_radiobutton =
|
||||
g_slist_length(buttongroup) - g_slist_index(buttongroup, tb) - 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/********************************************************************\
|
||||
* gnc_ui_find_transactions_dialog_cancel_cb
|
||||
\********************************************************************/
|
||||
|
||||
void
|
||||
gnc_ui_find_transactions_dialog_cancel_cb(GtkButton * button,
|
||||
gpointer user_data) {
|
||||
FindTransactionsDialog * ftd =
|
||||
gtk_object_get_data(GTK_OBJECT(user_data), "find_transactions_structure");
|
||||
|
||||
gnc_ui_find_transactions_dialog_destroy(ftd);
|
||||
}
|
||||
|
||||
|
||||
/********************************************************************\
|
||||
* gnc_ui_find_transactions_dialog_help_cb
|
||||
\********************************************************************/
|
||||
|
||||
void
|
||||
gnc_ui_find_transactions_dialog_help_cb(GtkButton * button,
|
||||
gpointer user_data) {
|
||||
helpWindow(NULL, HELP_STR, HH_FIND_TRANSACTIONS);
|
||||
}
|
||||
|
||||
|
||||
/********************************************************************\
|
||||
* gnc_ui_find_transactions_dialog_early_date_select_cb
|
||||
\********************************************************************/
|
||||
|
||||
void
|
||||
gnc_ui_find_transactions_dialog_early_date_select_cb(GtkButton * button,
|
||||
gpointer user_data) {
|
||||
FindTransactionsDialog * ftd =
|
||||
gtk_object_get_data(GTK_OBJECT(user_data), "find_transactions_structure");
|
||||
|
||||
gnc_ui_select_date_dialog_create(ftd->date_start_entry_1,
|
||||
ftd->date_start_entry_2,
|
||||
ftd->date_start_entry_3,
|
||||
ftd->ymd_format);
|
||||
}
|
||||
|
||||
/********************************************************************\
|
||||
* gnc_ui_find_transactions_dialog_late_date_select_cb
|
||||
\********************************************************************/
|
||||
|
||||
void
|
||||
gnc_ui_find_transactions_dialog_late_date_select_cb(GtkButton * button,
|
||||
gpointer user_data) {
|
||||
FindTransactionsDialog * ftd =
|
||||
gtk_object_get_data(GTK_OBJECT(user_data), "find_transactions_structure");
|
||||
|
||||
gnc_ui_select_date_dialog_create(ftd->date_end_entry_1,
|
||||
ftd->date_end_entry_2,
|
||||
ftd->date_end_entry_3,
|
||||
ftd->ymd_format);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/********************************************************************\
|
||||
* gnc_ui_find_transactions_dialog_ok_cb
|
||||
\********************************************************************/
|
||||
|
||||
void
|
||||
gnc_ui_find_transactions_dialog_ok_cb(GtkButton * button,
|
||||
gpointer user_data) {
|
||||
GtkWidget * dialog = user_data;
|
||||
FindTransactionsDialog * ftd =
|
||||
gtk_object_get_data(GTK_OBJECT(dialog), "find_transactions_structure");
|
||||
|
||||
GList * selected_accounts;
|
||||
char * descript_match_text;
|
||||
char * memo_match_text;
|
||||
char * number_match_text;
|
||||
char * action_match_text;
|
||||
|
||||
int search_type = ftd->search_type_radiobutton;
|
||||
|
||||
float amt_temp;
|
||||
int amt_type;
|
||||
Query * q, * q2;
|
||||
Account ** acclist;
|
||||
int i;
|
||||
gboolean new_ledger = FALSE;
|
||||
|
||||
int start_year, start_month, start_day;
|
||||
int end_year, end_month, end_day;
|
||||
|
||||
if(search_type == 0) {
|
||||
if(ftd->q) xaccFreeQuery(ftd->q);
|
||||
ftd->q = xaccMallocQuery();
|
||||
}
|
||||
|
||||
assert(ftd->q);
|
||||
|
||||
q = xaccMallocQuery();
|
||||
xaccQuerySetGroup(q, gncGetCurrentGroup());
|
||||
|
||||
/* account selections */
|
||||
selected_accounts =
|
||||
gnc_account_tree_get_current_accounts
|
||||
(GNC_ACCOUNT_TREE(ftd->account_tree));
|
||||
|
||||
/* description */
|
||||
descript_match_text =
|
||||
gtk_entry_get_text(GTK_ENTRY(ftd->description_entry));
|
||||
|
||||
/* memo */
|
||||
memo_match_text =
|
||||
gtk_entry_get_text(GTK_ENTRY(ftd->memo_entry));
|
||||
|
||||
/* number */
|
||||
number_match_text =
|
||||
gtk_entry_get_text(GTK_ENTRY(ftd->number_entry));
|
||||
|
||||
/* action */
|
||||
action_match_text =
|
||||
gtk_entry_get_text(GTK_ENTRY(ftd->action_entry));
|
||||
|
||||
if(g_list_length(selected_accounts)) {
|
||||
/* build the acclist from the widget GList */
|
||||
acclist = g_new0(Account *,
|
||||
g_list_length(selected_accounts) + 1);
|
||||
for(i=0; i < g_list_length(selected_accounts); i++) {
|
||||
acclist[i] = g_list_nth_data(selected_accounts, i);
|
||||
}
|
||||
acclist[i] = NULL;
|
||||
|
||||
xaccQueryAddAccountMatch(q, acclist,
|
||||
gnc_option_menu_get_active
|
||||
(ftd->match_accounts_picker),
|
||||
QUERY_AND);
|
||||
}
|
||||
|
||||
if(strlen(descript_match_text)) {
|
||||
xaccQueryAddDescriptionMatch(q, descript_match_text,
|
||||
gtk_toggle_button_get_active
|
||||
(GTK_TOGGLE_BUTTON
|
||||
(ftd->description_case_toggle)),
|
||||
gtk_toggle_button_get_active
|
||||
(GTK_TOGGLE_BUTTON
|
||||
(ftd->description_regexp_toggle)),
|
||||
QUERY_AND);
|
||||
}
|
||||
|
||||
|
||||
if(strlen(number_match_text)) {
|
||||
xaccQueryAddNumberMatch(q, number_match_text,
|
||||
gtk_toggle_button_get_active
|
||||
(GTK_TOGGLE_BUTTON
|
||||
(ftd->number_case_toggle)),
|
||||
gtk_toggle_button_get_active
|
||||
(GTK_TOGGLE_BUTTON
|
||||
(ftd->number_regexp_toggle)),
|
||||
QUERY_AND);
|
||||
}
|
||||
|
||||
|
||||
amt_temp =
|
||||
(double)gtk_spin_button_get_value_as_float
|
||||
(GTK_SPIN_BUTTON(ftd->amount_entry));
|
||||
|
||||
amt_type = gnc_option_menu_get_active(ftd->credit_debit_picker);
|
||||
|
||||
if((amt_temp > 0.00001) || (amt_type != 0)) {
|
||||
xaccQueryAddAmountMatch(q,
|
||||
amt_temp,
|
||||
amt_type,
|
||||
gnc_option_menu_get_active
|
||||
(ftd->amount_comp_picker),
|
||||
QUERY_AND);
|
||||
}
|
||||
|
||||
if(!strcmp(ftd->ymd_format, "us")) {
|
||||
start_day = gtk_spin_button_get_value_as_int
|
||||
(GTK_SPIN_BUTTON(ftd->date_start_entry_1));
|
||||
start_month = gtk_spin_button_get_value_as_int
|
||||
(GTK_SPIN_BUTTON(ftd->date_start_entry_2));
|
||||
start_year = gtk_spin_button_get_value_as_int
|
||||
(GTK_SPIN_BUTTON(ftd->date_start_entry_3));
|
||||
|
||||
end_day = gtk_spin_button_get_value_as_int
|
||||
(GTK_SPIN_BUTTON(ftd->date_end_entry_1));
|
||||
end_month = gtk_spin_button_get_value_as_int
|
||||
(GTK_SPIN_BUTTON(ftd->date_end_entry_2));
|
||||
end_year = gtk_spin_button_get_value_as_int
|
||||
(GTK_SPIN_BUTTON(ftd->date_end_entry_3));
|
||||
}
|
||||
else if(!strcmp(ftd->ymd_format, "uk") ||
|
||||
!strcmp(ftd->ymd_format, "europe")) {
|
||||
start_month = gtk_spin_button_get_value_as_int
|
||||
(GTK_SPIN_BUTTON(ftd->date_start_entry_1));
|
||||
start_day = gtk_spin_button_get_value_as_int
|
||||
(GTK_SPIN_BUTTON(ftd->date_start_entry_2));
|
||||
start_year = gtk_spin_button_get_value_as_int
|
||||
(GTK_SPIN_BUTTON(ftd->date_start_entry_3));
|
||||
|
||||
end_month = gtk_spin_button_get_value_as_int
|
||||
(GTK_SPIN_BUTTON(ftd->date_end_entry_1));
|
||||
end_day = gtk_spin_button_get_value_as_int
|
||||
(GTK_SPIN_BUTTON(ftd->date_end_entry_2));
|
||||
end_year = gtk_spin_button_get_value_as_int
|
||||
(GTK_SPIN_BUTTON(ftd->date_end_entry_3));
|
||||
}
|
||||
else if(!strcmp(ftd->ymd_format, "iso")) {
|
||||
start_year = gtk_spin_button_get_value_as_int
|
||||
(GTK_SPIN_BUTTON(ftd->date_start_entry_1));
|
||||
start_month = gtk_spin_button_get_value_as_int
|
||||
(GTK_SPIN_BUTTON(ftd->date_start_entry_2));
|
||||
start_day = gtk_spin_button_get_value_as_int
|
||||
(GTK_SPIN_BUTTON(ftd->date_start_entry_3));
|
||||
|
||||
end_year = gtk_spin_button_get_value_as_int
|
||||
(GTK_SPIN_BUTTON(ftd->date_end_entry_1));
|
||||
end_month = gtk_spin_button_get_value_as_int
|
||||
(GTK_SPIN_BUTTON(ftd->date_end_entry_2));
|
||||
end_day = gtk_spin_button_get_value_as_int
|
||||
(GTK_SPIN_BUTTON(ftd->date_end_entry_3));
|
||||
}
|
||||
else {
|
||||
start_day = gtk_spin_button_get_value_as_int
|
||||
(GTK_SPIN_BUTTON(ftd->date_start_entry_1));
|
||||
start_month = gtk_spin_button_get_value_as_int
|
||||
(GTK_SPIN_BUTTON(ftd->date_start_entry_2));
|
||||
start_year = gtk_spin_button_get_value_as_int
|
||||
(GTK_SPIN_BUTTON(ftd->date_start_entry_3));
|
||||
|
||||
end_day = gtk_spin_button_get_value_as_int
|
||||
(GTK_SPIN_BUTTON(ftd->date_end_entry_1));
|
||||
end_month = gtk_spin_button_get_value_as_int
|
||||
(GTK_SPIN_BUTTON(ftd->date_end_entry_2));
|
||||
end_year = gtk_spin_button_get_value_as_int
|
||||
(GTK_SPIN_BUTTON(ftd->date_end_entry_3));
|
||||
}
|
||||
|
||||
if(!((start_day==1) && (start_month==1) && (start_year==1900) &&
|
||||
(end_day==1) && (end_month==1) && (end_year==2100))) {
|
||||
xaccQueryAddDateMatch(q,
|
||||
start_day, start_month, start_year,
|
||||
end_day, end_month, end_year,
|
||||
QUERY_AND);
|
||||
}
|
||||
|
||||
if(strlen(memo_match_text)) {
|
||||
xaccQueryAddMemoMatch(q, memo_match_text,
|
||||
gtk_toggle_button_get_active
|
||||
(GTK_TOGGLE_BUTTON(ftd->memo_case_toggle)),
|
||||
gtk_toggle_button_get_active
|
||||
(GTK_TOGGLE_BUTTON(ftd->memo_regexp_toggle)),
|
||||
QUERY_AND);
|
||||
}
|
||||
|
||||
amt_temp =
|
||||
(double)gtk_spin_button_get_value_as_float
|
||||
(GTK_SPIN_BUTTON(ftd->price_entry));
|
||||
amt_type =
|
||||
gnc_option_menu_get_active(ftd->price_comp_picker);
|
||||
|
||||
if((amt_temp > 0.00001) || (amt_type != 0)) {
|
||||
xaccQueryAddSharePriceMatch(q,
|
||||
amt_temp,
|
||||
amt_type,
|
||||
QUERY_AND);
|
||||
}
|
||||
|
||||
amt_temp =
|
||||
(double)gtk_spin_button_get_value_as_float
|
||||
(GTK_SPIN_BUTTON(ftd->shares_entry));
|
||||
amt_type =
|
||||
gnc_option_menu_get_active(ftd->shares_comp_picker);
|
||||
|
||||
if((amt_temp > 0.00001) || (amt_type != 0)) {
|
||||
xaccQueryAddSharesMatch(q,
|
||||
amt_temp,
|
||||
amt_type,
|
||||
QUERY_AND);
|
||||
}
|
||||
|
||||
if(strlen(action_match_text)) {
|
||||
xaccQueryAddActionMatch(q, action_match_text,
|
||||
gtk_toggle_button_get_active
|
||||
(GTK_TOGGLE_BUTTON
|
||||
(ftd->action_case_toggle)),
|
||||
gtk_toggle_button_get_active
|
||||
(GTK_TOGGLE_BUTTON
|
||||
(ftd->action_regexp_toggle)),
|
||||
QUERY_AND);
|
||||
}
|
||||
|
||||
if(!ftd->ledger) {
|
||||
new_ledger = TRUE;
|
||||
ftd->ledger = xaccLedgerDisplayGeneral(NULL, NULL, SEARCH_LEDGER);
|
||||
xaccFreeQuery(ftd->ledger->query);
|
||||
}
|
||||
|
||||
switch(search_type) {
|
||||
case 0:
|
||||
ftd->ledger->query = q;
|
||||
break;
|
||||
case 1:
|
||||
ftd->ledger->query = xaccQueryMerge(ftd->q, q, QUERY_AND);
|
||||
xaccFreeQuery(q);
|
||||
break;
|
||||
case 2:
|
||||
ftd->ledger->query = xaccQueryMerge(ftd->q, q, QUERY_OR);
|
||||
xaccFreeQuery(q);
|
||||
break;
|
||||
case 3:
|
||||
q2 = xaccQueryInvert(q);
|
||||
ftd->ledger->query = xaccQueryMerge(ftd->q, q2, QUERY_AND);
|
||||
xaccFreeQuery(q2);
|
||||
xaccFreeQuery(q);
|
||||
break;
|
||||
}
|
||||
|
||||
ftd->ledger->dirty = 1;
|
||||
xaccLedgerDisplayRefresh(ftd->ledger);
|
||||
if (new_ledger) regWindowLedger(ftd->ledger);
|
||||
|
||||
gnc_ui_find_transactions_dialog_destroy(ftd);
|
||||
}
|
||||
|
||||
/********************************************************************\
|
||||
* gnc_ui_select_date_dialog_cancel_cb
|
||||
\********************************************************************/
|
||||
|
||||
SelectDateDialog *
|
||||
gnc_ui_select_date_dialog_create(GtkWidget * entry_1, GtkWidget * entry_2,
|
||||
GtkWidget * entry_3, char * ymd_default) {
|
||||
SelectDateDialog * sdd = g_new0(SelectDateDialog, 1);
|
||||
int y, m, d;
|
||||
|
||||
sdd->dialog = create_Select_Date();
|
||||
sdd->cal = gtk_object_get_data(GTK_OBJECT(sdd->dialog),
|
||||
"calendar1");
|
||||
|
||||
sdd->entry_1 = entry_1;
|
||||
sdd->entry_2 = entry_2;
|
||||
sdd->entry_3 = entry_3;
|
||||
|
||||
if(!strcmp(ymd_default, "us")) {
|
||||
m = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(sdd->entry_1));
|
||||
d = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(sdd->entry_2));
|
||||
y = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(sdd->entry_3));
|
||||
}
|
||||
else if(!strcmp(ymd_default, "uk") ||
|
||||
!strcmp(ymd_default, "europe")) {
|
||||
d = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(sdd->entry_1));
|
||||
m = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(sdd->entry_2));
|
||||
y = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(sdd->entry_3));
|
||||
}
|
||||
else if(!strcmp(ymd_default, "iso")) {
|
||||
y = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(sdd->entry_1));
|
||||
m = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(sdd->entry_2));
|
||||
d = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(sdd->entry_3));
|
||||
}
|
||||
else {
|
||||
m = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(sdd->entry_1));
|
||||
d = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(sdd->entry_2));
|
||||
y = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(sdd->entry_3));
|
||||
}
|
||||
|
||||
sdd->ymd_format = strdup(ymd_default);
|
||||
|
||||
gtk_calendar_select_month(GTK_CALENDAR(sdd->cal),
|
||||
m-1, y);
|
||||
gtk_calendar_select_day(GTK_CALENDAR(sdd->cal),
|
||||
d);
|
||||
|
||||
gtk_object_set_data(GTK_OBJECT(sdd->dialog), "select_date_struct",
|
||||
sdd);
|
||||
gtk_widget_show_all(GTK_WIDGET(sdd->dialog));
|
||||
return sdd;
|
||||
}
|
||||
|
||||
/********************************************************************\
|
||||
* gnc_ui_select_date_dialog_destroy
|
||||
\********************************************************************/
|
||||
|
||||
void
|
||||
gnc_ui_select_date_dialog_destroy(SelectDateDialog * sdd) {
|
||||
gnome_dialog_close(GNOME_DIALOG(sdd->dialog));
|
||||
g_free(sdd->ymd_format);
|
||||
g_free(sdd);
|
||||
}
|
||||
|
||||
/********************************************************************\
|
||||
* gnc_ui_select_date_dialog_cancel_cb
|
||||
\********************************************************************/
|
||||
|
||||
void
|
||||
gnc_ui_select_date_dialog_cancel_cb(GtkButton * button,
|
||||
gpointer user_data) {
|
||||
SelectDateDialog * sdd =
|
||||
(SelectDateDialog *)gtk_object_get_data(GTK_OBJECT(user_data),
|
||||
"select_date_struct");
|
||||
gnc_ui_select_date_dialog_destroy(sdd);
|
||||
}
|
||||
|
||||
|
||||
/********************************************************************\
|
||||
* gnc_ui_select_date_dialog_today_cb
|
||||
\********************************************************************/
|
||||
|
||||
void
|
||||
gnc_ui_select_date_dialog_today_cb(GtkButton * button,
|
||||
gpointer user_data) {
|
||||
SelectDateDialog * sdd =
|
||||
(SelectDateDialog *)gtk_object_get_data(GTK_OBJECT(user_data),
|
||||
"select_date_struct");
|
||||
time_t now;
|
||||
struct tm * bdtime;
|
||||
|
||||
now = time(NULL);
|
||||
bdtime = localtime(&now);
|
||||
gtk_calendar_select_month(GTK_CALENDAR(sdd->cal),
|
||||
bdtime->tm_mon,
|
||||
bdtime->tm_year+1900);
|
||||
gtk_calendar_select_day(GTK_CALENDAR(sdd->cal),
|
||||
bdtime->tm_mday);
|
||||
}
|
||||
|
||||
|
||||
/********************************************************************\
|
||||
* gnc_ui_select_date_dialog_cancel_cb
|
||||
\********************************************************************/
|
||||
|
||||
void
|
||||
gnc_ui_select_date_dialog_ok_cb(GtkButton * button,
|
||||
gpointer user_data) {
|
||||
SelectDateDialog * sdd =
|
||||
(SelectDateDialog *)gtk_object_get_data(GTK_OBJECT(user_data),
|
||||
"select_date_struct");
|
||||
int y, m, d;
|
||||
|
||||
gtk_calendar_get_date(GTK_CALENDAR(sdd->cal), &y, &m, &d);
|
||||
|
||||
if(!strcmp(sdd->ymd_format, "us")) {
|
||||
gtk_spin_button_set_value(GTK_SPIN_BUTTON(sdd->entry_1),
|
||||
(float)m+1);
|
||||
gtk_spin_button_set_value(GTK_SPIN_BUTTON(sdd->entry_2),
|
||||
(float)d);
|
||||
gtk_spin_button_set_value(GTK_SPIN_BUTTON(sdd->entry_3),
|
||||
(float)y);
|
||||
}
|
||||
else if(!strcmp(sdd->ymd_format, "uk") ||
|
||||
!strcmp(sdd->ymd_format, "europe")) {
|
||||
gtk_spin_button_set_value(GTK_SPIN_BUTTON(sdd->entry_1),
|
||||
(float)d);
|
||||
gtk_spin_button_set_value(GTK_SPIN_BUTTON(sdd->entry_2),
|
||||
(float)m+1);
|
||||
gtk_spin_button_set_value(GTK_SPIN_BUTTON(sdd->entry_3),
|
||||
(float)y);
|
||||
}
|
||||
else if(!strcmp(sdd->ymd_format, "iso")) {
|
||||
gtk_spin_button_set_value(GTK_SPIN_BUTTON(sdd->entry_1),
|
||||
(float)y);
|
||||
gtk_spin_button_set_value(GTK_SPIN_BUTTON(sdd->entry_2),
|
||||
(float)m+1);
|
||||
gtk_spin_button_set_value(GTK_SPIN_BUTTON(sdd->entry_3),
|
||||
(float)d);
|
||||
}
|
||||
|
||||
gnc_ui_select_date_dialog_destroy(sdd);
|
||||
}
|
||||
|
||||
115
src/gnome/dialog-find-transactions.h
Normal file
115
src/gnome/dialog-find-transactions.h
Normal file
@@ -0,0 +1,115 @@
|
||||
/********************************************************************\
|
||||
* dialog-find-transactions.h : locate transactions/splits matching *
|
||||
* criteria. *
|
||||
* Copyright (C) 2000 Bill Gribble <grib@billgribble.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, write to the Free Software *
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
|
||||
\********************************************************************/
|
||||
|
||||
#ifndef __DIALOG_FIND_TRANSACTIONS_H_
|
||||
#define __DIALOG_FIND_TRANSACTIONS_H_
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <gnome.h>
|
||||
#include <guile/gh.h>
|
||||
|
||||
#include "MultiLedger.h"
|
||||
#include "Query.h"
|
||||
|
||||
#include "glade-gnc-dialogs.h"
|
||||
|
||||
typedef struct {
|
||||
GtkWidget * dialog;
|
||||
GtkWidget * cal;
|
||||
GtkWidget * entry_1;
|
||||
GtkWidget * entry_2;
|
||||
GtkWidget * entry_3;
|
||||
char * ymd_format;
|
||||
|
||||
} SelectDateDialog;
|
||||
|
||||
typedef struct {
|
||||
GtkWidget * dialog;
|
||||
Query * q;
|
||||
xaccLedgerDisplay * ledger;
|
||||
|
||||
char * ymd_format;
|
||||
|
||||
int search_type_radiobutton;
|
||||
|
||||
GtkWidget * new_search_radiobutton;
|
||||
GtkWidget * narrow_search_radiobutton;
|
||||
GtkWidget * add_search_radiobutton;
|
||||
GtkWidget * delete_search_radiobutton;
|
||||
|
||||
GtkWidget * match_accounts_picker;
|
||||
GtkWidget * match_accounts_scroller;
|
||||
GtkWidget * account_tree;
|
||||
|
||||
GtkWidget * date_start_entry_1;
|
||||
GtkWidget * date_start_entry_2;
|
||||
GtkWidget * date_start_entry_3;
|
||||
|
||||
GtkWidget * date_end_entry_1;
|
||||
GtkWidget * date_end_entry_2;
|
||||
GtkWidget * date_end_entry_3;
|
||||
|
||||
GtkWidget * description_entry;
|
||||
GtkWidget * description_case_toggle;
|
||||
GtkWidget * description_regexp_toggle;
|
||||
|
||||
GtkWidget * number_entry;
|
||||
GtkWidget * number_case_toggle;
|
||||
GtkWidget * number_regexp_toggle;
|
||||
|
||||
GtkWidget * credit_debit_picker;
|
||||
GtkWidget * amount_comp_picker;
|
||||
GtkWidget * amount_entry;
|
||||
|
||||
GtkWidget * memo_entry;
|
||||
GtkWidget * memo_case_toggle;
|
||||
GtkWidget * memo_regexp_toggle;
|
||||
|
||||
GtkWidget * shares_comp_picker;
|
||||
GtkWidget * shares_entry;
|
||||
|
||||
GtkWidget * price_comp_picker;
|
||||
GtkWidget * price_entry;
|
||||
|
||||
GtkWidget * action_entry;
|
||||
GtkWidget * action_case_toggle;
|
||||
GtkWidget * action_regexp_toggle;
|
||||
|
||||
} FindTransactionsDialog;
|
||||
|
||||
FindTransactionsDialog *
|
||||
gnc_ui_find_transactions_dialog_create(xaccLedgerDisplay * ledger);
|
||||
|
||||
void gnc_ui_find_transactions_dialog_destroy(FindTransactionsDialog * pcd);
|
||||
void gnc_ui_find_transactions_dialog_ok_cb(GtkButton * button,
|
||||
gpointer user_data);
|
||||
void gnc_ui_find_transactions_dialog_cancel_cb(GtkButton * button,
|
||||
gpointer user_data);
|
||||
|
||||
SelectDateDialog *
|
||||
gnc_ui_select_date_dialog_create(GtkWidget * w1, GtkWidget * w2,
|
||||
GtkWidget * w3, char * ymd_format);
|
||||
void gnc_ui_select_date_dialog_destroy(SelectDateDialog * sdd);
|
||||
void gnc_ui_select_date_cancel_cb(GtkWidget * w, gpointer user_data);
|
||||
void gnc_ui_select_date_ok_cb(GtkWidget * w, gpointer user_data);
|
||||
|
||||
Split ** gnc_make_split_array(int nsplits);
|
||||
#endif
|
||||
@@ -28,6 +28,7 @@
|
||||
#include "top-level.h"
|
||||
#include "messages_i18n.h"
|
||||
#include "dialog-print-check.h"
|
||||
#include "dialog-utils.h"
|
||||
#include "window-help.h"
|
||||
#include "print-session.h"
|
||||
#include "ui-callbacks.h"
|
||||
@@ -46,9 +47,6 @@
|
||||
PrintCheckDialog *
|
||||
gnc_ui_print_check_dialog_create(SCM callback) {
|
||||
PrintCheckDialog * pcd = g_new0(PrintCheckDialog, 1);
|
||||
GtkWidget * menu;
|
||||
GtkWidget * active;
|
||||
int i;
|
||||
|
||||
/* call the glade-defined creator */
|
||||
pcd->dialog = create_Print_Check_Dialog();
|
||||
@@ -92,43 +90,11 @@ gnc_ui_print_check_dialog_create(SCM callback) {
|
||||
|
||||
/* fix the option menus so we can diagnose which option is
|
||||
selected */
|
||||
menu = gtk_option_menu_get_menu(GTK_OPTION_MENU(pcd->format_picker));
|
||||
for(i = 0; i < CHECK_PRINT_NUM_FORMATS; i++) {
|
||||
gtk_option_menu_set_history(GTK_OPTION_MENU(pcd->format_picker), i);
|
||||
active = gtk_menu_get_active(GTK_MENU(menu));
|
||||
gtk_object_set_data(GTK_OBJECT(active), "option_index",
|
||||
GINT_TO_POINTER(i));
|
||||
}
|
||||
gtk_option_menu_set_history(GTK_OPTION_MENU(pcd->format_picker), 0);
|
||||
gnc_option_menu_init(pcd->format_picker);
|
||||
gnc_option_menu_init(pcd->position_picker);
|
||||
gnc_option_menu_init(pcd->dformat_picker);
|
||||
gnc_option_menu_init(pcd->units_picker);
|
||||
|
||||
menu = gtk_option_menu_get_menu(GTK_OPTION_MENU(pcd->position_picker));
|
||||
for(i = 0; i < CHECK_PRINT_NUM_POSITIONS; i++) {
|
||||
gtk_option_menu_set_history(GTK_OPTION_MENU(pcd->position_picker), i);
|
||||
active = gtk_menu_get_active(GTK_MENU(menu));
|
||||
gtk_object_set_data(GTK_OBJECT(active), "option_index",
|
||||
GINT_TO_POINTER(i));
|
||||
}
|
||||
gtk_option_menu_set_history(GTK_OPTION_MENU(pcd->position_picker), 0);
|
||||
|
||||
menu = gtk_option_menu_get_menu(GTK_OPTION_MENU(pcd->dformat_picker));
|
||||
for(i = 0; i < CHECK_PRINT_NUM_DATEFORMATS; i++) {
|
||||
gtk_option_menu_set_history(GTK_OPTION_MENU(pcd->dformat_picker), i);
|
||||
active = gtk_menu_get_active(GTK_MENU(menu));
|
||||
gtk_object_set_data(GTK_OBJECT(active), "option_index",
|
||||
GINT_TO_POINTER(i));
|
||||
}
|
||||
gtk_option_menu_set_history(GTK_OPTION_MENU(pcd->dformat_picker), 0);
|
||||
|
||||
menu = gtk_option_menu_get_menu(GTK_OPTION_MENU(pcd->units_picker));
|
||||
for(i = 0; i < CHECK_PRINT_NUM_UNITS; i++) {
|
||||
gtk_option_menu_set_history(GTK_OPTION_MENU(pcd->units_picker), i);
|
||||
active = gtk_menu_get_active(GTK_MENU(menu));
|
||||
gtk_object_set_data(GTK_OBJECT(active), "option_index",
|
||||
GINT_TO_POINTER(i));
|
||||
}
|
||||
gtk_option_menu_set_history(GTK_OPTION_MENU(pcd->units_picker), 0);
|
||||
|
||||
|
||||
/* set data so we can find the struct in callbacks */
|
||||
gtk_object_set_data(GTK_OBJECT(pcd->dialog), "print_check_structure",
|
||||
pcd);
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
#include "global-options.h"
|
||||
#include "messages.h"
|
||||
#include "util.h"
|
||||
#include "EuroUtils.h"
|
||||
|
||||
|
||||
/* This static indicates the debugging module that this .o belongs to. */
|
||||
@@ -598,9 +599,15 @@ char * gnc_ui_get_account_field_name(int field)
|
||||
case ACCOUNT_BALANCE :
|
||||
return BALN_STR;
|
||||
break;
|
||||
case ACCOUNT_BALANCE_EURO :
|
||||
return BALN_EURO_STR;
|
||||
break;
|
||||
case ACCOUNT_TOTAL :
|
||||
return TOTAL_STR;
|
||||
break;
|
||||
case ACCOUNT_TOTAL_EURO :
|
||||
return TOTAL_EURO_STR;
|
||||
break;
|
||||
}
|
||||
|
||||
assert(0);
|
||||
@@ -671,6 +678,19 @@ char * gnc_ui_get_account_field_value_string(Account *account, int field)
|
||||
return xaccPrintAmount(balance, PRTSYM | PRTSEP);
|
||||
}
|
||||
break;
|
||||
case ACCOUNT_BALANCE_EURO :
|
||||
{
|
||||
/* hack alert -- this is not thread safe ... */
|
||||
static char string[256];
|
||||
char *account_currency = xaccAccountGetCurrency(account);
|
||||
double balance = gnc_ui_account_get_balance(account, FALSE);
|
||||
double euro_balance = gnc_convert_to_euro(account_currency, balance);
|
||||
|
||||
xaccSPrintAmountGeneral(string, euro_balance, PRTSYM | PRTSEP, 2, 2, "EURO");
|
||||
|
||||
return string;
|
||||
}
|
||||
break;
|
||||
case ACCOUNT_TOTAL :
|
||||
{
|
||||
double balance = gnc_ui_account_get_balance(account, TRUE);
|
||||
@@ -678,6 +698,19 @@ char * gnc_ui_get_account_field_value_string(Account *account, int field)
|
||||
return xaccPrintAmount(balance, PRTSYM | PRTSEP);
|
||||
}
|
||||
break;
|
||||
case ACCOUNT_TOTAL_EURO :
|
||||
{
|
||||
/* hack alert -- this is not thread safe ... */
|
||||
static char string[256];
|
||||
char *account_currency = xaccAccountGetCurrency(account);
|
||||
double balance = gnc_ui_account_get_balance(account, TRUE);
|
||||
double euro_balance = gnc_convert_to_euro(account_currency, balance);
|
||||
|
||||
xaccSPrintAmountGeneral(string, euro_balance, PRTSYM | PRTSEP, 2, 2, "EURO");
|
||||
|
||||
return string;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
assert(0);
|
||||
@@ -947,6 +980,7 @@ gnc_fill_menu_with_data(GnomeUIInfo *info, gpointer data)
|
||||
{
|
||||
case GNOME_APP_UI_RADIOITEMS:
|
||||
case GNOME_APP_UI_SUBTREE:
|
||||
case GNOME_APP_UI_SUBTREE_STOCK:
|
||||
gnc_fill_menu_with_data((GnomeUIInfo *) info->moreinfo, data);
|
||||
break;
|
||||
case GNOME_APP_UI_ENDOFINFO:
|
||||
@@ -959,3 +993,33 @@ gnc_fill_menu_with_data(GnomeUIInfo *info, gpointer data)
|
||||
info++;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
gnc_option_menu_init(GtkWidget * w) {
|
||||
GtkWidget * menu;
|
||||
GtkWidget * active;
|
||||
int i;
|
||||
|
||||
menu = gtk_option_menu_get_menu(GTK_OPTION_MENU(w));
|
||||
for(i = 0; i < g_list_length(GTK_MENU_SHELL(menu)->children); i++) {
|
||||
gtk_option_menu_set_history(GTK_OPTION_MENU(w), i);
|
||||
active = gtk_menu_get_active(GTK_MENU(menu));
|
||||
gtk_object_set_data(GTK_OBJECT(active),
|
||||
"option_index",
|
||||
GINT_TO_POINTER(i));
|
||||
}
|
||||
gtk_option_menu_set_history(GTK_OPTION_MENU(w), 0);
|
||||
}
|
||||
|
||||
int
|
||||
gnc_option_menu_get_active(GtkWidget * w) {
|
||||
GtkWidget * menu;
|
||||
GtkWidget * menuitem;
|
||||
|
||||
menu = gtk_option_menu_get_menu(GTK_OPTION_MENU(w));
|
||||
menuitem = gtk_menu_get_active(GTK_MENU(menu));
|
||||
return GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(menuitem),
|
||||
"option_index"));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -84,7 +84,9 @@ typedef enum
|
||||
ACCOUNT_CURRENCY,
|
||||
ACCOUNT_SECURITY,
|
||||
ACCOUNT_BALANCE, /* with sign reversal */
|
||||
ACCOUNT_BALANCE_EURO,
|
||||
ACCOUNT_TOTAL, /* balance + children's balance with sign reversal */
|
||||
ACCOUNT_TOTAL_EURO,
|
||||
NUM_ACCOUNT_FIELDS
|
||||
} AccountFieldCode;
|
||||
|
||||
@@ -158,4 +160,6 @@ void gnc_save_window_size(const char *prefix, int width, int height);
|
||||
|
||||
void gnc_fill_menu_with_data(GnomeUIInfo *info, gpointer data);
|
||||
|
||||
void gnc_option_menu_init(GtkWidget * option_menu);
|
||||
int gnc_option_menu_get_active(GtkWidget * option_menu);
|
||||
#endif
|
||||
|
||||
@@ -103,3 +103,44 @@ gnc_ui_print_check_dialog_cancel_cb (GtkButton *button,
|
||||
void
|
||||
gnc_ui_print_check_dialog_help_cb (GtkButton *button,
|
||||
gpointer user_data);
|
||||
|
||||
void
|
||||
gnc_ui_find_transactions_dialog_early_date_select_cb
|
||||
(GtkButton *button,
|
||||
gpointer user_data);
|
||||
|
||||
void
|
||||
gnc_ui_find_transactions_dialog_late_date_select_cb
|
||||
(GtkButton *button,
|
||||
gpointer user_data);
|
||||
|
||||
void
|
||||
gnc_ui_find_transactions_dialog_search_type_cb
|
||||
(GtkToggleButton *togglebutton,
|
||||
gpointer user_data);
|
||||
|
||||
void
|
||||
gnc_ui_find_transactions_dialog_ok_cb (GtkButton *button,
|
||||
gpointer user_data);
|
||||
|
||||
void
|
||||
gnc_ui_find_transactions_dialog_cancel_cb
|
||||
(GtkButton *button,
|
||||
gpointer user_data);
|
||||
|
||||
void
|
||||
gnc_ui_find_transactions_dialog_help_cb
|
||||
(GtkButton *button,
|
||||
gpointer user_data);
|
||||
|
||||
void
|
||||
gnc_ui_select_date_dialog_today_cb (GtkButton *button,
|
||||
gpointer user_data);
|
||||
|
||||
void
|
||||
gnc_ui_select_date_dialog_ok_cb (GtkButton *button,
|
||||
gpointer user_data);
|
||||
|
||||
void
|
||||
gnc_ui_select_date_dialog_cancel_cb (GtkButton *button,
|
||||
gpointer user_data);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -8,3 +8,5 @@ GtkWidget* create_Print_Preview_Dialog (void);
|
||||
GtkWidget* create_Print_Dialog (void);
|
||||
GtkWidget* create_Paper_Size_Selector_Dialog (void);
|
||||
GtkWidget* create_Print_Check_Dialog (void);
|
||||
GtkWidget* create_Find_Transactions (void);
|
||||
GtkWidget* create_Select_Date (void);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -589,10 +589,15 @@ gnc_configure_reverse_balance(void)
|
||||
reverse_type[INCOME] = GNC_T;
|
||||
reverse_type[CREDIT] = GNC_T;
|
||||
}
|
||||
else if (safe_strcmp(choice, "asset-expense") == 0)
|
||||
else if (safe_strcmp(choice, "debit") == 0)
|
||||
{
|
||||
reverse_type[ASSET] = GNC_T;
|
||||
reverse_type[EXPENSE] = GNC_T;
|
||||
reverse_type[BANK] = GNC_T;
|
||||
reverse_type[CASH] = GNC_T;
|
||||
reverse_type[ASSET] = GNC_T;
|
||||
reverse_type[STOCK] = GNC_T;
|
||||
reverse_type[MUTUAL] = GNC_T;
|
||||
reverse_type[CURRENCY] = GNC_T;
|
||||
reverse_type[EXPENSE] = GNC_T;
|
||||
}
|
||||
else if (safe_strcmp(choice, "none") == 0)
|
||||
{
|
||||
|
||||
@@ -46,6 +46,7 @@
|
||||
#include "dialog-transfer.h"
|
||||
#include "dialog-edit.h"
|
||||
#include "dialog-qif-import.h"
|
||||
#include "dialog-find-transactions.h"
|
||||
#include "Scrub.h"
|
||||
#include "util.h"
|
||||
#include "gnc.h"
|
||||
@@ -146,8 +147,9 @@ gnc_ui_refresh_statusbar()
|
||||
xaccSPrintAmount(asset_string, assets, PRTSYM | PRTSEP);
|
||||
if(euro)
|
||||
{
|
||||
strcat(asset_string, " / EURO");
|
||||
strcat(asset_string, xaccPrintAmount(euro_assets, PRTSEP));
|
||||
strcat(asset_string, " / ");
|
||||
xaccSPrintAmountGeneral(asset_string + strlen(asset_string), euro_assets,
|
||||
PRTSYM | PRTSEP, 2, 2, "EURO");
|
||||
}
|
||||
gtk_label_set_text(GTK_LABEL(main_info->assets_label), asset_string);
|
||||
gnc_set_label_color(main_info->assets_label, assets);
|
||||
@@ -155,8 +157,9 @@ gnc_ui_refresh_statusbar()
|
||||
xaccSPrintAmount(profit_string, profits, PRTSYM | PRTSEP);
|
||||
if(euro)
|
||||
{
|
||||
strcat(profit_string, " / EURO");
|
||||
strcat(profit_string, xaccPrintAmount(euro_profits, PRTSEP));
|
||||
strcat(profit_string, " / ");
|
||||
xaccSPrintAmountGeneral(profit_string + strlen(profit_string), euro_profits,
|
||||
PRTSYM | PRTSEP, 2, 2, "EURO");
|
||||
}
|
||||
gtk_label_set_text(GTK_LABEL(main_info->profits_label), profit_string);
|
||||
gnc_set_label_color(main_info->profits_label, profits);
|
||||
@@ -170,6 +173,13 @@ gnc_refresh_main_window()
|
||||
gnc_account_tree_refresh_all();
|
||||
}
|
||||
|
||||
static void
|
||||
gnc_ui_find_transactions_cb ( GtkWidget *widget, gpointer data )
|
||||
{
|
||||
gnc_ui_find_transactions_dialog_create(NULL);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
gnc_ui_exit_cb ( GtkWidget *widget, gpointer data )
|
||||
{
|
||||
@@ -607,10 +617,18 @@ gnc_configure_account_tree(void *data)
|
||||
new_avi.show_field[ACCOUNT_SECURITY] = TRUE;
|
||||
|
||||
else if (safe_strcmp(node->data, "balance") == 0)
|
||||
{
|
||||
new_avi.show_field[ACCOUNT_BALANCE] = TRUE;
|
||||
if(gnc_lookup_boolean_option("International", "Enable EURO support", FALSE))
|
||||
new_avi.show_field[ACCOUNT_BALANCE_EURO] = TRUE;
|
||||
}
|
||||
|
||||
else if (safe_strcmp(node->data, "total") == 0)
|
||||
{
|
||||
new_avi.show_field[ACCOUNT_TOTAL] = TRUE;
|
||||
if(gnc_lookup_boolean_option("International", "Enable EURO support", FALSE))
|
||||
new_avi.show_field[ACCOUNT_TOTAL_EURO] = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
gnc_free_list_option_value(list);
|
||||
@@ -710,6 +728,17 @@ gnc_main_create_toolbar(GnomeApp *app, GNCMainInfo *main_info)
|
||||
0, 0, NULL
|
||||
},
|
||||
GNOMEUIINFO_SEPARATOR,
|
||||
{ GNOME_APP_UI_ITEM,
|
||||
FIND_STR_N,
|
||||
TOOLTIP_FIND_N,
|
||||
gnc_ui_find_transactions_cb,
|
||||
NULL,
|
||||
NULL,
|
||||
GNOME_APP_PIXMAP_STOCK,
|
||||
GNOME_STOCK_PIXMAP_SEARCH,
|
||||
0, 0, NULL
|
||||
},
|
||||
GNOMEUIINFO_SEPARATOR,
|
||||
{ GNOME_APP_UI_ITEM,
|
||||
EXIT_STR_N,
|
||||
TOOLTIP_EXIT_N,
|
||||
|
||||
@@ -16,13 +16,12 @@
|
||||
* 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, write to the Free Software *
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
|
||||
* along with this program; if not, contact: *
|
||||
* *
|
||||
* Free Software Foundation Voice: +1-617-542-5942 *
|
||||
* 59 Temple Place - Suite 330 Fax: +1-617-542-2652 *
|
||||
* Boston, MA 02111-1307, USA gnu@gnu.org *
|
||||
* *
|
||||
* Author: Rob Clark *
|
||||
* Internet: rclark@cs.hmc.edu *
|
||||
* Address: 609 8th Street *
|
||||
* Huntington Beach, CA 92648-4632 *
|
||||
\********************************************************************/
|
||||
|
||||
#define _GNU_SOURCE
|
||||
@@ -51,6 +50,7 @@
|
||||
#include "table-html.h"
|
||||
#include "gnucash-sheet.h"
|
||||
#include "global-options.h"
|
||||
#include "dialog-find-transactions.h"
|
||||
#include "util.h"
|
||||
|
||||
|
||||
@@ -130,6 +130,7 @@ static void dateCB(GtkWidget *w, gpointer data);
|
||||
static void new_trans_cb(GtkWidget *widget, gpointer data);
|
||||
static void jump_cb(GtkWidget *widget, gpointer data);
|
||||
static void print_check_cb(GtkWidget * widget, gpointer data);
|
||||
static void gnc_ui_find_transactions_cb ( GtkWidget *widget, gpointer data );
|
||||
|
||||
static gboolean gnc_register_include_date(RegWindow *regData, time_t date);
|
||||
|
||||
@@ -478,31 +479,33 @@ gnc_register_set_date_range(RegWindow *regData)
|
||||
gtk_widget_set_sensitive(regDateData->set_button, FALSE);
|
||||
|
||||
toggle = GTK_TOGGLE_BUTTON(regDateData->show_earliest);
|
||||
if (gtk_toggle_button_get_active(toggle))
|
||||
xaccQueryShowEarliestDateFound(regData->ledger->query);
|
||||
else
|
||||
{
|
||||
time_t start;
|
||||
|
||||
xaccQueryPurgeTerms(regData->ledger->query, PD_DATE);
|
||||
|
||||
if (!gtk_toggle_button_get_active(toggle)) {
|
||||
time_t start;
|
||||
|
||||
start = gnome_date_edit_get_date(GNOME_DATE_EDIT(regDateData->start_date));
|
||||
start = gnc_register_min_day_time(start);
|
||||
|
||||
xaccQuerySetEarliest(regData->ledger->query, start);
|
||||
|
||||
xaccQueryAddDateMatchTT(regData->ledger->query,
|
||||
start, LONG_MAX,
|
||||
QUERY_AND);
|
||||
}
|
||||
|
||||
|
||||
toggle = GTK_TOGGLE_BUTTON(regDateData->show_latest);
|
||||
if (gtk_toggle_button_get_active(toggle))
|
||||
xaccQueryShowLatestDateFound(regData->ledger->query);
|
||||
else
|
||||
{
|
||||
if (!gtk_toggle_button_get_active(toggle)) {
|
||||
time_t end;
|
||||
|
||||
|
||||
end = gnome_date_edit_get_date(GNOME_DATE_EDIT(regDateData->end_date));
|
||||
end = gnc_register_max_day_time(end);
|
||||
|
||||
xaccQuerySetLatest(regData->ledger->query, end);
|
||||
|
||||
xaccQueryAddDateMatchTT(regData->ledger->query,
|
||||
LONG_MIN,
|
||||
end,
|
||||
QUERY_AND);
|
||||
}
|
||||
|
||||
|
||||
gnc_date_range_set_sensitivities(regData);
|
||||
}
|
||||
|
||||
@@ -807,6 +810,15 @@ gnc_register_create_tool_bar(RegWindow *regData)
|
||||
0, 0, NULL
|
||||
},
|
||||
GNOMEUIINFO_SEPARATOR,
|
||||
{
|
||||
GNOME_APP_UI_ITEM,
|
||||
FIND_STR_N, TOOLTIP_FIND_N,
|
||||
gnc_ui_find_transactions_cb,
|
||||
NULL, NULL,
|
||||
GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_PIXMAP_SEARCH,
|
||||
0, 0, NULL
|
||||
},
|
||||
GNOMEUIINFO_SEPARATOR,
|
||||
{
|
||||
GNOME_APP_UI_ITEM,
|
||||
CLOSE_STR_N, TOOLTIP_CLOSE_REG_N,
|
||||
@@ -827,6 +839,18 @@ gnc_register_create_tool_bar(RegWindow *regData)
|
||||
return toolbar;
|
||||
}
|
||||
|
||||
static void
|
||||
gnc_ui_find_transactions_cb ( GtkWidget *widget, gpointer data )
|
||||
{
|
||||
RegWindow * regdata = data;
|
||||
if(regdata->ledger->type == SEARCH_LEDGER) {
|
||||
gnc_ui_find_transactions_dialog_create(regdata->ledger);
|
||||
}
|
||||
else {
|
||||
gnc_ui_find_transactions_dialog_create(NULL);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static GtkWidget *
|
||||
gnc_register_create_status_bar(RegWindow *regData)
|
||||
@@ -1473,7 +1497,7 @@ regWindowLedger(xaccLedgerDisplay *ledger)
|
||||
if (regData != NULL)
|
||||
return regData;
|
||||
|
||||
xaccQuerySetMaxSplits(ledger->query, INT_MAX);
|
||||
/* xaccQuerySetMaxSplits(ledger->query, INT_MAX); */
|
||||
|
||||
regData = (RegWindow *) malloc(sizeof (RegWindow));
|
||||
|
||||
@@ -1502,7 +1526,10 @@ regWindowLedger(xaccLedgerDisplay *ledger)
|
||||
GTK_SIGNAL_FUNC (gnc_register_destroy_cb), regData);
|
||||
|
||||
regData->date_window = gnc_register_date_window(regData);
|
||||
gnc_register_set_date_range(regData);
|
||||
|
||||
if(ledger->type != SEARCH_LEDGER) {
|
||||
gnc_register_set_date_range(regData);
|
||||
}
|
||||
|
||||
statusbar = gnc_register_create_status_bar(regData);
|
||||
gtk_box_pack_start(GTK_BOX(vbox), statusbar, FALSE, FALSE, 0);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*******************************************************************\
|
||||
* window-register.h -- public GnuCash register functions *
|
||||
* Copyright (C) 1998,1999 Linas Vepstas *
|
||||
* Copyright (C) 1998,1999,2000 Linas Vepstas *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU General Public License as *
|
||||
@@ -13,13 +13,22 @@
|
||||
* 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, write to the Free Software *
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
|
||||
* along with this program; if not, contact: *
|
||||
* *
|
||||
* Free Software Foundation Voice: +1-617-542-5942 *
|
||||
* 59 Temple Place - Suite 330 Fax: +1-617-542-2652 *
|
||||
* Boston, MA 02111-1307, USA gnu@gnu.org *
|
||||
* *
|
||||
\********************************************************************/
|
||||
|
||||
#ifndef __WINDOW_REGISTER_H__
|
||||
#define __WINDOW_REGISTER_H__
|
||||
|
||||
#include "RegWindow.h"
|
||||
#include "MultiLedger.h"
|
||||
|
||||
RegWindow * regWindowLedger(xaccLedgerDisplay *ledger);
|
||||
|
||||
void gnc_register_raise(RegWindow *regData);
|
||||
void gnc_register_jump_to_blank(RegWindow *regData);
|
||||
void gnc_register_jump_to_split(RegWindow *regData, Split *split);
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
* Copyright (C) 2000 Dave Peticolas <peticola@cs.ucdavis.edu>
|
||||
*/
|
||||
|
||||
#include <limits.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
|
||||
@@ -165,7 +165,9 @@
|
||||
|
||||
;; account-list options use the option-data as a boolean value. If
|
||||
;; true, the gui should allow the user to select multiple accounts.
|
||||
;; values are always a list of accounts.
|
||||
;; Internally, values are always a list of guids. Externally, both
|
||||
;; guids and account pointers may be used to set the value of the
|
||||
;; option. The option always returns a list of account pointers.
|
||||
(define (gnc:make-account-list-option
|
||||
section
|
||||
name
|
||||
@@ -174,7 +176,17 @@
|
||||
default-getter
|
||||
value-validator
|
||||
multiple-selection)
|
||||
(let ((option (default-getter))
|
||||
|
||||
(define (convert-to-guid item)
|
||||
(if (string? item)
|
||||
item
|
||||
(gnc:account-get-guid item)))
|
||||
(define (convert-to-account item)
|
||||
(if (string? item)
|
||||
(gnc:account-lookup item)
|
||||
item))
|
||||
|
||||
(let ((option (map convert-to-guid (default-getter)))
|
||||
(option-set #f)
|
||||
(validator
|
||||
(if (not value-validator)
|
||||
@@ -182,17 +194,19 @@
|
||||
value-validator)))
|
||||
(gnc:make-option
|
||||
section name sort-tag 'account-list documentation-string
|
||||
(lambda () (if option-set option (default-getter)))
|
||||
(lambda () (map convert-to-account (if option-set
|
||||
option
|
||||
(default-getter))))
|
||||
(lambda (account-list)
|
||||
(let* ((result (validator account-list))
|
||||
(valid (car result))
|
||||
(value (cadr result)))
|
||||
(if valid
|
||||
(begin
|
||||
(set! option value)
|
||||
(set! option (map convert-to-guid value))
|
||||
(set! option-set #t))
|
||||
(gnc:error "Illegal account list value set"))))
|
||||
default-getter
|
||||
(lambda () (map convert-to-account (default-getter)))
|
||||
#f
|
||||
validator
|
||||
multiple-selection #f)))
|
||||
|
||||
@@ -317,7 +317,7 @@ the account instead of opening a register." #f))
|
||||
'default
|
||||
(list #(default "Income & Expense" "Reverse Income and Expense Accounts")
|
||||
#(credit "Credit Accounts" "Reverse Credit Card, Liability, Equity, and Income Accounts")
|
||||
#(asset-expense "Asset & Expense" "Reverse Asset and Expense Accounts")
|
||||
#(debit "Debit Accounts" "Reverse Bank, Cash, Asset, Stock, Mutual Fund, Currency, and Expense Accounts")
|
||||
#(none "None" "Don't reverse any accounts"))))
|
||||
|
||||
|
||||
|
||||
@@ -71,7 +71,7 @@
|
||||
;; increment the xtn count in place
|
||||
(list-set! entry 4
|
||||
(+ (list-ref entry 4)
|
||||
(length (qif-file:xtns file))))
|
||||
(qif-file:default-acct-xtns file)))
|
||||
;; make a new hash table entry for the account
|
||||
;; make it a Bank account by default.
|
||||
(hash-set!
|
||||
@@ -82,10 +82,10 @@
|
||||
GNC-CCARD-TYPE)
|
||||
gnc-acct-info)
|
||||
(list
|
||||
(length (qif-file:xtns file))
|
||||
(qif-file:default-acct-xtns file)
|
||||
#f)))))))
|
||||
qif-files)
|
||||
|
||||
|
||||
;; now make the second pass through the files, looking at the
|
||||
;; transactions. Hopefully the accounts are all there already.
|
||||
;; stock accounts can have both a category/account and another
|
||||
@@ -110,7 +110,25 @@
|
||||
GNC-MUTUAL-TYPE)
|
||||
gnc-acct-info)
|
||||
(list 1 xtn)))))))
|
||||
|
||||
;; if there's a from-acct, reference it
|
||||
(let ((from (qif-xtn:from-acct xtn))
|
||||
(entry #f))
|
||||
(if from
|
||||
(begin
|
||||
(set! entry (hash-ref acct-hash from))
|
||||
(if entry
|
||||
(list-set! entry 4
|
||||
(+ 1 (list-ref entry 4)))
|
||||
(hash-set! acct-hash from
|
||||
(append (qif-import:guess-acct
|
||||
from
|
||||
(list
|
||||
GNC-BANK-TYPE
|
||||
GNC-CCARD-TYPE
|
||||
GNC-STOCK-TYPE)
|
||||
gnc-acct-info)
|
||||
(list 1 #f)))))))
|
||||
|
||||
;; iterate over the splits doing the same thing.
|
||||
(for-each
|
||||
(lambda (split)
|
||||
|
||||
@@ -22,8 +22,10 @@
|
||||
(let ((qstate-type #f)
|
||||
(current-xtn #f)
|
||||
(current-split #f)
|
||||
(current-account-name #f)
|
||||
(default-split #f)
|
||||
(first-xtn #f)
|
||||
(ignore-accounts #f)
|
||||
(line #f)
|
||||
(tag #f)
|
||||
(value #f)
|
||||
@@ -36,7 +38,7 @@
|
||||
(lambda ()
|
||||
;; loop over lines
|
||||
(let line-loop ()
|
||||
(set! line (read-line))
|
||||
(set! line (read-delimited (string #\nl #\cr)))
|
||||
(if (and
|
||||
(not (eof-object? line))
|
||||
(>= (string-length line) 1))
|
||||
@@ -63,7 +65,12 @@
|
||||
((eq? qstate-type 'type:cat)
|
||||
(set! current-xtn (make-qif-cat)))
|
||||
((eq? qstate-type 'account)
|
||||
(set! current-xtn (make-qif-acct)))))
|
||||
(set! current-xtn (make-qif-acct)))
|
||||
((eq? qstate-type 'option:autoswitch)
|
||||
(set! ignore-accounts #t))
|
||||
((eq? qstate-type 'clear:autoswitch)
|
||||
(set! ignore-accounts #f))))
|
||||
|
||||
;;; (#t
|
||||
;;; (display "qif-file:read-file can't handle ")
|
||||
;;; (write qstate-type)
|
||||
@@ -71,7 +78,7 @@
|
||||
;;; (newline))))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; account transactions
|
||||
;; bank-account type transactions
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
((member qstate-type valid-acct-types)
|
||||
@@ -179,17 +186,23 @@
|
||||
|
||||
;; ^ : end-of-record
|
||||
((#\^)
|
||||
(if (and (qif-xtn:date current-xtn)
|
||||
(qif-split:amount default-split))
|
||||
(if (qif-xtn:date current-xtn)
|
||||
(begin
|
||||
(if (not (qif-split:amount default-split))
|
||||
(qif-split:set-amount! default-split 0.00))
|
||||
|
||||
(if (null? (qif-xtn:splits current-xtn))
|
||||
(qif-xtn:set-splits! current-xtn
|
||||
(list default-split)))
|
||||
(qif-file:add-xtn! self current-xtn))
|
||||
(begin
|
||||
(display "qif-file:read-file : discarding xtn")
|
||||
(newline)
|
||||
(qif-xtn:print current-xtn)))
|
||||
(if (and (not ignore-accounts)
|
||||
current-account-name)
|
||||
(qif-xtn:set-from-acct! current-xtn
|
||||
current-account-name))
|
||||
(qif-file:add-xtn! self current-xtn)))
|
||||
; (begin
|
||||
; (display "qif-file:read-file : discarding xtn")
|
||||
; (newline)
|
||||
; (qif-xtn:print current-xtn)))
|
||||
|
||||
(if (and first-xtn
|
||||
(string? (qif-xtn:payee current-xtn))
|
||||
@@ -300,14 +313,18 @@
|
||||
(qif-acct:set-limit!
|
||||
current-xtn (qif-file:parse-value/decimal self value)))
|
||||
|
||||
;; B : budget amount. not really supported.
|
||||
((#\B)
|
||||
(qif-acct:set-budget!
|
||||
current-xtn (qif-file:parse-value/decimal self value)))
|
||||
|
||||
((#\^)
|
||||
(if (not ignore-accounts)
|
||||
(set! current-account-name
|
||||
(qif-acct:name current-xtn)))
|
||||
(qif-file:add-account! self current-xtn)
|
||||
;;; (qif-acct:print current-xtn)
|
||||
(set! current-xtn (make-qif-acct)))
|
||||
|
||||
(else
|
||||
(display "qif-file:read-file : unknown Account slot ")
|
||||
(display tag) (newline))))
|
||||
(set! current-xtn (make-qif-acct)))))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; Category (Cat) transactions
|
||||
|
||||
@@ -33,7 +33,9 @@
|
||||
guessed-date-format
|
||||
y2k-threshold
|
||||
currency ;; this is a string.. no checking
|
||||
xtns ;;
|
||||
default-acct-xtns
|
||||
accts-mentioned
|
||||
xtns
|
||||
accounts
|
||||
cats
|
||||
classes)))
|
||||
@@ -95,6 +97,18 @@
|
||||
(define (qif-file:set-currency! self value)
|
||||
(simple-obj-setter self <qif-file> 'currency value))
|
||||
|
||||
(define (qif-file:default-acct-xtns self)
|
||||
(simple-obj-getter self <qif-file> 'default-acct-xtns))
|
||||
|
||||
(define (qif-file:set-default-acct-xtns! self value)
|
||||
(simple-obj-setter self <qif-file> 'default-acct-xtns value))
|
||||
|
||||
(define (qif-file:accts-mentioned self)
|
||||
(simple-obj-getter self <qif-file> 'accts-mentioned))
|
||||
|
||||
(define (qif-file:set-accts-mentioned! self value)
|
||||
(simple-obj-setter self <qif-file> 'accts-mentioned value))
|
||||
|
||||
(define (qif-file:cats self)
|
||||
(simple-obj-getter self <qif-file> 'cats))
|
||||
|
||||
@@ -128,6 +142,8 @@
|
||||
(qif-file:set-guessed-date-format! self date-format)
|
||||
(qif-file:set-currency! self currency)
|
||||
(qif-file:set-y2k-threshold! self 50)
|
||||
(qif-file:set-default-acct-xtns! self 0)
|
||||
(qif-file:set-accts-mentioned! self '())
|
||||
(qif-file:set-xtns! self '())
|
||||
(qif-file:set-accounts! self '())
|
||||
(qif-file:set-cats! self '())
|
||||
@@ -209,7 +225,6 @@
|
||||
;; [N] number (check number, sell, or buy)
|
||||
;; [C] cleared : parsed (x/X/*) ;
|
||||
;; [T] amount : parsed, units are currency from <qif-file>.
|
||||
;; [M] memo : string
|
||||
;; [I] share price : parsed
|
||||
;; [Q] number of shares
|
||||
;; [Y] name of security
|
||||
@@ -221,8 +236,8 @@
|
||||
(define <qif-xtn>
|
||||
(make-simple-class
|
||||
'qif-xtn
|
||||
'(date payee address number cleared memo
|
||||
share-price num-shares security-name adjustment
|
||||
'(date payee address number cleared
|
||||
from-acct share-price num-shares security-name adjustment
|
||||
splits bank-xtn? mark)))
|
||||
|
||||
(define (qif-xtn? self)
|
||||
@@ -258,6 +273,12 @@
|
||||
(define (qif-xtn:set-cleared! self value)
|
||||
(simple-obj-setter self <qif-xtn> 'cleared value))
|
||||
|
||||
(define (qif-xtn:from-acct self)
|
||||
(simple-obj-getter self <qif-xtn> 'from-acct))
|
||||
|
||||
(define (qif-xtn:set-from-acct! self value)
|
||||
(simple-obj-setter self <qif-xtn> 'from-acct value))
|
||||
|
||||
(define (qif-xtn:share-price self)
|
||||
(simple-obj-getter self <qif-xtn> 'share-price))
|
||||
|
||||
@@ -333,6 +354,7 @@
|
||||
(begin
|
||||
(display "qif-import: failed to reparse stock info")
|
||||
(newline)
|
||||
(qif-xtn:print self)
|
||||
(set! reparse-ok
|
||||
(list #f "Could not autodetect radix format."))))
|
||||
|
||||
@@ -358,7 +380,7 @@
|
||||
(qif-xtn:date self))))
|
||||
(if (string? (qif-xtn:date self))
|
||||
(begin
|
||||
(display "qif-import: failed to reparse date")
|
||||
(display "qif-import: failed to reparse date ")
|
||||
(write (qif-xtn:date self)) (newline)
|
||||
(set! reparse-ok
|
||||
(list #f "Could not autodetect date format."))))
|
||||
@@ -378,7 +400,7 @@
|
||||
(define <qif-acct>
|
||||
(make-simple-class
|
||||
'qif-acct
|
||||
'(name type description limit)))
|
||||
'(name type description limit budget)))
|
||||
|
||||
(define (qif-acct:name self)
|
||||
(simple-obj-getter self <qif-acct> 'name))
|
||||
@@ -404,6 +426,12 @@
|
||||
(define (qif-acct:set-limit! self value)
|
||||
(simple-obj-setter self <qif-acct> 'limit value))
|
||||
|
||||
(define (qif-acct:budget self)
|
||||
(simple-obj-getter self <qif-acct> 'budget))
|
||||
|
||||
(define (qif-acct:set-budget! self value)
|
||||
(simple-obj-setter self <qif-acct> 'budget value))
|
||||
|
||||
(define (make-qif-acct)
|
||||
(make-simple-obj <qif-acct>))
|
||||
|
||||
@@ -539,6 +567,29 @@
|
||||
|
||||
|
||||
(define (qif-file:add-xtn! self xtn)
|
||||
(let ((from (qif-xtn:from-acct xtn)))
|
||||
(if from
|
||||
(if (not (member from (qif-file:accts-mentioned self)))
|
||||
(qif-file:set-accts-mentioned!
|
||||
self (cons from (qif-file:accts-mentioned self))))
|
||||
(let ((defs (qif-file:default-acct-xtns self)))
|
||||
(qif-file:set-default-acct-xtns! self (+ 1 defs))
|
||||
(if (and (eq? 0 defs)
|
||||
(not (member (qif-file:account self)
|
||||
(qif-file:accts-mentioned self))))
|
||||
(qif-file:set-accts-mentioned!
|
||||
self (cons (qif-file:account self)
|
||||
(qif-file:accts-mentioned self)))))))
|
||||
(for-each
|
||||
(lambda (split)
|
||||
(if (and (qif-split:category-is-account? split)
|
||||
(not (member (qif-split:category split)
|
||||
(qif-file:accts-mentioned self))))
|
||||
(qif-file:set-accts-mentioned!
|
||||
self (cons (qif-split:category split)
|
||||
(qif-file:accts-mentioned self)))))
|
||||
(qif-xtn:splits xtn))
|
||||
|
||||
(qif-file:set-xtns! self
|
||||
(cons xtn (qif-file:xtns self))))
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
2;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;; qif-parse.scm
|
||||
;;; routines to parse values and dates in QIF files.
|
||||
;;;
|
||||
@@ -277,11 +277,16 @@
|
||||
(set! possibilities (delq 'm-d-y possibilities)))
|
||||
(if (or (not (number? n1)) (> n1 31))
|
||||
(set! possibilities (delq 'd-m-y possibilities)))
|
||||
(if (or (not (number? n1)) (< n1 1))
|
||||
(set! possibilities (delq 'd-m-y possibilities)))
|
||||
(if (or (not (number? n1)) (< n1 1))
|
||||
(set! possibilities (delq 'm-d-y possibilities)))
|
||||
|
||||
(if (or (not (number? n2)) (> n2 12))
|
||||
(begin
|
||||
(set! possibilities (delq 'd-m-y possibilities))
|
||||
(set! possibilities (delq 'y-m-d possibilities))))
|
||||
|
||||
(if (or (not (number? n2)) (> n2 31))
|
||||
(begin
|
||||
(set! possibilities (delq 'm-d-y possibilities))
|
||||
@@ -291,6 +296,12 @@
|
||||
(set! possibilities (delq 'y-d-m possibilities)))
|
||||
(if (or (not (number? n3)) (> n3 31))
|
||||
(set! possibilities (delq 'y-m-d possibilities)))
|
||||
|
||||
(if (or (not (number? n3)) (< n3 1))
|
||||
(set! possibilities (delq 'y-m-d possibilities)))
|
||||
(if (or (not (number? n3)) (< n3 1))
|
||||
(set! possibilities (delq 'y-d-m possibilities)))
|
||||
|
||||
|
||||
;; if there's exactly one possibility left, we've got a good
|
||||
;; guess. if there are no possibilities left, the date
|
||||
|
||||
@@ -195,6 +195,11 @@
|
||||
;; transactions should give us a small speed advantage.
|
||||
(for-each
|
||||
(lambda (qif-file)
|
||||
(display "Importing QIF xtns from ")
|
||||
(display (qif-file:path qif-file)) (newline)
|
||||
(display "Accounts mentioned: ")
|
||||
(write (qif-file:accts-mentioned qif-file)) (newline)
|
||||
|
||||
;; within the file, iterate over transactions. key things to
|
||||
;; remember: if the L line in the transaction is a category,
|
||||
;; it's a single-entry xtn and no need to look for the other
|
||||
@@ -264,12 +269,15 @@
|
||||
(gnc:transaction-set-xnum gnc-xtn (qif-xtn:number qif-xtn)))
|
||||
|
||||
;; find the GNC account for the near end of the transaction
|
||||
;; (all splits have the same near end)
|
||||
(if (qif-xtn:bank-xtn? qif-xtn)
|
||||
(begin
|
||||
(set! near-acct-info
|
||||
(hash-ref qif-acct-map
|
||||
(qif-file:account qif-file)))
|
||||
(if (qif-xtn:from-acct qif-xtn)
|
||||
(set! near-acct-info
|
||||
(hash-ref qif-acct-map
|
||||
(qif-xtn:from-acct qif-xtn)))
|
||||
(set! near-acct-info
|
||||
(hash-ref qif-acct-map
|
||||
(qif-file:account qif-file))))
|
||||
(set! near-acct-name
|
||||
(list-ref near-acct-info 1))
|
||||
(set! near-acct (hash-ref gnc-acct-hash near-acct-name)))
|
||||
@@ -290,7 +298,7 @@
|
||||
(eq? 'cleared cleared)
|
||||
(eq? 'reconciled cleared))
|
||||
(gnc:split-set-reconcile gnc-near-split #\c)))
|
||||
|
||||
|
||||
;; iterate over QIF splits
|
||||
(for-each
|
||||
(lambda (qif-split)
|
||||
@@ -411,7 +419,7 @@
|
||||
split
|
||||
(qif-import:mark-matching-split split xtn qif-file qif-files))
|
||||
(qif-split:set-mark! split #t)))))
|
||||
(qif-xtn:splits xtn))
|
||||
(qif-xtn:splits xtn))
|
||||
(qif-xtn:set-mark! xtn #t))
|
||||
|
||||
(define (qif-import:mark-matching-split split xtn qif-file qif-files)
|
||||
@@ -425,10 +433,12 @@
|
||||
(done #f))
|
||||
|
||||
(if bank-xtn?
|
||||
(set! near-acct-name (qif-file:account qif-file))
|
||||
(let ((near (qif-xtn:from-acct xtn)))
|
||||
(if near
|
||||
(set! near-acct-name near)
|
||||
(set! near-acct-name (qif-file:account qif-file))))
|
||||
(set! near-acct-name (qif-xtn:security-name xtn)))
|
||||
|
||||
|
||||
;; (display "mark-matching-split : near-acct = ")
|
||||
;; (write near-acct-name)
|
||||
;; (display " far-acct = ")
|
||||
@@ -438,12 +448,20 @@
|
||||
;; (newline)
|
||||
|
||||
;; this is the grind loop. Go over every unmarked split of every
|
||||
;; unmarked transaction of every file that's not this one.
|
||||
;; unmarked transaction of every file that has any transactions from
|
||||
;; the far-acct-name.
|
||||
(let file-loop ((files qif-files))
|
||||
(if (and (not (eq? qif-file (car files)))
|
||||
(or (not bank-xtn?)
|
||||
(string=? far-acct-name
|
||||
(qif-file:account (car files)))))
|
||||
(if (and
|
||||
(member near-acct-name
|
||||
(qif-file:accts-mentioned (car files)))
|
||||
(member far-acct-name
|
||||
(qif-file:accts-mentioned (car files))))
|
||||
|
||||
;; (if (and (not (eq? qif-file (car files)))
|
||||
;; (or (not bank-xtn?)
|
||||
;; (string=? far-acct-name
|
||||
;; (qif-file:account (car files)))))
|
||||
|
||||
(let xtn-loop ((xtns (qif-file:xtns (car files))))
|
||||
(if (not (qif-xtn:mark (car xtns)))
|
||||
(let split-loop ((splits (qif-xtn:splits (car xtns))))
|
||||
|
||||
@@ -85,7 +85,7 @@
|
||||
(display " ")
|
||||
(display slot)
|
||||
(display " : ")
|
||||
(display (simple-obj-getter obj class slot))
|
||||
(write (simple-obj-getter obj class slot))
|
||||
(newline))
|
||||
(vector-ref (cdr class) 2)))
|
||||
|
||||
|
||||
@@ -30,7 +30,8 @@ INCLPATH = \
|
||||
-I@top_srcdir@/src/engine/guid \
|
||||
-I@top_srcdir@/include \
|
||||
-I@PERLINCL@/CORE \
|
||||
-I$(prefix)/include
|
||||
-I$(prefix)/include \
|
||||
`glib-config --cflags glib`
|
||||
|
||||
# set -Dbool=char because the perl headers need this
|
||||
# use -fpic so that we can create loadable module
|
||||
|
||||
@@ -42,6 +42,7 @@
|
||||
#define HH_ACCEDIT "xacc-accountedit.html"
|
||||
#define HH_QIFIMPORT "xacc-qif-import.html"
|
||||
#define HH_PRINTCHECK "xacc-print-check.html"
|
||||
#define HH_FIND_TRANSACTIONS "xacc-find-transactions.html"
|
||||
#define HH_PRINT "xacc-print.html"
|
||||
|
||||
/** STRUCTS *********************************************************/
|
||||
|
||||
Reference in New Issue
Block a user