Changeset View
Changeset View
Standalone View
Standalone View
kmymoney/views/khomeview.cpp
Show First 20 Lines • Show All 931 Lines • ▼ Show 20 Line(s) | 927 | { | |||
---|---|---|---|---|---|
932 | for (it_a = acc.accountList().begin(); it_a != acc.accountList().end(); ++it_a) { | 932 | for (it_a = acc.accountList().begin(); it_a != acc.accountList().end(); ++it_a) { | ||
933 | MyMoneyAccount stock = file->account(*it_a); | 933 | MyMoneyAccount stock = file->account(*it_a); | ||
934 | if (!stock.isClosed()) { | 934 | if (!stock.isClosed()) { | ||
935 | try { | 935 | try { | ||
936 | MyMoneyMoney val; | 936 | MyMoneyMoney val; | ||
937 | MyMoneyMoney balance = file->balance(stock.id(), QDate::currentDate()); | 937 | MyMoneyMoney balance = file->balance(stock.id(), QDate::currentDate()); | ||
938 | MyMoneySecurity security = file->security(stock.currencyId()); | 938 | MyMoneySecurity security = file->security(stock.currencyId()); | ||
939 | const MyMoneyPrice &price = file->price(stock.currencyId(), security.tradingCurrency()); | 939 | const MyMoneyPrice &price = file->price(stock.currencyId(), security.tradingCurrency()); | ||
940 | val = (balance * price.rate(security.tradingCurrency())).convert(MyMoneyMoney::precToDenom(KMyMoneyGlobalSettings::pricePrecision())); | 940 | val = (balance * price.rate(security.tradingCurrency())).convertPrecision(security.pricePrecision()); | ||
941 | // adjust value of security to the currency of the account | 941 | // adjust value of security to the currency of the account | ||
942 | MyMoneySecurity accountCurrency = file->currency(acc.currencyId()); | 942 | MyMoneySecurity accountCurrency = file->currency(acc.currencyId()); | ||
943 | val = val * file->price(security.tradingCurrency(), accountCurrency.id()).rate(accountCurrency.id()); | 943 | val = val * file->price(security.tradingCurrency(), accountCurrency.id()).rate(accountCurrency.id()); | ||
944 | val = val.convert(acc.fraction()); | 944 | val = val.convert(acc.fraction()); | ||
945 | value += val; | 945 | value += val; | ||
946 | } catch (const MyMoneyException &e) { | 946 | } catch (const MyMoneyException &e) { | ||
947 | qWarning("%s", qPrintable(QString("cannot convert stock balance of %1 to base currency: %2").arg(stock.name(), e.what()))); | 947 | qWarning("%s", qPrintable(QString("cannot convert stock balance of %1 to base currency: %2").arg(stock.name(), e.what()))); | ||
948 | } | 948 | } | ||
▲ Show 20 Lines • Show All 1081 Lines • Show Last 20 Lines |