gnucash maint: Multiple changes pushed
Christopher Lam
clam at code.gnucash.org
Tue Aug 18 19:27:36 EDT 2020
Updated via https://github.com/Gnucash/gnucash/commit/98c8b233 (commit)
via https://github.com/Gnucash/gnucash/commit/cbbca470 (commit)
via https://github.com/Gnucash/gnucash/commit/2fd2b7bb (commit)
via https://github.com/Gnucash/gnucash/commit/5bf57260 (commit)
via https://github.com/Gnucash/gnucash/commit/17c0c42e (commit)
via https://github.com/Gnucash/gnucash/commit/6c4edf94 (commit)
via https://github.com/Gnucash/gnucash/commit/4aafa175 (commit)
via https://github.com/Gnucash/gnucash/commit/5e034056 (commit)
via https://github.com/Gnucash/gnucash/commit/9ec5c86f (commit)
from https://github.com/Gnucash/gnucash/commit/ef2db1ed (commit)
commit 98c8b23351a3fd266f47f9ea67474b4bc4229ede
Merge: cbbca4701 2fd2b7bb6
Author: Christopher Lam <christopher.lck at gmail.com>
Date: Wed Aug 19 07:19:42 2020 +0800
Merge branch 'maint-797852-bis' into maint #776
commit cbbca4701306b2bb85bef7af9020b93e5dab6af6
Author: Christopher Lam <christopher.lck at gmail.com>
Date: Tue Aug 18 21:12:23 2020 +0800
[test-engine-extras] Use more efficient gnc:list-flatten
diff --git a/bindings/guile/test/test-engine-extras.scm b/bindings/guile/test/test-engine-extras.scm
index 336c2103c..8e3087efa 100644
--- a/bindings/guile/test/test-engine-extras.scm
+++ b/bindings/guile/test/test-engine-extras.scm
@@ -21,6 +21,7 @@
(use-modules (gnucash app-utils))
(use-modules (gnucash engine))
+(use-modules (gnucash utilities))
(use-modules (srfi srfi-1))
(use-modules (sw_app_utils))
(use-modules (sw_engine))
@@ -342,12 +343,8 @@
(define (env-create-account-structure-alist env account-structure)
(let ((accounts (env-create-account-structure env account-structure)))
- (define (flatten l)
- (if (null? l) '()
- (if (not (pair? l)) (list l)
- (append (flatten (car l)) (flatten (cdr l))))))
(map (lambda (acct) (cons (xaccAccountGetName acct) acct))
- (flatten accounts))))
+ (gnc:list-flatten accounts))))
(define (env-expense-account-structure env)
(env-create-account-structure
diff --git a/gnucash/report/reports/standard/test/test-standard-category-report.scm b/gnucash/report/reports/standard/test/test-standard-category-report.scm
index f2e380d03..c700e1971 100644
--- a/gnucash/report/reports/standard/test/test-standard-category-report.scm
+++ b/gnucash/report/reports/standard/test/test-standard-category-report.scm
@@ -205,15 +205,6 @@
(test-end "multiplier test"))
(teardown))
-(define (list-leaves list)
- (if (not (pair? list))
- (cons list '())
- (fold (lambda (next acc)
- (append (list-leaves next)
- acc))
- '()
- list)))
-
(define (multi-acct-test expense-report-uuid)
(let* ((expense-options (gnc:make-report-options expense-report-uuid))
(env (create-test-env))
@@ -223,7 +214,7 @@
(list "Assets"
(list (cons 'type ACCT-TYPE-ASSET))
(list "Bank"))))
- (leaf-expense-accounts (list-leaves expense-accounts))
+ (leaf-expense-accounts (gnc:list-flatten expense-accounts))
(bank-account (car (car (cdr asset-accounts)))))
(for-each (lambda (expense-account)
(env-create-daily-transactions env
commit 2fd2b7bb64e07de4f4319b47b4c1e291af6f0a48
Author: Christopher Lam <christopher.lck at gmail.com>
Date: Tue Aug 18 22:27:03 2020 +0800
Bug 797852 - Error in Accounts Payable Aging re cut off dates
Finally the proper fix in aging-report.
The aging-report must consider only activity in the report period
specified. If an invoice is paid after the report period, it is
considered unpaid.
diff --git a/gnucash/report/report-utilities.scm b/gnucash/report/report-utilities.scm
index 1ceb1276d..f5c2f256e 100644
--- a/gnucash/report/report-utilities.scm
+++ b/gnucash/report/report-utilities.scm
@@ -908,7 +908,13 @@
(let* ((invoice (gncInvoiceGetInvoiceFromTxn
(xaccSplitGetParent (car splits))))
(lot (gncInvoiceGetPostedLot invoice))
- (bal (gnc-lot-get-balance lot))
+ (lot-splits (gnc-lot-get-split-list lot))
+ (bal (fold
+ (lambda (a b)
+ (if (<= (xaccTransGetDate (xaccSplitGetParent a)) to-date)
+ (+ (xaccSplitGetAmount a) b)
+ b))
+ 0 lot-splits))
(bal (if receivable? bal (- bal)))
(date (if (eq? date-type 'postdate)
(gncInvoiceGetDatePosted invoice)
commit 5bf57260aee182717023801c21cbc5f57fe941c7
Author: Christopher Lam <christopher.lck at gmail.com>
Date: Sat Aug 15 16:19:59 2020 +0800
[business-urls] link to owner report with enddate
diff --git a/gnucash/gnome/business-urls.c b/gnucash/gnome/business-urls.c
index ce1825ad1..e0283a4f3 100644
--- a/gnucash/gnome/business-urls.c
+++ b/gnucash/gnome/business-urls.c
@@ -213,7 +213,7 @@ ownerreportCB (const char *location, const char *label,
GncOwner owner;
Account *acc;
GHashTable *query_ht;
- time64 enddate;
+ time64 enddate = INT64_MAX;
gboolean show_report = TRUE;
g_return_val_if_fail (location != NULL, FALSE);
@@ -293,7 +293,13 @@ ownerreportCB (const char *location, const char *label,
/* Ok, let's run this report */
if (show_report)
- gnc_business_call_owner_report (result->parent, &owner, acc);
+ {
+ if (enddate != INT64_MAX)
+ gnc_business_call_owner_report_with_enddate (result->parent, &owner,
+ acc, enddate);
+ else
+ gnc_business_call_owner_report (result->parent, &owner, acc);
+ }
g_hash_table_destroy (query_ht);
return show_report;
commit 17c0c42e0ba008a2677c15003ae87c50e4c0d828
Author: Christopher Lam <christopher.lck at gmail.com>
Date: Sat Aug 15 15:52:02 2020 +0800
[dialog-invoice] gnc_business_call_owner_report_with_enddate
diff --git a/gnucash/gnome/dialog-invoice.c b/gnucash/gnome/dialog-invoice.c
index 8eb5c0c05..95ee269d2 100644
--- a/gnucash/gnome/dialog-invoice.c
+++ b/gnucash/gnome/dialog-invoice.c
@@ -1161,6 +1161,14 @@ void gnc_invoice_window_new_invoice_cb (GtkWindow *parent, gpointer data)
}
void gnc_business_call_owner_report (GtkWindow *parent, GncOwner *owner, Account *acc)
+{
+ gnc_business_call_owner_report_with_enddate (parent, owner, acc, INT64_MAX);
+}
+
+void gnc_business_call_owner_report_with_enddate (GtkWindow *parent,
+ GncOwner *owner,
+ Account *acc,
+ time64 enddate)
{
int id;
SCM args;
@@ -1171,9 +1179,13 @@ void gnc_business_call_owner_report (GtkWindow *parent, GncOwner *owner, Account
args = SCM_EOL;
- func = scm_c_eval_string ("gnc:owner-report-create");
+ func = scm_c_eval_string ("gnc:owner-report-create-with-enddate");
g_return_if_fail (scm_is_procedure (func));
+ /* set the enddate */
+ arg = (enddate != INT64_MAX) ? scm_from_int64 (enddate) : SCM_BOOL_F;
+ args = scm_cons (arg, args);
+
if (acc)
{
swig_type_info * qtype = SWIG_TypeQuery("_p_Account");
diff --git a/gnucash/gnome/dialog-invoice.h b/gnucash/gnome/dialog-invoice.h
index 002e4af37..7b70c0838 100644
--- a/gnucash/gnome/dialog-invoice.h
+++ b/gnucash/gnome/dialog-invoice.h
@@ -67,6 +67,11 @@ GNCSearchWindow * gnc_invoice_search (GtkWindow *parent, GncInvoice *start, GncO
void gnc_business_call_owner_report (GtkWindow* parent, GncOwner *owner, Account *acc);
+void gnc_business_call_owner_report_with_enddate (GtkWindow* parent,
+ GncOwner *owner,
+ Account *acc,
+ time64 enddate);
+
void gnc_invoice_window_sort (InvoiceWindow *iw, invoice_sort_type_t sort_code);
GtkWidget * gnc_invoice_window_create_summary_bar (InvoiceWindow *iw);
commit 6c4edf94cee82a557eb27c265898e600439ea086
Author: Christopher Lam <christopher.lck at gmail.com>
Date: Mon Aug 17 22:35:53 2020 +0800
[aging] call owner-report-text with end-date
diff --git a/gnucash/report/reports/aging.scm b/gnucash/report/reports/aging.scm
index ca9f5f31e..3f364f8bc 100644
--- a/gnucash/report/reports/aging.scm
+++ b/gnucash/report/reports/aging.scm
@@ -807,7 +807,7 @@ copying this report to a spreadsheet for use in a mail merge.")
(cons
(gnc:make-html-text
(gnc:html-markup-anchor
- (gnc:owner-report-text owner account)
+ (gnc:owner-report-text owner account report-date)
total))
rest))))
commit 4aafa1752f6204fb35d7037dca7dd76e207bf428
Author: Christopher Lam <christopher.lck at gmail.com>
Date: Sat Aug 15 15:51:44 2020 +0800
[new-aging] create owner report with end-date
diff --git a/gnucash/report/reports/standard/new-aging.scm b/gnucash/report/reports/standard/new-aging.scm
index c6f497749..c9fbfa397 100644
--- a/gnucash/report/reports/standard/new-aging.scm
+++ b/gnucash/report/reports/standard/new-aging.scm
@@ -230,7 +230,9 @@ exist but have no suitable transactions."))
(else (op-num (car aging1) (car aging2)))))))))
;; set default title
- (gnc:html-document-set-title! document report-title)
+ (gnc:html-document-set-title!
+ document
+ (format #f "~a - ~a" report-title (qof-print-date report-date)))
(cond
((null? accounts)
@@ -309,7 +311,7 @@ exist but have no suitable transactions."))
"number-cell"
(gnc:make-html-text
(gnc:html-markup-anchor
- (gnc:owner-report-text owner account)
+ (gnc:owner-report-text owner account report-date)
(gnc:make-gnc-monetary comm aging-total)))))
(options->address options receivable owner)))))
(sort owners-and-aging sort-aging<?))
commit 5e0340560a90648da0a1685df84856e2c5d4e7bf
Author: Christopher Lam <christopher.lck at gmail.com>
Date: Sat Aug 15 16:19:37 2020 +0800
[html-utilities] gnc:owner-report-text can accepts enddate
diff --git a/gnucash/report/html-utilities.scm b/gnucash/report/html-utilities.scm
index 5f44213d2..3967ec5be 100644
--- a/gnucash/report/html-utilities.scm
+++ b/gnucash/report/html-utilities.scm
@@ -94,7 +94,7 @@
(else
""))))
-(define (gnc:owner-report-text owner acc)
+(define* (gnc:owner-report-text owner acc #:optional date)
(let* ((end-owner (gncOwnerGetEndOwner owner))
(type (gncOwnerGetType end-owner)))
(gnc-build-url
@@ -105,6 +105,7 @@
((eqv? type GNC-OWNER-EMPLOYEE) "owner=e:")
(else "unknown-type="))
(gncOwnerReturnGUID end-owner)
+ (if date (format #f "&enddate=~a" date) "")
(if (null? acc) "" (string-append "&acct=" (gncAccountGetGUID acc))))
"")))
commit 9ec5c86f55894a1b9467432d5d21e0b45cd0a57b
Author: Christopher Lam <christopher.lck at gmail.com>
Date: Sat Aug 15 15:51:40 2020 +0800
[new-owner-report][api] owner-report-create-with-enddate
similar to owner-report-create, accepts enddate argument
diff --git a/gnucash/report/reports/reports.scm b/gnucash/report/reports/reports.scm
index 67b2fe51a..9154a927d 100644
--- a/gnucash/report/reports/reports.scm
+++ b/gnucash/report/reports/reports.scm
@@ -38,6 +38,7 @@
(export gnc:payables-report-create)
(export gnc:receivables-report-create)
(export gnc:owner-report-create)
+(export gnc:owner-report-create-with-enddate)
(define report-dirs (list
'(gnucash reports standard) ; prefix for standard reports included in gnucash
@@ -48,7 +49,8 @@
; and then load all reports found in the given prefixes
(let* ((loc (gnc-locale-name))
(loc-spec (if (string-prefix? "de_DE" loc) 'de_DE 'us))
- (all-dirs (append report-dirs (list (list 'gnucash 'reports 'locale-specific loc-spec)))))
+ (all-dirs (append report-dirs
+ `((gnucash reports locale-specific ,loc-spec)))))
(report-module-loader all-dirs))
(use-modules (gnucash engine))
@@ -86,3 +88,4 @@
(use-modules (gnucash reports standard new-owner-report))
(define gnc:owner-report-create owner-report-create)
+(define gnc:owner-report-create-with-enddate owner-report-create-with-enddate)
diff --git a/gnucash/report/reports/standard/new-owner-report.scm b/gnucash/report/reports/standard/new-owner-report.scm
index a71d812e9..9771c638b 100644
--- a/gnucash/report/reports/standard/new-owner-report.scm
+++ b/gnucash/report/reports/standard/new-owner-report.scm
@@ -29,6 +29,7 @@
(define-module (gnucash reports standard new-owner-report))
(use-modules (srfi srfi-1))
+(use-modules (srfi srfi-2))
(use-modules (srfi srfi-8))
(use-modules (srfi srfi-9))
(use-modules (srfi srfi-11)) ;for let-values
@@ -1193,28 +1194,28 @@ invoices and amounts.")))))
'in-menu? #t)
-(define (owner-report-create-internal report-guid owner owner-type)
+(define (owner-report-create-internal report-guid owner owner-type enddate)
(let* ((options (gnc:make-report-options report-guid))
- (owner-op (gnc:lookup-option options owner-page (owner-string owner-type))))
+ (owner-op (gnc:lookup-option options owner-page (owner-string owner-type)))
+ (date-op (gnc:lookup-option options gnc:pagename-general optname-to-date)))
(gnc:option-set-value owner-op owner)
+ (when enddate
+ (gnc:option-set-value date-op (cons 'absolute enddate)))
(gnc:make-report report-guid options)))
-(define (owner-report-create owner account)
+(define (owner-report-create-with-enddate owner account enddate)
;; note account isn't actually used
- (let ((type (gncOwnerGetType (gncOwnerGetEndOwner owner))))
- (cond
- ((eqv? type GNC-OWNER-CUSTOMER)
- ;; Not sure whether to pass type, or to use the guid in the report function
- (owner-report-create-internal customer-report-guid owner type))
-
- ((eqv? type GNC-OWNER-VENDOR)
- (owner-report-create-internal vendor-report-guid owner type))
+ (define guid-alist
+ (list (cons GNC-OWNER-CUSTOMER customer-report-guid)
+ (cons GNC-OWNER-VENDOR vendor-report-guid)
+ (cons GNC-OWNER-EMPLOYEE employee-report-guid)))
+ (and-let* ((type (gncOwnerGetType (gncOwnerGetEndOwner owner)))
+ (guid (assv-ref guid-alist type)))
+ (owner-report-create-internal guid owner type enddate)))
- ((eqv? type GNC-OWNER-EMPLOYEE)
- (owner-report-create-internal employee-report-guid owner type))
-
- (else #f))))
+(define (owner-report-create owner account)
+ (owner-report-create-with-enddate owner account #f))
(define (gnc:owner-report-create-internal
account split query journal? double? title debit-string credit-string)
@@ -1229,3 +1230,4 @@ invoices and amounts.")))))
(gnc:register-report-hook ACCT-TYPE-RECEIVABLE #t gnc:owner-report-create-internal)
(gnc:register-report-hook ACCT-TYPE-PAYABLE #t gnc:owner-report-create-internal)
(export owner-report-create)
+(export owner-report-create-with-enddate)
Summary of changes:
bindings/guile/test/test-engine-extras.scm | 7 ++---
gnucash/gnome/business-urls.c | 10 +++++--
gnucash/gnome/dialog-invoice.c | 14 +++++++++-
gnucash/gnome/dialog-invoice.h | 5 ++++
gnucash/report/html-utilities.scm | 3 +-
gnucash/report/report-utilities.scm | 8 +++++-
gnucash/report/reports/aging.scm | 2 +-
gnucash/report/reports/reports.scm | 5 +++-
gnucash/report/reports/standard/new-aging.scm | 6 ++--
.../report/reports/standard/new-owner-report.scm | 32 ++++++++++++----------
.../test/test-standard-category-report.scm | 11 +-------
11 files changed, 64 insertions(+), 39 deletions(-)
More information about the gnucash-changes
mailing list