gnucash master: Multiple changes pushed

Geert Janssens gjanssens at code.gnucash.org
Tue Oct 31 04:58:10 EDT 2017


Updated	 via  https://github.com/Gnucash/gnucash/commit/f05761e6 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/641d56f3 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/9669bd6b (commit)
	 via  https://github.com/Gnucash/gnucash/commit/09bcb515 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/e9598228 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/b92a41b6 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/d22b098d (commit)
	 via  https://github.com/Gnucash/gnucash/commit/5157d8b5 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/e64e73b6 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/a9fab360 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/dfa25e8c (commit)
	 via  https://github.com/Gnucash/gnucash/commit/cdb67763 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/3475a894 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/885272a1 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/d077400b (commit)
	 via  https://github.com/Gnucash/gnucash/commit/b74c0bed (commit)
	 via  https://github.com/Gnucash/gnucash/commit/51a0a55e (commit)
	 via  https://github.com/Gnucash/gnucash/commit/85fae7ef (commit)
	 via  https://github.com/Gnucash/gnucash/commit/04b51002 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/fa789371 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/eda22039 (commit)
	from  https://github.com/Gnucash/gnucash/commit/115c0bf4 (commit)



commit f05761e636f27810145b55e2ef25a93b88c2ca1b
Merge: 9669bd6 641d56f
Author: Geert Janssens <geert at kobaltwit.be>
Date:   Tue Oct 31 09:53:33 2017 +0100

    Merge branch 'gtk3-update7' of https://github.com/Bob-IT/gnucash into unstable

diff --cc gnucash/gnucash-320.css
index 812d063,29242ca..d7e0495
--- a/gnucash/gnucash-320.css
+++ b/gnucash/gnucash-320.css
@@@ -67,5 -67,6 +67,5 @@@ cursor button 
  /* Some tweaks for the about dialog */
  dialog#GnuCash > box > box > label
  {
-     font-size: 24px;
+   font-size: 24px;
  }
 -

commit 641d56f346f256cc8517f8014449dd5cb978f912
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Mon Oct 2 11:36:18 2017 +0100

    Move the CSS files to a Gresource file
    
    Move the source CSS files to the gnucash directory and load them from
    a gresource file. As pseudo class 'insensative' is deprecated, add a
    second main css file to be used after Gtk3.20

diff --git a/configure.ac b/configure.ac
index fd23a64..5b7fedc 100644
--- a/configure.ac
+++ b/configure.ac
@@ -325,6 +325,9 @@ AC_CHECK_HEADERS(dirent.h dlfcn.h dl.h utmp.h locale.h mcheck.h unistd.h wctype.
 
 GLIB_GSETTINGS
 
+GLIB_COMPILE_RESOURCES=`$PKG_CONFIG --variable glib_compile_resources gio-2.0`
+AC_SUBST(GLIB_COMPILE_RESOURCES)
+
 # I'm sure we (used to?) require this in various places, so don't remove
 # this test unless you've done sufficient code review/testing.
 AC_MSG_CHECKING(if unsigned long is at least as big as guint32)
diff --git a/gnucash/CMakeLists.txt b/gnucash/CMakeLists.txt
index b939be5..a85ebfd 100644
--- a/gnucash/CMakeLists.txt
+++ b/gnucash/CMakeLists.txt
@@ -27,6 +27,7 @@ ENDIF (WIN32)
 
 SET (gnucash_SOURCES
   gnucash-bin.c
+  gnucash-gresources.c
   ${GNUCASH_RESOURCE_FILE}
 )
 
@@ -42,6 +43,40 @@ TARGET_LINK_LIBRARIES (gnucash
    ${GUILE_LDFLAGS} ${GLIB2_LDFLAGS} ${GTK3_LDFLAGS} ${GTK_MAC_LDFLAGS}
 )
 
+# Get glib executable for generating the gresource file
+EXECUTE_PROCESS(
+   COMMAND
+       ${PKG_CONFIG_EXECUTABLE} gio-2.0 --variable glib_compile_resources
+   OUTPUT_VARIABLE
+       GLIB_COMPILE_RESOURCES_EXECUTABLE
+   OUTPUT_STRIP_TRAILING_WHITESPACE
+)
+
+# Get the dependencies of the gresource
+EXECUTE_PROCESS(
+  OUTPUT_VARIABLE
+      gr_files
+  COMMAND ${GLIB_COMPILE_RESOURCES_EXECUTABLE}
+     --sourcedir=${CMAKE_CURRENT_SOURCE_DIR}
+     --generate-dependencies
+     ${CMAKE_CURRENT_SOURCE_DIR}/gnucash-gresources.xml
+)
+
+STRING (REPLACE "\n" ";" gresource_files ${gr_files})
+
+ADD_CUSTOM_COMMAND(
+   OUTPUT gnucash-gresources.c
+   COMMAND
+    ${GLIB_COMPILE_RESOURCES_EXECUTABLE}
+    --target=gnucash-gresources.c
+    --sourcedir=${CMAKE_CURRENT_SOURCE_DIR}
+    --generate-source
+    ${CMAKE_CURRENT_SOURCE_DIR}/gnucash-gresources.xml
+   DEPENDS
+    ${CMAKE_CURRENT_SOURCE_DIR}/gnucash-gresources.xml ${gresource_files}
+   WORKING_DIRECTORY
+    ${CMAKE_CURRENT_BINARY_DIR}
+)
 
 IF (MAC_INTEGRATION)
   TARGET_COMPILE_OPTIONS(gnucash PRIVATE ${OSX_EXTRA_COMPILE_FLAGS})
@@ -202,7 +237,7 @@ ENDIF(WIN32)
 
 
 SET_LOCAL_DIST(gnucash_DIST_local CMakeLists.txt environment.in generate-gnc-script
-               gnucash-bin.c gnucash.rc.in gnucash-valgrind.in
+               gnucash-bin.c gnucash.rc.in gnucash-valgrind.in gnucash-gresourses.xml ${gresource_files}
                Makefile.am ${gnucash_EXTRA_DIST})
 
 SET(gnucash_DIST ${gnucash_DIST_local} ${gnome_DIST} ${gnome_search_DIST}
diff --git a/gnucash/Makefile.am b/gnucash/Makefile.am
index 9687a4f..c79855f 100644
--- a/gnucash/Makefile.am
+++ b/gnucash/Makefile.am
@@ -55,9 +55,14 @@ PLATFORM_FILES = gnucash-valgrind
 
 endif !PLATFORM_WIN32
 
+# gresource for css
+gresource_files = $(shell $(GLIB_COMPILE_RESOURCES) --sourcedir=$(srcdir) --generate-dependencies $(srcdir)/gnucash-gresources.xml)
+gnucash-gresources.c: gnucash-gresources.xml $(gresource_files)
+	$(AM_V_GEN) $(GLIB_COMPILE_RESOURCES) --target=$@ --sourcedir=$(srcdir) --generate-source $<
+
 BIN_NAME = gnucash
 bin_PROGRAMS = ${BIN_NAME}
-gnucash_SOURCES = gnucash-bin.c ${GNUCASH_RESOURCE_FILE}
+gnucash_SOURCES = gnucash-bin.c gnucash-gresources.c ${GNUCASH_RESOURCE_FILE}
 gnucash_LDADD = \
   ${top_builddir}/gnucash/register/ledger-core/libgncmod-ledger-core.la \
   ${top_builddir}/gnucash/report/report-gnome/libgncmod-report-gnome.la \
@@ -156,6 +161,8 @@ EXTRA_DIST = \
 	generate-gnc-script \
 	gnucash-valgrind.in \
 	environment.in \
+	gnucash-gresources.xml \
+	${gresource_files} \
 	CMakeLists.txt
 
 AM_CPPFLAGS += -DG_LOG_DOMAIN=\"gnc.bin\"
diff --git a/gnucash/gnome-utils/gnc-gnome-utils.c b/gnucash/gnome-utils/gnc-gnome-utils.c
index 1642ed9..099072c 100644
--- a/gnucash/gnome-utils/gnc-gnome-utils.c
+++ b/gnucash/gnome-utils/gnc-gnome-utils.c
@@ -169,6 +169,33 @@ gnc_configure_date_completion (void)
     qof_date_completion_set(dc, backmonths);
 }
 
+/* This function was copied from GTK3.22 as it was only introduced in
+ * version 3.16 */
+#if !GTK_CHECK_VERSION(3,16,0)
+static void
+gtk_css_provider_load_from_resource (GtkCssProvider *css_provider,
+                                     const gchar *resource_path)
+{
+  GFile *file;
+  gchar *uri, *escaped;
+
+  g_return_if_fail (GTK_IS_CSS_PROVIDER (css_provider));
+  g_return_if_fail (resource_path != NULL);
+
+  escaped = g_uri_escape_string (resource_path,
+                  G_URI_RESERVED_CHARS_ALLOWED_IN_PATH, FALSE);
+  uri = g_strconcat ("resource://", escaped, NULL);
+  g_free (escaped);
+
+  file = g_file_new_for_uri (uri);
+  g_free (uri);
+
+  gtk_css_provider_load_from_file (css_provider, file, NULL);
+
+  g_object_unref (file);
+}
+#endif
+
 void
 gnc_add_css_file (void)
 {
@@ -176,8 +203,6 @@ gnc_add_css_file (void)
     GdkDisplay *display;
     GdkScreen *screen;
     const gchar *var;
-    gchar* pkgdatadir = gnc_path_get_pkgdatadir ();
-    gchar *str;
     GError *error = 0;
 
     provider_user = gtk_css_provider_new ();
@@ -190,21 +215,17 @@ gnc_add_css_file (void)
     gtk_style_context_add_provider_for_screen (screen, GTK_STYLE_PROVIDER (provider_app), GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
     gtk_style_context_add_provider_for_screen (screen, GTK_STYLE_PROVIDER (provider_user), GTK_STYLE_PROVIDER_PRIORITY_USER);
 
-    if (pkgdatadir)
-    {
-        str = g_build_filename (pkgdatadir, "ui", "gnucash-fallback.css", (char *)NULL);
-        gtk_css_provider_load_from_path (provider_fallback, str, &error);
-        g_free (str);
-
-        str = g_build_filename (pkgdatadir, "ui", "gnucash.css", (char *)NULL);
-        gtk_css_provider_load_from_path (provider_app, str, &error);
-        g_free (str);
-    }
-    g_free (pkgdatadir);
+#if GTK_CHECK_VERSION(3,20,0)
+    gtk_css_provider_load_from_resource (provider_app, "/org/gnucash/gnucash-320.css");
+#else
+    gtk_css_provider_load_from_resource (provider_app, "/org/gnucash/gnucash-310.css");
+#endif
+    gtk_css_provider_load_from_resource (provider_fallback,  "/org/gnucash/gnucash-fallback-310.css");
 
     var = g_get_home_dir ();
     if (var)
     {
+        gchar *str;
         str = g_build_filename (var, ".gtk-3.0-gnucash.css", (char *)NULL);
         gtk_css_provider_load_from_path (provider_user, str, &error);
         g_free (str);
diff --git a/gnucash/gnome-utils/ui/CMakeLists.txt b/gnucash/gnome-utils/ui/CMakeLists.txt
index d0bfa4a..cdf16ef 100644
--- a/gnucash/gnome-utils/ui/CMakeLists.txt
+++ b/gnucash/gnome-utils/ui/CMakeLists.txt
@@ -15,8 +15,6 @@ SET(gnome_utils_ui_DIST_local
         gnc-windows-menu-ui.xml
         Makefile.am
         osx_accel_map
-        gnucash.css
-        gnucash-fallback.css
         )
 
 SET_DIST_LIST(gnome_utils_ui_DIST ${gnome_utils_ui_DIST_local})
diff --git a/gnucash/gnome-utils/ui/Makefile.am b/gnucash/gnome-utils/ui/Makefile.am
index 4eeeec0..3f82751 100644
--- a/gnucash/gnome-utils/ui/Makefile.am
+++ b/gnucash/gnome-utils/ui/Makefile.am
@@ -3,8 +3,6 @@ ui_DATA = \
 	gnc-main-window-ui.xml \
 	gnc-windows-menu-ui.xml \
 	gnc-windows-menu-ui-quartz.xml \
-	osx_accel_map \
-	gnucash.css \
-	gnucash-fallback.css
+	osx_accel_map
 
 EXTRA_DIST = $(ui_DATA) CMakeLists.txt
diff --git a/gnucash/gnome-utils/ui/gnucash.css b/gnucash/gnucash-310.css
similarity index 85%
copy from gnucash/gnome-utils/ui/gnucash.css
copy to gnucash/gnucash-310.css
index 7ed35d1..e4a37a3 100644
--- a/gnucash/gnome-utils/ui/gnucash.css
+++ b/gnucash/gnucash-310.css
@@ -1,5 +1,5 @@
 /* Note: Widgets obtained from Glade files will not be addressable
-   unless they have been named or have style classes added. Only 
+   unless they have been named or have style classes added. Only
    the widget type can be configured unless they are named in code */
 
 
@@ -12,6 +12,15 @@
   color: @negative-numbers;
 }
 
+/* Change font color by mixing with grey */
+.lighter-grey-mix {
+  color: mix (currentColor, grey, 0.8);
+}
+
+.darker-grey-mix {
+  color: mix (currentColor, grey, 0.2);
+}
+
 /* Register Cursor padding settings, make sure entry matches sheet.h */
 cursor entry {
   padding: 2px 5px 2px 5px;
@@ -64,3 +73,9 @@ cursor button {
   background-color: mix (@register_cursor_bg_color, grey, 0.2);
 }
 
+/* Some tweaks for the about dialog */
+dialog#GnuCash > box > box > label
+{
+  font-size: 24px;
+}
+
diff --git a/gnucash/gnome-utils/ui/gnucash.css b/gnucash/gnucash-320.css
similarity index 86%
rename from gnucash/gnome-utils/ui/gnucash.css
rename to gnucash/gnucash-320.css
index 7ed35d1..29242ca 100644
--- a/gnucash/gnome-utils/ui/gnucash.css
+++ b/gnucash/gnucash-320.css
@@ -1,5 +1,5 @@
 /* Note: Widgets obtained from Glade files will not be addressable
-   unless they have been named or have style classes added. Only 
+   unless they have been named or have style classes added. Only
    the widget type can be configured unless they are named in code */
 
 
@@ -36,7 +36,7 @@ cursor button {
   background-color: @register_primary_bg_color;
 }
 
-*.register-primary:insensitive {
+*.register-primary:disabled {
   background-color: mix (@register_primary_bg_color, grey, 0.2);
 }
 
@@ -44,7 +44,7 @@ cursor button {
   background-color: @register_secondary_bg_color;
 }
 
-*.register-secondary:insensitive {
+*.register-secondary:disabled {
   background-color: mix (@register_secondary_bg_color, grey, 0.2);
 }
 
@@ -52,7 +52,7 @@ cursor button {
   background-color: @register_split_bg_color;
 }
 
-*.register-split:insensitive {
+*.register-split:disabled {
   background-color: mix (@register_split_bg_color, grey, 0.2);
 }
 
@@ -60,7 +60,13 @@ cursor button {
   background-color: @register_cursor_bg_color;
 }
 
-*.register-cursor:insensitive {
+*.register-cursor:disabled {
   background-color: mix (@register_cursor_bg_color, grey, 0.2);
 }
 
+/* Some tweaks for the about dialog */
+dialog#GnuCash > box > box > label
+{
+  font-size: 24px;
+}
+
diff --git a/gnucash/gnome-utils/ui/gnucash-fallback.css b/gnucash/gnucash-fallback-310.css
similarity index 97%
rename from gnucash/gnome-utils/ui/gnucash-fallback.css
rename to gnucash/gnucash-fallback-310.css
index b08a722..7cc73d8 100644
--- a/gnucash/gnome-utils/ui/gnucash-fallback.css
+++ b/gnucash/gnucash-fallback-310.css
@@ -1,5 +1,5 @@
 /* Note: Widgets obtained from Glade files will not be addressable
-   unless they have been named or have style classes added. Only 
+   unless they have been named or have style classes added. Only
    the widget type can be configured unless they are named in code */
 
 
@@ -62,7 +62,7 @@
 @define-color marker_bg_color yellow;
 
 *.primary {
-   background-color: @primary_bg_color;
+  background-color: @primary_bg_color;
 }
 
 *.primary-dark {
diff --git a/gnucash/gnucash-gresources.xml b/gnucash/gnucash-gresources.xml
new file mode 100644
index 0000000..78dbc6d
--- /dev/null
+++ b/gnucash/gnucash-gresources.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<gresources>
+  <gresource prefix="/org/gnucash">
+    <file>gnucash-310.css</file>
+    <file>gnucash-320.css</file>
+    <file>gnucash-fallback-310.css</file>
+  </gresource>
+</gresources>

commit 9669bd6b6c2c573ef335d397c4b70898038e1705
Author: John Ralls <jralls at ceridwen.us>
Date:   Sat Oct 28 17:11:27 2017 -0700

    Release 2.7.1

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0e4f813..b12c00f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -13,14 +13,14 @@ ENABLE_TESTING()
 # Version number of gnucash
 SET (GNUCASH_MAJOR_VERSION 2)
 SET (GNUCASH_MINOR_VERSION 7)
-SET (GNUCASH_MICRO_VERSION 0)
+SET (GNUCASH_MICRO_VERSION 1)
 SET (GNUCASH_NANO_VERSION 0)
 SET (VERSION "${GNUCASH_MAJOR_VERSION}.${GNUCASH_MINOR_VERSION}.${GNUCASH_MICRO_VERSION}")
 SET (GNUCASH_LATEST_STABLE_SERIES 2.6)
 
 SET (PACKAGE gnucash)
 SET (PACKAGE_NAME GnuCash)
-SET (PACKAGE_VERSION 2.7.0)
+SET (PACKAGE_VERSION 2.7.1)
 SET (PACKAGE_BUGREPORT gnucash-devel at gnucash.org)
 SET (PACKAGE_TARNAME ${PACKAGE})
 SET (PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
diff --git a/ChangeLog b/ChangeLog
index fc7d16b..e5a3ce6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,166 @@
+2017-10-28 John Ralls 
+
+	* Don't copy ChangeLog on a tarball build. (HEAD -> unstable, origin/unstable)
+
+2017-10-28 John Ralls 
+
+	* Pass a NULL parent to gnc_options_dialog_new_modal in assistant-hierarchy.
+
+2017-10-27 John Ralls 
+
+	* Set a parent window for the options dialogs.
+
+2017-10-27 John Ralls 
+
+	* Merge branch Christopher Lam's Transaction Report Improvements into unstable.
+
+2017-10-27 John Ralls 
+
+	* Merge branch J. Marino's cashflow-barchart report into unstable.
+
+2017-10-27 John Ralls 
+
+	* Merge Aaron Law's branch 'buildfix' to unstable. (origin/master, origin/HEAD)
+
+2017-10-27 John Ralls 
+
+	* [SQL] Check return of string_to_guid, bail if false.
+
+2017-10-26 John Ralls 
+
+	* Bug 789298 - Prompt for file history update leads to crash during startup.
+
+2017-10-27 lmat 
+
+	* Updating home directory to fix CI error messages
+
+2017-10-27 Christopher Lam 
+
+	* transaction.scm upgrade complete
+
+2017-10-27 christopherlam 
+
+	* refactor old is-filter-member to use srfi-1
+
+2017-10-26 christopherlam 
+
+	* improve split-remove-duplicates, combine filters
+
+2017-10-25 christopherlam 
+
+	* Regex is optional, and add transaction matcher
+
+2017-10-24 Christopher Lam 
+
+	* Enhance transaction.scm account filter to regex
+
+2017-10-24 christopherlam 
+
+	* Enhance account filter to a regex
+
+2017-10-24 christopherlam 
+
+	* Amend some strings for improved visibility
+
+2017-10-24 christopherlam 
+
+	* Change critical code to pure FP
+
+2017-10-26 John Ralls 
+
+	* Bug 789297 - Account Tax Related Information - 2.7.0 is not backwards compatible
+
+2017-10-26 John Ralls 
+
+	* Fix NEWS errors reported by Chris Lam
+
+2017-10-26 Geert Janssens 
+
+	* Add GNUCASH_BUILD_ID cmake/configure variable which allows packagers to define their own
+
+2017-10-26 Geert Janssens 
+
+	* Use alternative revision retrieval if git describe is failing
+
+2017-10-26 Geert Janssens 
+
+	* Improve about dialog layout and contents
+
+2017-10-26 John Ralls 
+
+	* Revert "Partial fix to exception crashes on Windows."
+
+2017-10-26 John Ralls 
+
+	* Fix Windows crash-on-throw.
+
+2017-10-22 John Ralls 
+
+	* Partial fix to exception crashes on Windows.
+
+2017-10-25 Geert Janssens 
+
+	* Fix building from dist tarball with python bindings enabled
+
+2017-10-25 Geert Janssens 
+
+	* Fix disabling src docs build on Windows
+
+2017-10-26 Geert Janssens 
+
+	* Prevent gcc from searching config.h in the current directory
+
+2017-10-26 Geert Janssens 
+
+	* Add gnucash.1 man page as proper dependency for dist
+
+2017-10-22 Carwyn Nelson 
+
+	* Little refactor of account.c
+
+2017-10-23 Geert Janssens 
+
+	* Improve gnc_numeric_boxed_copy_func based on discussion in PR#145
+
+2017-04-23 Bob-IT 
+
+	* Save button active on every load
+
+2017-10-22 John Ralls 
+
+	* Don't build design docs on Windows.
+
+2017-10-20 John Ralls 
+
+	* Add fixed bugs for 2.7.0 to NEWS.
+
+2017-10-20 Geert Janssens 
+
+	* Remove configure option --enable-locale-specific-tax and make gnucash always behave as if it was set
+
+2017-10-19 Jose Marino 
+
+	* fix reconcile dialog always showing ending balance of zero
+
+2017-10-17 Jose Marino 
+
+	* add unit test for cashflow-barchart report
+
+2017-10-17 John Ralls 
+
+	* Merge branch 'unstable'
+
 2017-10-15 John Ralls 
 
-	* Re-release 2.7.0 (HEAD -> unstable)
+	* Re-release 2.7.0 (tag: 2.7.0a)
+
+2017-10-16 Jose Marino 
+
+	* add new report 'cashflow-barchart.scm' to build system
+
+2017-10-16 Jose Marino 
+
+	* fix module location of new cashflow-barchart report
 
 2017-10-15 John Ralls 
 
@@ -8,7 +168,7 @@
 
 2017-10-16 John Ralls 
 
-	* Use file:/// when constructing a tempdir uri on Windows. (origin/unstable)
+	* Use file:/// when constructing a tempdir uri on Windows.
 
 2017-10-16 John Ralls 
 
@@ -42,6 +202,10 @@
 
 	* reapply commit 3cdac65 on the new dialog-ab-pref and remove obsolete section from dialog-ab.gade
 
+2017-10-11 Jose Marino 
+
+	* add new report: cashflow-barchart.scm
+
 2017-10-06 fell 
 
 	* Merge branch 'maint' into unstable
@@ -52,7 +216,7 @@
 
 2017-10-05 Geert Janssens 
 
-	* Replace ambiguous 'scm' with 'vcs' in macro name (origin/master, origin/HEAD)
+	* Replace ambiguous 'scm' with 'vcs' in macro name
 
 2017-10-05 Geert Janssens 
 
@@ -6450,7 +6614,3 @@
 
 	* Add a missing gettext in plugin page owner tree
 
-2016-01-01 fell 
-
-	* Bug 760052 - missing flag translatable in Custom Report
-
diff --git a/NEWS b/NEWS
index 7f8657d..87bcc6d 100644
--- a/NEWS
+++ b/NEWS
@@ -1,17 +1,70 @@
 Version history:
 ------- -------
-2.7.0  - 17 October 2017
-       The Gnucash Development Team is pleased to release Gnucash 2.7.0,
-       the first release of an unstable series leading to Gnucash 2.8.0.
-
-       This release is UNSTABLE and SHOULD NOT BE USED in production.
-       See the KNOWN PROBLEMS list at the bottom of the announcement.
-
-       Note: Version information in the splash screen and About dialog
-       will now reflect the date of the last commit used to build
-       GnuCash rather than the date it was compiled. This is to assist
-       quality assurance and debugging efforts by Linux distribution
-       maintainers.
+2.7.1 - 29 October 2017
+
+    The Gnucash Development Team is pleased to release Gnucash 2.7.1,
+    the second release of an unstable series leading to Gnucash 2.8.0.
+
+    This release is UNSTABLE and SHOULD NOT BE USED in production.
+    See the KNOWN PROBLEMS list at the bottom of the announcement.
+
+New Features For Users:
+
+A new Cashflow Barchart report from Jose Marino
+
+    Transaction Report improvements, including regular expression filtering,
+    from Chrostopher Lam.
+
+    The About dialog box layout is improved.
+
+    GnuCash will always build the locale-specific tax modules. This
+    was optional when building with autotools and never enabled when
+    building with cmake. Note that the only supported tax locales are
+    en_US and de_DE.
+
+The following bugs are fixed only in unstable/master:
+
+    Bug 789298 - Prompt for file history update leads to crash during startup.
+
+Other repairs not marked as bugs in git:
+
+    GnuCash no longer crashes on startup on Windows.
+
+    GnuCash no longer crashes when loading price data.
+
+    The Options Dialogs will appear over the application window
+    instead of wherever Gdk decides is coordinates 0, 0 on the
+    display.
+
+    Owners were not correctly linked to invoices in the SQL backend.
+
+    Building from a tarball with python enabled now works.
+
+    Fix Reconcile dialog always showing a 0 ending balance.
+
+    Fix the book being always marked dirty at startup if it contained
+    any scheduled transactions.
+
+KNOWN PROBLEMS:
+
+    On Microsoft Windows starting the AQBanking Setup Wizard crashes GnuCash.
+
+    test-import-bayes built with autotools intermittently fails at
+    line 381, where the returned value is 1 instead of the expected 6.
+
+2.7.0 - 17 October 2017
+
+    The Gnucash Development Team is pleased to release Gnucash 2.7.0,
+    the first release of an unstable series leading to Gnucash 2.8.0.
+
+    This release is UNSTABLE and SHOULD NOT BE USED in production.
+    See the KNOWN PROBLEMS list at the bottom of the announcement.
+
+    Note: Version information in the splash screen and About dialog
+    will now reflect the date of the last commit used to build
+    GnuCash rather than the date it was compiled. This is to assist
+    quality assurance and debugging efforts by Linux distribution
+    maintainers.
 
 New Features For Users:
 
diff --git a/configure.ac b/configure.ac
index 6592592..8dc550c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -20,7 +20,7 @@ dnl Process this file with autoconf to produce a configure script.
 
 # Autoconf initialization
 AC_PREREQ(2.60)
-AC_INIT([GnuCash], [2.7.0], [https://bugzilla.gnome.org/page.cgi?id=browse.html&product=GnuCash], , [http://www.gnucash.org/])
+AC_INIT([GnuCash], [2.7.1], [https://bugzilla.gnome.org/page.cgi?id=browse.html&product=GnuCash], , [http://www.gnucash.org/])
 AC_CONFIG_HEADERS(config.h)
 AC_CONFIG_SRCDIR(libgnucash/engine/Transaction.h)
 AC_CONFIG_MACRO_DIR([macros])
diff --git a/po/POTFILES.skip b/po/POTFILES.skip
index 5f3cf98..45f38fc 100644
--- a/po/POTFILES.skip
+++ b/po/POTFILES.skip
@@ -68,6 +68,7 @@ gnucash/report/standard-reports/gnucash/report/standard-reports/budget-flow.scm
 gnucash/report/standard-reports/gnucash/report/standard-reports/budget-income-statement.scm
 gnucash/report/standard-reports/gnucash/report/standard-reports/budget.scm
 gnucash/report/standard-reports/gnucash/report/standard-reports/cash-flow.scm
+gnucash/report/standard-reports/gnucash/report/standard-reports/cashflow-barchart.scm
 gnucash/report/standard-reports/gnucash/report/standard-reports/category-barchart.scm
 gnucash/report/standard-reports/gnucash/report/standard-reports/daily-reports.scm
 gnucash/report/standard-reports/gnucash/report/standard-reports/equity-statement.scm

commit 09bcb515a1b2b71c8fa89f6673370822b34fe28b
Author: John Ralls <jralls at ceridwen.us>
Date:   Sun Oct 29 13:55:43 2017 -0700

    Set relative path to icon file in Windows resource script.
    
    No idea why this is necessary for tarball builds, but it is.
    Also update the copyright date in the same file.

diff --git a/gnucash/gnucash.rc.in b/gnucash/gnucash.rc.in
index abbaa08..b2e2776 100644
--- a/gnucash/gnucash.rc.in
+++ b/gnucash/gnucash.rc.in
@@ -1,6 +1,6 @@
 #include <windows.h>
 
-APPLICATION_ICON ICON DISCARDABLE "gnucash-icon.ico"
+APPLICATION_ICON ICON DISCARDABLE "../data/pixmaps/gnucash-icon.ico"
 
 VS_VERSION VERSIONINFO
  FILEVERSION     @GNUCASH_MAJOR_VERSION@, at GNUCASH_MINOR_VERSION@, at GNUCASH_MICRO_VERSION@,0
@@ -19,7 +19,7 @@ BEGIN
       VALUE "FileDescription", "GnuCash Program File"
       VALUE "FileVersion", "@VERSION@"
       VALUE "InternalName", "gnucash"
-      VALUE "LegalCopyright", "©2011 GnuCash Development Team, Licence: GPL v2.0 or later"
+      VALUE "LegalCopyright", "©2017 GnuCash Development Team, Licence: GPL v2.0 or later"
       VALUE "OriginalFilename", "gnucash.exe"
       VALUE "ProductName", "GnuCash Free Finance Manager"
       VALUE "ProductVersion", "@VERSION@"

commit e959822817d690a454551ec880e9da708d080479
Author: John Ralls <jralls at ceridwen.us>
Date:   Sat Oct 28 14:21:39 2017 -0700

    Don't copy ChangeLog on a tarball build.
    
    There's no reason to and besides it breaks in-source builds
    because trying to copy onto itself raises an error.

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5f6be6f..0e4f813 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -840,8 +840,7 @@ IF (BUILDING_FROM_VCS)
   )
   INSTALL(FILES ${CMAKE_BINARY_DIR}/ChangeLog DESTINATION share/doc/gnucash)
 ELSE()
-  FILE(COPY ChangeLog DESTINATION ChangeLog)
-  INSTALL(FILES ChangeLog DESTINATION share/doc/gnucash)
+  INSTALL(FILES ${CMAKE_SOURCE_DIR}/ChangeLog DESTINATION share/doc/gnucash)
 ENDIF()
 
 #Link LICENSE to COPYING so that people expecting to find it,

commit b92a41b60863ff237e5f71c554dda189e55564f8
Author: John Ralls <jralls at ceridwen.us>
Date:   Sat Oct 28 09:56:58 2017 -0700

    Pass a NULL parent to gnc_options_dialog_new_modal in assistant-hierarchy.
    
    In this case the dialog isn't a dialog, it's a notebook page, so it
    doesn't need to have a parent at creation.

diff --git a/gnucash/gnome/assistant-hierarchy.c b/gnucash/gnome/assistant-hierarchy.c
index dae9afb..66258b1 100644
--- a/gnucash/gnome/assistant-hierarchy.c
+++ b/gnucash/gnome/assistant-hierarchy.c
@@ -1174,9 +1174,9 @@ book_options_dialog_close_cb(GNCOptionWin * optionwin,
 }
 
 static void
-assistant_insert_book_options_page (hierarchy_data *data, GtkWindow* parent)
+assistant_insert_book_options_page (hierarchy_data *data)
 {
-    GtkWidget *options;
+    GtkWidget *options, *parent;
     GtkWidget *vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
     gtk_box_set_homogeneous (GTK_BOX (vbox), FALSE);
 
@@ -1185,9 +1185,9 @@ assistant_insert_book_options_page (hierarchy_data *data, GtkWindow* parent)
 			   gnc_option_db_load, data->options);
     gnc_option_db_clean (data->options);
 
+    /* The options dialog gets added to the notebook so it doesn't need a parent.*/
     data->optionwin = gnc_options_dialog_new_modal (TRUE, _("New Book Options"),
-                                                    DIALOG_BOOK_OPTIONS_CM_CLASS,
-                                                    parent);
+                                                    DIALOG_BOOK_OPTIONS_CM_CLASS, NULL);
     gnc_options_dialog_build_contents_full (data->optionwin, data->options, FALSE);
 
     gnc_options_dialog_set_close_cb (data->optionwin,
@@ -1196,6 +1196,7 @@ assistant_insert_book_options_page (hierarchy_data *data, GtkWindow* parent)
     gnc_options_dialog_set_new_book_option_values (data->options);
 
     options = gnc_options_dialog_notebook (data->optionwin);
+    parent = gtk_widget_get_parent (options);
 
     g_object_ref (options);
     gtk_container_remove (GTK_CONTAINER(parent), options);
@@ -1278,7 +1279,7 @@ gnc_create_hierarchy_assistant (gboolean use_defaults, GncHierarchyAssistantFini
 
     /* Book options page - only on new books */
     if (data->new_book)
-        assistant_insert_book_options_page (data, GTK_WINDOW (tree_view));
+        assistant_insert_book_options_page (data);
 
     /* Final Accounts Page */
     data->final_account_tree_container = GTK_WIDGET(gtk_builder_get_object (builder, "final_account_tree_box"));

commit d22b098dff105d0e79e6cc58ba2c9b37558c5c2b
Author: John Ralls <jralls at ceridwen.us>
Date:   Fri Oct 27 16:23:02 2017 -0700

    Set a parent window for the options dialogs.
    
    So they pop up centered on the GnuCash window instead of
    on the wrong monitor.

diff --git a/gnucash/gnome-utils/dialog-options.c b/gnucash/gnome-utils/dialog-options.c
index 48c53a7..9d6768f 100644
--- a/gnucash/gnome-utils/dialog-options.c
+++ b/gnucash/gnome-utils/dialog-options.c
@@ -2125,9 +2125,9 @@ refresh_handler (GHashTable *changes, gpointer user_data)
  *
  */
 GNCOptionWin *
-gnc_options_dialog_new(gchar *title)
+gnc_options_dialog_new(gchar *title, GtkWindow *parent)
 {
-    return gnc_options_dialog_new_modal(FALSE, title, NULL);
+    return gnc_options_dialog_new_modal(FALSE, title, NULL, parent);
 }
 
 /* gnc_options_dialog_new_modal:
@@ -2145,7 +2145,8 @@ gnc_options_dialog_new(gchar *title)
  */
 GNCOptionWin *
 gnc_options_dialog_new_modal(gboolean modal, gchar *title,
-                                                    const char *component_class)
+                             const char *component_class,
+                             GtkWindow *parent)
 {
     GNCOptionWin *retval;
     GtkBuilder   *builder;
@@ -2160,7 +2161,7 @@ gnc_options_dialog_new_modal(gboolean modal, gchar *title,
 
     // Set the style context for this dialog so it can be easily manipulated with css
     gnc_widget_set_style_context (GTK_WIDGET(retval->dialog), "GncOptionsDialog");
-
+    gtk_window_set_transient_for (GTK_WINDOW (retval->dialog), parent);
     /* Page List */
     {
         GtkTreeView *view;
diff --git a/gnucash/gnome-utils/dialog-options.h b/gnucash/gnome-utils/dialog-options.h
index cfbe013..1ed60c1 100644
--- a/gnucash/gnome-utils/dialog-options.h
+++ b/gnucash/gnome-utils/dialog-options.h
@@ -36,8 +36,9 @@ typedef struct gnc_option_win GNCOptionWin;
 typedef void (* GNCOptionWinCallback)(GNCOptionWin *, gpointer data);
 
 GNCOptionWin * gnc_options_dialog_new_modal(gboolean modal, gchar *title,
-                                                const char *component_class);
-GNCOptionWin * gnc_options_dialog_new(gchar *title);
+                                            const char *component_class,
+                                            GtkWindow *parent);
+GNCOptionWin * gnc_options_dialog_new(gchar *title, GtkWindow *parent);
 GNCOptionWin * gnc_options_dialog_new_w_dialog(gchar *title, GtkWidget *dialog);
 void gnc_options_dialog_destroy(GNCOptionWin * win);
 void gnc_options_register_stocks (void);
diff --git a/gnucash/gnome-utils/dialog-utils.c b/gnucash/gnome-utils/dialog-utils.c
index 36a9935..73c0ca0 100644
--- a/gnucash/gnome-utils/dialog-utils.c
+++ b/gnucash/gnome-utils/dialog-utils.c
@@ -676,10 +676,8 @@ gnc_new_book_option_display (GtkWidget *parent)
     GtkWidget *window;
     gint result = GTK_RESPONSE_HELP;
 
-    window = gnc_book_options_dialog_cb (TRUE, _( "New Book Options"));
-    if (parent)
-        gtk_window_set_transient_for (GTK_WINDOW(window), GTK_WINDOW(parent));
-
+    window = gnc_book_options_dialog_cb (TRUE, _( "New Book Options"),
+                                         GTK_WINDOW (parent));
     if (window)
     {
         /* close dialog and proceed unless help button selected */
diff --git a/gnucash/gnome-utils/gnc-main-window.c b/gnucash/gnome-utils/gnc-main-window.c
index ea67b82..862403f 100644
--- a/gnucash/gnome-utils/gnc-main-window.c
+++ b/gnucash/gnome-utils/gnc-main-window.c
@@ -4056,7 +4056,7 @@ show_handler (const char *class_name, gint component_id,
 }
 
 GtkWidget *
-gnc_book_options_dialog_cb (gboolean modal, gchar *title)
+gnc_book_options_dialog_cb (gboolean modal, gchar *title, GtkWindow* parent)
 {
     QofBook *book = gnc_get_current_book ();
     GNCOptionDB *options;
@@ -4073,9 +4073,10 @@ gnc_book_options_dialog_cb (gboolean modal, gchar *title)
     {
         return NULL;
     }
-    optionwin = gnc_options_dialog_new_modal (modal,
-                (title ? title : _( "Book Options")),
-                DIALOG_BOOK_OPTIONS_CM_CLASS);
+    optionwin = gnc_options_dialog_new_modal (
+        modal,
+        (title ? title : _( "Book Options")),
+        DIALOG_BOOK_OPTIONS_CM_CLASS, parent);
     gnc_options_dialog_build_contents (optionwin, options);
 
     gnc_options_dialog_set_book_options_help_cb (optionwin);
@@ -4094,7 +4095,7 @@ gnc_book_options_dialog_cb (gboolean modal, gchar *title)
 static void
 gnc_main_window_cmd_file_properties (GtkAction *action, GncMainWindow *window)
 {
-    gnc_book_options_dialog_cb (FALSE, NULL);
+    gnc_book_options_dialog_cb (FALSE, NULL, GTK_WINDOW (window));
 }
 
 static void
diff --git a/gnucash/gnome-utils/gnc-main-window.h b/gnucash/gnome-utils/gnc-main-window.h
index c414617..46f01bf 100644
--- a/gnucash/gnome-utils/gnc-main-window.h
+++ b/gnucash/gnome-utils/gnc-main-window.h
@@ -417,10 +417,14 @@ void gnc_main_window_show_all_windows(void);
  *
  *  @param title Title of the dialog; "Book Options" if NULL.
  *
+ *  @param parent The toplevel GdkWindow with which the dialog will
+ *  be transient for.
+ *
  *  @return A pointer to the GtkWidget for the dialog that can be used
  *  when started in modal mode.
  **/
-GtkWidget *gnc_book_options_dialog_cb (gboolean modal, gchar *title);
+GtkWidget *gnc_book_options_dialog_cb (gboolean modal, gchar *title,
+                                       GtkWindow *parent);
 
 /**
  * Processes selected options in the Book Options dialog: checks book_currency
diff --git a/gnucash/gnome-utils/gnome-utils.i b/gnucash/gnome-utils/gnome-utils.i
index 24d85cf..bafde30 100644
--- a/gnucash/gnome-utils/gnome-utils.i
+++ b/gnucash/gnome-utils/gnome-utils.i
@@ -49,7 +49,7 @@ SCM scm_init_sw_gnome_utils_module (void);
 
 %import "base-typemaps.i"
 
-GNCOptionWin * gnc_options_dialog_new(gchar *title);
+GNCOptionWin * gnc_options_dialog_new(gchar *title, GtkWindow* parent);
 void gnc_options_dialog_destroy(GNCOptionWin * win);
 void gnc_options_dialog_build_contents(GNCOptionWin *propertybox,
                                        GNCOptionDB  *odb);
diff --git a/gnucash/gnome/assistant-hierarchy.c b/gnucash/gnome/assistant-hierarchy.c
index 5a6d25d..dae9afb 100644
--- a/gnucash/gnome/assistant-hierarchy.c
+++ b/gnucash/gnome/assistant-hierarchy.c
@@ -1174,9 +1174,9 @@ book_options_dialog_close_cb(GNCOptionWin * optionwin,
 }
 
 static void
-assistant_insert_book_options_page (hierarchy_data *data)
+assistant_insert_book_options_page (hierarchy_data *data, GtkWindow* parent)
 {
-    GtkWidget *options, *parent;
+    GtkWidget *options;
     GtkWidget *vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
     gtk_box_set_homogeneous (GTK_BOX (vbox), FALSE);
 
@@ -1186,7 +1186,8 @@ assistant_insert_book_options_page (hierarchy_data *data)
     gnc_option_db_clean (data->options);
 
     data->optionwin = gnc_options_dialog_new_modal (TRUE, _("New Book Options"),
-                                                DIALOG_BOOK_OPTIONS_CM_CLASS);
+                                                    DIALOG_BOOK_OPTIONS_CM_CLASS,
+                                                    parent);
     gnc_options_dialog_build_contents_full (data->optionwin, data->options, FALSE);
 
     gnc_options_dialog_set_close_cb (data->optionwin,
@@ -1195,7 +1196,6 @@ assistant_insert_book_options_page (hierarchy_data *data)
     gnc_options_dialog_set_new_book_option_values (data->options);
 
     options = gnc_options_dialog_notebook (data->optionwin);
-    parent = gtk_widget_get_parent (options);
 
     g_object_ref (options);
     gtk_container_remove (GTK_CONTAINER(parent), options);
@@ -1278,7 +1278,7 @@ gnc_create_hierarchy_assistant (gboolean use_defaults, GncHierarchyAssistantFini
 
     /* Book options page - only on new books */
     if (data->new_book)
-        assistant_insert_book_options_page (data);
+        assistant_insert_book_options_page (data, GTK_WINDOW (tree_view));
 
     /* Final Accounts Page */
     data->final_account_tree_container = GTK_WIDGET(gtk_builder_get_object (builder, "final_account_tree_box"));
diff --git a/gnucash/report/report-gnome/dialog-report-column-view.c b/gnucash/report/report-gnome/dialog-report-column-view.c
index f7a8e18..d351ca4 100644
--- a/gnucash/report/report-gnome/dialog-report-column-view.c
+++ b/gnucash/report/report-gnome/dialog-report-column-view.c
@@ -309,7 +309,7 @@ gnc_column_view_edit_options(SCM options, SCM view)
         gnc_column_view_edit * r = g_new0(gnc_column_view_edit, 1);
         GtkBuilder *builder;
 
-        r->optwin = gnc_options_dialog_new(NULL);
+        r->optwin = gnc_options_dialog_new(NULL, NULL);
 
         /* Hide the generic dialog page list. */
         gtk_widget_hide(gnc_options_page_list(r->optwin));
diff --git a/gnucash/report/report-gnome/dialog-report-style-sheet.c b/gnucash/report/report-gnome/dialog-report-style-sheet.c
index a3005b1..f2fbb97 100644
--- a/gnucash/report/report-gnome/dialog-report-style-sheet.c
+++ b/gnucash/report/report-gnome/dialog-report-style-sheet.c
@@ -157,9 +157,10 @@ gnc_style_sheet_dialog_create(StyleSheetDialog * ss,
     ss_info        * ssinfo = g_new0(ss_info, 1);
     GtkWidget      * window;
     gchar          * title;
+    GtkWindow      * parent = GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (ss->list_view)));
 
     title = g_strdup_printf(_("HTML Style Sheet Properties: %s"), name);
-    ssinfo->odialog = gnc_options_dialog_new(title);
+    ssinfo->odialog = gnc_options_dialog_new(title, parent);
     ssinfo->odb     = gnc_option_db_new(scm_options);
     ssinfo->stylesheet = sheet_info;
     ssinfo->row_ref    = row_ref;
diff --git a/gnucash/report/report-gnome/gnc-plugin-page-report.c b/gnucash/report/report-gnome/gnc-plugin-page-report.c
index 7cdd98e..a0fe927 100644
--- a/gnucash/report/report-gnome/gnc-plugin-page-report.c
+++ b/gnucash/report/report-gnome/gnc-plugin-page-report.c
@@ -1663,12 +1663,12 @@ static void
 gnc_plugin_page_report_options_cb( GtkAction *action, GncPluginPageReport *report )
 {
     GncPluginPageReportPrivate *priv;
-
+    GtkWindow *parent = GTK_WINDOW (gnc_plugin_page_get_window (GNC_PLUGIN_PAGE (report)));
     priv = GNC_PLUGIN_PAGE_REPORT_GET_PRIVATE(report);
     if (priv->cur_report == SCM_BOOL_F)
         return;
 
-    if (gnc_report_edit_options (priv->cur_report))
+    if (gnc_report_edit_options (priv->cur_report, parent))
         gnc_plugin_page_report_add_edited_report(priv, priv->cur_report);
 }
 
diff --git a/gnucash/report/report-gnome/window-report.c b/gnucash/report/report-gnome/window-report.c
index 93e525c..82e2bc2 100644
--- a/gnucash/report/report-gnome/window-report.c
+++ b/gnucash/report/report-gnome/window-report.c
@@ -88,7 +88,7 @@ gnc_options_dialog_apply_cb(GNCOptionWin * propertybox,
     results = gnc_option_db_commit (win->db);
     for (iter = results; iter; iter = iter->next)
     {
-        GtkWidget *dialog = gtk_message_dialog_new(NULL,
+        GtkWidget *dialog = gtk_message_dialog_new(GTK_WINDOW (win->win),
                                                    0,
                                                    GTK_MESSAGE_ERROR,
                                                    GTK_BUTTONS_OK,
@@ -156,7 +156,8 @@ gnc_report_raise_editor(SCM report)
 
 
 GtkWidget *
-gnc_report_window_default_params_editor(SCM options, SCM report)
+gnc_report_window_default_params_editor(SCM options, SCM report,
+                                        GtkWindow *parent)
 {
     SCM get_report_type   = scm_c_eval_string("gnc:report-type");
     SCM get_template      = scm_c_eval_string("gnc:find-report-template");
@@ -190,7 +191,7 @@ gnc_report_window_default_params_editor(SCM options, SCM report)
         }
 
         /* Don't forget to translate the window title */
-        prm->win  = gnc_options_dialog_new((gchar*) (title && *title ? _(title) : ""));
+        prm->win  = gnc_options_dialog_new((gchar*) (title && *title ? _(title) : ""), parent);
 
         g_free ((gpointer *) title);
 
@@ -214,7 +215,7 @@ gnc_report_window_default_params_editor(SCM options, SCM report)
 }
 
 gboolean
-gnc_report_edit_options(SCM report)
+gnc_report_edit_options(SCM report, GtkWindow *parent)
 {
     SCM set_editor        = scm_c_eval_string("gnc:report-set-editor-widget!");
     SCM get_options       = scm_c_eval_string("gnc:report-options");
@@ -244,7 +245,7 @@ gnc_report_edit_options(SCM report)
         if (g_strcmp0 (rpt_type, "d8ba4a2e89e8479ca9f6eccdeb164588") == 0)
             options_widget = gnc_column_view_edit_options (options, report);
         else
-            options_widget = gnc_report_window_default_params_editor (options, report);
+            options_widget = gnc_report_window_default_params_editor (options, report, parent);
         g_free (rpt_type);
     }
 
@@ -323,7 +324,7 @@ gnc_html_options_url_cb (const char *location, const char *label,
             return FALSE;
         }
 
-        gnc_report_edit_options (report);
+        gnc_report_edit_options (report, NULL);
 
         return TRUE;
     }
diff --git a/gnucash/report/report-gnome/window-report.h b/gnucash/report/report-gnome/window-report.h
index ee7b9db..4e3e475 100644
--- a/gnucash/report/report-gnome/window-report.h
+++ b/gnucash/report/report-gnome/window-report.h
@@ -33,13 +33,13 @@ typedef struct gnc_report_window_s gnc_report_window;
 /** PROTOTYPES ******************************************************/
 
 // scm-exposed
-GtkWidget * gnc_report_window_default_params_editor(SCM options, SCM report);
+GtkWidget * gnc_report_window_default_params_editor(SCM options, SCM report, GtkWindow *parent);
 
 // called from multiple places
 // [gnome-business/dialog-invoice.c;gnome/window-register.c]; and
 // scm-exposed; 3-liner which calls gnc_main_window_open_report after handling busy-cursor.
 void       reportWindow(int id);
-gboolean   gnc_report_edit_options(SCM report);
+gboolean   gnc_report_edit_options(SCM report, GtkWindow *parent);
 // module[/plugin]-init
 void       gnc_report_init (void);
 
diff --git a/po/POTFILES.in b/po/POTFILES.in
index eaf0f39..bced61f 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -464,6 +464,7 @@ gnucash/report/standard-reports/budget-barchart.scm
 gnucash/report/standard-reports/budget-flow.scm
 gnucash/report/standard-reports/budget-income-statement.scm
 gnucash/report/standard-reports/budget.scm
+gnucash/report/standard-reports/cashflow-barchart.scm
 gnucash/report/standard-reports/cash-flow.scm
 gnucash/report/standard-reports/category-barchart.scm
 gnucash/report/standard-reports/daily-reports.scm

commit 5157d8b50ae3985e5f0e32746cb23c4a0a3cb90c
Merge: e64e73b a9fab36
Author: John Ralls <jralls at ceridwen.us>
Date:   Fri Oct 27 12:06:52 2017 -0700

    Merge branch Christopher Lam's Transaction Report Improvements into unstable.


commit e64e73b6556ec1f0e55704787f88ab4592d0d03d
Merge: 115c0bf 85fae7e
Author: John Ralls <jralls at ceridwen.us>
Date:   Fri Oct 27 11:31:46 2017 -0700

    Merge branch J. Marino's cashflow-barchart report into unstable.


commit a9fab360401a7a859a304ba4033cbf8c189278ac
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Fri Oct 27 16:01:45 2017 +0800

    transaction.scm upgrade complete
    
    It now has account and transaction substring/regex matcher.
    Verified working in 2.7.0

diff --git a/gnucash/report/standard-reports/income-gst-statement.scm b/gnucash/report/standard-reports/income-gst-statement.scm
index 6784755..8d327c8 100644
--- a/gnucash/report/standard-reports/income-gst-statement.scm
+++ b/gnucash/report/standard-reports/income-gst-statement.scm
@@ -1587,7 +1587,7 @@ for taxes paid on expenses, and type LIABILITY for taxes collected on sales.")
         ;; in guile code
         ((= splitcount 2)
          (is-in-account-list? other-account))
-        
+
         ;; A multi-split transaction - run over all splits
         ((> splitcount 2)
          (or-map is-in-account-list? other-accounts))
diff --git a/gnucash/report/standard-reports/transaction.scm b/gnucash/report/standard-reports/transaction.scm
index dab69e8..bd3445c 100644
--- a/gnucash/report/standard-reports/transaction.scm
+++ b/gnucash/report/standard-reports/transaction.scm
@@ -64,6 +64,10 @@
 (define optname-table-export (N_ "Table for Exporting"))
 (define optname-common-currency (N_ "Common Currency"))
 (define optname-currency (N_ "Report's currency"))
+(define optname-account-matcher (N_ "Account Matcher"))
+(define optname-account-matcher-regex (N_ "Account Matcher uses regular expressions for extended matching"))
+(define optname-transaction-matcher (N_ "Transaction Matcher"))
+(define optname-transaction-matcher-regex (N_ "Transaction Matcher uses regular expressions for extended matching"))
 (define def:grand-total-style "grand-total")
 (define def:normal-row-style "normal-row")
 (define def:alternate-row-style "alternate-row")
@@ -639,7 +643,24 @@
    (gnc:make-simple-boolean-option
     gnc:pagename-general optname-table-export
     "g" (N_ "Formats the table suitable for cut & paste exporting with extra cells.") #f))  
-  
+
+  (gnc:register-trep-option
+   (gnc:make-string-option
+    gnc:pagename-general optname-transaction-matcher
+    "i1" (N_ "Match only transactions whose substring is matched e.g. '#gift' \
+will find all transactions with #gift in description, notes or memo. It can be left \
+blank, which will disable the matcher.")
+    ""))
+
+  (gnc:register-trep-option
+   (gnc:make-simple-boolean-option
+    gnc:pagename-general optname-transaction-matcher-regex
+    "i2"
+    (N_ "By default the transaction matcher will search substring only. Set this to true to \
+enable full POSIX regular expressions capabilities. '#work|#family' will match both \
+tags within description, notes or memo. ")
+    #f))
+
   ;; Accounts options
   
   ;; account to do report on
@@ -658,14 +679,22 @@
 
   (gnc:register-trep-option
    (gnc:make-string-option
-    gnc:pagename-accounts (N_ "Account Matcher")
-    "a5" (N_ "Match only above accounts whose fullname is matched by regex \
-e.g. ':Travel' will match Expenses:Travel:Holiday and Expenses:Business:Travel. \
-'Car|Flights' will match both Expenses:Car and Expenses:Business:Flights. It \
-can be left blank, which will disable the matcher")
+    gnc:pagename-accounts optname-account-matcher
+    "a5" (N_ "Match only above accounts whose fullname is matched e.g. ':Travel' will match \
+Expenses:Travel:Holiday and Expenses:Business:Travel. It can be left blank, which will disable \
+the matcher.")
     ""))
 
   (gnc:register-trep-option
+   (gnc:make-simple-boolean-option
+    gnc:pagename-accounts optname-account-matcher-regex
+    "a6"
+    (N_ "By default the account matcher will search substring only. Set this to true to enable full \
+POSIX regular expressions capabilities. 'Car|Flights' will match both Expenses:Car and Expenses:Flights. \
+Use a period (.) to match a single character e.g. '20../.' will match 'Travel 2017/1 London'. ")
+    #f))
+
+  (gnc:register-trep-option
    (gnc:make-account-list-option
     gnc:pagename-accounts (N_ "Filter By...")
     "b" (N_ "Filter on these accounts.")
@@ -1530,10 +1559,19 @@ Credit Card, and Income accounts."))))))
 
 
   (gnc:report-starting reportname)
-  (let ((document (gnc:make-html-document))
-	(c_account_1 (opt-val gnc:pagename-accounts "Accounts"))
-	(c_account_matcher (opt-val gnc:pagename-accounts "Account Matcher"))
-	(c_account_2 (opt-val gnc:pagename-accounts "Filter By..."))
+  (let* ((document (gnc:make-html-document))
+        (c_account_0 (opt-val gnc:pagename-accounts "Accounts"))
+        (account-matcher (opt-val gnc:pagename-accounts optname-account-matcher))
+        (account-matcher-regexp (if (opt-val gnc:pagename-accounts optname-account-matcher-regex)
+                                    (make-regexp account-matcher)
+                                    #f))
+        (c_account_1 (filter
+                      (lambda (acc)
+                        (if account-matcher-regexp
+                            (regexp-exec account-matcher-regexp (gnc-account-get-full-name acc))
+                            (string-contains (gnc-account-get-full-name acc) account-matcher)))
+                     c_account_0))
+        (c_account_2 (opt-val gnc:pagename-accounts "Filter By..."))
 	(filter-mode (opt-val gnc:pagename-accounts "Filter Type"))
         (begindate (gnc:timepair-start-day-time
                     (gnc:date-option-absolute-time
@@ -1541,6 +1579,10 @@ Credit Card, and Income accounts."))))))
         (enddate (gnc:timepair-end-day-time
                   (gnc:date-option-absolute-time
                    (opt-val gnc:pagename-general "End Date"))))
+        (transaction-matcher (opt-val gnc:pagename-general optname-transaction-matcher))
+        (transaction-matcher-regexp (if (opt-val gnc:pagename-general optname-transaction-matcher-regex)
+                                        (make-regexp transaction-matcher)
+                                        #f))
         (report-title (opt-val 
                        gnc:pagename-general
                        gnc:optname-reportname))
@@ -1548,18 +1590,13 @@ Credit Card, and Income accounts."))))))
         (primary-order (opt-val pagename-sorting "Primary Sort Order"))
         (secondary-key (opt-val pagename-sorting optname-sec-sortkey))
         (secondary-order (opt-val pagename-sorting "Secondary Sort Order"))
-	(void-status (opt-val gnc:pagename-accounts optname-void-transactions))
+        (void-status (opt-val gnc:pagename-accounts optname-void-transactions))
         (splits '())
         (query (qof-query-create-for-splits)))
 
     ;;(gnc:warn "accts in trep-renderer:" c_account_1)
     ;;(gnc:warn "Report Account names:" (get-other-account-names c_account_1))
 
-    (set! c_account_1
-          (filter (lambda (acc)
-                    (string-match c_account_matcher (gnc-account-get-full-name acc)))
-                  c_account_1))
-    
     (if (not (or (null? c_account_1) (and-map not c_account_1)))
         (begin
           (qof-query-set-book query (gnc-get-current-book))
@@ -1590,28 +1627,23 @@ Credit Card, and Income accounts."))))))
 
           ;;(gnc:warn "Splits in trep-renderer:" splits)
 
-	  ;;(gnc:warn "Filter account names:" (get-other-account-names c_account_2))
-
-	  ;;This should probably a cond or a case to allow for different filter types.
-	  ;;(gnc:warn "Filter Mode: " filter-mode)
-	  (if (eq? filter-mode 'include)
-	      (begin
-		;;(gnc:warn "Including Filter Accounts")
-		(set! splits (filter (lambda (split) 
-				       (is-filter-member split c_account_2))
-				     splits))
-		)
-	      )
-
-	  (if (eq? filter-mode 'exclude)
-	      (begin
-		;;(gnc:warn "Excluding Filter Accounts")
-		(set! splits (filter (lambda (split) 
-				       (not (is-filter-member split c_account_2)))
-				     splits))
-		)
-	      )
-	
+          ; Combined Filter:
+          ; - include/exclude splits to/from selected accounts
+          ; - substring/regex matcher for Transaction Description/Notes/Memo
+          (set! splits (filter
+                        (lambda (split)
+                          (let* ((trans (xaccSplitGetParent split))
+                                 (match? (lambda (str)
+                                           (if transaction-matcher-regexp
+                                               (regexp-exec transaction-matcher-regexp str)
+                                               (string-contains str transaction-matcher)))))
+                            (and (if (eq? filter-mode 'include) (is-filter-member split c_account_2) #t)
+                                 (if (eq? filter-mode 'exclude) (not (is-filter-member split c_account_2)) #t)
+                                 (or (match? (xaccTransGetDescription trans))
+                                     (match? (xaccTransGetNotes trans))
+                                     (match? (xaccSplitGetMemo split))))))
+                        splits))
+
           (if (not (null? splits))
               (let ((table 
                      (make-split-table 
@@ -1659,12 +1691,22 @@ match the time interval and account selection specified \
 in the Options panel.")))
                 (gnc:html-document-add-object! document p))))
 
-        ;; error condition: no accounts specified
-        
-        (gnc:html-document-add-object!
-         document 
-	 (gnc:html-make-no-account-warning 
-	  report-title (gnc:report-id report-obj))))
+        (if (null? c_account_0)
+            
+            ;; error condition: no accounts specified
+            (gnc:html-document-add-object!
+             document 
+             (gnc:html-make-no-account-warning 
+              report-title (gnc:report-id report-obj)))
+
+            ;; error condition: accounts were specified but none matcher string/regex
+            (gnc:html-document-add-object!
+             document
+             (gnc:make-html-text
+              (gnc:html-markup-h2
+               (N_ "No accounts were matched"))
+              (gnc:html-markup-p
+               (N_ "The account matcher specified in the report options did not match any accounts."))))))
 
     (gnc:report-finished)
     document))

commit dfa25e8cbd17ec420b84e9180a098501d9155e3e
Author: christopherlam <christopher.lck at gmail.com>
Date:   Fri Oct 27 15:10:49 2017 +0800

    refactor old is-filter-member to use srfi-1
    
    This has better readability

diff --git a/gnucash/report/standard-reports/income-gst-statement.scm b/gnucash/report/standard-reports/income-gst-statement.scm
index 64c7aa0..6784755 100644
--- a/gnucash/report/standard-reports/income-gst-statement.scm
+++ b/gnucash/report/standard-reports/income-gst-statement.scm
@@ -228,7 +228,8 @@ accounts must be of type ASSET for taxes paid on expenses, and type LIABILITY fo
                           subtotal-style export?)
   (let* ((row-contents '())
          (columns (map (lambda (coll) (coll 'format gnc:make-gnc-monetary #f)) subtotal-collectors))
-         (list-of-commodities (delete-duplicates (map gnc:gnc-monetary-commodity (apply append columns)))))
+         (list-of-commodities (delete-duplicates (map gnc:gnc-monetary-commodity (apply append columns))
+                                                 gnc-commodity-equal)))
 
     (define (retrieve-commodity list-of-monetary commodity)
       (if (null? list-of-monetary)
@@ -1574,37 +1575,22 @@ for taxes paid on expenses, and type LIABILITY for taxes collected on sales.")
 
   (define (is-filter-member split account-list)
     (let* ((txn (xaccSplitGetParent split))
-           (splitcount (xaccTransCountSplits txn)))
-
+           (splitcount (xaccTransCountSplits txn))
+           (other-account (xaccSplitGetAccount (xaccSplitGetOtherSplit split)))
+           (splits-equal? (lambda (s1 s2) (xaccSplitEqual s1 s2 #t #f #f)))
+           (other-splits (delete split (xaccTransGetSplitList txn) splits-equal?))
+           (other-accounts (map xaccSplitGetAccount other-splits))
+           (is-in-account-list? (lambda (acc) (member acc account-list))))
       (cond
         ;; A 2-split transaction - test separately so it can be optimized
         ;; to significantly reduce the number of splits to traverse
         ;; in guile code
         ((= splitcount 2)
-         (let* ((other      (xaccSplitGetOtherSplit split))
-                (other-acct (xaccSplitGetAccount other)))
-           (member other-acct account-list)))
-
+         (is-in-account-list? other-account))
+        
         ;; A multi-split transaction - run over all splits
         ((> splitcount 2)
-         (let ((splits (xaccTransGetSplitList txn)))
-
-           ;; Walk through the list of splits.
-           ;; if we reach the end, return #f
-           ;; if the 'this' != 'split' and the split->account is a member
-           ;; of the account-list, then return #t, else recurse
-           (define (is-member splits)
-             (if (null? splits)
-                 #f
-                 (let* ((this (car splits))
-                        (rest (cdr splits))
-                        (acct (xaccSplitGetAccount this)))
-                   (if (and (not (eq? this split))
-                            (member acct account-list))
-                       #t
-                       (is-member rest)))))
-
-           (is-member splits)))
+         (or-map is-in-account-list? other-accounts))
 
         ;; Single transaction splits
         (else #f))))

commit cdb677633ca78d6ed94a36a6ba1a3e93649b79dd
Author: christopherlam <christopher.lck at gmail.com>
Date:   Thu Oct 26 22:16:24 2017 +0800

    improve split-remove-duplicates, combine filters
    
    To use inbuilt list functions

diff --git a/gnucash/report/standard-reports/income-gst-statement.scm b/gnucash/report/standard-reports/income-gst-statement.scm
index 1027658..64c7aa0 100644
--- a/gnucash/report/standard-reports/income-gst-statement.scm
+++ b/gnucash/report/standard-reports/income-gst-statement.scm
@@ -1566,16 +1566,11 @@ for taxes paid on expenses, and type LIABILITY for taxes collected on sales.")
   ;;  ( map (lambda (acct)  (gnc-account-get-full-name acct)) account-list))
 
   (define (splits-filter-unique-transactions splits)
-    (let ((have-trans-hash (make-hash-table)))
-      (define (only-one-copy? split)
-        (let* ((parent (xaccSplitGetParent split))
-               (trans-guid (gncTransGetGUID parent)))
-          (if (hash-ref have-trans-hash trans-guid #f)
-              #f  ; already have a copy of this transaction
-              (begin
-                (hash-set! have-trans-hash trans-guid #t)
-                #t))))
-      (filter only-one-copy? splits)))
+    (define (same-txn? s1 s2)
+      (define txn1 (xaccSplitGetParent s1))
+      (define txn2 (xaccSplitGetParent s2))
+      (xaccTransEqual txn1 txn2 #t #t #t #f))
+    (delete-duplicates! splits same-txn?))
 
   (define (is-filter-member split account-list)
     (let* ((txn (xaccSplitGetParent split))
@@ -1690,26 +1685,11 @@ for taxes paid on expenses, and type LIABILITY for taxes collected on sales.")
 
           ;;(gnc:warn "Splits in trep-renderer:" splits)
 
-          ;;(gnc:warn "Filter account names:" (get-other-account-names c_account_2))
-
-          ;;This should probably a cond or a case to allow for different filter types.
-          ;;(gnc:warn "Filter Mode: " filter-mode)
-          (if (eq? filter-mode 'include)
-              (begin
-                ;;(gnc:warn "Including Filter Accounts")
-                (set! splits (filter (lambda (split)
-                                       (is-filter-member split c_account_2))
-                                     splits))))
-
-          (if (eq? filter-mode 'exclude)
-              (begin
-                ;;(gnc:warn "Excluding Filter Accounts")
-                (set! splits (filter (lambda (split)
-                                       (not (is-filter-member split c_account_2)))
-                                     splits))))
-
-          ; Combines: Transaction Description/Notes/Memo matcher, include only
-          ; invoices & regular transactions, and disallow closing txns.
+          ; Combined Filter:
+          ; - include/exclude splits to/from selected accounts
+          ; - include only Invoices & Regular Transactions (i.e. remove Link & Payments)
+          ; - disallow Closing Transactions, and
+          ; - substring/regex matcher for Description/Notes/Memo 
           (set! splits (filter
                         (lambda (split)
                           (let* ((trans (xaccSplitGetParent split))
@@ -1718,7 +1698,9 @@ for taxes paid on expenses, and type LIABILITY for taxes collected on sales.")
                                            (if transaction-matcher-regexp
                                                (regexp-exec transaction-matcher-regexp str)
                                                (string-contains str transaction-matcher)))))
-                            (and (member txn-type (list TXN-TYPE-NONE TXN-TYPE-INVOICE))
+                            (and (if (eq? filter-mode 'include) (is-filter-member split c_account_2) #t)
+                                 (if (eq? filter-mode 'exclude) (not (is-filter-member split c_account_2)) #t)
+                                 (member txn-type (list TXN-TYPE-NONE TXN-TYPE-INVOICE))
                                  (not (xaccTransGetIsClosingTxn trans))
                                  (or (match? (xaccTransGetDescription trans))
                                      (match? (xaccTransGetNotes trans))

commit 3475a894f9f463cd36b1dc19817e07ea2a4e0f02
Author: christopherlam <christopher.lck at gmail.com>
Date:   Wed Oct 25 14:09:28 2017 +0800

    Regex is optional, and add transaction matcher
    
    This commit will reinstate substring matcher, with optional regex matching.
    
    Will also add a Transaction Matcher - will include splits whose description/notes/memo is substring/regex matched. Will be usable for #category matching, especially when backported to transaction.scm
    
    Also strings are defined centrally which will aid localization and reduce typos.

diff --git a/gnucash/report/standard-reports/income-gst-statement.scm b/gnucash/report/standard-reports/income-gst-statement.scm
index 20885eb..1027658 100644
--- a/gnucash/report/standard-reports/income-gst-statement.scm
+++ b/gnucash/report/standard-reports/income-gst-statement.scm
@@ -63,11 +63,15 @@
 (define optname-void-transactions (N_ "Void Transactions"))
 (define optname-table-export (N_ "Table for Exporting"))
 (define optname-common-currency (N_ "Common Currency"))
-(define TAX-SETUP-DESC "From the Report Options, you will need to select the accounts which will \
+(define TAX-SETUP-DESC (N_ "From the Report Options, you will need to select the accounts which will \
 hold the GST/VAT taxes collected or paid. These accounts must contain splits which document the \
 monies which are wholly sent or claimed from tax authorities during periodic GST/VAT returns. These \
-accounts must be of type ASSET for taxes paid on expenses, and type LIABILITY for taxes collected on sales.")
+accounts must be of type ASSET for taxes paid on expenses, and type LIABILITY for taxes collected on sales."))
 (define optname-currency (N_ "Report's currency"))
+(define optname-account-matcher (N_ "Account Matcher"))
+(define optname-account-matcher-regex (N_ "Account Matcher uses regular expressions for extended matching"))
+(define optname-transaction-matcher (N_ "Transaction Matcher"))
+(define optname-transaction-matcher-regex (N_ "Transaction Matcher uses regular expressions for extended matching"))
 (define def:grand-total-style "grand-total")
 (define def:normal-row-style "normal-row")
 (define def:alternate-row-style "alternate-row")
@@ -676,6 +680,23 @@ accounts must be of type ASSET for taxes paid on expenses, and type LIABILITY fo
     gnc:pagename-general optname-table-export
     "g" (N_ "Formats the table suitable for cut & paste exporting with extra cells.") #f))
 
+  (gnc:register-trep-option
+   (gnc:make-string-option
+    gnc:pagename-general optname-transaction-matcher
+    "i1" (N_ "Match only transactions whose substring is matched e.g. '#gift' \
+will find all transactions with #gift in memo, description or notes. It can be left \
+blank, which will disable the matcher.")
+    ""))
+
+  (gnc:register-trep-option
+   (gnc:make-simple-boolean-option
+    gnc:pagename-general optname-transaction-matcher-regex
+    "i2"
+    (N_ "By default the transaction matcher will search substring only. Set this to true to \
+enable full POSIX regular expressions capabilities. '#work|#family' will match both \
+tags within description, notes or memo. ")
+    #f))
+
   ;; Accounts options
 
   ;; account to do report on
@@ -696,13 +717,22 @@ accounts must be of type ASSET for taxes paid on expenses, and type LIABILITY fo
 
   (gnc:register-trep-option
    (gnc:make-string-option
-    gnc:pagename-accounts (N_ "Account Matcher")
-    "b15" (N_ "Match only above accounts whose fullname matches regex e.g. ':Travel' will \
-match Expenses:Travel:Holiday and Expenses:Business:Travel. 'Car|Flights' will match both \
-Expenses:Car and Expenses:Flights. It can be left blank, which will disable the matcher.")
+    gnc:pagename-accounts optname-account-matcher
+    "b15" (N_ "Match only above accounts whose fullname is matched e.g. ':Travel' will match \
+Expenses:Travel:Holiday and Expenses:Business:Travel. It can be left blank, which will disable \
+the matcher.")
     ""))
 
   (gnc:register-trep-option
+   (gnc:make-simple-boolean-option
+    gnc:pagename-accounts optname-account-matcher-regex
+    "b16"
+    (N_ "By default the account matcher will search substring only. Set this to true to enable full \
+POSIX regular expressions capabilities. 'Car|Flights' will match both Expenses:Car and Expenses:Flights. \
+Use a period (.) to match a single character e.g. '20../.' will match 'Travel 2017/1 London'. ")
+    #f))
+
+  (gnc:register-trep-option
    (gnc:make-account-list-limited-option
     gnc:pagename-accounts (N_ "Tax Accounts")
     "b17" (N_ "Please find and select the accounts which will hold the tax collected or paid. \
@@ -1588,10 +1618,15 @@ for taxes paid on expenses, and type LIABILITY for taxes collected on sales.")
 
   (let* ((document (gnc:make-html-document))
          (c_account_0 (opt-val gnc:pagename-accounts "Accounts"))
-         (c_account_matcher (opt-val gnc:pagename-accounts "Account Matcher"))
+         (account-matcher (opt-val gnc:pagename-accounts optname-account-matcher))
+         (account-matcher-regexp (if (opt-val gnc:pagename-accounts optname-account-matcher-regex)
+                                     (make-regexp account-matcher)
+                                     #f))
          (c_account_1 (filter
                        (lambda (acc)
-                         (string-match c_account_matcher (gnc-account-get-full-name acc)))
+                         (if account-matcher-regexp
+                             (regexp-exec account-matcher-regexp (gnc-account-get-full-name acc))
+                             (string-contains (gnc-account-get-full-name acc) account-matcher)))
                        c_account_0))
          (c_account_2 (opt-val gnc:pagename-accounts "Filter By..."))
          (tax-accounts (opt-val gnc:pagename-accounts "Tax Accounts"))
@@ -1606,6 +1641,10 @@ for taxes paid on expenses, and type LIABILITY for taxes collected on sales.")
          (enddate (gnc:timepair-end-day-time
                    (gnc:date-option-absolute-time
                     (opt-val gnc:pagename-general "End Date"))))
+         (transaction-matcher (opt-val gnc:pagename-general optname-transaction-matcher))
+         (transaction-matcher-regexp (if (opt-val gnc:pagename-general optname-transaction-matcher-regex)
+                                         (make-regexp transaction-matcher)
+                                         #f))
          (report-title (opt-val
                         gnc:pagename-general
                         gnc:optname-reportname))
@@ -1669,20 +1708,27 @@ for taxes paid on expenses, and type LIABILITY for taxes collected on sales.")
                                        (not (is-filter-member split c_account_2)))
                                      splits))))
 
-          ; We have to remove duplicates because the report will *sum* amounts in a transaction
-          ; otherwise it will double count where transaction contains 2 splits in same account
-          (set! splits (splits-filter-unique-transactions splits))
-
-          ; For each split, we will only keep those which contain useful data
-          ; e.g. show invoices & regular transactions. We will also disallow closing txns.
+          ; Combines: Transaction Description/Notes/Memo matcher, include only
+          ; invoices & regular transactions, and disallow closing txns.
           (set! splits (filter
                         (lambda (split)
                           (let* ((trans (xaccSplitGetParent split))
-                                 (txn-type (xaccTransGetTxnType trans)))
+                                 (txn-type (xaccTransGetTxnType trans))
+                                 (match? (lambda (str)
+                                           (if transaction-matcher-regexp
+                                               (regexp-exec transaction-matcher-regexp str)
+                                               (string-contains str transaction-matcher)))))
                             (and (member txn-type (list TXN-TYPE-NONE TXN-TYPE-INVOICE))
-                                 (not (xaccTransGetIsClosingTxn trans)))))
+                                 (not (xaccTransGetIsClosingTxn trans))
+                                 (or (match? (xaccTransGetDescription trans))
+                                     (match? (xaccTransGetNotes trans))
+                                     (match? (xaccSplitGetMemo split))))))
                         splits))
 
+          ; We have to remove duplicates because the report will *sum* amounts in a transaction
+          ; otherwise it will double count where transaction contains 2 splits in same account
+          (set! splits (splits-filter-unique-transactions splits))
+
           (if (not (null? splits))
               (let ((table
                      (make-split-table
@@ -1762,28 +1808,38 @@ for taxes paid on expenses, and type LIABILITY for taxes collected on sales.")
 
         ;; error condition: no accounts specified
 
-        (begin
-          (gnc:html-document-add-object!
-           document
-           (gnc:html-make-no-account-warning
-            report-title (gnc:report-id report-obj)))
-
-          (gnc:html-document-add-object!
-           document
-           (gnc:make-html-text
-            (gnc:html-markup-p
-             "This report is useful to calculate periodic business tax payable/receivable from"
-             " authorities. From <i>Edit report options</i> above, choose your Business Income and Business Expense accounts."
-             " Each transaction may contain, in addition to the accounts payable/receivable or bank accounts,"
-             " a split to a tax account, e.g. Income:Sales -$1000, Liability:GST on Sales -$100, Asset:Bank $1100.")
-            (gnc:html-markup-p
-             " These tax accounts can either be populated using the standard register, or from Business Invoices and Bills "
-             " which will require Business > Sales Tax Tables to be set up correctly. Please see the documentation.")))
-
-          (gnc:html-document-add-object!
-           document
-           (gnc:make-html-text
-            (gnc:html-markup-p TAX-SETUP-DESC)))))
+          (if (null? c_account_0)
+              (begin
+                (gnc:html-document-add-object!
+                 document
+                 (gnc:html-make-no-account-warning
+                  report-title (gnc:report-id report-obj)))
+                
+                (gnc:html-document-add-object!
+                 document
+                 (gnc:make-html-text
+                  (gnc:html-markup-p
+                   "This report is useful to calculate periodic business tax payable/receivable from"
+                   " authorities. From <i>Edit report options</i> above, choose your Business Income and Business Expense accounts."
+                   " Each transaction may contain, in addition to the accounts payable/receivable or bank accounts,"
+                   " a split to a tax account, e.g. Income:Sales -$1000, Liability:GST on Sales -$100, Asset:Bank $1100.")
+                  (gnc:html-markup-p
+                   " These tax accounts can either be populated using the standard register, or from Business Invoices and Bills "
+                   " which will require Business > Sales Tax Tables to be set up correctly. Please see the documentation.")))
+                
+                (gnc:html-document-add-object!
+                 document
+                 (gnc:make-html-text
+                  (gnc:html-markup-p TAX-SETUP-DESC))))
+            
+              (begin
+                (gnc:html-document-add-object!
+                 document
+                 (gnc:make-html-text
+                  (gnc:html-markup-h2
+                   (N_ "No accounts were matched"))
+                  (gnc:html-markup-p
+                   (N_ "The account matcher specified in the report options did not match any accounts.")))))))
 
     (gnc:report-finished)
     document))

commit 885272a150bb138bd2d4a01c098caa3eae77ba80
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Tue Oct 24 19:18:40 2017 +0800

    Enhance transaction.scm account filter to regex
    
    This commit will enhance the account fullname filter to full regex matching capabilities. Will allow complex account fullname queries e.g. 'Car|Flights'

diff --git a/gnucash/report/standard-reports/transaction.scm b/gnucash/report/standard-reports/transaction.scm
index 4fbab7d..dab69e8 100644
--- a/gnucash/report/standard-reports/transaction.scm
+++ b/gnucash/report/standard-reports/transaction.scm
@@ -34,6 +34,7 @@
 (use-modules (gnucash main)) ;; FIXME: delete after we finish modularizing.
 (use-modules (srfi srfi-1))
 (use-modules (srfi srfi-13))
+(use-modules (ice-9 regex))
 (use-modules (gnucash gnc-module))
 (use-modules (gnucash gettext))
 
@@ -657,10 +658,11 @@
 
   (gnc:register-trep-option
    (gnc:make-string-option
-    gnc:pagename-accounts (N_ "Account Substring")
-    "a5" (N_ "Match only above accounts whose fullname contains substring e.g. ':Travel' will \
-match Expenses:Travel:Holiday and Expenses:Business:Travel. Can be left blank, which will \
-disable the substring filter. This filter is case-sensitive.")
+    gnc:pagename-accounts (N_ "Account Matcher")
+    "a5" (N_ "Match only above accounts whose fullname is matched by regex \
+e.g. ':Travel' will match Expenses:Travel:Holiday and Expenses:Business:Travel. \
+'Car|Flights' will match both Expenses:Car and Expenses:Business:Flights. It \
+can be left blank, which will disable the matcher")
     ""))
 
   (gnc:register-trep-option
@@ -1530,7 +1532,7 @@ Credit Card, and Income accounts."))))))
   (gnc:report-starting reportname)
   (let ((document (gnc:make-html-document))
 	(c_account_1 (opt-val gnc:pagename-accounts "Accounts"))
-	(c_account_substring (opt-val gnc:pagename-accounts "Account Substring"))
+	(c_account_matcher (opt-val gnc:pagename-accounts "Account Matcher"))
 	(c_account_2 (opt-val gnc:pagename-accounts "Filter By..."))
 	(filter-mode (opt-val gnc:pagename-accounts "Filter Type"))
         (begindate (gnc:timepair-start-day-time
@@ -1555,7 +1557,7 @@ Credit Card, and Income accounts."))))))
 
     (set! c_account_1
           (filter (lambda (acc)
-                    (string-contains (gnc-account-get-full-name acc) c_account_substring))
+                    (string-match c_account_matcher (gnc-account-get-full-name acc)))
                   c_account_1))
     
     (if (not (or (null? c_account_1) (and-map not c_account_1)))

commit d077400ba87b44af75c1c3b97661d035028e9aca
Author: christopherlam <christopher.lck at gmail.com>
Date:   Tue Oct 24 12:59:25 2017 +0800

    Enhance account filter to a regex
    
    This commit will enhance the account fullname filter to full regex matching capabilities. Will allow complex account fullname queries e.g. "Car|Flights|Travel"

diff --git a/gnucash/report/standard-reports/income-gst-statement.scm b/gnucash/report/standard-reports/income-gst-statement.scm
index 92d0476..20885eb 100644
--- a/gnucash/report/standard-reports/income-gst-statement.scm
+++ b/gnucash/report/standard-reports/income-gst-statement.scm
@@ -37,6 +37,7 @@
 (use-modules (gnucash main)) ;; FIXME: delete after we finish modularizing.
 (use-modules (srfi srfi-1))
 (use-modules (srfi srfi-13))
+(use-modules (ice-9 regex))
 (use-modules (gnucash gnc-module))
 (use-modules (gnucash gettext))
 (use-modules (gnucash printf))
@@ -695,10 +696,10 @@ accounts must be of type ASSET for taxes paid on expenses, and type LIABILITY fo
 
   (gnc:register-trep-option
    (gnc:make-string-option
-    gnc:pagename-accounts (N_ "Account Substring")
-    "b15" (N_ "Match only above accounts whose fullname contains substring e.g. ':Travel' will \
-match Expenses:Travel:Holiday and Expenses:Business:Travel. Can be left blank, which will \
-disable the substring filter. This filter is case-sensitive.")
+    gnc:pagename-accounts (N_ "Account Matcher")
+    "b15" (N_ "Match only above accounts whose fullname matches regex e.g. ':Travel' will \
+match Expenses:Travel:Holiday and Expenses:Business:Travel. 'Car|Flights' will match both \
+Expenses:Car and Expenses:Flights. It can be left blank, which will disable the matcher.")
     ""))
 
   (gnc:register-trep-option
@@ -1587,10 +1588,10 @@ for taxes paid on expenses, and type LIABILITY for taxes collected on sales.")
 
   (let* ((document (gnc:make-html-document))
          (c_account_0 (opt-val gnc:pagename-accounts "Accounts"))
-         (c_account_substring (opt-val gnc:pagename-accounts "Account Substring"))
+         (c_account_matcher (opt-val gnc:pagename-accounts "Account Matcher"))
          (c_account_1 (filter
                        (lambda (acc)
-                         (string-contains (gnc-account-get-full-name acc) c_account_substring))
+                         (string-match c_account_matcher (gnc-account-get-full-name acc)))
                        c_account_0))
          (c_account_2 (opt-val gnc:pagename-accounts "Filter By..."))
          (tax-accounts (opt-val gnc:pagename-accounts "Tax Accounts"))

commit b74c0bedfd56b6b772abd325a41910e6511f90d9
Author: christopherlam <christopher.lck at gmail.com>
Date:   Tue Oct 24 08:06:56 2017 +0800

    Amend some strings for improved visibility
    
    Enhance visibility of total-sales and total-purchases (all caps) and amend input/output tax accounts display.

diff --git a/gnucash/report/standard-reports/income-gst-statement.scm b/gnucash/report/standard-reports/income-gst-statement.scm
index f820d3f..92d0476 100644
--- a/gnucash/report/standard-reports/income-gst-statement.scm
+++ b/gnucash/report/standard-reports/income-gst-statement.scm
@@ -1197,7 +1197,7 @@ for taxes paid on expenses, and type LIABILITY for taxes collected on sales.")
         (append
          ; each column will be a vector
          ; (vector heading calculator-function reverse-column?)
-         (list (vector "Total Sales" total-sales #t))
+         (list (vector "TOTAL SALES" total-sales #t))
          (if (gnc:option-value (gnc:lookup-option options gnc:pagename-display (N_ "Individual income columns")))
              (map (lambda (acc) (vector (xaccAccountGetName acc) (account-adder acc) #t))
                   accounts-sales)
@@ -1206,7 +1206,7 @@ for taxes paid on expenses, and type LIABILITY for taxes collected on sales.")
              (map (lambda (acc) (vector (xaccAccountGetName acc) (account-adder acc) #t))
                   accounts-tax-collected)
              (list (vector "Tax on Sales" tax-on-sales #t)))
-         (list (vector "Total Purchases" total-purchases #f))
+         (list (vector "TOTAL PURCHASES" total-purchases #f))
          (if (gnc:option-value (gnc:lookup-option options gnc:pagename-display (N_ "Individual expense columns")))
              (map (lambda (acc) (vector (xaccAccountGetName acc) (account-adder acc) #f))
                   accounts-purchases)
@@ -1723,14 +1723,18 @@ for taxes paid on expenses, and type LIABILITY for taxes collected on sales.")
                  (gnc:make-html-text
                   (gnc:html-markup-p
                    "Input Tax accounts: "
-                   (string-join (map gnc-account-get-full-name accounts-tax-paid) ", "))))
+                   (if (null? accounts-tax-paid)
+                       (N_ "None")
+                       (string-join (map gnc-account-get-full-name accounts-tax-paid) ", ")))))
 
                 (gnc:html-document-add-object!
                  document
                  (gnc:make-html-text
                   (gnc:html-markup-p
                    "Output Tax accounts: "
-                   (string-join (map gnc-account-get-full-name accounts-tax-collected) ", "))))
+                   (if (null? accounts-tax-collected)
+                       (N_ "None")
+                       (string-join (map gnc-account-get-full-name accounts-tax-collected) ", ")))))
 
                 (if (null? (append accounts-tax-collected accounts-tax-paid))
                     (gnc:html-document-add-object!

commit 51a0a55e43c742cbdb58440dce479e4e348e0a29
Author: christopherlam <christopher.lck at gmail.com>
Date:   Tue Oct 24 08:04:27 2017 +0800

    Change critical code to pure FP
    
    The function split-adder is the most crucial code  in this report. This commit changes it to pure functional programming.

diff --git a/gnucash/report/standard-reports/income-gst-statement.scm b/gnucash/report/standard-reports/income-gst-statement.scm
index a74092f..f820d3f 100644
--- a/gnucash/report/standard-reports/income-gst-statement.scm
+++ b/gnucash/report/standard-reports/income-gst-statement.scm
@@ -1173,33 +1173,22 @@ for taxes paid on expenses, and type LIABILITY for taxes collected on sales.")
       (letrec
           ((myadd (lambda (X Y) (if X (if Y (gnc-numeric-add X Y GNC-DENOM-AUTO GNC-RND-ROUND) X) Y)))
            (myneg (lambda (X) (if X (gnc-numeric-neg X) #f)))
-           (split-adder (lambda (split accountlist typefilter)
+           (split-adder (lambda (split accountlist)
                           (let* ((transaction (xaccSplitGetParent split))
                                  (splits-in-transaction (xaccTransGetSplitList transaction))
-                                 (sum #f))
-                            (for-each (lambda (s)
-                                        (let* ((splitAcc (xaccSplitGetAccount s))
-                                               (splitVal (if (xaccTransGetVoidStatus transaction)
-                                                             (xaccSplitVoidFormerValue s)
-                                                             (xaccSplitGetValue s)))
-                                               (splitCommodity (xaccAccountGetCommodity splitAcc))
-                                               (splitAccType (xaccAccountGetType splitAcc))
-                                               (splitAccName (xaccAccountGetName splitAcc)))
-                                          (if accountlist
-                                              (if (member splitAcc accountlist)
-                                                  (set! sum (myadd sum splitVal))))
-                                          (if typefilter
-                                              (if (eq? typefilter splitAccType)
-                                                  (set! sum (myadd sum splitVal))))))
-                                      splits-in-transaction)
-                            sum)))
-           ;(sales-without-tax (lambda (s) (split-adder s #f ACCT-TYPE-INCOME)))
-           ;(purchases-without-tax (lambda (s) (split-adder s #f ACCT-TYPE-EXPENSE)))
-           (tax-on-sales (lambda (s) (split-adder s accounts-tax-collected #f)))
-           (tax-on-purchases (lambda (s) (split-adder s accounts-tax-paid #f)))
-           (sales-without-tax (lambda (s) (split-adder s accounts-sales #f)))
-           (purchases-without-tax (lambda (s) (split-adder s accounts-purchases #f)))
-           (account-adder (lambda (acc) (lambda (s) (split-adder s (list acc) #f))))
+                                 (split-get-value (lambda (s)
+                                                    (if (xaccTransGetVoidStatus transaction)
+                                                        (xaccSplitVoidFormerValue s)
+                                                        (xaccSplitGetValue s))))
+                                 (include-split? (lambda (s) (member (xaccSplitGetAccount s) accountlist)))
+                                 (filtered-splits (filter include-split? splits-in-transaction))
+                                 (list-of-values (map split-get-value filtered-splits)))
+                            (fold myadd #f list-of-values))))
+           (tax-on-sales (lambda (s) (split-adder s accounts-tax-collected)))
+           (tax-on-purchases (lambda (s) (split-adder s accounts-tax-paid)))
+           (sales-without-tax (lambda (s) (split-adder s accounts-sales)))
+           (purchases-without-tax (lambda (s) (split-adder s accounts-purchases)))
+           (account-adder (lambda (acc) (lambda (s) (split-adder s (list acc)))))
            (total-sales (lambda (s) (myadd (tax-on-sales s) (sales-without-tax s))))
            (total-purchases (lambda (s) (myadd (tax-on-purchases s) (purchases-without-tax s))))
            (bank-remittance (lambda (s) (myneg (myadd (total-sales s) (total-purchases s)))))

commit 85fae7ef526cb24b3954a8a610b0ab4d55225d27
Author: Jose Marino <jmarino at users.noreply.github.com>
Date:   Tue Oct 17 10:37:45 2017 -0600

    add unit test for cashflow-barchart report
    
    Heavily inspired by test-generic-net-barchart.scm with a touch of
    test-cash-flow.scm

diff --git a/gnucash/report/standard-reports/cashflow-barchart.scm b/gnucash/report/standard-reports/cashflow-barchart.scm
index d4992af..0589a34 100644
--- a/gnucash/report/standard-reports/cashflow-barchart.scm
+++ b/gnucash/report/standard-reports/cashflow-barchart.scm
@@ -507,10 +507,14 @@
      (cons 'money-in-collector money-in-collector)
      (cons 'money-out-collector money-out-collector))))
 
+;; export to make uuid available to unit test: test-cashflow-barchart
+(export cashflow-barchart-uuid)
+(define cashflow-barchart-uuid "5426e4d987f6444387fe70880e5b28a0")
+
 (gnc:define-report
  'version 1
  'name reportname
- 'report-guid "5426e4d987f6444387fe70880e5b28a0"
+ 'report-guid cashflow-barchart-uuid
  'menu-tip (N_ "Shows a barchart with cash flow over time")
  'menu-path (list gnc:menuname-income-expense)
  'options-generator cashflow-barchart-options-generator
diff --git a/gnucash/report/standard-reports/test/CMakeLists.txt b/gnucash/report/standard-reports/test/CMakeLists.txt
index a771186..7be4c9c 100644
--- a/gnucash/report/standard-reports/test/CMakeLists.txt
+++ b/gnucash/report/standard-reports/test/CMakeLists.txt
@@ -1,4 +1,5 @@
 GNC_ADD_SCHEME_TEST(test-cash-flow test-cash-flow.scm)
+GNC_ADD_SCHEME_TEST(test-cashflow-barchart test-cashflow-barchart.scm)
 GNC_ADD_SCHEME_TEST(test-standard-category-report test-standard-category-report.scm)
 GNC_ADD_SCHEME_TEST(test-standard-net-barchart test-standard-net-barchart.scm)
 GNC_ADD_SCHEME_TEST(test-standard-net-linechart test-standard-net-linechart.scm)
@@ -20,5 +21,5 @@ GNC_ADD_SCHEME_TARGETS(scm-test-standard-reports
 )
 
 SET_DIST_LIST(test_standard_reports_DIST CMakeLists.txt Makefile.am ${scm_test_standard_reports_SOURCES}
-        test-cash-flow.scm test-standard-category-report.scm test-standard-net-barchart.scm
+        test-cash-flow.scm test-cashflow-barchart.scm test-standard-category-report.scm test-standard-net-barchart.scm
         test-standard-net-linechart.scm)
diff --git a/gnucash/report/standard-reports/test/Makefile.am b/gnucash/report/standard-reports/test/Makefile.am
index d6d5153..2a4e808 100644
--- a/gnucash/report/standard-reports/test/Makefile.am
+++ b/gnucash/report/standard-reports/test/Makefile.am
@@ -2,6 +2,7 @@ TESTS = $(SCM_TESTS)
 
 SCM_TESTS = \
 	test-cash-flow \
+	test-cashflow-barchart \
 	test-standard-category-report \
 	test-standard-net-barchart \
 	test-standard-net-linechart
diff --git a/gnucash/report/standard-reports/test/test-cashflow-barchart.scm b/gnucash/report/standard-reports/test/test-cashflow-barchart.scm
new file mode 100644
index 0000000..e4f7dde
--- /dev/null
+++ b/gnucash/report/standard-reports/test/test-cashflow-barchart.scm
@@ -0,0 +1,288 @@
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; 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, contact:
+;;
+;; Free Software Foundation           Voice:  +1-617-542-5942
+;; 51 Franklin Street, Fifth Floor    Fax:    +1-617-542-2652
+;; Boston, MA  02110-1301,  USA       gnu at gnu.org
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+(use-modules (gnucash gnc-module))
+
+(gnc:module-begin-syntax (gnc:module-load "gnucash/app-utils" 0))
+(gnc:module-load "gnucash/report/report-system" 0)
+
+(use-modules (gnucash engine))
+(use-modules (sw_engine))
+
+(use-modules (gnucash engine test test-extras))
+(use-modules (gnucash report report-system))
+(use-modules (gnucash report report-system test test-extras))
+(use-modules (gnucash report standard-reports cashflow-barchart))
+
+(add-to-load-path "../../stylesheets/")
+(use-modules (gnucash report stylesheets))
+
+(use-modules (ice-9 format))
+(use-modules (ice-9 streams))
+(use-modules (srfi srfi-1))
+
+
+(define (run-test)
+  (logging-and (test-in-txn)
+               (test-out-txn)
+               (test-null-txn)))
+
+
+(define (set-option report page tag value)
+  ((gnc:option-setter (gnc:lookup-option (gnc:report-options report)
+                                         page tag)) value))
+
+
+(define constructor (record-constructor <report>))
+
+
+(define structure
+  (list "Root" (list (cons 'type ACCT-TYPE-ASSET))
+        (list "Asset"
+              (list "Bank")
+              (list "Wallet"))
+        (list "Expenses" (list (cons 'type ACCT-TYPE-EXPENSE)))
+        (list "Income" (list (cons 'type ACCT-TYPE-INCOME)))))
+
+
+;; Test two transactions from income to two different assets in two different days
+(define (test-in-txn)
+  (let* ((template (gnc:find-report-template cashflow-barchart-uuid))
+         (options (gnc:make-report-options cashflow-barchart-uuid))
+         (report (constructor cashflow-barchart-uuid "bar" options
+                              #t #t #f #f ""))
+         (renderer (gnc:report-template-renderer template)))
+    (let* ((env (create-test-env))
+           (account-alist (env-create-account-structure-alist env structure))
+           (bank-account (cdr (assoc "Bank" account-alist)))
+           (wallet-account (cdr (assoc "Wallet" account-alist)))
+           (expense-account (cdr (assoc "Expenses" account-alist)))
+           (income-account (cdr (assoc "Income" account-alist)))
+           (date-0 (gnc:get-start-this-month))
+           (date-1 (gnc:timepair-next-day date-0))
+           (date-2 (gnc:timepair-next-day date-1)))
+      (env-create-transaction env
+                              date-1
+                              bank-account
+                              income-account
+                              (gnc:make-gnc-numeric 1 1))
+      (env-create-transaction env
+                              date-2
+                              wallet-account
+                              income-account
+                              (gnc:make-gnc-numeric 5 1))
+      (begin
+        (set-option report gnc:pagename-display "Show Table" #t)
+        (set-option report gnc:pagename-general "Start Date" (cons 'absolute date-0))
+        (set-option report gnc:pagename-general "End Date" (cons 'absolute date-2))
+        (set-option report gnc:pagename-general "Step Size" 'DayDelta)
+        (set-option report gnc:pagename-general "Price Source" 'pricedb-nearest)
+        (set-option report gnc:pagename-general "Report's currency"  (gnc-default-report-currency))
+        (set-option report gnc:pagename-accounts "Accounts" (list wallet-account bank-account))
+
+        (let ((doc (renderer report)))
+          (gnc:html-document-set-style-sheet! doc (gnc:report-stylesheet report))
+          (let* ((result (gnc:html-document-render doc #f))
+                 (tbl (stream->list
+                       (pattern-streamer "<tr>"
+					 (list (list "<td>([0-9]+)/([0-9]+)/([0-9]+)</td>"
+						     1 2 3)
+                                               (list "<td class=\"number-cell\">[^0-9]*([^<]*)</td>" 1)
+					       (list "<td class=\"number-cell\">[^0-9]*([^<]*)</td>" 1)
+					       (list "<td class=\"number-cell\">[^0-9]*([^<]*)</td>" 1))
+					 result)))
+                 (total (stream->list
+                         (pattern-streamer "<tr><td>Total</td>"
+                                           (list (list "<td class=\"number-cell\">[^0-9]*([^<]*)</td>" 1)
+                                                 (list "<td class=\"number-cell\">[^0-9]*([^<]*)</td>" 1)
+                                                 (list "<td class=\"number-cell\">[^0-9]*([^<]*)</td>" 1))
+					 result))))
+            (and (every (lambda (row)                 ; test in=net & out=0 in all rows (all days)
+                          (and (equal? (second row) (fourth row))
+                               (= 0 (string->number (car (third row))))))
+                        tbl)
+                 (= 0 (tbl-ref->number tbl 0 1))      ; 1st day in =0
+                 (= 1 (tbl-ref->number tbl 1 1))      ; 2nd day in =1
+                 (= 5 (tbl-ref->number tbl 2 1))      ; 3rd day in =5
+                 (= (tbl-ref->number total 0 0) (tbl-ref->number total 0 2)) ; total in=total net
+                 (= 0 (tbl-ref->number total 0 1))    ; total out=0
+                 (= 3 (tbl-row-count tbl))
+                 (= 4 (tbl-column-count tbl)))))
+        )
+      )
+    )
+  )
+
+
+;; Test two transactions from two different assets to expense in two different days
+(define (test-out-txn)
+  (let* ((template (gnc:find-report-template cashflow-barchart-uuid))
+         (options (gnc:make-report-options cashflow-barchart-uuid))
+         (report (constructor cashflow-barchart-uuid "bar" options
+                              #t #t #f #f ""))
+         (renderer (gnc:report-template-renderer template)))
+    (let* ((env (create-test-env))
+           (account-alist (env-create-account-structure-alist env structure))
+           (bank-account (cdr (assoc "Bank" account-alist)))
+           (wallet-account (cdr (assoc "Wallet" account-alist)))
+           (expense-account (cdr (assoc "Expenses" account-alist)))
+           (income-account (cdr (assoc "Income" account-alist)))
+           (date-0 (gnc:get-start-this-month))
+           (date-1 (gnc:timepair-next-day date-0))
+           (date-2 (gnc:timepair-next-day date-1)))
+      (env-create-transaction env
+                              date-1
+                              bank-account
+                              income-account
+                              (gnc:make-gnc-numeric 100 1))   ; large in txn to avoid negative net (hard to parse)
+      (env-create-transaction env
+                              date-1
+                              expense-account
+                              bank-account
+                              (gnc:make-gnc-numeric 1 1))
+      (env-create-transaction env
+                              date-2
+                              wallet-account
+                              income-account
+                              (gnc:make-gnc-numeric 100 1))   ; large in txn to avoid negative net (hard to parse)
+      (env-create-transaction env
+                              date-2
+                              expense-account
+                              wallet-account
+                              (gnc:make-gnc-numeric 5 1))
+      (begin
+        (set-option report gnc:pagename-display "Show Table" #t)
+        (set-option report gnc:pagename-general "Start Date" (cons 'absolute date-0))
+        (set-option report gnc:pagename-general "End Date" (cons 'absolute date-2))
+        (set-option report gnc:pagename-general "Step Size" 'DayDelta)
+        (set-option report gnc:pagename-general "Price Source" 'pricedb-nearest)
+        (set-option report gnc:pagename-general "Report's currency"  (gnc-default-report-currency))
+        (set-option report gnc:pagename-accounts "Accounts" (list wallet-account bank-account))
+
+        (let ((doc (renderer report)))
+          (gnc:html-document-set-style-sheet! doc (gnc:report-stylesheet report))
+          (let* ((result (gnc:html-document-render doc #f))
+                 (tbl (stream->list
+                       (pattern-streamer "<tr>"
+					 (list (list "<td>([0-9]+)/([0-9]+)/([0-9]+)</td>"
+						     1 2 3)
+                                               (list "<td class=\"number-cell\">[^0-9]*([^<]*)</td>" 1)
+					       (list "<td class=\"number-cell\">[^0-9]*([^<]*)</td>" 1)
+					       (list "<td class=\"number-cell\">[^0-9]*([^<]*)</td>" 1))
+					 result)))
+                 (total (stream->list
+                         (pattern-streamer "<tr><td>Total</td>"
+                                           (list (list "<td class=\"number-cell\">[^0-9]*([^<]*)</td>" 1)
+                                                 (list "<td class=\"number-cell\">[^0-9]*([^<]*)</td>" 1)
+                                                 (list "<td class=\"number-cell\">[^0-9]*([^<]*)</td>" 1))
+                                           result))))
+            (and (every (lambda (row)                 ; test in-out=net in all rows (all days)
+                          (let ((in (string->number (car (second row))))
+                                (out (string->number (car (third row))))
+                                (net (string->number (car (fourth row)))))
+                            (= (- in out) net)))
+                        tbl)
+                 (= 0 (tbl-ref->number tbl 0 2))      ; 1st day out =0
+                 (= 1 (tbl-ref->number tbl 1 2))      ; 2nd day out =1
+                 (= 5 (tbl-ref->number tbl 2 2))      ; 3rd day out =5
+                 (= (- (tbl-ref->number total 0 0) (tbl-ref->number total 0 1)) ; total in-total out=total net
+                    (tbl-ref->number total 0 2))
+                 (= 6 (tbl-ref->number total 0 1))    ; total out=6
+                 (= 3 (tbl-row-count tbl))
+                 (= 4 (tbl-column-count tbl)))))
+        )
+      )
+    )
+  )
+
+
+;; Test null transaction (transaction between assets)
+;; This test is identical to test-in-txn but with an extra transaction between assets
+(define (test-null-txn)
+  (let* ((template (gnc:find-report-template cashflow-barchart-uuid))
+         (options (gnc:make-report-options cashflow-barchart-uuid))
+         (report (constructor cashflow-barchart-uuid "bar" options
+                              #t #t #f #f ""))
+         (renderer (gnc:report-template-renderer template)))
+    (let* ((env (create-test-env))
+           (account-alist (env-create-account-structure-alist env structure))
+           (bank-account (cdr (assoc "Bank" account-alist)))
+           (wallet-account (cdr (assoc "Wallet" account-alist)))
+           (expense-account (cdr (assoc "Expenses" account-alist)))
+           (income-account (cdr (assoc "Income" account-alist)))
+           (date-0 (gnc:get-start-this-month))
+           (date-1 (gnc:timepair-next-day date-0))
+           (date-2 (gnc:timepair-next-day date-1)))
+      (env-create-transaction env
+                              date-1
+                              bank-account
+                              income-account
+                              (gnc:make-gnc-numeric 1 1))
+      (env-create-transaction env
+                              date-1
+                              bank-account
+                              wallet-account
+                              (gnc:make-gnc-numeric 20 1))  ; this transaction should not be counted
+      (env-create-transaction env
+                              date-2
+                              wallet-account
+                              income-account
+                              (gnc:make-gnc-numeric 5 1))
+
+      (begin
+        (set-option report gnc:pagename-display "Show Table" #t)
+        (set-option report gnc:pagename-general "Start Date" (cons 'absolute date-0))
+        (set-option report gnc:pagename-general "End Date" (cons 'absolute date-2))
+        (set-option report gnc:pagename-general "Step Size" 'DayDelta)
+        (set-option report gnc:pagename-general "Price Source" 'pricedb-nearest)
+        (set-option report gnc:pagename-general "Report's currency"  (gnc-default-report-currency))
+        (set-option report gnc:pagename-accounts "Accounts" (list wallet-account bank-account))
+
+        (let ((doc (renderer report)))
+          (gnc:html-document-set-style-sheet! doc (gnc:report-stylesheet report))
+          (let* ((result (gnc:html-document-render doc #f))
+                 (tbl (stream->list
+                       (pattern-streamer "<tr>"
+					 (list (list "<td>([0-9]+)/([0-9]+)/([0-9]+)</td>"
+						     1 2 3)
+                                               (list "<td class=\"number-cell\">[^0-9]*([^<]*)</td>" 1)
+					       (list "<td class=\"number-cell\">[^0-9]*([^<]*)</td>" 1)
+					       (list "<td class=\"number-cell\">[^0-9]*([^<]*)</td>" 1))
+					 result)))
+                 (total (stream->list
+                         (pattern-streamer "<tr><td>Total</td>"
+                                           (list (list "<td class=\"number-cell\">[^0-9]*([^<]*)</td>" 1)
+                                                 (list "<td class=\"number-cell\">[^0-9]*([^<]*)</td>" 1)
+                                                 (list "<td class=\"number-cell\">[^0-9]*([^<]*)</td>" 1))
+                                           result))))
+            (and (every (lambda (row)                 ; test in=net & out=0 in all rows (all days)
+                          (and (equal? (second row) (fourth row))
+                               (= 0 (string->number (car (third row))))))
+                        tbl)
+                 (= 0 (tbl-ref->number tbl 0 1))      ; 1st day in =0
+                 (= 1 (tbl-ref->number tbl 1 1))      ; 2nd day in =1
+                 (= 5 (tbl-ref->number tbl 2 1))      ; 3rd day in =5
+                 (= (tbl-ref->number total 0 0) (tbl-ref->number total 0 2)) ; total in=total net
+                 (= 0 (tbl-ref->number total 0 1))    ; total out=0
+                 (= 3 (tbl-row-count tbl))
+                 (= 4 (tbl-column-count tbl)))))
+        )
+      )
+    )
+  )

commit 04b510022d839794256ce468b601669a06fee030
Author: Jose Marino <jmarino at users.noreply.github.com>
Date:   Mon Oct 16 16:07:03 2017 -0600

    add new report 'cashflow-barchart.scm' to build system

diff --git a/gnucash/report/standard-reports/CMakeLists.txt b/gnucash/report/standard-reports/CMakeLists.txt
index 35c53c2..2ff9016 100644
--- a/gnucash/report/standard-reports/CMakeLists.txt
+++ b/gnucash/report/standard-reports/CMakeLists.txt
@@ -15,6 +15,7 @@ SET (standard_reports_SCHEME_2
     budget-income-statement.scm
     budget.scm
     cash-flow.scm
+    cashflow-barchart.scm
     category-barchart.scm
     daily-reports.scm
     equity-statement.scm
diff --git a/gnucash/report/standard-reports/Makefile.am b/gnucash/report/standard-reports/Makefile.am
index e95f369..7040d88 100644
--- a/gnucash/report/standard-reports/Makefile.am
+++ b/gnucash/report/standard-reports/Makefile.am
@@ -17,6 +17,7 @@ gncscmrpt_DATA = \
    budget-flow.scm \
    budget-income-statement.scm \
    cash-flow.scm \
+   cashflow-barchart.scm \
    category-barchart.scm \
    daily-reports.scm \
    equity-statement.scm \

commit fa7893710f7ea453b22d3d271fec51284a24bfb8
Author: Jose Marino <jmarino at users.noreply.github.com>
Date:   Mon Oct 16 16:20:00 2017 -0600

    fix module location of new cashflow-barchart report

diff --git a/gnucash/report/standard-reports/cashflow-barchart.scm b/gnucash/report/standard-reports/cashflow-barchart.scm
index 547a0fb..d4992af 100644
--- a/gnucash/report/standard-reports/cashflow-barchart.scm
+++ b/gnucash/report/standard-reports/cashflow-barchart.scm
@@ -27,14 +27,13 @@
 ;;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
-(define-module (gnucash report cashflow-barchart))
+(define-module (gnucash report standard-reports cashflow-barchart))
 
 (use-modules (gnucash main)) ;; FIXME: delete after we finish modularizing.
 (use-modules (gnucash gnc-module))
 (use-modules (gnucash gettext))
 (use-modules (gnucash engine))
 (use-modules (gnucash printf))
-(use-modules (gnucash report stylesheets))
 
 (gnc:module-load "gnucash/report/report-system" 0)
 

commit eda22039add5717df92296c80de0dde6107e0cf1
Author: Jose Marino <jmarino at users.noreply.github.com>
Date:   Wed Oct 11 12:13:27 2017 -0600

    add new report: cashflow-barchart.scm
    
    This report displays a bar chart showing cash flow over time per
    given time interval (money in, money out and net flow). It provides
    a graphical representation over time of the data provided by
    existing report "Cash Flow".
    It can be viewed as a hybrid between existing reports "Cash Flow"
    and "Income & Expense Barchart". It displays the data shown by
    "Cash Flow" in a format similar to "Income & Expense Barchart".

diff --git a/gnucash/report/standard-reports/cashflow-barchart.scm b/gnucash/report/standard-reports/cashflow-barchart.scm
new file mode 100644
index 0000000..547a0fb
--- /dev/null
+++ b/gnucash/report/standard-reports/cashflow-barchart.scm
@@ -0,0 +1,518 @@
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; cashflow-barchart.scm: cash flow barchart report
+;;
+;; By Jose Marino <jmarino at users.noreply.github.com>
+;;
+;; based on cash-flow.scm by:
+;; Herbert Thoma <herbie at hthoma.de>
+;; and net-barchart by:
+;; Robert Merkel <rgmerk at mira.net>
+;;
+;; 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, contact:
+;;
+;; Free Software Foundation           Voice:  +1-617-542-5942
+;; 51 Franklin Street, Fifth Floor    Fax:    +1-617-542-2652
+;; Boston, MA  02110-1301,  USA       gnu at gnu.org
+;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+(define-module (gnucash report cashflow-barchart))
+
+(use-modules (gnucash main)) ;; FIXME: delete after we finish modularizing.
+(use-modules (gnucash gnc-module))
+(use-modules (gnucash gettext))
+(use-modules (gnucash engine))
+(use-modules (gnucash printf))
+(use-modules (gnucash report stylesheets))
+
+(gnc:module-load "gnucash/report/report-system" 0)
+
+;; Define these utilities to avoid using module srfi-1
+(define first car)
+(define second cadr)
+
+(define reportname (N_ "Cash Flow Barchart"))
+
+;; define all option's names so that they are properly defined
+;; in *one* place.
+;; Accounts
+(define optname-accounts (N_ "Accounts"))
+(define optname-include-trading-accounts (N_ "Include Trading Accounts in report"))
+;; Display
+(define optname-show-inout (N_ "Show Money In/Out"))
+(define optname-show-net (N_ "Show Net Flow"))
+(define optname-show-table (N_ "Show Table"))
+(define optname-plot-width (N_ "Plot Width"))
+(define optname-plot-height (N_ "Plot Height"))
+;; General
+(define optname-from-date (N_ "Start Date"))
+(define optname-to-date (N_ "End Date"))
+(define optname-stepsize (N_ "Step Size"))
+(define optname-report-currency (N_ "Report's currency"))
+(define optname-price-source (N_ "Price Source"))
+
+
+;; options generator function
+(define (cashflow-barchart-options-generator)
+  (let* ((options (gnc:new-options))
+         (add-option
+          (lambda (new-option)
+            (gnc:register-option options new-option))))
+
+    ;; General tab
+    (gnc:options-add-date-interval!
+     options gnc:pagename-general
+     optname-from-date optname-to-date "a")
+
+    (gnc:options-add-interval-choice!
+     options gnc:pagename-general optname-stepsize "b" 'MonthDelta)
+
+    (gnc:options-add-currency!
+     options gnc:pagename-general optname-report-currency "c")
+
+    (gnc:options-add-price-source!
+     options gnc:pagename-general
+     optname-price-source "d" 'pricedb-nearest)
+
+    ;; Accounts tab
+    (add-option
+     (gnc:make-account-list-option
+      gnc:pagename-accounts optname-accounts
+      "a" (N_ "Report on these accounts.")
+      (lambda ()     ; account getter
+        (gnc:filter-accountlist-type
+         (list ACCT-TYPE-BANK ACCT-TYPE-CASH ACCT-TYPE-ASSET
+               ACCT-TYPE-STOCK ACCT-TYPE-MUTUAL)
+         (gnc-account-get-descendants-sorted (gnc-get-current-root-account))))
+      #f #t))
+
+    (gnc:register-option
+     options
+     (gnc:make-simple-boolean-option
+      gnc:pagename-accounts optname-include-trading-accounts
+      "b" (N_ "Include transfers to and from Trading Accounts in the report.")  #f))
+
+    ;; Display tab
+    (gnc:register-option
+     options
+     (gnc:make-simple-boolean-option
+      gnc:pagename-display optname-show-inout
+      "a" (N_ "Show money in/out?") #t))
+
+    (gnc:register-option
+     options
+     (gnc:make-simple-boolean-option
+      gnc:pagename-display optname-show-net
+      "b" (N_ "Show net money flow?") #t))
+
+    (gnc:register-option
+     options
+     (gnc:make-simple-boolean-option
+      gnc:pagename-display optname-show-table
+      "c" (N_ "Display a table of the selected data.") #f))
+
+    ;; Plot size options
+    (gnc:options-add-plot-size!
+     options gnc:pagename-display
+     optname-plot-width optname-plot-height "d" (cons 'percent 100.0) (cons 'percent 100.0))
+
+    ;; Set the general page as default option tab
+    (gnc:options-set-default-section options gnc:pagename-general)
+
+    options))
+
+  ;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; cashflow-barchart-renderer
+;; set up the document and add the barchart and table
+  ;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+(define (cashflow-barchart-renderer report-obj)
+  (define (get-option pagename optname)
+    (gnc:option-value
+     (gnc:lookup-option
+      (gnc:report-options report-obj) pagename optname)))
+
+  (gnc:report-starting reportname)
+
+  ;; get all option's values
+  (let* ((accounts (get-option gnc:pagename-accounts
+                               optname-accounts))
+         (include-trading-accounts (get-option gnc:pagename-accounts
+                                               optname-include-trading-accounts))
+         (row-num 0)
+         (work-done 0)
+         (work-to-do 0)
+         (report-currency (get-option gnc:pagename-general
+                                      optname-report-currency))
+         (price-source (get-option gnc:pagename-general
+                                   optname-price-source))
+         (from-date-tp (gnc:timepair-start-day-time
+                        (gnc:date-option-absolute-time
+                         (get-option gnc:pagename-general
+                                     optname-from-date))))
+         (to-date-tp (gnc:timepair-end-day-time
+                      (gnc:date-option-absolute-time
+                       (get-option gnc:pagename-general
+                                   optname-to-date))))
+
+         ;; calculate the exchange rates
+         (exchange-fn (gnc:case-exchange-fn
+                       price-source report-currency to-date-tp))
+
+         (interval (get-option gnc:pagename-general optname-stepsize))
+         (show-inout? (get-option gnc:pagename-display optname-show-inout))
+         (show-net? (get-option gnc:pagename-display optname-show-net))
+         (show-table? (get-option gnc:pagename-display optname-show-table))
+         (height (get-option gnc:pagename-display optname-plot-height))
+         (width (get-option gnc:pagename-display optname-plot-width))
+
+         (dates-list (gnc:make-date-interval-list
+                      (gnc:timepair-start-day-time from-date-tp)
+                      (gnc:timepair-end-day-time to-date-tp)
+                      (gnc:deltasym-to-delta interval)))
+         (report-title (get-option gnc:pagename-general
+                                   gnc:optname-reportname))
+
+         (doc (gnc:make-html-document))
+         (table (gnc:make-html-table))
+         (txt (gnc:make-html-text))
+         (chart (gnc:make-html-barchart))
+         (non-zeros #f))
+
+    ;; utility function used to generate chart (from net-barchart.scm)
+    (define (add-column! data-list)
+      (begin
+        (gnc:html-barchart-append-column! chart data-list)
+        (if (gnc:not-all-zeros data-list) (set! non-zeros #t))
+        #f))
+
+    (if (not (null? accounts))
+        (let* ((money-diff-collector (gnc:make-commodity-collector))
+               (account-disp-list '())
+
+               (time-exchange-fn #f)
+               (commodity-list (gnc:accounts-get-commodities
+                                accounts
+                                report-currency))
+               ;; Get an exchange function that will convert each transaction using the
+               ;; nearest available exchange rate if that is what is specified
+               (time-exchange-fn (gnc:case-exchange-time-fn
+                                  price-source report-currency
+                                  commodity-list to-date-tp
+                                  0 0))
+               (date-string-list (map (lambda (date-list-item)       ; date-list-item is (start . end)
+                                        (gnc-print-date (car date-list-item)))
+                                      dates-list))
+               (results-by-date '())
+               (in-list '())
+               (out-list '())
+               (net-list '())
+               (in-value-list #f)
+               (out-value-list #f)
+               (net-value-list #f)
+               (in-total-collector (gnc:make-commodity-collector))
+               (out-total-collector (gnc:make-commodity-collector))
+               (net-total-collector (gnc:make-commodity-collector))
+               )
+
+          ;; Helper function to convert currencies
+          (define (to-report-currency currency amount date)
+            (gnc:gnc-monetary-amount
+             (time-exchange-fn (gnc:make-gnc-monetary currency amount)
+                               report-currency
+                               date)))
+          ;; Sum a collector to return a gnc-monetary
+          (define (sum-collector collector)
+            (gnc:sum-collector-commodity
+             collector report-currency exchange-fn)
+            )
+          ;; Convert gnc:monetary to number (used to generate data for the chart)
+          (define (monetary->double monetary)
+            (gnc-numeric-to-double (gnc:gnc-monetary-amount monetary))
+            )
+
+          ;; gather money in/out data for all date intervals
+          (set! work-done 0)
+          (set! work-to-do (length dates-list))
+          (for-each
+           (lambda (date-pair)
+             (set! work-done (+ 1 work-done))
+             (gnc:report-percent-done (* 80 (/ work-done work-to-do)))
+             (let* ((settings (list (cons 'accounts accounts)
+                                    (cons 'to-date-tp (second date-pair))
+                                    (cons 'from-date-tp (first date-pair))
+                                    (cons 'report-currency report-currency)
+                                    (cons 'include-trading-accounts include-trading-accounts)
+                                    (cons 'to-report-currency to-report-currency)))
+                    (result (cashflow-barchart-calc-money-in-out settings))
+                    (money-in-collector (cdr (assq 'money-in-collector result)))
+                    (money-out-collector (cdr (assq 'money-out-collector result)))
+                    (money-net-collector (gnc:make-commodity-collector))
+                    (money-in-monetary (sum-collector money-in-collector))
+                    (money-out-monetary (sum-collector money-out-collector))
+                    (money-net-monetary #f)
+                    )
+               (money-net-collector 'merge money-in-collector #f)
+               (money-net-collector 'minusmerge money-out-collector #f)
+               (set! money-net-monetary (sum-collector money-net-collector))
+               (set! in-list (cons money-in-monetary in-list))
+               (set! out-list (cons money-out-monetary out-list))
+               (set! net-list (cons money-net-monetary net-list))
+               (in-total-collector 'merge money-in-collector #f)
+               (out-total-collector 'merge money-out-collector #f)
+               ))
+           dates-list)
+
+          (net-total-collector 'merge in-total-collector #f)
+          (net-total-collector 'minusmerge out-total-collector #f)
+
+          ;; flip result lists (they were built by appending to the front)
+          (set! in-list (reverse in-list))
+          (set! out-list (reverse out-list))
+
+          (set! in-value-list (map monetary->double in-list))
+          (set! out-value-list (map monetary->double out-list))
+
+          (if show-net?
+              (begin
+                (set! net-list (reverse net-list))
+                (set! net-value-list (map monetary->double net-list)))
+              )
+          (gnc:report-percent-done 90)
+
+          (gnc:html-barchart-set-title! chart report-title)
+          (gnc:html-barchart-set-subtitle!
+           chart (sprintf #f
+                          (_ "%s to %s")
+                          (gnc-print-date from-date-tp)
+                          (gnc-print-date to-date-tp)))
+          (gnc:html-barchart-set-width! chart width)
+          (gnc:html-barchart-set-height! chart height)
+          (gnc:html-barchart-set-row-labels! chart date-string-list)
+          (gnc:html-barchart-set-y-axis-label!
+           chart (gnc-commodity-get-mnemonic report-currency))
+
+          (if show-inout?
+              (begin
+                (add-column! in-value-list)
+                (add-column! out-value-list)
+                ))
+          (if show-net?
+              (add-column! net-value-list))
+
+          ;; Legend labels, colors
+          (gnc:html-barchart-set-col-labels!
+           chart (append
+                  (if show-inout?
+                      (list (_ "Money In") (_ "Money Out")) '())
+                  (if show-net?
+                      (list (_ "Net Flow")) '())))
+          (gnc:html-barchart-set-col-colors!
+           chart (append
+                  (if show-inout?
+                      '("blue" "red") '())
+                  (if show-net?
+                      '("green") '())))
+          (gnc:report-percent-done 95)
+
+          ;; If we have no data in the plot, display warning message
+          (if non-zeros
+              (gnc:html-document-add-object! doc chart)
+              (gnc:html-document-add-object!
+               doc
+               (gnc:html-make-empty-data-warning
+                report-title (gnc:report-id report-obj)))
+              )
+
+          (if (and non-zeros show-table?)
+              (let* ((table (gnc:make-html-table)))
+                (set! date-string-list (append date-string-list (list "Total")))
+                (set! in-list (append in-list (list (sum-collector in-total-collector))))
+                (set! out-list (append out-list (list (sum-collector out-total-collector))))
+                (if show-net?
+                    (set! net-list (append net-list (list (sum-collector net-total-collector)))))
+
+                (gnc:html-table-set-col-headers!
+                 table (append (list (_ "Date"))
+                               (if show-inout?
+                                   (list (_ "Money In") (_ "Money Out")) '())
+                               (if show-net?
+                                   (list (_ "Net Flow")) '())
+                               ))
+
+                (gnc:html-document-add-object!
+                 doc (gnc:make-html-text (gnc:html-markup-h3 (_ "Overview:"))))
+                (gnc:html-table-append-column! table date-string-list)
+
+                (if show-inout?
+                    (begin
+                      (gnc:html-table-append-column! table in-list)
+                      (gnc:html-table-append-column! table out-list)
+                      ))
+                (if show-net?
+                    (gnc:html-table-append-column! table net-list))
+
+                ;; set numeric columns to align right
+                (for-each
+                 (lambda (col)
+                   (gnc:html-table-set-col-style!
+                    table col "td"
+                    'attribute (list "class" "number-cell")))
+                 '(1 2 3))
+
+                (gnc:html-document-add-object! doc table)
+                )
+              )
+
+          )
+        ;; else: error condition: no accounts specified
+        (gnc:html-document-add-object!
+         doc
+         (gnc:html-make-no-account-warning
+          reportname (gnc:report-id report-obj)))
+        ) ;; if not null? accounts
+
+    (gnc:report-finished)
+
+    doc))
+
+
+;; function to add inflow and outflow of money
+(define (cashflow-barchart-calc-money-in-out settings)
+  (let* ((accounts (cdr (assq 'accounts settings)))
+         (to-date-tp (cdr (assq 'to-date-tp settings)))
+         (from-date-tp (cdr (assq 'from-date-tp settings)))
+         (report-currency (cdr (assq 'report-currency settings)))
+         (include-trading-accounts (cdr (assq 'include-trading-accounts settings)))
+         (to-report-currency (cdr (assq 'to-report-currency settings)))
+
+         (is-report-account? (account-in-list-pred accounts))
+
+         (money-in-accounts '())
+         (money-in-hash (make-hash-table))
+         (money-in-collector (gnc:make-commodity-collector))
+
+         (money-out-accounts '())
+         (money-out-hash (make-hash-table))
+         (money-out-collector (gnc:make-commodity-collector))
+
+         (all-splits (gnc:account-get-trans-type-splits-interval accounts '() from-date-tp to-date-tp))
+         (splits-seen-table (make-hash-table)))
+
+    (define (split-seen? split)
+      (if (split-hashtable-ref splits-seen-table split) #t
+          (begin
+            (split-hashtable-set! splits-seen-table split #t)
+            #f)))
+
+    (define (work-per-split split)
+      (let ((parent (xaccSplitGetParent split)))
+        (if (and (gnc:timepair-le (gnc-transaction-get-date-posted parent) to-date-tp)
+                 (gnc:timepair-ge (gnc-transaction-get-date-posted parent) from-date-tp))
+            (let* ((parent-description (xaccTransGetDescription parent))
+                   (parent-currency (xaccTransGetCurrency parent)))
+                                        ;(gnc:debug parent-description
+                                        ;           " - "
+                                        ;           (gnc-commodity-get-printname parent-currency))
+              (for-each
+               (lambda (s)
+                 (let* ((s-account (xaccSplitGetAccount s))
+                        (s-account-type (xaccAccountGetType s-account))
+                        (s-amount (xaccSplitGetAmount s))
+                        (s-value (xaccSplitGetValue s))
+                        (s-commodity (xaccAccountGetCommodity s-account)))
+                   ;; Check if this is a dangling split
+                   ;; and print a warning
+                   (if (null? s-account)
+                       (display
+                        (string-append
+                         "WARNING: s-account is NULL for split: "
+                         (gncSplitGetGUID s) "\n")))
+                                        ;(gnc:debug (xaccAccountGetName s-account))
+                   (if (and      ;; make sure we don't have
+                        (not (null? s-account)) ;;  any dangling splits
+                        (or include-trading-accounts (not (eq? s-account-type ACCT-TYPE-TRADING)))
+                        (not (is-report-account? s-account)))
+                       (if (not (split-seen? s))
+                           (begin
+                             (if (gnc-numeric-negative-p s-value)
+                                 (let ((s-account-in-collector (account-hashtable-ref money-in-hash s-account)))
+                                        ;(gnc:debug "in:" (gnc-commodity-get-printname s-commodity)
+                                        ;            (gnc-numeric-to-double s-amount)
+                                        ;            (gnc-commodity-get-printname parent-currency)
+                                        ;            (gnc-numeric-to-double s-value))
+                                   (if (not s-account-in-collector)
+                                       (begin
+                                         (set! s-account-in-collector (gnc:make-commodity-collector))
+                                         (account-hashtable-set! money-in-hash s-account
+                                                                 s-account-in-collector)
+                                         (set! money-in-accounts (cons s-account money-in-accounts))
+                                         )
+                                       )
+                                   (let ((s-report-value (to-report-currency parent-currency
+                                                                             (gnc-numeric-neg s-value)
+                                                                             (gnc-transaction-get-date-posted
+                                                                              parent))))
+                                     (money-in-collector 'add report-currency s-report-value)
+                                     (s-account-in-collector 'add report-currency s-report-value))
+                                   )
+                                 (let ((s-account-out-collector (account-hashtable-ref money-out-hash s-account)))
+                                        ;(gnc:debug "out:" (gnc-commodity-get-printname s-commodity)
+                                        ;            (gnc-numeric-to-double s-amount)
+                                        ;            (gnc-commodity-get-printname parent-currency)
+                                        ;            (gnc-numeric-to-double s-value))
+                                   (if (not s-account-out-collector)
+                                       (begin
+                                         (set! s-account-out-collector (gnc:make-commodity-collector))
+                                         (account-hashtable-set! money-out-hash s-account
+                                                                 s-account-out-collector)
+                                         (set! money-out-accounts (cons s-account money-out-accounts))
+                                         )
+                                       )
+                                   (let ((s-report-value (to-report-currency parent-currency
+                                                                             s-value
+                                                                             (gnc-transaction-get-date-posted
+                                                                              parent))))
+                                     (money-out-collector 'add report-currency s-report-value)
+                                     (s-account-out-collector 'add report-currency s-report-value))
+                                   )
+                                 )
+                             )
+                           )
+                       )
+                   )
+                 )
+               (xaccTransGetSplitList parent)
+               )
+              )
+            )
+        )
+      )
+
+    ;; Calculate money in and out for each split
+    (for-each work-per-split all-splits)
+
+    ;; Return an association list of results
+    (list
+     (cons 'money-in-collector money-in-collector)
+     (cons 'money-out-collector money-out-collector))))
+
+(gnc:define-report
+ 'version 1
+ 'name reportname
+ 'report-guid "5426e4d987f6444387fe70880e5b28a0"
+ 'menu-tip (N_ "Shows a barchart with cash flow over time")
+ 'menu-path (list gnc:menuname-income-expense)
+ 'options-generator cashflow-barchart-options-generator
+ 'renderer cashflow-barchart-renderer)



Summary of changes:
 CMakeLists.txt                                     |   7 +-
 ChangeLog                                          | 174 ++++++-
 NEWS                                               |  77 ++-
 configure.ac                                       |   5 +-
 gnucash/CMakeLists.txt                             |  37 +-
 gnucash/Makefile.am                                |   9 +-
 gnucash/gnome-utils/dialog-options.c               |   9 +-
 gnucash/gnome-utils/dialog-options.h               |   5 +-
 gnucash/gnome-utils/dialog-utils.c                 |   6 +-
 gnucash/gnome-utils/gnc-gnome-utils.c              |  47 +-
 gnucash/gnome-utils/gnc-main-window.c              |  11 +-
 gnucash/gnome-utils/gnc-main-window.h              |   6 +-
 gnucash/gnome-utils/gnome-utils.i                  |   2 +-
 gnucash/gnome-utils/ui/CMakeLists.txt              |   2 -
 gnucash/gnome-utils/ui/Makefile.am                 |   4 +-
 gnucash/gnome/assistant-hierarchy.c                |   3 +-
 .../ui/gnucash.css => gnucash-310.css}             |  14 +-
 .../ui/gnucash.css => gnucash-320.css}             |  12 +-
 ...ucash-fallback.css => gnucash-fallback-310.css} |   4 +-
 gnucash/gnucash-gresources.xml                     |   9 +
 gnucash/gnucash.rc.in                              |   4 +-
 .../report-gnome/dialog-report-column-view.c       |   2 +-
 .../report-gnome/dialog-report-style-sheet.c       |   3 +-
 .../report/report-gnome/gnc-plugin-page-report.c   |   4 +-
 gnucash/report/report-gnome/window-report.c        |  13 +-
 gnucash/report/report-gnome/window-report.h        |   4 +-
 gnucash/report/standard-reports/CMakeLists.txt     |   1 +
 gnucash/report/standard-reports/Makefile.am        |   1 +
 .../report/standard-reports/cashflow-barchart.scm  | 521 +++++++++++++++++++++
 .../standard-reports/income-gst-statement.scm      | 258 +++++-----
 .../report/standard-reports/test/CMakeLists.txt    |   3 +-
 gnucash/report/standard-reports/test/Makefile.am   |   1 +
 .../test/test-cashflow-barchart.scm                | 288 ++++++++++++
 gnucash/report/standard-reports/transaction.scm    | 130 +++--
 po/POTFILES.in                                     |   1 +
 po/POTFILES.skip                                   |   1 +
 36 files changed, 1428 insertions(+), 250 deletions(-)
 copy gnucash/{gnome-utils/ui/gnucash.css => gnucash-310.css} (89%)
 rename gnucash/{gnome-utils/ui/gnucash.css => gnucash-320.css} (90%)
 rename gnucash/{gnome-utils/ui/gnucash-fallback.css => gnucash-fallback-310.css} (97%)
 create mode 100644 gnucash/gnucash-gresources.xml
 create mode 100644 gnucash/report/standard-reports/cashflow-barchart.scm
 create mode 100644 gnucash/report/standard-reports/test/test-cashflow-barchart.scm



More information about the gnucash-changes mailing list