Commit Graph

20623 Commits

Author SHA1 Message Date
Christopher Lam
768132236a [general-ledger] Void-Transactions had moved from Accounts to Filter
TR void-transaction moved from Account tab to Filter tab.
2019-02-20 21:41:11 +08:00
Christopher Lam
971be33951 [html-fonts] compact (font-name-to-style-info)
which was badly written. compact, and create tests.
2019-02-20 21:09:22 +08:00
Christopher Lam
4a2b5e9641 [hooks.scm] deprecate hooks.scm
this module has a single function which is used only once. inline it.
2019-02-20 21:09:22 +08:00
Christopher Lam
f64586b873 [app-utils] remove config-var.scm
unused since 1999?
2019-02-20 21:04:23 +08:00
Christopher Lam
6945e1c7d7 [cash-flow][budget] logic error in sub-accounts handling
Previous logic would cycle through accounts' sub-accounts, and each
sub-account would be queried for inclusion in accounts; if not
present, the accounts would be appended by all sub-accounts.

Logic would dictate that only the missing sub-account should be added
to the accounts list.

No functional change is expected; previous behaviour would generate an
unnecessarily long resulting accounts list (includes sub-accounts as
many times as there are sub-accounts).
2019-02-20 20:46:27 +08:00
Christopher Lam
2215dfc5e1 [cash-flow] clean up cash-flow calculator
1. remove split-seen? helper function. use a simple list.

2. they were maintaining 2 lists for in, 2 lists for out. simplify to
1 list each.

3. convert single-use function to named let

4. remove transaction date filter - transactions were already
date-filtered by the query prior.

5. use simple lists instead of split/account hash tables. use the
incredible versatile srfi-1 functions.

6. s-report-value can be defined earlier

7. clean up whitespace so that line maxwidth is 80

8. tests already exist in test-cash-flow.scm
2019-02-20 20:15:57 +08:00
Christopher Lam
c6f5e6736b [cash-flow] *untabify/delete-trailing-whitespace/reindent* 2019-02-20 20:02:08 +08:00
Christopher Lam
d97d4930ba [cash-flow] replace account-in-alist with srfi-1 equivalent 2019-02-20 20:02:08 +08:00
Christopher Lam
1a69bf1b2f [cashflow-barchart] remove srfi-1 aliases 2019-02-20 20:02:08 +08:00
Christopher Lam
56bccd1b50 [cashflow-barchart] reuse cash-flow-calc-money-in-out
The (cashflow-barchart-calc-money-in-out) function was copied verbatim
from cash-flow.scm (apart from the returned list being shorter). reuse
function from cash-flow.scm.

Test already exists in test-cashflow-barchart.scm
2019-02-20 20:02:08 +08:00
Christopher Lam
12d6ace967 [commodity-utilities] first/second/third -> car/cadr/caddr 2019-02-20 19:32:07 +08:00
Christopher Lam
c045e7c5ec [commodity-utilities] simplify gnc:uniform-commodity?
old code was confusing; returns non-#f if either of following is true:
- elts is null list
- elts is 1-element list
  and report-commodity is a member of this 1-element list

change to much more intelligible code
2019-02-20 19:32:07 +08:00
Christopher Lam
eab4eecac8 [commodity-utilities] deprecate gnc-commodity-collector-commodity-count
this function is only used twice in exported functions. inline and
refactor to be simpler.
2019-02-20 19:32:07 +08:00
Christopher Lam
058ef28849 [commodity-utilities] deprecate gnc-commodity-collector-contains-commodity?
this function is only used once. inline it.
2019-02-20 19:32:07 +08:00
Christopher Lam
e3160af417 [report-utilities] fix (gnc:make-stats-collector)
allows it to compare numbers with +/-inf.0 -- 10E9 is an arbitrary
number to compare numbers.

(< N +inf.0) is guaranteed to be #t for all numbers N whereby N is not
also +inf.0.
2019-02-20 19:15:06 +08:00
Christopher Lam
60558f6ad1 [report-utilities] (gnc:account-get-balances-at-dates) documentation
the algorithm assumes dates-list is sorted chronologically. enforce
it, and document.
2019-02-20 19:02:46 +08:00
Christopher Lam
b1cd7393b6 [report-utilities] gnc:account-get-balances-at-dates adjustment
(Release Note - developer section)

Modification to gnc:account-get-balances-at-dates.

formerly it would accept an optional #:ignore-closing? boolean to skip
closing transactions.

it would be more general to accept a #:split->amount function whose
default is xaccSplitGetAmount. calling (split->amount split) should
return amount from the split. if the function returns #f, it
effectively skips the split. this will allow a more general
account-balance list accumulator, allowing novel balance strategies
e.g. split->amount may test split void status and return the split
xaccSplitVoidFormerAmount, test description/memo and return an amount
depending on description contents, or test the split and return 1 or 0
which will return a tally of splits.

the direct equivalence for the previous #:ignore-closing? keyword
argument is #:split->amount (lambda (s) (and (not (xaccTransGetIsClosingTxn
(xaccSplitGetParent s))) (xaccSplitGetAmount s)))

NOTE: the modifications to category-barchart.scm and net-charts.scm
will use the #:split->amount kwarg as well.

This function is extensively tested in the commit
53cab269f4
2019-02-20 19:02:42 +08:00
John Ralls
11083d6052 Bug 796989 - some date/time does not honor user locale (bis).
Set the locale for C so that it matches what's set for C++.
2019-02-19 09:49:56 -08:00
Christopher Lam
6f5be2a473 [test-report-utilities] mark gnc:account-get-balance-at-date obsolete 2019-02-19 22:44:34 +08:00
Christopher Lam
4f0e9a5168 [options] gnc:warn when looking up old option names
the option lookup mechanism will dynamically translate option
names. warn the user if this takes place so that the report writer may
use new option names.
2019-02-19 22:28:12 +08:00
Frank H. Ellenberger
7c4d340e65 PR #458: Add accounts templates for fr_BE
Merge branch 'fr_BE' of https://github.com/bigon/Gnucash into fr_BE
2019-02-19 12:37:06 +01:00
Christopher Lam
51b6cf600d [report-utilities] deprecate gnc:commodity-collectorlist-get-merged
this function is unused
2019-02-19 06:59:35 +08:00
Frank H. Ellenberger
d7190c0fac Merge branch 'patch-1' of https://github.com/sicelo/Gnucash into maint
Bug 797105 - Incorrect local-symbol for SZL currency
PR #461
2019-02-18 14:09:54 +01:00
Sicelo
07fbb46398
Update SZL section header
Clarify the reason for changing the symbol
2019-02-17 08:10:55 +02:00
Christopher Lam
817c3f4d6a Merge branch 'christopherlam-maint-bugfixes' into maint 2019-02-17 11:58:45 +08:00
Mike Alexander
d4af5244d0 Bug 797106: Do a better job of converting decimal prices to rationals.
Use the Scheme rationalize method to convert the decimal numbers
from Finance::Quote to ratinal numbers.  This avoids rediculous
precision like 8515625000000001/3906250000000000 for 2.18.
2019-02-17 11:58:15 +08:00
Michiel Brentjens
c6ac5e2c09 Update gnc-tree-view-split-reg.c
gcc version 8.2.1 20181127 (GCC) gave a warning pointing at the problem.
2019-02-17 11:58:15 +08:00
Christopher Lam
a4789fcac5 bugfix: fix crasher when loading saved-report with unknown choices.
If a saved-report with e.g. relative date, multichoice option is
unknown, the report would crash, and the Report-Options would
segfault. This commit fixes both: report-date defaults to 'today',
multichoice-options defaults to default-value.

Following this commit, if a report loads a saved-report or .gcm from a
future version, a gnc:warn will be emitted and the report will not
crash; it will use relative-date today. Multichoice will remain the
default value. Report Options will not segfault.

The user will be notified via a gnc:gui-warn dialog
2019-02-17 11:25:06 +08:00
Christopher Lam
a731c9ed9a [gnome-utils] add gnc:gui-warn/error/msg global functions
gnc:gui-[warn|error|msg] are new global functions.

By default they mirror gnc:warn/error/msg. However then gnome is
available, they will display appropriate warn/error/info dialog in
addition to outputting to console.
2019-02-17 11:24:57 +08:00
Mike Alexander
95aed30320 Bug 797106: Do a better job of converting decimal prices to rationals.
Use the Scheme rationalize method to convert the decimal numbers
from Finance::Quote to ratinal numbers.  This avoids rediculous
precision like 8515625000000001/3906250000000000 for 2.18.
2019-02-16 19:38:37 -05:00
Sicelo
86be3b9247
Update iso-4217-currencies.xml 2019-02-16 18:08:45 +02:00
Sicelo
96577ff922
Update iso-4217-currencies.xml
Fixing the 'local-symbol' property for the SZL currency from "L" to "E." See Bug 797105.
2019-02-16 01:10:09 +02:00
Laurent Bigonville
72296f910f data/accounts/fr_*: Add usage precisions for the common account template 2019-02-15 17:52:44 +01:00
Laurent Bigonville
36e93e39c7 data/accounts/fr_BE: s/chèque/courant 2019-02-15 17:43:57 +01:00
Laurent Bigonville
9f804bf844 Add accounts templates for French Belgium (fr_BE)
This is ATM a complete copy of the templates from fr_FR
2019-02-15 17:43:57 +01:00
Laurent Bigonville
accaf13f1f data/accounts/fr_{CH,FR}acctchrt_common.gnucash-xea: Add missing comma 2019-02-15 17:43:57 +01:00
Laurent Bigonville
8776580dcf data/accounts/fr_{CH,FR}/acctchrt_spouseretire.gnucash-xea: Add missing words 2019-02-15 17:43:57 +01:00
Geert Janssens
f22e30ba9e Merge branch 'maint' of https://github.com/brentjens/gnucash into maint 2019-02-13 18:47:06 +01:00
Christopher Lam
65bfeaf5de [date-utilities] bugfix: date-intervals produces good month deltas
Instead of recursing the date, we calculate the next month using an
index-based multiplier, and apply modulo/remainder as appropriate to
determine the next month/year.

Then we attempt to create new mktime, and if the resulting mktime's
month is not as expected, reduce the mday by 1 until resulting month
is correct. This fixes monthly intervals for end-of-month days.

Test via monthly/quarterly deltas, and also includes leapyear
calculation.
2019-02-13 22:23:44 +08:00
Christopher Lam
74d4be19dc [transaction] bugfix: date-grouping must allow indenting
Indenting checkbox was erroneously disabled when: sortkey = date,
date-subtotal = not 'none.

This commit will allow indenting option in the above case.
2019-02-13 22:23:44 +08:00
Christopher Lam
8f2776dabd [transaction] bugfix: subtotal-table + subtotals-only = hide table
It is intuitive that if the user wishes to show the subtotal-table,
and hide the transactions, then both the main (hidden) transactions
and subtotals must be hidden as well.

https://gnucash.uservoice.com/forums/101223-feature-request/suggestions/36565759-add-a-transaction-report-option-to-show-subtotal
2019-02-13 22:23:44 +08:00
Christopher Lam
d8d3c669a6 Bug 795729 - Advanced Portfolio Report - Percentage rates not displaying leading zeros
Refine guile (format) string.
2019-02-13 22:23:44 +08:00
Christopher Lam
2349e785c4 Bug 773169 - General Ledger Report report name should be specified
Running trep-options-generator directly from transaction.scm seems to
set the report title properly. The previous code aimed to create a new
options object using transaction report's uuid and reportname, and I
do not anticipate any material change to the report output.
2019-02-13 22:23:44 +08:00
Christopher Lam
06941ca0e6 Bug 797074 - Reports with averages are displaying fractions
Convert amounts to decimal prior to adding to html-table.  Also adds
tests to make sure averages are displayed in 2 decimal places.
2019-02-13 22:23:44 +08:00
Christian Stimming
dac94ce038 Remove ktoblzcheck dependency.
Remove old (non-SEPA) online transaction code, because now in 2019
the banks will only offer SEPA transactions and no others. This
in turn means we don't need the old ktoblzcheck checking functions
at all, hence I remove this dependency completely.
2019-02-13 11:26:39 +01:00
John Ralls
140eb0b110 Log a warning in gnc_get_locale() instead of writing to stderr. 2019-02-12 12:58:42 -08:00
John Ralls
67f5dfb034 Bug 796946 - Mortgage and Loan Repayment Setup tool crashes when...
exiting "Loan Repayment Options" page.

Because libstdc++ on Windows doesn't support any C++ locales besides
"C" and throws an exception if you try.

To work around this use GetNumberFormatW (not GetCurrencyFormatW,
that includes the currency symbol) to create a formatted number string
with the right separators, grouping, and precision.
2019-02-12 12:53:13 -08:00
Michiel Brentjens
4c4acb7e92
Update gnc-tree-view-split-reg.c
gcc version 8.2.1 20181127 (GCC) gave a warning pointing at the problem.
2019-02-12 21:50:31 +01:00
John Ralls
bfadfd7d6d Fix erratic localization of dates on Windows.
Date format selection on Windows relies on Windows National Language
functions and those are unaffected by the POSIX setlocale(). We have
in the past relied upon gtk initialization to handle this but it has
not been reliable since the move to Gtk3. Note that this applies only
when the locale is set via a Unix-style environment variable (typically
LANG) or in the environment file; it's unnecessary and ignored when
using the localization settings in Region & Language.
2019-02-11 16:24:03 -08:00
John Ralls
8f88b7f2b0 Restore the global locale after Guile munges it.
There's no way to change the environment locale on Windows so calling
setlocale(LC_ALL, ""), as guile does in its init routine, reads the
user's Language and Region settings instead of the environment
variables. We save the discovered environment locale and call setlocale
with it again after Guile has initialized.
2019-02-10 15:45:29 -08:00