[Kmymoney-devel] Import of QIF investment transactions that have commissions

jeffjl.kde at outlook.com jeffjl.kde at outlook.com
Wed Aug 26 16:33:04 UTC 2015


I am using KMM 4.7.2.  I export my data from Quicken 2013 to a QIF file.  When KMM imports a QIF investment buy or sell transaction that includes a commission, the total for the transaction has the commission added 3 times, so the total amount is wrong, and the warning triangle is added to the record in the ledger view.
 
I have debugged this and come up with fixes. But I'm surprised (and concerned about the impact of my changes) that this has not been brought up as an issue before.
 
The changes that make the import work and remove the warning in the ledger are summarized below: 
 
1. The "T" line in the QIF buy/sell record is the total including commissions.  MyMoneyQifReader::processInvestmentTransactionEntry() puts the total from the "T" line in tr.m_amount.  It also puts the commission in tr.m_fees, so they are included in the transaction.  I changed it so that tr.m_amount is the amount without the commission.
 
2. The original MyMoneyStatementReader::processTransactionEntry() adds the transaction amount and the transaction fee and puts the result in the split s1.value.  In the original code, since the amount already includes the commission, this is the 2nd addition of the commission.  Since the fee is going to be split out separately, I changed this to not add the fee to s1.value, and from change #1, s1.value now has no commission in it.
 
3. Since the QIF reader did not put the price per share in the transaction (even though it is available), the statement reader calculates a price per share.  But it adds the commission to the transaction amount (which originally already included the commission) before dividing by the number of shares.  This effectively adds the commission for the 3rd time.  I changed it to not add the commission when calculating the price per share, and due to change #1 use the amount that does not include any commission. (This results in calculating the price per share that is in the QIF file but is not used.)
 
4. Finally, to get rid of the warning triangle, I had to change the amount that gets split to the investment account's associated checking account.  I had to add the commission to "transfervalue".  This actually puts "transfervalue" back to the number it would have had in the original code since the transaction amount originally included the commission.
 
With these changes, I can import my QIF and the buy/sell transactions in both ledgers (investment and associated checking) have the correct numbers and no warning triangles.  
 
Comments?
 
Thanks,
Jeff.
 
 
 
 
 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kmymoney-devel/attachments/20150826/7883264d/attachment.html>


More information about the KMyMoney-devel mailing list