Commit Graph

21672 Commits

Author SHA1 Message Date
Frank H. Ellenberger
91183a2af5 drop emacs_trailer from xml files.
Modern versions of emacs know, how to behave on xml files.
2019-11-25 00:42:40 +01:00
Christopher Lam
287b857a18 [html-style-info] deprecate font-face/size/color
Only 'font-color was demonstrated in hello-world.scm, and these were
never used in practice.
2019-11-23 22:55:14 +08:00
Christopher Lam
729bf5ae6a [hello-world] remove 'Text Color' option - will be deprecated
... because deleting an option does not cause crash in saved-reports.
2019-11-23 22:55:14 +08:00
Christopher Lam
101cc91698 [reports] use new api gnc:account-accumulate-at-dates
queries xaccSplitGetNoclosingBalance (which is a pointer dereference)
instead of a more complex conditional-based snippet for split->amount,
should be faster.

The category-barchart change will choose the appropriate split->elt
function according to the account type. This is more efficient than
the old split->amount function which includes a conditional.

Note we don't need to test for account being income/expense:
asset/liability accounts do not have Closing transactions. Therefore
we can use xaccSplitGetNoclosingBalance for splits from any account
type.
2019-11-23 22:55:14 +08:00
Christopher Lam
68b0abdfa6 [report-utilities] gnc:account-accumulate-at-dates: specify default elt
if acc has no splits before report-date, the nosplit->elt will specify
the default value to be inserted in the result list.

e.g. consider:

dates are (date1 date2 date3 date4 date5)
account has splits starting after date2:

(gnc:account-accumulate-at-dates account dates
 #:split->elt (const 'yea) #:nosplit->elt 'nay)

results in '(nay nay yea yea yea)
2019-11-23 22:55:14 +08:00
Robert Fewell
17d3938866 [I18N] Remove trailing colon and space from source file dialogue labels 2019-11-22 13:36:03 +00:00
Robert Fewell
5586ccaa5f [I18N] Remove trailing colon and space from glade dialogue labels - part2 2019-11-22 13:36:03 +00:00
Robert Fewell
6897f13e78 [I18N] Remove trailing colon and space from glade dialogue labels - part1 2019-11-22 13:36:03 +00:00
Christopher Lam
063a270499 [new-owner-report] fix: payment->invoice gets invoice totals
previously the payment-amount deduction loop used the
payment-split-list to obtain the invoice-posting-split's amount. this
would occasionally fail and would return the invoice-payment-split
amount, obtaining the wrong sign.

modify to retrieve the invoice total via gncInvoice API.

therefore payment-amount, minus gncInvoiceGetTotal(inv) amounts,
results in the overpayment amount.
2019-11-21 20:44:29 +08:00
Christopher Lam
b3493509d1 [balsheet-pnl] speed up by pre-generating account report-date splits
previous code was very inefficient: if an account had N old splits and
balance-sheet reported on M recent dates, it would scan splitlist
multiple times: (1) to retrieve splits, (2) filter until
column-date, (3) find the last one. i.e. total O(N * M * 3).

this algorithm pre-generates the account's report-date splits by
scanning each account only once, creating M splits which are queried
by get-cell-anchor-fn via list-ref. i.e. O(N)

it is immedialtely converted to a vector because we want O(1)
access. from get-cell-anchor-fn

a future optimisation may scan the accounts' splitlists once per
report run, acquiring all required data (i.e. last period split,
split->balance, closing entries) in 1 pass, to generate a column-data
record.
2019-11-21 20:11:49 +08:00
Christopher Lam
dda3da8416 [report-utilities][API] gnc:account-accumulate-at-dates
this is a generalised form from gnc:account-get-balances-at-dates to
accumulate a list from report dates.

this function will scan through account splitlist, processing each
split via split->elt, accumulating results at date boundaries into the
results list. it uses ice-9 match for conciseness.

in: acc   - account
    dates - a list of time64
    split->elt - an unary lambda. the result of calling (split->elt split)
                 will be accumulated onto the resulting list. by
                 default it returns the last split-balance before
                 date boundary, similar to gnc:account-get-balances-at-dates

out: (list elt0 elt1 ...), each entry is the result of split->elt
2019-11-21 19:54:18 +08:00
Christopher Lam
f0a189adbb [test-report-utilities] add test-get-account-at-dates 2019-11-21 19:54:14 +08:00
Christopher Lam
2671814251 [balsheet-pnl] income statement parent account can link to TR
this commit modifies the recursive-parent subtotal generator to also
include a link to a transaction report with all relevant accounts.
2019-11-20 21:31:51 +08:00
Christopher Lam
1ab95b5563 [invoice][i18n] enable i18n options helptext
and remove obsolete options "My Company" and "My Company ID"
2019-11-20 21:31:40 +08:00
Christopher Lam
eea5ac98c0 [stylesheet-plain][html5] omit <h3></h3> when headline is empty.
We compare headline with "", rather than test (string-null? headline),
because headline may be either a string or a complex gnc:html-text
object.
2019-11-19 19:35:05 +08:00
Christopher Lam
9bb2e4a21a [html-fonts][html5] add html,body height 100vh
This CSS rule allows children elements (such as <canvas>) to inherit
100% viewport height for displaying full-screen charts. This is
necessary for standards-mode.

https://quirks.spec.whatwg.org/#the-html-element-fills-the-viewport-quirk
2019-11-19 19:34:56 +08:00
Christopher Lam
fbc7c9027e [scm/utilities] even more efficient list-flatten functions
because:

* list? is O(N), because it needs to test for an improper
list. improper lists are lists whose last pair's cdr cell is not
'(). null? and pair? are both O(1).

* avoids reverse which is also O(N): guile has unlimited stack
therefore we can do non-tail-call loop first to pass as parameter to
the tail-call loop. this removes the need for prepend-and-reverse.
2019-11-19 19:28:27 +08:00
Robert Fewell
043abcb436 Reformat the gnc_cell_renderer_date* source files
Change tabs to spaces and fix some spaces issues in the source files.
2019-11-18 16:18:27 +00:00
Robert Fewell
09746ca61d Fix GncPopupEntry missing property error
There was error in the trace file for GncPopupEntry of the format...
Object class GncPopupEntry doesn't implement property 'editing-canceled'
 from interface 'GtkCellEditable' so added one.
2019-11-18 16:17:20 +00:00
Robert Fewell
6a167389ad Bug 797492 - Lock up on 'Find Account'
If you list accounts with the "find accounts" dialogue, then delete an
account it has found (e.g. jump & delete), then return to the dialogue,
the dialogue doesn't refresh when the window regains the focus, so you
can accidentally jump to an account you have recently deleted which
will lock up Gnucash.

Fix this by listening to account events and then refresh the list.
2019-11-18 16:16:25 +00:00
Christopher Lam
de09259f13 Bug 797500 - valgrind errors - new/delete vs malloc/free
Mismatched new/g_free()
Change to new/guid_free() which calls delete
2019-11-17 09:55:51 +08:00
Christopher Lam
78cd4eaa05 [html-fonts] compact and tidy functions 2019-11-15 21:27:09 +08:00
Christopher Lam
37a51475be [test-report-html] modify test to expect DOCTYPE 2019-11-15 21:26:58 +08:00
Christopher Lam
b35daaa7aa [html-fonts] enforce border-color grey to td & th elements
Using class td.neg will cause border-color to be red on modern
browser. We need to add td and th selectors to enforce grey border.
2019-11-15 21:05:09 +08:00
Christopher Lam
e26f20ffa9 [html-document] add <!DOCTYPE html> to reports 2019-11-15 20:55:16 +08:00
Christopher Lam
58258b9400 [trep-engine] add transaction filter exclude option
add boolean option which converts the transaction filter from
'include' to 'exclude'.
2019-11-15 06:14:10 +08:00
Christopher Lam
509c542a9a [new-owner-report] fix signs for vendor/employee reports
Handling AP account splits mean we must negate some amounts for
processing and display.
2019-11-14 10:25:42 +08:00
pianoslum
c520c5af19 Add three missing German translations 2019-11-12 22:04:55 +01:00
Christopher Lam
c4a19b9b5a [new-owner-report] fix: Payment links to payment split
Previously owner-report "Payment" links to APAR payment split. Best
link to the transfer account split thereby showing original
payment. Also creates a link for each transfer split although
theoretically there should only be one. e.g. if 2 non-APAR split in
payment transaction, it'll show "Payment Payment" in the "Type"
column.
2019-11-12 21:57:37 +08:00
Christopher Lam
0b8bfe6683 [new-owner-report] fix: invoice->payments renders full amount
For payments spanning multiple invoices, previously it would render
partial payment amount. But this info duplicates the invoice
details.

By rendering the full payment amount, it will ease tracking with other
invoices paid with same payment.

If the payment transaction originates from a different currency, the
invoice->payments table will render it in the originating currency.
2019-11-12 21:57:28 +08:00
Christopher Lam
a63ba72624 [report-utilities] fix: gnc:owner-splits->aging-list uses APAR splits
... instead of payment splits to calculate payment amount, because
payment splits may be in a different currency. using APAR split total
minus invoice amounts is guaranteed to produce correct overpayment
amount in APAR currency.
2019-11-12 15:15:54 +08:00
Christopher Lam
346d2e24da [new-owner-report] use total-number-cell for monetaries
Previous would tag all cells as total-label-cell. Tag monetaries with
total-number-cell which leads to right-aligned period totals.
2019-11-11 22:08:41 +08:00
Christopher Lam
3d5d8191dd [report-utilities] fix: overpayments in gnc:owner-splits->aging-list
Previous algorithm had assumed all payments would match attached
invoices. This updated algorithm does not assume.

Invoice: add into appropriate bucket and save invoice+splits into
list.

Payment: scan payments from invoice+splits to find appropriate
invoice, and deduct from the transfer account. The remainder is an
pre/overpayment and added into prepayment bucket.

It will always assume that the splitlist being processed will *all*
belong to one owner.
2019-11-11 22:08:41 +08:00
Christopher Lam
980776f46f [new-owner-report] fix: overpayments must show prepayment row
If a payment exceeds the amounts from associated invoices, the amount
remaining must be considered a prepayment.
2019-11-11 22:08:41 +08:00
John Ralls
9189bcbe41 Bug 797078 - "Automatic decimal point" Should Not Cause 2 Different Behaviors
It's documented only for automatically inserting the decimal point
so remove the code that affects number display.
2019-11-10 12:33:20 -08:00
Christopher Lam
a482c25072 [new-aging] step 4 - prepended lists must be reversed
after building lists by prepending in b72052137 we need to process
them in reverse to obtain the original sorting of accounts and
owner-list.
2019-11-10 18:17:25 +08:00
Christopher Lam
6f7c6b9de3 [new-aging] step 3 - only render APAR details if APAR-accounts>1
This commit will hide the APAR account anchor if there's only one
found. So, for majority of users with single AP/AR accounts, the aging
report will be very similar to old one. For users with multi APAR
accounts, each one will be shown with header (and anchor) and
indenting to highlight grouping.
2019-11-10 08:51:38 +08:00
Christopher Lam
97798f9fd1 [new-aging] step 2 - reduce indentation level by 1
merge two let* together
2019-11-10 08:51:29 +08:00
Christopher Lam
b72052137b [new-aging] step 1 - split loops into processing vs building table
Instead of rendering html-table all incrementally, build
account-and-owners and owners-and-aging lists first, leaving building
the html-table for the end. tofree is a list of owners which are
generated and must be freed after use.
2019-11-10 08:50:11 +08:00
Christopher Lam
72c20a07c3 [new-owner-report] merge setup-query and setup-job-query
They were very similar.

and remove html-document-set-title! because the document headline will
override title in the renderer.
2019-11-09 15:11:02 +08:00
Christopher Lam
9f4677e346 [new-owner-report] apply total-label-cell to label
Previous used 'total-number-cell' thereby unnecessarily right-aligning
total label cells.

Also xaccTransGetAccountAmount is more appropriate than
xaccTransGetAccountValue because the latter may retrieve numbers in a
currency other than APAR currency.
2019-11-09 14:31:24 +08:00
Christopher Lam
f0701da868 [new-owner-report] modify report row->value accessor
Previously each owner-table row's value would access split's
amount. But this fails for payments spanning multiple invoices,
because these (with a single split to bank) will have a split for each
invoice. Hence split->amount gets only 1 invoice payment amount.

This change modifies to obtain the sum total of split->amounts in the
APAR account thus handles multi-invoice payments correctly.
2019-11-09 06:17:05 +08:00
John Ralls
a4773d2ba7 Ensure all uses of g_table_index are protected from NULL return values.
Including all of the convenience wrappers.

Also remove a few calls where the result is discarded, as it has no
side effects.
2019-11-08 13:12:05 -08:00
John Ralls
2bc7d314ed Bug 797481 - crash on close of unsaved tabs by pressing [X]
Pretty much the only place gnucash_sheet_get_block could crash is in
g_table_index, either because the GTable's GArray has been deleted or
the index is out of range. Add g_return_val_if_false tests for each
possibility.
2019-11-08 12:33:00 -08:00
Robert Fewell
32ff31fead Bug 796945 - Search dialog update - follow up
For some reason on Ubuntu 18.04 that uses Gtk3.22.30 and maybe others
we have to set the scroll window content min height after the dialog
has been shown to get the correct scroll window height
2019-11-08 14:53:29 +00:00
Christopher Lam
952c656144 [dialog-payment] instead of tooltip, render in gtklabel
The warning icon is used to show blocking and non-blocking warnings in
a payment. Increase visibility by showing the warning as a gtklabel
instead of a tooltip.
2019-11-08 18:43:57 +08:00
Christopher Lam
ee19108321 [dialog-payment] tooltip warning if payment is unattached
Completing a payment for a customer without associating with an open
invoice is allowable and is used for prepayments.

Previously this was done silently.

This commit will enable a warning to inform that the payment does not
have an invoice/bill document attached. This warning does not block
the payment however.
2019-11-08 18:42:27 +08:00
Christopher Lam
21d608038e Addendum to UI Jump to Invoice at 535632b02
Previous trans->invoice strategy was flawed. A payment for multiple
invoices would always return the first invoice found.

A safer approach is to find split->invoice -- this enables a split
from a payment for multiple invoices to retrieve the corresponding
invoice.

The disadvantage is that we cannot jump from bank split to invoice
split anymore; this is acceptable because a payment which covers
multiple invoices would lead to ambiguity and would require UI to
select the invoice for jump.
2019-11-06 06:45:55 +08:00
John Ralls
e991fe853c Bug 797086 - Import customer dialog – headers not translated 2019-11-05 09:14:43 -08:00
John Ralls
910cdbfddc Fix compile error, missing return value.
And a condition, !(!inv) to cast inv as a bool is a bit too clever.
inv != NULL more clearly conveys the intent.
2019-11-05 09:14:43 -08:00