These functions were unnecessarily complex and used to build html
report. Tests are not mandatory here... All tests still pass which
means the html-documents are being built up correctly.
this will modify a test which was calibrated to record purchase price
only. fix transaction creation to add prices for both purchase and
sales, and also fix test which was assuming no sale price was bring
recorded.
This is the general case for any transaction creation. Rewrite other
transaction creation routines to use it. All tests still work
unchanged, which confirms this function works well.
This will allow tests to create multisplit transactions, of an
arbitrary number of splits. If the list-of-split's values are not
balanced (i.e. total 0), the engine will create an Imbalance-CUR
split.
The motivation is to allow creation of complex multisplit
multicommodity transactions eg USD50 + GBP20 (USD25) = EUR66 (USD75)
as well as their prices GBP/USD = 25/20 and EUR/USD = 75/66.
* USD -50
* USD -25 = GBP -20
* USD +75 = EUR +66
This will be useful in creating tests for stock-based reports, whereby
stock sales need splits in STOCK/ASSET/INCOME accounts.
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).
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
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
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
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.
(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
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.
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.
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
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.
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.
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.
Indenting checkbox was erroneously disabled when: sortkey = date,
date-subtotal = not 'none.
This commit will allow indenting option in the above case.