When I try to enter investment transactions manually, I have to enter the total sale or buy amount in the field labeled "price/share". Otherwise the data is incorrectly entered into the database. Reproducible: Always Steps to Reproduce: 1. Open investment ledger. 2. Click "new" 3. Enter data. 4. If data is entered as shown on the form, after clicking "enter" ledger shows an incorrect price per share. However if one substitutes the total sale or buy amount in the "Price/share" field, the data show correctly on the ledger. Actual Results: Computer calculates an incorrect price per share. Expected Results: Entering the price per share should yield the correct data (or the form should be relabeled). Although I figured out a workaround by trial and error, it took a long time. This needs to be fixed soon to prevent frustration by other users. It's a basic flaw that should not be present in software that is this mature.
In these circumstances, what happens depends on the settings for the stock concerned. If you edit the stock, in Investment details, the last parameter allows a choice for price entry. This is covered in the handbook.
This was resolved incorrectly. Yes, the behaviour changes depending on whether you set the stock's price entry to "Total for all shares" or "Price per share", but the field labels are not updating to reflect that behaviour. Regardless of which setting you're using, you'll always have two fields: an editable field named "Price/share" and a non-editable field named "Total". If your setting is set to "Price per share", it works as expected: you type in your number of shares, your price per share, and it multiplies them to fill out the Total field. If you're using "Total for all shares", then you need to enter your shares in the Shares field, and then enter the *total value* in the *Price/share* field. Once you enter the transaction, it will move the total value you just entered into the "Total" field, and recalculate the "Price/share" field. The expected behaviour would be that, when using "Total for all shares", the "Total" field becomes editable and the "Price/share" field becomes non-editable.
I believe this issue is still present. The problem is not how the entry is handled - it is correctly handled according to the appropriate setting (price per share or total price.) The problem is the label on the entry field in the transaction form in the ledger does not change to indicate which one is being used - it ALWAYS says price/share. This can be very confusing, especially if you have it set differently for different investments.
Thanks to Jack and Rick for clarifying this bug. Yes, the failure to relabel the fields and make the appropriate field not editable depending on the input method selected is incorrect and very confusing.
I've just started to look at this, and the code, too, is pretty confusing. Some of it appears overly complicated, and wrong too. I haven't yet got my head around the complete picture, and I just hope things clarify, rather than the opposite.
Created attachment 94087 [details] Patch for bug.
I have this working now. There was no provision for relabelling the priceLabel. I felt that having a label of Transaction price' was not really accurate as a transaction does not have a price. So, instead, I've used 'Transaction amount'. This appears only on editing a transaction, otherwise 'Price/share' is used. 'Transaction amount' is used in several places in QIFReader. I'll add the patch here, but won't commit for a week or so.
@Allan: why don't you (also) post the patch on reviewboard? Makes it a lot easier to comment on.
(In reply to Thomas Baumgart from comment #8) > @Allan: why don't you (also) post the patch on reviewboard? Makes it a lot > easier to comment on. OK. Some while ago, when I queried this, Cristian said it wasn't necessary when a bug was involved. Also, reviewboard submissions seem to 'go to sleep' sometimes, so, if only a small patch is involved, I try to push it through as I sometimes have a number of things on the go and it avoids the hassle of having to collect my thoughts again. Anyway, will do.
Git commit 601bc8c80cfd5d04303f20be09dda635adea9cd5 by Allan Anderson. Committed on 19/08/2015 at 21:10. Pushed by allananderson into branch 'master'. Fix "Price/share" field on investment transaction entry form is mislabeled. M +22 -5 kmymoney/dialogs/investactivities.cpp M +1 -0 kmymoney/dialogs/investactivities.h M +9 -12 kmymoney/dialogs/investtransactioneditor.cpp M +2 -1 kmymoney/dialogs/investtransactioneditor.h http://commits.kde.org/kmymoney/601bc8c80cfd5d04303f20be09dda635adea9cd5
Thanks for your work on this Allan. I'm an end user that relies on version updates for the program on repositories. I have no clue how to compile and use a patch. Is there any estimate on when this fix might make it to a version in the repositories, and what version that will be? I'm currently using 4.7.2.
On 25/08/15 00:02, David wrote: > https://bugs.kde.org/show_bug.cgi?id=347166 > > --- Comment #11 from David <dph41375@yahoo.com> --- > Thanks for your work on this Allan. I'm an end user that relies on version > updates for the program on repositories. I have no clue how to compile and use > a patch. Is there any estimate on when this fix might make it to a version in > the repositories, and what version that will be? I'm currently using 4.7.2. > The patch has been committed. As I understand it, release 4.8.0 is provisionally scheduled for the end of September, beginning of October. I think that should include the MSWindows version. Allan
Allan - If I edit a transaction which imported as a Dividend, and switch it to Reinvestment Dividend, the label on that second field is blank, although it correctly uses the value I enter as total amount. If I save the transaction, it correctly displays the price/share, and if I edit it again, it correctly displays it as Transaction amount. Is there some other path through the code where you would need to set the label?
On 26/08/15 00:02, Jack wrote: > https://bugs.kde.org/show_bug.cgi?id=347166 > > Jack <ostroffjh@users.sourceforge.net> changed: > > What |Removed |Added > ---------------------------------------------------------------------------- > CC| |ostroffjh@users.sourceforge > | |.net > > --- Comment #13 from Jack <ostroffjh@users.sourceforge.net> --- > Allan - If I edit a transaction which imported as a Dividend, and switch it to > Reinvestment Dividend, the label on that second field is blank, although it > correctly uses the value I enter as total amount. If I save the transaction, > it correctly displays the price/share, and if I edit it again, it correctly > displays it as Transaction amount. Is there some other path through the code > where you would need to set the label? > Hi Jack I think I see what you mean, but my brain has shut down already. I'll investigate later. Allan
On 26/08/15 00:02, Jack wrote: > https://bugs.kde.org/show_bug.cgi?id=347166 > > Jack <ostroffjh@users.sourceforge.net> changed: > > What |Removed |Added > ---------------------------------------------------------------------------- > CC| |ostroffjh@users.sourceforge > | |.net > > --- Comment #13 from Jack <ostroffjh@users.sourceforge.net> --- > Allan - If I edit a transaction which imported as a Dividend, and switch it to > Reinvestment Dividend, the label on that second field is blank, although it > correctly uses the value I enter as total amount. If I save the transaction, > it correctly displays the price/share, and if I edit it again, it correctly > displays it as Transaction amount. Is there some other path through the code > where you would need to set the label? > This is a common feature of both Buy and Sell, as well as Reinvest. On opening a new transaction of any of these types, the Price field shows, but has no label. In xxxxxx::ShowWidgets(), showing the Price label is controlled by Activity::havePrice(), which in turn depends on the presence of a price. So the user has to first enter a price, but this isn't helped, for a new user, because of the absent label. I can't see the purpose of Activity::havePrice() here, and it certainly isn't helpful. The enabling of Enter is controlled by Activity::havePrice() anyway, and the entering of a price, so I would propose to remove it from the three ShowWidgets() methods of the activities that require a price. In your particular use case, there is a further problem, however. Changing a Dividend transaction to a Reinvest, results in an unbalanced transaction, with a missing assignment. This appears to be a hangover from your original Dividend transaction, so I'll need to see what's needed to remove that. Allan
Right, after a lot of toil, I have a fix for the 'unbalanced transaction, with a missing assignment' problem that Jack encountered, but I'm not sure it is the best way to fix the problem. More to follow. However , what I've done is to detect the change of transaction activity type, and when one is detected, return MymoneyMoney() from that split. Now, starting to clean up, I seem to find that const MyMoneyMoney MyMoneyTransaction:const MyMoneyMoney MyMoneyTransaction::splitSum() const const works without any detection involved, in other words , it always returns 0.00 for splitSum(), which seems strange. Any thoughts, anyone? I'll continue checking anyway.
From the source comment of MyMoneyTransaction::splitSum() /** * This method is used to return the sum of all splits of this transaction * * @return MyMoneyMoney value of sum of all splits */ and a general requirement for a balanced book is, that this sum is always zero. Otherwise, the transaction becomes imbalanced. So it is not strange at all but perfect. The value() member of all splits is used to sum up here.
(In reply to Thomas Baumgart from comment #17) > From the source comment of MyMoneyTransaction::splitSum() > > /** > * This method is used to return the sum of all splits of this transaction > * > * @return MyMoneyMoney value of sum of all splits > */ > > and a general requirement for a balanced book is, that this sum is always > zero. Otherwise, the transaction becomes imbalanced. So it is not strange at > all but perfect. The value() member of all splits is used to sum up here. ...and I nearly posted a follow-up to ignore me as it was rubbish! That helps me concentrate where needed. Thanks.
Comment on attachment 94087 [details] Patch for bug. this patch was superseded by - Git commit 601bc8c80cfd5d04303f20be09dda635adea9cd5 by Allan Anderson. Committed on 19/08/2015 at 21:10. Pushed by allananderson into branch 'master'. Fix "Price/share" field on investment transaction entry form is mislabeled.