[Patch] Add a reversing transaction to the one(s) currently selected

Thomas Baumgart thb at net-bembel.de
Tue Mar 24 18:33:29 GMT 2020


On Dienstag, 24. März 2020 02:05:33 CET Dawid Wrobel wrote:

> On Sat, Mar 21, 2020 at 1:41 PM Thomas Baumgart <thb at net-bembel.de> wrote:
> 
> > Eventually we will do that. Guess I have to learn how to work with those
> > pull requests then.
> 
> I am looking forward to this.
> 
> Why do you use
> >
> >         d->m_value = d->m_value * MyMoneyMoney::MINUS_ONE;
> > instead of
> >         d->m_value = -d->m_value;
> >
> 
> I saw it used in a similar fashion in a number of places, e.g. in
> mymoneyforecast.cpp, so I assumed it was the "KMyMoney" way to do it.

Hmm, an addition is usually faster than a multiplication, hence why. That was
probably written before we had a unary minus operator.

> > Also, make sure to invert the sign of the MyMoneySplit::m_shares member as
> > well. Otherwise, your book-keeping is off ;)
> >
> 
> Indeed, I missed that one. Thank you. Fixed and tested with an investment
> account.

It is not only relevant for investment transactions but used in other cases as well.
E.g. it becomes important in multi-currency transactions.

How do we want to proceed with your changes? I could get them from your repo and add
them to KMyMoney.

Thomas

-- 

Regards

Thomas Baumgart

https://www.signal.org/       Signal, the better WhatsApp
-------------------------------------------------------------
Q: How do you make a water bed more bouncy? A: Fill it with spring water!
-------------------------------------------------------------
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 868 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kmymoney-devel/attachments/20200324/f9e1041a/attachment.sig>


More information about the KMyMoney-devel mailing list