gnucash maint: Multiple changes pushed
Christopher Lam
clam at code.gnucash.org
Sun Feb 2 01:40:33 EST 2020
Updated via https://github.com/Gnucash/gnucash/commit/1e0983d0 (commit)
via https://github.com/Gnucash/gnucash/commit/0c5bded6 (commit)
via https://github.com/Gnucash/gnucash/commit/97eb3c7e (commit)
via https://github.com/Gnucash/gnucash/commit/77c2bc2b (commit)
via https://github.com/Gnucash/gnucash/commit/f59e3ca7 (commit)
from https://github.com/Gnucash/gnucash/commit/34609184 (commit)
commit 1e0983d0d8c482896cfce2ca3b5f6618f7f24314
Merge: 0c5bded6f f59e3ca75
Author: Christopher Lam <christopher.lck at gmail.com>
Date: Sun Feb 2 14:40:05 2020 +0800
Merge branch 'maint-202001-budget-editor-summaries' into maint
commit 0c5bded6fc0cfefc8252e37f747cb4955f3d2370
Author: Christopher Lam <christopher.lck at gmail.com>
Date: Sat Feb 1 01:21:28 2020 +0800
[report-utilities] streamline (match) use
reduces the indent level
diff --git a/gnucash/report/report-system/report-utilities.scm b/gnucash/report/report-system/report-utilities.scm
index 1c595a673..0383bc969 100644
--- a/gnucash/report/report-system/report-utilities.scm
+++ b/gnucash/report/report-system/report-utilities.scm
@@ -506,28 +506,26 @@ flawed. see report-utilities.scm. please update reports.")
(() (reverse result))
((date . rest)
+ (define (before-date? s) (< (split->date s) date))
+ (define (after-date? s) (< date (split->date s)))
(match splits
;; end of splits, but still has dates. pad with last-result
;; until end of dates.
(() (lp '() rest (cons last-result result) last-result))
- ((head . tail)
- (let ((next (and (pair? tail) (car tail))))
- (cond
-
- ;; the next split is still before date.
- ((and next (< (split->date next) date))
- (lp tail dates result (split->elt head)))
+ ;; the next split is still before date.
+ ((and (_ (? before-date?) . _) (head . tail))
+ (lp tail dates result (split->elt head)))
- ;; head split after date, accumulate previous result
- ((< date (split->date head))
- (lp splits rest (cons last-result result) last-result))
+ ;; head split after date, accumulate previous result
+ (((? after-date?) . tail)
+ (lp splits rest (cons last-result result) last-result))
- ;; head split before date, next split after date, or end.
- (else
- (let ((head-result (split->elt head)))
- (lp tail rest (cons head-result result) head-result)))))))))))
+ ;; head split before date, next split after date, or end.
+ ((head . tail)
+ (let ((head-result (split->elt head)))
+ (lp tail rest (cons head-result result) head-result))))))))
;; This works similar as above but returns a commodity-collector,
;; thus takes care of children accounts with different currencies.
commit 97eb3c7e98a99196b7aa6ad5fc5dab1b1713e396
Author: Christopher Lam <christopher.lck at gmail.com>
Date: Sat Feb 1 00:24:28 2020 +0800
[new-owner-report] handle LINK txns as normal payments
With this commit, lot-splits which are part of LINK transactions are
handled similarly to PAYMENT splits -- the non-APAR var is renamed to
non-document to reflect their new role: collating all splits without
an attached invoice lot.
diff --git a/gnucash/report/business-reports/new-owner-report.scm b/gnucash/report/business-reports/new-owner-report.scm
index 8ccf3406e..201fb800a 100644
--- a/gnucash/report/business-reports/new-owner-report.scm
+++ b/gnucash/report/business-reports/new-owner-report.scm
@@ -561,39 +561,39 @@
;; each invoice payment split's peer splits are analysed.
(let lp1 ((lot-txn-splits (xaccTransGetSplitList lot-txn))
- (non-APAR '())
+ (non-document '())
(result result))
(cond
- ;; finished. loop up, adding single row with non-APAR
+ ;; finished. loop up, adding single row with non-document
((null? lot-txn-splits)
(lp (cdr lot-splits)
- (if (null? non-APAR)
+ (if (null? non-document)
result
(cons (make-link-data
(qof-print-date (xaccTransGetDate lot-txn))
(split->reference lot-split)
(split->type-str lot-split)
- (splits->desc non-APAR)
+ (splits->desc non-document)
(gnc:make-html-text (split->anchor lot-split #t))
(list->cell
- (map (lambda (s) (split->anchor s #f)) non-APAR))
+ (map (lambda (s) (split->anchor s #f)) non-document))
(gncTransGetGUID lot-txn))
result))))
- ;; this payment peer is non-APAR, accumulate it.
+ ;; this payment peer is non-document, accumulate it.
((not (memv (xaccAccountGetType
(xaccSplitGetAccount (car lot-txn-splits)))
(list ACCT-TYPE-RECEIVABLE ACCT-TYPE-PAYABLE)))
(lp1 (cdr lot-txn-splits)
- (cons (car lot-txn-splits) non-APAR)
+ (cons (car lot-txn-splits) non-document)
result))
;; this payment's peer split has same sign as the
;; payment split. ignore.
((sign-equal? (xaccSplitGetAmount (car lot-txn-splits))
(xaccSplitGetAmount lot-split))
- (lp1 (cdr lot-txn-splits) non-APAR result))
+ (lp1 (cdr lot-txn-splits) non-document result))
;; this payment's peer APAR split is a document lot
;; reducing split.
@@ -604,7 +604,7 @@
(xaccSplitGetParent posting-split)))
(posting-txn (xaccSplitGetParent posting-split)))
(lp1 (cdr lot-txn-splits)
- non-APAR
+ non-document
(cons (make-link-data
(qof-print-date (xaccTransGetDate posting-txn))
(split->reference posting-split)
@@ -621,19 +621,9 @@
(else
(gnc:warn (car lot-txn-splits) " in APAR but can't find "
"owner; is likely an old-style link transaction.")
- (let* ((lot-txn-split (car lot-txn-splits))
- (posting-txn (xaccSplitGetParent lot-txn-split)))
- (lp1 (cdr lot-txn-splits)
- non-APAR
- (cons (make-link-data
- (qof-print-date (xaccTransGetDate posting-txn))
- (split->reference lot-txn-split)
- (split->type-str lot-txn-split)
- (splits->desc (list lot-txn-split))
- (gnc:make-html-text (split->anchor lot-txn-split #t))
- (gnc:make-html-text (split->anchor lot-txn-split #t))
- (gncTransGetGUID posting-txn))
- result))))))))))))
+ (lp1 (cdr lot-txn-splits)
+ (cons (car lot-txn-splits) non-document)
+ result))))))))))
commit 77c2bc2b9a77685601e3a733f9cac8368af3fb31
Author: Christopher Lam <christopher.lck at gmail.com>
Date: Tue Jan 21 22:56:15 2020 +0800
[new-owner-report] simplify build-column-used
diff --git a/gnucash/report/business-reports/new-owner-report.scm b/gnucash/report/business-reports/new-owner-report.scm
index c581d02a3..8ccf3406e 100644
--- a/gnucash/report/business-reports/new-owner-report.scm
+++ b/gnucash/report/business-reports/new-owner-report.scm
@@ -183,34 +183,15 @@
(cols-list (assq-ref cols-alist section)))
(count identity cols-list)))
-(define columns-used-size 10)
-
(define (build-column-used options)
- (define (opt-val section name)
+ (define (opt-val name)
(gnc:option-value
- (gnc:lookup-option options section name)))
- (define (make-set-col col-vector)
- (let ((col 0))
- (lambda (used? index)
- (if used?
- (begin
- (vector-set! col-vector index col)
- (set! col (+ col 1)))
- (vector-set! col-vector index #f)))))
-
- (let* ((col-vector (make-vector columns-used-size #f))
- (set-col (make-set-col col-vector)))
- (set-col (opt-val "Display Columns" date-header) 0)
- (set-col (opt-val "Display Columns" due-date-header) 1)
- (set-col (opt-val "Display Columns" reference-header) 2)
- (set-col (opt-val "Display Columns" type-header) 3)
- (set-col (opt-val "Display Columns" desc-header) 4)
- (set-col (opt-val "Display Columns" sale-header) 5)
- (set-col (opt-val "Display Columns" tax-header) 6)
- (set-col (opt-val "Display Columns" debit-header) 7)
- (set-col (opt-val "Display Columns" credit-header) 8)
- (set-col (opt-val "Display Columns" balance-header) 9)
- col-vector))
+ (gnc:lookup-option options "Display Columns" name)))
+ (list->vector
+ (map opt-val
+ (list date-header due-date-header reference-header type-header
+ desc-header sale-header tax-header debit-header credit-header
+ balance-header))))
(define (make-heading-list column-vector link-option acct-type)
(let ((heading-list '())
@@ -254,8 +235,6 @@
(reverse heading-list)))
(define num-buckets 6)
-(define (new-bucket-vector)
- (make-vector num-buckets 0))
(define (sign-equal? a b)
(or (= 0 a b) (< 0 (* a b))))
commit f59e3ca751ac149177925d7b94e1ffa21fedd5a7
Author: Christopher Lam <christopher.lck at gmail.com>
Date: Sat Jan 4 12:03:46 2020 +0800
Bug 797551 - Budget totals line missing in 3.8
Reinstate Income/Expense/Transfer/Total, but rename to:
* Inflow from Income
* Outflow to Expense
* Outflow to Asset/Equity/Liability
* Remaining to Budget
diff --git a/gnucash/gnome/gnc-budget-view.c b/gnucash/gnome/gnc-budget-view.c
index 96d596dd1..0345303f0 100644
--- a/gnucash/gnome/gnc-budget-view.c
+++ b/gnucash/gnome/gnc-budget-view.c
@@ -93,11 +93,10 @@ struct _GncBudgetViewClass
enum
{
- TOTALS_TYPE_INCOME, /**< This total is Income type*/
- TOTALS_TYPE_EXPENSES, /**< This total is Expenses type*/
- TOTALS_TYPE_ASSET, /**< This total is Assets type*/
- TOTALS_TYPE_LIABILITY, /**< This total is Liabilities type*/
- TOTALS_TYPE_EQUITY /**< This total is for Equity type*/
+ TOTALS_TYPE_INCOME, /**< This total is Income type*/
+ TOTALS_TYPE_EXPENSES, /**< This total is Expenses type*/
+ TOTALS_TYPE_ASSET_LIAB_EQ, /**< This total is Asset/Liab/Equity type*/
+ TOTALS_TYPE_REMAINDER /**< This total is Remaining to Budget*/
};
/**< \brief ENUM for different budget totals types.
@@ -446,17 +445,15 @@ gbv_create_widget (GncBudgetView *budget_view)
G_CALLBACK(gbv_totals_scrollbar_value_changed_cb), budget_view);
// Create totals tree view
- totals_tree_model = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_INT);
- gtk_list_store_append (totals_tree_model, &iter);
- gtk_list_store_set (totals_tree_model, &iter, 0, _("Income"), 1, TOTALS_TYPE_INCOME, -1);
- gtk_list_store_append (totals_tree_model, &iter);
- gtk_list_store_set (totals_tree_model, &iter, 0, _("Expenses"), 1, TOTALS_TYPE_EXPENSES, -1);
- gtk_list_store_append (totals_tree_model, &iter);
- gtk_list_store_set (totals_tree_model, &iter, 0, _("Assets"), 1, TOTALS_TYPE_ASSET, -1);
- gtk_list_store_append (totals_tree_model, &iter);
- gtk_list_store_set (totals_tree_model, &iter, 0, _("Liabilities"), 1, TOTALS_TYPE_LIABILITY, -1);
- gtk_list_store_append (totals_tree_model, &iter);
- gtk_list_store_set (totals_tree_model, &iter, 0, _("Equity"), 1, TOTALS_TYPE_EQUITY, -1);
+ totals_tree_model = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_INT);
+ gtk_list_store_append(totals_tree_model, &iter);
+ gtk_list_store_set(totals_tree_model, &iter, 0, _("Inflow from Income"), 1, TOTALS_TYPE_INCOME, -1);
+ gtk_list_store_append(totals_tree_model, &iter);
+ gtk_list_store_set(totals_tree_model, &iter, 0, _("Outflow to Expenses"), 1, TOTALS_TYPE_EXPENSES, -1);
+ gtk_list_store_append(totals_tree_model, &iter);
+ gtk_list_store_set(totals_tree_model, &iter, 0, _("Outflow to Asset/Equity/Liability"), 1, TOTALS_TYPE_ASSET_LIAB_EQ, -1);
+ gtk_list_store_append(totals_tree_model, &iter);
+ gtk_list_store_set(totals_tree_model, &iter, 0, _("Remaining to Budget"), 1, TOTALS_TYPE_REMAINDER, -1);
totals_tree_view = GTK_TREE_VIEW(gtk_tree_view_new());
priv->totals_tree_view = totals_tree_view;
@@ -1168,7 +1165,7 @@ totals_col_source (GtkTreeViewColumn *col, GtkCellRenderer *cell,
gchar amtbuff[100]; //FIXME: overkill, where's the #define?
gint i;
gint num_top_accounts;
- gboolean red;
+ gboolean red, neg;
GNCPriceDB *pdb;
gnc_commodity *total_currency, *currency;
@@ -1193,28 +1190,30 @@ totals_col_source (GtkTreeViewColumn *col, GtkCellRenderer *cell,
{
account = gnc_account_nth_child (priv->rootAcct, i);
currency = gnc_account_get_currency_or_parent (account);
+ neg = FALSE;
switch (xaccAccountGetType (account))
{
- case ACCT_TYPE_INCOME:
- if (row_type != TOTALS_TYPE_INCOME)
- continue;
- break;
- case ACCT_TYPE_EXPENSE:
- if (row_type != TOTALS_TYPE_EXPENSES)
- continue;
- break;
case ACCT_TYPE_ASSET:
- if (row_type != TOTALS_TYPE_ASSET)
+ case ACCT_TYPE_LIABILITY:
+ case ACCT_TYPE_EQUITY:
+ if (row_type != TOTALS_TYPE_ASSET_LIAB_EQ &&
+ row_type != TOTALS_TYPE_REMAINDER)
continue;
+ neg = (row_type != TOTALS_TYPE_ASSET_LIAB_EQ);
break;
- case ACCT_TYPE_LIABILITY:
- if (row_type != TOTALS_TYPE_LIABILITY)
+ case ACCT_TYPE_INCOME:
+ if (row_type != TOTALS_TYPE_INCOME &&
+ row_type != TOTALS_TYPE_REMAINDER)
continue;
+ neg = (row_type == TOTALS_TYPE_ASSET_LIAB_EQ);
break;
- case ACCT_TYPE_EQUITY:
- if (row_type != TOTALS_TYPE_EQUITY)
+ case ACCT_TYPE_EXPENSE:
+ if ((row_type != TOTALS_TYPE_EXPENSES) &&
+ (row_type != TOTALS_TYPE_REMAINDER))
continue;
+ neg = (row_type == TOTALS_TYPE_REMAINDER ||
+ row_type == TOTALS_TYPE_ASSET_LIAB_EQ);
break;
default:
continue;
@@ -1234,6 +1233,9 @@ totals_col_source (GtkTreeViewColumn *col, GtkCellRenderer *cell,
gnc_budget_get_period_start_date (budget, period_num));
}
+ if (neg)
+ value = gnc_numeric_neg (value);
+
total = gnc_numeric_add (total, value, GNC_DENOM_AUTO, GNC_HOW_DENOM_LCD);
}
Summary of changes:
gnucash/gnome/gnc-budget-view.c | 62 +++++++++----------
.../report/business-reports/new-owner-report.scm | 69 ++++++----------------
gnucash/report/report-system/report-utilities.scm | 26 ++++----
3 files changed, 63 insertions(+), 94 deletions(-)
More information about the gnucash-changes
mailing list