Commit e9011f2a authored by Łukasz Wojniłowicz's avatar Łukasz Wojniłowicz
Browse files

Calculate investment performance if starting balance isn't zero

BUG:375550
FIXED-IN:5.0
parent 52611c67
......@@ -1056,7 +1056,7 @@ void QueryTable::constructPerformanceRow(const ReportAccount& account, TableRow&
MyMoneyMoney buysTotal = buys.total();
MyMoneyMoney sellsTotal = sells.total();
MyMoneyMoney cashincomeTotal = cashincome.total();
if (!buysTotal.isZero()) {
if (!buysTotal.isZero() || !startingBal.isZero()) {
returnInvestment = (sellsTotal + buysTotal + cashincomeTotal + endingBal - startingBal) / (startingBal - buysTotal);
returnInvestment = returnInvestment.convert(10000);
} else
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment