Changeset View
Changeset View
Standalone View
Standalone View
kmymoney/reports/querytable.cpp
Show First 20 Lines • Show All 770 Lines • ▼ Show 20 Line(s) | 760 | if (it_split == myBegin) { | |||
---|---|---|---|---|---|
771 | 771 | | |||
772 | if (splitAcc.isInvest()) { | 772 | if (splitAcc.isInvest()) { | ||
773 | // use the institution of the parent for stock accounts | 773 | // use the institution of the parent for stock accounts | ||
774 | institution = splitAcc.parent().institutionId(); | 774 | institution = splitAcc.parent().institutionId(); | ||
775 | MyMoneyMoney shares = (*it_split).shares(); | 775 | MyMoneyMoney shares = (*it_split).shares(); | ||
776 | 776 | | |||
777 | qA["action"] = (*it_split).action(); | 777 | qA["action"] = (*it_split).action(); | ||
778 | qA["shares"] = shares.isZero() ? "" : shares.toString(); | 778 | qA["shares"] = shares.isZero() ? "" : shares.toString(); | ||
779 | qA["price"] = shares.isZero() ? "" : xr.convert(MyMoneyMoney::precToDenom(KMyMoneyGlobalSettings::pricePrecision())).toString(); | 779 | qA["price"] = shares.isZero() ? "" : xr.convertPrecision(splitAcc.currency().pricePrecision()).toString(); | ||
780 | 780 | | |||
781 | if (((*it_split).action() == MyMoneySplit::ActionBuyShares) && shares.isNegative()) | 781 | if (((*it_split).action() == MyMoneySplit::ActionBuyShares) && shares.isNegative()) | ||
782 | qA["action"] = "Sell"; | 782 | qA["action"] = "Sell"; | ||
783 | 783 | | |||
784 | qA["investaccount"] = splitAcc.parent().name(); | 784 | qA["investaccount"] = splitAcc.parent().name(); | ||
785 | 785 | | |||
786 | MyMoneySplit stockSplit = (*it_split); | 786 | MyMoneySplit stockSplit = (*it_split); | ||
787 | MyMoneySplit assetAccountSplit; | 787 | MyMoneySplit assetAccountSplit; | ||
▲ Show 20 Lines • Show All 339 Lines • ▼ Show 20 Line(s) | 1126 | else | |||
1127 | qA["currency"] = account.currency().id(); | 1127 | qA["currency"] = account.currency().id(); | ||
1128 | 1128 | | |||
1129 | qA["accountid"] = account.id(); | 1129 | qA["accountid"] = account.id(); | ||
1130 | qA["account"] = account.name(); | 1130 | qA["account"] = account.name(); | ||
1131 | qA["topaccount"] = account.topParentName(); | 1131 | qA["topaccount"] = account.topParentName(); | ||
1132 | qA["institution"] = institution.isEmpty() ? i18n("No Institution") : file->institution(institution).name(); | 1132 | qA["institution"] = institution.isEmpty() ? i18n("No Institution") : file->institution(institution).name(); | ||
1133 | qA["rank"] = "0"; | 1133 | qA["rank"] = "0"; | ||
1134 | 1134 | | |||
1135 | qA["price"] = startPrice.convert(MyMoneyMoney::precToDenom(KMyMoneyGlobalSettings::pricePrecision())).toString(); | 1135 | qA["price"] = startPrice.convertPrecision(account.currency().pricePrecision()).toString(); | ||
1136 | if (account.isInvest()) { | 1136 | if (account.isInvest()) { | ||
1137 | qA["shares"] = startShares.toString(); | 1137 | qA["shares"] = startShares.toString(); | ||
1138 | } | 1138 | } | ||
1139 | 1139 | | |||
1140 | qA["postdate"] = strStartDate; | 1140 | qA["postdate"] = strStartDate; | ||
1141 | qA["balance"] = startBalance.convert(fraction).toString(); | 1141 | qA["balance"] = startBalance.convert(fraction).toString(); | ||
1142 | qA["value"].clear(); | 1142 | qA["value"].clear(); | ||
1143 | qA["id"] = 'A'; | 1143 | qA["id"] = 'A'; | ||
1144 | m_rows += qA; | 1144 | m_rows += qA; | ||
1145 | 1145 | | |||
1146 | //ending balance | 1146 | //ending balance | ||
1147 | qA["price"] = endPrice.convert(MyMoneyMoney::precToDenom(KMyMoneyGlobalSettings::pricePrecision())).toString(); | 1147 | qA["price"] = endPrice.convertPrecision(account.currency().pricePrecision()).toString(); | ||
1148 | 1148 | | |||
1149 | if (account.isInvest()) { | 1149 | if (account.isInvest()) { | ||
1150 | qA["shares"] = endShares.toString(); | 1150 | qA["shares"] = endShares.toString(); | ||
1151 | } | 1151 | } | ||
1152 | 1152 | | |||
1153 | qA["postdate"] = strEndDate; | 1153 | qA["postdate"] = strEndDate; | ||
1154 | qA["balance"] = endBalance.toString(); | 1154 | qA["balance"] = endBalance.toString(); | ||
1155 | qA["rank"] = "3"; | 1155 | qA["rank"] = "3"; | ||
▲ Show 20 Lines • Show All 338 Lines • ▼ Show 20 Line(s) | 1490 | { | |||
1494 | 1494 | | |||
1495 | MyMoneyMoney netprice = account.deepCurrencyPrice(m_config.toDate()); | 1495 | MyMoneyMoney netprice = account.deepCurrencyPrice(m_config.toDate()); | ||
1496 | if (m_config.isConvertCurrency() && account.isForeignCurrency()) | 1496 | if (m_config.isConvertCurrency() && account.isForeignCurrency()) | ||
1497 | netprice *= account.baseCurrencyPrice(m_config.toDate()); // display currency is base currency, so set the price | 1497 | netprice *= account.baseCurrencyPrice(m_config.toDate()); // display currency is base currency, so set the price | ||
1498 | 1498 | | |||
1499 | netprice = netprice.reduce(); | 1499 | netprice = netprice.reduce(); | ||
1500 | shares = shares.reduce(); | 1500 | shares = shares.reduce(); | ||
1501 | 1501 | | |||
1502 | qaccountrow["price"] = netprice.convert(MyMoneyMoney::precToDenom(KMyMoneyGlobalSettings::pricePrecision())).toString(); | 1502 | qaccountrow["price"] = netprice.convertPrecision(account.currency().pricePrecision()).toString(); | ||
1503 | qaccountrow["value"] = (netprice * shares).convert(fraction).toString(); | 1503 | qaccountrow["value"] = (netprice * shares).convert(fraction).toString(); | ||
1504 | qaccountrow["shares"] = shares.toString(); | 1504 | qaccountrow["shares"] = shares.toString(); | ||
1505 | 1505 | | |||
1506 | QString iid = account.institutionId(); | 1506 | QString iid = account.institutionId(); | ||
1507 | 1507 | | |||
1508 | // If an account does not have an institution, get it from the top-parent. | 1508 | // If an account does not have an institution, get it from the top-parent. | ||
1509 | if (iid.isEmpty() && !account.isTopLevel()) | 1509 | if (iid.isEmpty() && !account.isTopLevel()) | ||
1510 | iid = account.topParent().institutionId(); | 1510 | iid = account.topParent().institutionId(); | ||
▲ Show 20 Lines • Show All 181 Lines • ▼ Show 20 Line(s) | 1665 | do { | |||
1692 | if (splitAcc.isInvest()) { | 1692 | if (splitAcc.isInvest()) { | ||
1693 | 1693 | | |||
1694 | // use the institution of the parent for stock accounts | 1694 | // use the institution of the parent for stock accounts | ||
1695 | institution = splitAcc.parent().institutionId(); | 1695 | institution = splitAcc.parent().institutionId(); | ||
1696 | MyMoneyMoney shares = (*it_split).shares(); | 1696 | MyMoneyMoney shares = (*it_split).shares(); | ||
1697 | 1697 | | |||
1698 | qA["action"] = (*it_split).action(); | 1698 | qA["action"] = (*it_split).action(); | ||
1699 | qA["shares"] = shares.isZero() ? "" : (*it_split).shares().toString(); | 1699 | qA["shares"] = shares.isZero() ? "" : (*it_split).shares().toString(); | ||
1700 | qA["price"] = shares.isZero() ? "" : xr.convert(MyMoneyMoney::precToDenom(KMyMoneyGlobalSettings::pricePrecision())).toString(); | 1700 | qA["price"] = shares.isZero() ? "" : xr.convertPrecision(splitAcc.currency().pricePrecision()).toString(); | ||
1701 | 1701 | | |||
1702 | if (((*it_split).action() == MyMoneySplit::ActionBuyShares) && (*it_split).shares().isNegative()) | 1702 | if (((*it_split).action() == MyMoneySplit::ActionBuyShares) && (*it_split).shares().isNegative()) | ||
1703 | qA["action"] = "Sell"; | 1703 | qA["action"] = "Sell"; | ||
1704 | 1704 | | |||
1705 | qA["investaccount"] = splitAcc.parent().name(); | 1705 | qA["investaccount"] = splitAcc.parent().name(); | ||
1706 | } | 1706 | } | ||
1707 | 1707 | | |||
1708 | include_me = m_config.includes(splitAcc); | 1708 | include_me = m_config.includes(splitAcc); | ||
1709 | a_fullname = splitAcc.fullName(); | 1709 | a_fullname = splitAcc.fullName(); | ||
1710 | a_memo = (*it_split).memo(); | 1710 | a_memo = (*it_split).memo(); | ||
1711 | 1711 | | |||
1712 | qA["price"] = xr.convert(MyMoneyMoney::precToDenom(KMyMoneyGlobalSettings::pricePrecision())).toString(); | 1712 | qA["price"] = xr.convertPrecision(splitAcc.currency().pricePrecision()).toString(); | ||
1713 | qA["account"] = splitAcc.name(); | 1713 | qA["account"] = splitAcc.name(); | ||
1714 | qA["accountid"] = splitAcc.id(); | 1714 | qA["accountid"] = splitAcc.id(); | ||
1715 | qA["topaccount"] = splitAcc.topParentName(); | 1715 | qA["topaccount"] = splitAcc.topParentName(); | ||
1716 | 1716 | | |||
1717 | qA["institution"] = institution.isEmpty() | 1717 | qA["institution"] = institution.isEmpty() | ||
1718 | ? i18n("No Institution") | 1718 | ? i18n("No Institution") | ||
1719 | : file->institution(institution).name(); | 1719 | : file->institution(institution).name(); | ||
1720 | 1720 | | |||
▲ Show 20 Lines • Show All 158 Lines • ▼ Show 20 Line(s) | 1878 | else | |||
1879 | qA["currency"] = account.currency().id(); | 1879 | qA["currency"] = account.currency().id(); | ||
1880 | 1880 | | |||
1881 | qA["accountid"] = account.id(); | 1881 | qA["accountid"] = account.id(); | ||
1882 | qA["account"] = account.name(); | 1882 | qA["account"] = account.name(); | ||
1883 | qA["topaccount"] = account.topParentName(); | 1883 | qA["topaccount"] = account.topParentName(); | ||
1884 | qA["institution"] = institution.isEmpty() ? i18n("No Institution") : file->institution(institution).name(); | 1884 | qA["institution"] = institution.isEmpty() ? i18n("No Institution") : file->institution(institution).name(); | ||
1885 | qA["rank"] = "0"; | 1885 | qA["rank"] = "0"; | ||
1886 | 1886 | | |||
1887 | qA["price"] = startPrice.convert(MyMoneyMoney::precToDenom(KMyMoneyGlobalSettings::pricePrecision())).toString(); | 1887 | qA["price"] = startPrice.convertPrecision(account.currency().pricePrecision()).toString(); | ||
1888 | if (account.isInvest()) { | 1888 | if (account.isInvest()) { | ||
1889 | qA["shares"] = startShares.toString(); | 1889 | qA["shares"] = startShares.toString(); | ||
1890 | } | 1890 | } | ||
1891 | 1891 | | |||
1892 | qA["postdate"] = strStartDate; | 1892 | qA["postdate"] = strStartDate; | ||
1893 | qA["balance"] = startBalance.convert(fraction).toString(); | 1893 | qA["balance"] = startBalance.convert(fraction).toString(); | ||
1894 | qA["value"].clear(); | 1894 | qA["value"].clear(); | ||
1895 | qA["id"] = 'A'; | 1895 | qA["id"] = 'A'; | ||
1896 | m_rows += qA; | 1896 | m_rows += qA; | ||
1897 | 1897 | | |||
1898 | qA["rank"] = "3"; | 1898 | qA["rank"] = "3"; | ||
1899 | //ending balance | 1899 | //ending balance | ||
1900 | qA["price"] = endPrice.convert(MyMoneyMoney::precToDenom(KMyMoneyGlobalSettings::pricePrecision())).toString(); | 1900 | qA["price"] = endPrice.convertPrecision(account.currency().pricePrecision()).toString(); | ||
1901 | 1901 | | |||
1902 | if (account.isInvest()) { | 1902 | if (account.isInvest()) { | ||
1903 | qA["shares"] = endShares.toString(); | 1903 | qA["shares"] = endShares.toString(); | ||
1904 | } | 1904 | } | ||
1905 | 1905 | | |||
1906 | qA["postdate"] = strEndDate; | 1906 | qA["postdate"] = strEndDate; | ||
1907 | qA["balance"] = endBalance.toString(); | 1907 | qA["balance"] = endBalance.toString(); | ||
1908 | qA["id"] = 'Z'; | 1908 | qA["id"] = 'Z'; | ||
1909 | m_rows += qA; | 1909 | m_rows += qA; | ||
1910 | } | 1910 | } | ||
1911 | } | 1911 | } | ||
1912 | 1912 | | |||
1913 | 1913 | | |||
1914 | 1914 | | |||
1915 | } | 1915 | } |