merges ideas from Phil Longstaff's ytd-budget.scm report. differences
from non-envelope budget:
* envelope budgeting accumulates bgt/act/diff amounts from period=0
e.g. selecting periods 2 to 4 means amounts must accumulate from
period 0 to 1 (not shown) and accumulated amounts 2 to 4 (shown).
* total column must encompass all periods from 0 to maxperiod
scm_c_string_length() returns the wrong answer when the C string is
UTF8: It returns the number of codepoints because the SCM string is in
UTF32, but we need the number of bytes for gtk_text_buffer_set_text.
Fortunately scm_to_utf8_string returns a null-terminated string so
we can just tell gtk_text_buffer_set_text to figure it out on its own.
Guile doesn't use g_malloc so don't use g_free, and gpointer* is a
void** so change the cast to void* for free.
this option is useless; it does not enforce currency conversion, it
was merely used for "Amount Due, XXX" currency-mnemonic. Remove this
option, and modify code to use invoice currency instead.
pricealist is a long list generated once, yet is dumped via gnc:debug
for every call to gnc:exchange-by-pricealist-nearest. This change
moves gnc:debug to the initial pricealist generation, ensuring that
gnc:exchange-by-pricealist-nearest is much faster.
This function converted to purely functional approach.
Note that commodity-collectors always round amounts to the currency
SCU therefore we replicate the behaviour here.
this test had confused 2 functions:
(exchange-fn monetary currency) --> monetary
and
(to-report-currency currency amount date) --> amount
this flaw surfaces with the shortened gnc:sum-collector-commodity definition.
When asset/liability/income/expense accounts are either missing or
deselected, the report would crash. This commit will ensure the
date-specific balance calculators do not crash.
The reason for crash is the form (apply map gnc:monetaries-add lists)
where lists is usually a list-of-list-of-monetaries, e.g.
(list (list $1.00 $2.00 $3.00)
(list $2.35 $3.44 $4.45))
and (apply map gnc:monetaries-add lists) will return a list of the
matched sums, i.e. commodity-collectors (list (list <$3.35> <$5.44>
<$7.45>)), whereby each commodity-collector is denoted by <...>
When there are missing account-types (or deselected) the lists are
empty-lists, therefore mapping will fail. This change ensures that
null-lists are handled by returning (list (list <> <> <>)), with null
commodity-collectors.
code sets date-option to today. it fails to set the default-value. the
date will reset when user click 'reset options', and this commit
ensures the 'today' date remains the default date.
Previous 9ed0174cb would place any entry with customername == "No
Customer" last, including genuine customers with this particular
name. This commit modifies to test on presence of owner-report-url to
detect owner/no-owner entries. This is reliable for this report.
The widget with the log messages didn't fill the space
in the dialog anymore. Probably a side-effect of 58465432,
but fixed now anyway.
Also, one label whose "translatable" attribute was removed
had to get it again.
view_selection_function added to only allow adding a row to the selection if GNCImport_Add is set for the transaction.
Explicit selection clearing
try explicitly clearing the row in the add, update and clear toggle callbacks - before refresh row and add debugging info which showed that the selection is called after exiting the above callbacks and as the view_selection_function has no knowledge that the add checkbox has just been toggled it allows the row to be selected. Requires a flag to be set in the add_toggle_cb which prevents selection in the view_selection_function and is cleared there.
Fix row being selected after A(dd)toggled
When the A is toggled on from U+R or R the row is automatically selected and if the row is toggled back to U+R or R selected, it cannot be unselected. Add a global add-toggled flag set in the gnc_gen_trans_add-toggled_cb and used in the treeview multiple selection function to prevent a row being selected immediately after the A has been toggled.
Fix to Multiple selection to ensure the match dialog comes up on double click on a reconciled or update row and implement a view_selection_function so that only rows flagged for addition can be added to a selection
Fixes requested by Bob-IT
removed global add_toggled variable and added it to _main_matcher_info structure. modified gnc_gen_trans_add_toggled_cb and view_selection_function to use the _main_matcher_info member.
* profit/sales/expense are sorted within currency groups. each group
is prepended by currency-mnemonic header. header is rendered only
if num(currencies) > 1.
* markup/customername have no currency grouping.
* customername sorting ensures 'No Customer' entries are last.