Commit Graph

21783 Commits

Author SHA1 Message Date
Robert Fewell
3d2e2c2348 Allow room for the border on the item_edit button 2019-12-16 14:52:55 +00:00
Robert Fewell
b7f67bb387 Bug 796736 - Register cell pop up columns width to narrow
On first start up, cells with a pop up were initialised with the sample
text plus the cell height. This worked most of the time but with small
fonts the height could be smaller than the minimum button width so the
cell was too small. Add a function to retrieve the button width which
can not be less than the minimum button width and add this to be the
sample text width.

Also when you double clicked on the header of a pop up cell column to
auto size the cell width it did not take into account the button width
and so was too narrow, this is also fixed by getting the button width.
2019-12-16 14:52:48 +00:00
Christopher Lam
75dba61255 Bug 797521 - Receivable Aging (beta): invoice->payments refined
* filter payments from lot's splits by split-is-payment?
* dedupe payments
* sort by payment posted date
2019-12-16 12:55:18 +08:00
Christopher Lam
5e7c295471 Bug 797521 - Receivable Aging (beta): omit duplicate invoices
924fee2f3 redux, unfortunately gncInvoiceGetGUID isn't actually
available from scheme so we use the O(N^2) accumulator instead.
2019-12-16 02:35:58 +08:00
Christopher Lam
924fee2f3e Bug 797521 - Receivable Aging (beta): omit duplicate invoices
When processing payment->invoices, don't show duplicate invoices. This
is an unusual case documented in the bug.

Note: Instead of sort-and-delete-duplicates the invoices, we could
replace the invoice accumulator with the O(N^2) version:

(if (member invoice invoices) invoices (cons invoice invoices))
2019-12-16 02:09:00 +08:00
Christopher Lam
43fab24e2c Bug 797521 - Receivable Aging (beta): include earliest split
When processing invoice->payments, we used gnc-lot-get-earliest-split
to find the lot opening-split to skip it.

However it does not always return the lot opening-split, because a
lot-reducing split may be dated earlier than the lot opening-split.

This change means that the posting-split is processed together with
the payment splits, but its PaymentAcctSplitList is null, so it does
not add any row to the result.
2019-12-16 02:08:19 +08:00
Christopher Lam
7cd6591c77 [new-owner-report] fix args to make-payment->invoices-table
It should receive 1 arg instead of 2.

guile-2.2 allows internal defines to be called with a higher number of
args.  This may be a guile bug.  Follow-up tracking at
https://lists.gnu.org/archive/html/bug-guile/2019-12/msg00011.html

guile-2.0 (IMHO correctly) does not allow this invalid call.
2019-12-15 10:03:05 +08:00
Christopher Lam
a513140e15 [new-owner-report] use gnc-lot API for searching business links
Previous would search invoices->payments and payment->invoices during
the report by analysing each posting and payment txn.

This change will remove the splits searching and use gnc-lot API to
find these links.

* also use ice-9 match for easier matching
* also use global gnc:multiline-to-html-text
* also remove some duplicate sanity checks
2019-12-14 17:20:29 +08:00
Christopher Lam
cbb0c36ad4 [test-owner-report] properly test link amounts
Previous test wasn't comprehensive; due to variable row lengths,
the (td 11) wouldn't consistently select the link amount. using
(td -1) will select the last <td> element in the row.

Moreover also test the class-name to target the link amounts otherwise
other elements (eg the aging-list) will also be returned.
2019-12-14 12:39:58 +08:00
Christopher Lam
b372f28829 [test-owner-report] initial tests new-owner-report
mainly tests amounts being displayed are correct
2019-12-12 22:27:24 +08:00
Christopher Lam
670811455d [report-utilities] bugfix: aging-list was incorrect. off-by-1 error.
off-by-1 error in aging-list dates.
2019-12-12 22:27:24 +08:00
Christopher Lam
1c605a6b10 [report-utilities] bugfix: overpayment works for AP accounts
and fix comment from 5f6b9946d.
2019-12-12 22:27:09 +08:00
Robert Fewell
cac155a97c Swap the buttons around on the Budget Open dialogue
Swap the OK and Cancel buttons so they conform to the normal layout.
2019-12-11 15:16:48 +00:00
Robert Fewell
8e155bfccf Change the spacing in files gnc-plugin-page-budget.* 2019-12-11 15:16:48 +00:00
Robert Fewell
1320b79dc7 Change the spacing in files gnc-plugin-budget.* 2019-12-11 15:16:48 +00:00
Robert Fewell
eb7810788b Missing g_strfreev in gnc-plugin-page-report for keys value 2019-12-11 15:16:48 +00:00
Robert Fewell
803d4c511e Bug 797489 - No option to use account codes in Budget View - Part1
In the budget view there is no option to add the account code column
which some uses use for sorting their accounts. This commit introduces
a feature flag to be used in version 4.0 but if set in 3.8 will hide
the new account code column so the view is not disrupted.
2019-12-11 15:16:48 +00:00
Robert Fewell
d0727a1bfb Bug797519 - Budget Viewer Totals do not redraw upon to Sign-Reversal changes
Connect to the 'row-changed' signal for the account tree and do a
redraw on the totals tree view. Also fixes when changing the preference
for using negative amounts in red.
2019-12-11 15:16:48 +00:00
Robert Fewell
dc1881bd4b Make sure the same variable name is used for GncBudgetView
GncBudgetView was name differently through out the file so change all
uses to be the same.
2019-12-11 15:16:48 +00:00
Robert Fewell
4a4e0ae562 Change some spacing in source files gnc-budget-view.* 2019-12-11 15:16:48 +00:00
Christopher Lam
5f6b9946d4 [report-utilities] bugfix: fix overpayment detection
For 1 payment to >1 invoices, previous would miscalculate overpayment.

Old overpayment definition -- from the payment amount, successively
subtract the invoice totals. If remaining is >0, then this is
overpayment. But this fails whereby invoice was partially paid
elsewhere because the overpayment would miss them.

New overpayment definition -- the payment txn is analysed, and all
APAR-splits' lots are analysed. Any lot with no invoice is a
prepayment.

This is a simpler algorithm and does not require the creation and
searching of invoices-and-splits.
2019-12-11 21:37:12 +08:00
Christopher Lam
0212537cca [new-owner-report] bugfix: fix overpayment detection
For 1 payment to >1 invoices, previous would miscalculate overpayment.

Old overpayment definition -- from the payment amount, successively
subtract the invoice totals. If remaining is >0, then this is
overpayment. But this fails whereby invoice was partially paid
elsewhere because the overpayment would miss them.

New overpayment definition -- the payment txn is analysed, and all
APAR-splits' lots are analysed. Any lot with no invoice is a
prepayment.
2019-12-11 21:37:04 +08:00
Christopher Lam
3efb960daf Bug 797521 - Receivable Aging (beta): prepayments logic doesn't work, appears to use incorrect absolute value logic
Overpayments create at least 2 APAR splits (1 for each invoice, and 1
for the overpayment), they were processed multiple times.

Modify query to return unique transactions, thereby ensuring a payment
gets processed once only.
2019-12-11 16:08:17 +08:00
Christopher Lam
60765e388a Bug 797279 - Reports RTL do not support RTL
RTL autodetect seems to rely on the report-title being RTL.
2019-12-09 19:31:31 +08:00
Christopher Lam
e40bee0ff6 [Bug 797520] Balance Sheet (Multicolumn) the retained earnings amount in the equity section has its sign reversed
c21bb66d6 had a regression: income-expense-balances was originally
negated, only to be negated again for use in retained-earnings-fn. The
previous change forgot to negate income-expense-balances.

This commit removes the negation before use of income-expense-balances
in retained-earnings-fn, thereby simplifying code.
2019-12-09 19:06:50 +08:00
Christopher Lam
6266ca2f12 g_free() output of get_negative_color
because gdk_rgba_to_string() returns a newly-allocated string

* get_negative_color is gchar* instead of const gchar*
* move to dialog-utils.c
* rename get_negative_color() to get_negative_color_str() in
window-main-summarybar.c
* add g_free to gnc_tree_model_account_dispose ()
* modify code to g_free () after use
2019-12-07 21:03:11 +08:00
Christopher Lam
17bbf870e5 Bug 797401 - Invoice Reports need an overall page width set
Use html5 @media to set main-table to page width.
2019-12-07 21:03:11 +08:00
Christopher Lam
b5f9cd0b32 [budgets.scm] budget reports handle both natural & reversed budgets 2019-12-05 17:26:46 +08:00
Christopher Lam
775200ef34 [gnc-budget-view.c] totals - 5 fundamental types
previous showed income/expense/transfers/totals budget totals, of
uncertain meaning. now shows income/expense/asset/liability/equity
budget totals.

the 5 lines also become sensitive to global sign-reverses property
2019-12-05 17:26:46 +08:00
Christopher Lam
2cd69e8d85 [budgets.c] handle both natural & reversed signs budgets
introduce new API
* gnc_using_unreversed_budgets - queries book's unreversed feature
* gnc_reverse_budget_balance - check if book unreversal status matches
  2nd argument. if so, return account's reversal status. else, return
  FALSE.

* gnome-budget-view can now show both natural and reversed budgets
* gnome-plugin-page-budget will now read&write both natural and
  reversed budgets.
2019-12-05 17:26:46 +08:00
Christopher Lam
ded336f987 [gnc-features] enable reading of unreversed budgets 2019-12-05 17:26:46 +08:00
Christopher Lam
c06191a656 Transaction.c: avoid slow g_list_nth_data 2019-12-05 13:06:11 +08:00
Christopher Lam
1c64385614 base-typemaps: avoid slow g_list_nth_data
scan GList via glist pointer links rather than incrementing index.
2019-12-05 10:17:12 +08:00
Christopher Lam
7833c59896 Bug 724219 - Customer Summary includes Closing Entries when reporting across the end of year 2019-12-02 22:20:17 +08:00
Christopher Lam
7ad4c4afbd [html-acct-table] compact gnc:html-acct-table-get-cell 2019-12-02 22:20:17 +08:00
Christopher Lam
8bf54ebfc1 [html-acct-table] compact traverse-accounts!
* convert for-each to named-let
* allows reduction of set! calls
2019-12-02 22:20:17 +08:00
Christopher Lam
ab20071d82 [report-utilities] strify hash-table to Hash(kvp-list)
Hash tables are strified to "Hash()" "Hash(key=value,...)"
2019-12-02 18:20:02 +08:00
Christopher Lam
2333b6db27 [reports] avoid "<br/>" literal: use gnc:multiline-to-html-text 2019-12-02 16:48:05 +08:00
Christopher Lam
3ee434edf6 [new-aging] use gnc:html-markup-ol 2019-12-02 00:32:02 +08:00
Christopher Lam
4aa17ef65b [html-text][API] gnc:html-markup-ol, gnc:multiline-to-html-text
* (gnc:html-markup-ol lst)

  creates an ordered list

* gnc:multiline-to-html-text: creates html-text with <br/> elements

  "line1\nline2\nline3" ->
  (gnc:make-html-text "line1" (gnc:html-markup-br)
                      "line2" (gnc:html-markup-br)
                      "line3")
2019-12-02 00:32:02 +08:00
Christopher Lam
a52d60f48e [business-reports] compact gnc:owner-report-text 2019-12-02 00:32:02 +08:00
Geert Janssens
df1f033f41 bindings-python - drop references to gnucash-env
We no longer ship a gnucash-env script, directly use python(3) instead
2019-11-30 13:20:08 +01:00
Christopher Lam
0b11a073f0 Merge branch 'maint' of git://github.com/andrey-legayev/gnucash into maint 2019-11-30 16:34:48 +08:00
Christopher Lam
c21bb66d68 [balsheet-pnl] refactor common account-balance-list adder
* use fold, more efficient, removes the need for intermediate list

  (map cdr (filter filter-fn accounts-balances)): filter will create 1
  intermediate list, which is passed as an argument to map which
  creates the final list. using fold will remove the need for
  intermediate list.

* list->vector for O(1) access
2019-11-30 16:34:28 +08:00
Christopher Lam
def0caa011 [balsheet-pnl] use and-let*, reindent 2019-11-30 16:34:17 +08:00
Christopher Lam
e97b78df80 [balsheet-pnl] fix: single-date balsheet missed printing date 2019-11-30 16:34:17 +08:00
Christopher Lam
54c4575f27 [balsheet-pnl] fix: hide Equity sections when not needed
* If currencies are not converted, Unrealized Gains are
meaningless. Hide them.

* If there are no income/expense accounts, retained earnings will be
nil. Remove row.
2019-11-30 16:34:06 +08:00
Andrey Legayev
34c14b44a9
Remove not needed semicolons in Python bindings 2019-11-29 18:32:50 +02:00
John Ralls
7853f5a24a Ignore trailing noise on imported transaction account numbers.
AQBanking6 uses a separate method for retrieving account numbers
for account info and transactions, where the transactions method can
have additional characters, most often the ISO4217 currency code. That
results in match failures when importing.

As a work-around, compare only the length of the account-info-generated
online id when comparing it to the transaction-generated one.

Note that this is only a partial solution: At least one German bank
also appends characters to the transaction-generated bank id and that
will still cause the match to fail.
2019-11-28 09:17:59 -08:00
Christopher Lam
1af8e272c7 [balsheet-pnl] unrealized-gain calculator is now much faster.
Previous code would call gnc:account-get-comm-value-at-date for each
report-date; this function generates qof-query, retrieves account
splits, scans them to accumulate split->transaction->currency and
split->value into a commodity collector.

This commit will hook into the existing gnc:account-accumulate
function, accumulating the same split->transaction->currency and
split->value into a collector.

Note we must make a copy of the accumulator at each report-date
via (gnc:collector+ val-coll) otherwise the same val-coll will be
mutated through subsequent splits.

For a multicolumn balsheet, for every account with N old splits, and
reporting on M report dates, it would run in O(N*M) time. This
algorithm will hook into existing accumulator, i.e. I think O(1).

The majority speed-up however comes from avoiding M qof-queries per
report.
2019-11-26 21:52:10 +08:00