A transaction's value should be balanced independently in trading and
non-trading splits to be considered balanced. Incorrect adjustment
of exchange rates on existing splits can cause this to be an issue.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@22645 57a11ea4-9604-0410-9ed3-97b8803252fd
This patch is an updated patch which I have been fighting with the sort
model on. It allows you to add, delete and modify basic transactions
and splits with the toolbar buttons. Jump and move to blank are
also working.
Visual indication of read only and future transactions are
also implemented.
As before, do not open same account in old and new register.
Tab key works manually but needs more work, cell editable value does not
seem to be reliable which was the way I was going to auto step over
uneditable cells.
There is another problem if you enter the debit/credit value before the
account, you will get an error in the trace file but entries
are recorded, not sure of answer.
New transactions are not added in date order at the moment, this was
going to be done by the sort model or the existing method of reload
register via the commented out watchers in ledger-display.
All the numeric functions are the existing ones from the rewrite and as
such I have not proved they are correct but a basic transaction seems to
work.
Author: Robert Fewell <14ubobit@gmail.com>
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@22448 57a11ea4-9604-0410-9ed3-97b8803252fd
It was removed in SVN r21579, "Cruft Reduction"< but it's not cruft.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@22382 57a11ea4-9604-0410-9ed3-97b8803252fd
This is very incomplete, but at the same time well isolated from the
rest of the code, so it is easy to disable should it not get functional
and stable before the next major release.
I decided to include it in trunk to give it more visibility and prevent
bitrot in the patch.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@22289 57a11ea4-9604-0410-9ed3-97b8803252fd
The actual change to configure.ac (at line 1106) to enable -Wunused -- or rather to un-disable it -- is not included in order to not break the build for folks with buggy versions of swig.
(For example, https://sourceforge.net/tracker/?func=detail&aid=3530021&group_id=1645&atid=101645)
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@22203 57a11ea4-9604-0410-9ed3-97b8803252fd
(Initially I thought there were a relation to the "freeze" state of a
transaction, but this turned out to be not the case.)
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@22118 57a11ea4-9604-0410-9ed3-97b8803252fd
As usual, re-indentation was done using astyle-1.24 using the following options:
astyle --indent=spaces=4 --brackets=break --pad-oper --pad-header --suffix=none
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@21816 57a11ea4-9604-0410-9ed3-97b8803252fd
analysis.
As a result, some unused functions and function prototypes are removed.
It did expose one real bug in Transaction.c so far.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@21687 57a11ea4-9604-0410-9ed3-97b8803252fd
Nothing in gnc-session-scm.c was being used, so deleted it and its corresponding header.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@21579 57a11ea4-9604-0410-9ed3-97b8803252fd
If an register is open on an account that has capital gains transactions
created by the lot scrubber when you quit Gnucash, a capital gains
transaction may be freed twice since it is freed when the associated
sale is freed and again when it is encountered on the list of
transactions to be freed.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@21495 57a11ea4-9604-0410-9ed3-97b8803252fd
This re-indentation was done using astyle-1.24 using the following options:
astyle --indent=spaces=4 --brackets=break --pad-oper --pad-header --suffix=none
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@20163 57a11ea4-9604-0410-9ed3-97b8803252fd
This is necessary for Bug #570042 but doesn't completely solve it until
the reports are updated to use the new API. This is backwards-compatible
with the slot data inserted by the book closing since 2010-03-02.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@19945 57a11ea4-9604-0410-9ed3-97b8803252fd
This patch changes the default rounding behaviour in GnuCash from
"Round to nearest even" to "Round away to infinity". See the bugreport
for more details on these different rounding methods.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@19695 57a11ea4-9604-0410-9ed3-97b8803252fd
This also strips trailing whitespaces from lines where they existed.
This re-indentation was done using astyle-1.24 using the following options:
astyle --indent=spaces=4 --brackets=break --pad-oper --pad-header --suffix=none
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@18970 57a11ea4-9604-0410-9ed3-97b8803252fd
Note that only the type was renamed, but not any enums or function names.
Hence, the scheme wrappers should be unchanged completely (hopefully).
Discussed at http://lists.gnucash.org/pipermail/gnucash-devel/2010-March/027679.html
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@18969 57a11ea4-9604-0410-9ed3-97b8803252fd
In addition to the known timespec, the date is also stored
as a kvp_value of TYPE_GDATE so that we know afterwards this
date has really been set as a date.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@18925 57a11ea4-9604-0410-9ed3-97b8803252fd
This also strips trailing whitespaces from lines where they existed.
This re-indentation was done using astyle-1.24 using the following options:
astyle --indent=spaces=4 --brackets=break --pad-oper --pad-header --suffix=none
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@18788 57a11ea4-9604-0410-9ed3-97b8803252fd
Those were introduced in r17724, bug#539957, but apparently this
C99 is not supported by MSVC and won't be for some time to come.
Hence, for MSVC we need the workaround to define a macro that will
shadow the member names. However, the initialization itself works
fine and non-MSVC code is unchanged, so I think we can live with that.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@18755 57a11ea4-9604-0410-9ed3-97b8803252fd
However, this code doesn't compile with MSVC9.0 for a few reasons:
1. libguile.h comes with its own scmconfig.h which contains HAVE_STDINT_H
whereas MSVC doesn't have that. This is stupid guile which doesn't accept
the fact that the user uses a different compiler than how they compiled guile.
2. Some initializations are not supported: Account.c:3312 etc.
3. The C99 "designated initializers" of e.g. Account.c:4661 ff. (r17724,
bug#539957) are not supported by MSVC9.0 - this is the hardest problem
of these all.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@18738 57a11ea4-9604-0410-9ed3-97b8803252fd
Patch by Mike Alexander:
This patch implements trading accounts somewhat as described in Peter
Selinger's document at
<http://www.mathstat.dal.ca/~selinger/accounting/gnucash.html>. Although he
describes it as a multiple currency problem, it really applies to any
transactions involving multiple commodities (for example buying or selling a
stock) Hence I've called the trading accounts "commodity exchange accounts"
which seems more descriptive.
In summary these patches add an option to use commodity exchange accounts and
if it is on a transaction must be balanced both in value (in the transaction
currency) and in each commodity or currency used in any split in the
transaction. If a transaction only contains splits in the transaction currency
then this is the same rule as Gnucash has always enforced.
In this patch, the option to use trading accounts has been moved from
Edit->Preferences to File->Properties and is now associated with the active
book instead of being a global option. If you have set the global value on in
a previous version you will need to set it on again in each file for which you
want trading accounts, the previous global setting will be ignored.
A more detailed list of changes follows:
1. Added a "Use commodity exchange accounts" per-book option.
2. Added gnc_monetary and MonetaryList data types.
3. Renamed xaccTransGetImbalance to xaccTransGetImbalanceValue and added a new
xaccTransGetImbalance that returns a MonetaryList. Also added
xaccTransIsBalanced to see if the transaction is balanced without returning a
GList that needs to be freed. It calls both xaccTransGetImbalance and
xaccTransGetImbalanceValue since a transaction may be unbalanced with regard to
either without being unbalanced with regard to the other.
4. Changed gnc_split_register_get_debcred_bg_color to use xaccTransIsBalanced.
5. Changed gnc_split_register_balance_trans to not offer to adjust an existing
split if there imbalances in multiple currencies. Because of bugs in the
register code this is rarely called.
6. Changed importers to use xaccTransGetImbalanceValue to check for imbalance,
assuming that they won't create multiple currency trasactions.
7. Changed xaccTransScrubImbalance to create a balancing split for each
imbalanced commodity in the transaction. Also balances the transaction value.
The commodity balancing splits go into accounts in the hierarchy
Trading:NAMESPACE:COMMODITY. The value balancing splits go into
Imbalance-CURRENCY as before.
8. Changed xaccSplitConvertAmount to use xaccTransIsBalanced instead of
xaccTransGetImbalance.
9. Changed gnc_split_register_get_debcred_entry to sometimes use the split
amount instead of value if using currency accounts.
If the register is a stock register (i.e., shows shares and prices), it uses
the value if the split is in the register commodity (i.e. is for the stock) and
the amount otherwise. It shows the currency symbol unless the commodity is the
default currency.
If the register is not a stock register it always uses the amount and shows the
currency symbol if the split is not in the register commodity.
Also changed it to not return a value for a null split unless the transaction
is unbalanced in exactly one currency. This is what goes in a blank split as
the proposed value.
10. Changed refresh_model_row to use xaccTransGetImbalanceValue to get the
imbalance, assuming that importers don't create transactions in multiple
currencies. Also same change in gnc_import_process_trans_item,
downloaded_transaction_append, and gnc_import_TransInfo_is_balanced.
11. Changed the TRANS_IMBALANCE accessor method in xaccTransRegister to use
xaccTransGetImbalanceValue. As far as I can tell this is only used by the
"pd-balance" query type in gnc_scm2query_term_query_v1() defined in
engine-helpers.c. This query type only tests the result for zero/non-zero.
12. Changed xaccTransGetAccountConvRate to accept any split into the correct
commodity instead of insisting on one into the provided account. Then can use
it in xaccTransScrubImbalance to set the value of the imbalance split from its
amount, however later changed xaccTransScrubImbalance to not use it. Instead
it sets the value for the new split correctly to keep the value of the whole
transaction balanced.
13. Changed the balance sheet report to include a new option to not compute
unrealized gains and losses.
14. Related to 9 above, changed gnc_split_register_auto_calc to not do anything
if given a stock register where the value cell doesn't contain the value.
15. Also related to 9, changed gnc_split_register_save_amount_values to set the
amount and value fields in the split correctly when using trading accounts.
16. Changed the new account and edit account dialogs to allow any commodity or
currency for an income account if using trading accounts. It would be better
to add a new account type for trading accounts, but that's a big deal and I'll
leave that for later after we see whether this set of changes is going to be
accepted or rejected.
17. Change gnc_xfer_dialog_run_exchange_dialog to understand that the new value
is really the split's amount if using trading accounts.
18. Changed xaccSplitGetOtherSplit to ignore trading splits if using commodity
exchange accounts.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@18429 57a11ea4-9604-0410-9ed3-97b8803252fd
fails. Most engine objects catch the qof commit but then just log the
problem to the trace log. Now, the engine objects will invoke this
callback. gnc-main-window registers a callback and opens a dialog box
to inform the user. This is necessary because with an sql backend,
commits happen whenever an object is created or modified, not just
synchronously when the user selects to save the file.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@17667 57a11ea4-9604-0410-9ed3-97b8803252fd
Those two functions were merged into one, qof_instance_get_guid(), in
r15773, but they returned different values if the parameter was NULL.
Some code depends on the return value being guid_null(), or maybe even
NULL, so revert the changes entity->instance, where the entity is not
guaranteed to be non-NULL.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@16212 57a11ea4-9604-0410-9ed3-97b8803252fd
single pair of fields attached to the QofInstance object.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@16041 57a11ea4-9604-0410-9ed3-97b8803252fd