Changeset View
Changeset View
Standalone View
Standalone View
kmymoney/reports/listtable.cpp
Show First 20 Lines • Show All 159 Lines • ▼ Show 20 Line(s) | 106 | { | |||
---|---|---|---|---|---|
160 | i18nHeaders["topcategory"] = i18n("Top Category"); | 160 | i18nHeaders["topcategory"] = i18n("Top Category"); | ||
161 | i18nHeaders["categorytype"] = i18n("Category Type"); | 161 | i18nHeaders["categorytype"] = i18n("Category Type"); | ||
162 | i18nHeaders["month"] = i18n("Month"); | 162 | i18nHeaders["month"] = i18n("Month"); | ||
163 | i18nHeaders["week"] = i18n("Week"); | 163 | i18nHeaders["week"] = i18n("Week"); | ||
164 | i18nHeaders["reconcileflag"] = i18n("Reconciled"); | 164 | i18nHeaders["reconcileflag"] = i18n("Reconciled"); | ||
165 | i18nHeaders["action"] = i18n("Action"); | 165 | i18nHeaders["action"] = i18n("Action"); | ||
166 | i18nHeaders["shares"] = i18n("Shares"); | 166 | i18nHeaders["shares"] = i18n("Shares"); | ||
167 | i18nHeaders["price"] = i18n("Price"); | 167 | i18nHeaders["price"] = i18n("Price"); | ||
168 | i18nHeaders["latestprice"] = i18n("Price"); | 168 | i18nHeaders["lastprice"] = i18n("Last Price"); | ||
169 | i18nHeaders["buyprice"] = i18n("Buy Price"); | ||||
169 | i18nHeaders["netinvvalue"] = i18n("Net Value"); | 170 | i18nHeaders["netinvvalue"] = i18n("Net Value"); | ||
170 | i18nHeaders["buys"] = i18n("Buys"); | 171 | i18nHeaders["buys"] = i18n("Buy Value"); | ||
171 | i18nHeaders["sells"] = i18n("Sells"); | 172 | i18nHeaders["sells"] = i18n("Sell Value"); | ||
172 | i18nHeaders["buysST"] = i18n("Short-term Buys"); | 173 | i18nHeaders["buysST"] = i18n("Short-term Buy Value"); | ||
173 | i18nHeaders["sellsST"] = i18n("Short-term Sells"); | 174 | i18nHeaders["sellsST"] = i18n("Short-term Sell Value"); | ||
174 | i18nHeaders["buysLT"] = i18n("Long-term Buys"); | 175 | i18nHeaders["buysLT"] = i18n("Long-term Buy Value"); | ||
175 | i18nHeaders["sellsLT"] = i18n("Long-term Sells"); | 176 | i18nHeaders["sellsLT"] = i18n("Long-term Sell Value"); | ||
176 | i18nHeaders["reinvestincome"] = i18n("Dividends Reinvested"); | 177 | i18nHeaders["reinvestincome"] = i18n("Dividends Reinvested"); | ||
177 | i18nHeaders["cashincome"] = i18n("Dividends Paid Out"); | 178 | i18nHeaders["cashincome"] = i18n("Dividends Paid Out"); | ||
178 | i18nHeaders["startingbal"] = i18n("Starting Balance"); | 179 | i18nHeaders["startingbal"] = i18n("Starting Balance"); | ||
179 | i18nHeaders["endingbal"] = i18n("Ending Balance"); | 180 | i18nHeaders["endingbal"] = i18n("Ending Balance"); | ||
181 | i18nHeaders["marketvalue"] = i18n("Market Value"); | ||||
180 | i18nHeaders["return"] = i18n("Annualized Return"); | 182 | i18nHeaders["return"] = i18n("Annualized Return"); | ||
181 | i18nHeaders["returninvestment"] = i18n("Return On Investment"); | 183 | i18nHeaders["returninvestment"] = i18n("Return On Investment"); | ||
182 | i18nHeaders["fees"] = i18n("Fees"); | 184 | i18nHeaders["fees"] = i18n("Fees"); | ||
183 | i18nHeaders["interest"] = i18n("Interest"); | 185 | i18nHeaders["interest"] = i18n("Interest"); | ||
184 | i18nHeaders["payment"] = i18n("Payment"); | 186 | i18nHeaders["payment"] = i18n("Payment"); | ||
185 | i18nHeaders["balance"] = i18n("Balance"); | 187 | i18nHeaders["balance"] = i18n("Balance"); | ||
186 | i18nHeaders["type"] = i18n("Type"); | 188 | i18nHeaders["type"] = i18n("Type"); | ||
187 | i18nHeaders["name"] = i18nc("Account name", "Name"); | 189 | i18nHeaders["name"] = i18nc("Account name", "Name"); | ||
Show All 12 Lines | |||||
200 | i18nHeaders["favorite"] = i18n("Preferred"); | 202 | i18nHeaders["favorite"] = i18n("Preferred"); | ||
201 | i18nHeaders["loanamount"] = i18n("Loan Amount"); | 203 | i18nHeaders["loanamount"] = i18n("Loan Amount"); | ||
202 | i18nHeaders["interestrate"] = i18n("Interest Rate"); | 204 | i18nHeaders["interestrate"] = i18n("Interest Rate"); | ||
203 | i18nHeaders["nextinterestchange"] = i18n("Next Interest Change"); | 205 | i18nHeaders["nextinterestchange"] = i18n("Next Interest Change"); | ||
204 | i18nHeaders["periodicpayment"] = i18n("Periodic Payment"); | 206 | i18nHeaders["periodicpayment"] = i18n("Periodic Payment"); | ||
205 | i18nHeaders["finalpayment"] = i18n("Final Payment"); | 207 | i18nHeaders["finalpayment"] = i18n("Final Payment"); | ||
206 | i18nHeaders["currentbalance"] = i18n("Current Balance"); | 208 | i18nHeaders["currentbalance"] = i18n("Current Balance"); | ||
207 | i18nHeaders["capitalgain"] = i18n("Capital Gain"); | 209 | i18nHeaders["capitalgain"] = i18n("Capital Gain"); | ||
210 | i18nHeaders["percentagegain"] = i18n("Percentage Gain"); | ||||
208 | i18nHeaders["capitalgainST"] = i18n("Short-term Gain"); | 211 | i18nHeaders["capitalgainST"] = i18n("Short-term Gain"); | ||
209 | i18nHeaders["capitalgainLT"] = i18n("Long-term Gain"); | 212 | i18nHeaders["capitalgainLT"] = i18n("Long-term Gain"); | ||
210 | 213 | | |||
211 | // the list of columns which represent money, so we can display them correctly | 214 | // the list of columns which represent money, so we can display them correctly | ||
212 | QStringList moneyColumns = QString("value,shares,price,latestprice,netinvvalue,buys,buysST,buysLT,sells,sellsST,sellsLT,cashincome,reinvestincome,startingbal,fees,interest,payment,balance,balancewarning,maxbalancelimit,creditwarning,maxcreditlimit,loanamount,periodicpayment,finalpayment,currentbalance,startingbal,endingbal,capitalgain,capitalgainST,capitalgainLT").split(','); | 215 | QStringList moneyColumns = QString("value,price,lastprice,buyprice,netinvvalue,buys,buysST,buysLT,sells,sellsST,sellsLT,cashincome,reinvestincome,startingbal,fees,interest,payment,balance,balancewarning,maxbalancelimit,creditwarning,maxcreditlimit,loanamount,periodicpayment,finalpayment,currentbalance,startingbal,endingbal,capitalgain,capitalgainST,capitalgainLT,marketvalue").split(','); | ||
213 | 216 | | |||
214 | // the list of columns which represent shares, which is like money except the | 217 | // the list of columns which represent shares, which is like money except the | ||
215 | // transaction currency will not be displayed | 218 | // transaction currency will not be displayed | ||
216 | QStringList sharesColumns = QString("shares").split(','); | 219 | QStringList sharesColumns = QString("shares").split(','); | ||
217 | 220 | | |||
218 | // the list of columns which represent a percentage, so we can display them correctly | 221 | // the list of columns which represent a percentage, so we can display them correctly | ||
219 | QStringList percentColumns = QString("return,returninvestment,interestrate").split(','); | 222 | QStringList percentColumns = QString("return,returninvestment,interestrate,percentagegain").split(','); | ||
220 | 223 | | |||
221 | // the list of columns which represent dates, so we can display them correctly | 224 | // the list of columns which represent dates, so we can display them correctly | ||
222 | QStringList dateColumns = QString("postdate,entrydate,nextduedate,openingdate,nextinterestchange").split(','); | 225 | QStringList dateColumns = QString("postdate,entrydate,nextduedate,openingdate,nextinterestchange").split(','); | ||
223 | 226 | | |||
224 | result += "<table class=\"report\">\n<thead><tr class=\"itemheader\">"; | 227 | result += "<table class=\"report\">\n<thead><tr class=\"itemheader\">"; | ||
225 | 228 | | |||
226 | QStringList::const_iterator it_column = columns.constBegin(); | 229 | QStringList::const_iterator it_column = columns.constBegin(); | ||
227 | while (it_column != columns.constEnd()) { | 230 | while (it_column != columns.constEnd()) { | ||
▲ Show 20 Lines • Show All 224 Lines • ▼ Show 20 Line(s) | 454 | if (data.isEmpty()) { | |||
452 | result += QString("<td%1></td>") | 455 | result += QString("<td%1></td>") | ||
453 | .arg((*it_column == "value") ? " class=\"value\"" : ""); | 456 | .arg((*it_column == "value") ? " class=\"value\"" : ""); | ||
454 | csv += "\"\","; | 457 | csv += "\"\","; | ||
455 | } else if (MyMoneyMoney(data) == MyMoneyMoney::autoCalc) { | 458 | } else if (MyMoneyMoney(data) == MyMoneyMoney::autoCalc) { | ||
456 | result += QString("<td%1>%3%2%4</td>") | 459 | result += QString("<td%1>%3%2%4</td>") | ||
457 | .arg((*it_column == "value") ? " class=\"value\"" : "") | 460 | .arg((*it_column == "value") ? " class=\"value\"" : "") | ||
458 | .arg(i18n("Calculated"), tlinkBegin, tlinkEnd); | 461 | .arg(i18n("Calculated"), tlinkBegin, tlinkEnd); | ||
459 | csv += "\"" + i18n("Calculated") + "\","; | 462 | csv += "\"" + i18n("Calculated") + "\","; | ||
460 | } else if (*it_column == "price") { | 463 | } else if ((*it_column).endsWith(QLatin1String("price"))) { | ||
461 | int pricePrecision = file->security(file->account((*it_row)["accountid"]).currencyId()).pricePrecision(); | 464 | int pricePrecision = file->security(file->account((*it_row)["accountid"]).currencyId()).pricePrecision(); | ||
462 | result += QString("<td>%3%2 %1%4</td>") | 465 | result += QString("<td>%3%2 %1%4</td>") | ||
463 | .arg(MyMoneyMoney(data).formatMoney(QString(), pricePrecision), currencyID, tlinkBegin, tlinkEnd); | 466 | .arg(MyMoneyMoney(data).formatMoney(QString(), pricePrecision), currencyID, tlinkBegin, tlinkEnd); | ||
464 | csv += "\"" + currencyID + " " + MyMoneyMoney(data).formatMoney(QString(), pricePrecision, false) + "\","; | 467 | csv += "\"" + currencyID + " " + MyMoneyMoney(data).formatMoney(QString(), pricePrecision, false) + "\","; | ||
465 | } else { | 468 | } else { | ||
466 | result += QString("<td%1>%4%2 %3%5</td>") | 469 | result += QString("<td%1>%4%2 %3%5</td>") | ||
467 | .arg((*it_column == "value") ? " class=\"value\"" : "") | 470 | .arg((*it_column == "value") ? " class=\"value\"" : "") | ||
468 | .arg(currencyID) | 471 | .arg(currencyID) | ||
▲ Show 20 Lines • Show All 151 Lines • Show Last 20 Lines |