Changeset View
Changeset View
Standalone View
Standalone View
kmymoney/reports/listtable.cpp
Context not available. | |||||
242 | // | 242 | // | ||
---|---|---|---|---|---|
243 | 243 | | |||
244 | bool row_odd = true; | 244 | bool row_odd = true; | ||
245 | bool isHigherGroupTotal = false; // hack to inform whether to put separator line or not | ||||
245 | 246 | | |||
246 | // ***DV*** | 247 | // ***DV*** | ||
247 | MyMoneyMoney startingBalance; | 248 | MyMoneyMoney startingBalance; | ||
Context not available. | |||||
260 | // detect whether any of groups changed and display new group header in that case | 261 | // detect whether any of groups changed and display new group header in that case | ||
261 | for (int i = 0; i < groups.count(); ++i) { | 262 | for (int i = 0; i < groups.count(); ++i) { | ||
262 | if (prevGrpNames.at(i) != (*it_row)[groups.at(i)]) { | 263 | if (prevGrpNames.at(i) != (*it_row)[groups.at(i)]) { | ||
263 | row_odd = true; | 264 | // group header of lowest group doesn't bring any useful information | ||
264 | result += "<tr class=\"sectionheader\">" | 265 | // if hide transaction is enabled, so don't display it | ||
265 | "<td class=\"left" + QString::number(i) + "\" " | 266 | if (!m_config.isHideTransactions() || i != groups.count() - 1) { | ||
266 | "colspan=\"" + QString::number(columns.count()) + "\">" + | 267 | row_odd = true; | ||
267 | (*it_row)[groups.at(i)] + "</td></tr>\n"; | 268 | result += "<tr class=\"sectionheader\">" | ||
268 | csv += "\"" + (*it_row)[groups.at(i)] + "\"\n"; | 269 | "<td class=\"left" + QString::number(i) + "\" " | ||
270 | "colspan=\"" + QString::number(columns.count()) + "\">" + | ||||
271 | (*it_row)[groups.at(i)] + "</td></tr>\n"; | ||||
272 | csv += "\"" + (*it_row)[groups.at(i)] + "\"\n"; | ||||
273 | } | ||||
274 | if (i == groups.count() - 1) // lowest group has been switched... | ||||
275 | isHigherGroupTotal = false; // ...so expect lowest group total | ||||
269 | prevGrpNames.replace(i, (*it_row)[groups.at(i)]); | 276 | prevGrpNames.replace(i, (*it_row)[groups.at(i)]); | ||
270 | } | 277 | } | ||
271 | } | 278 | } | ||
Context not available. | |||||
274 | // Columns | 281 | // Columns | ||
275 | // | 282 | // | ||
276 | 283 | | |||
277 | // skip the opening and closing balance row, | | |||
278 | // if the balance column is not shown | | |||
279 | // rank = 0 for opening balance, rank = 3 for closing balance | | |||
280 | if ((columns.contains("balance") == 0) && ((*it_row)["rank"] == "0" || (*it_row)["rank"] == "3")) | | |||
281 | continue; | | |||
282 | | ||||
283 | bool need_label = true; | 284 | bool need_label = true; | ||
284 | 285 | | |||
285 | QString tlink; // link information to account and transaction | 286 | QString tlink; // link information to account and transaction | ||
286 | // ***DV*** | | |||
287 | if ((* it_row)["rank"] == "1") { | | |||
288 | row_odd = ! row_odd; | | |||
289 | tlink = QString("id=%1&tid=%2") | | |||
290 | .arg((* it_row)["accountid"], (* it_row)["id"]); | | |||
291 | } | | |||
292 | 287 | | |||
293 | if ((*it_row)["rank"] == "0" || (*it_row)["rank"] == "3") | 288 | if (!m_config.isHideTransactions() || (*it_row)["rank"] == "4") { // if hide transaction is enabled display only total rows i.e. rank = 4 | ||
294 | result += QString("<tr class=\"item%1\">").arg((* it_row)["id"]); | 289 | if ((*it_row)["rank"] == "0" || (*it_row)["rank"] == "3") { | ||
295 | else if ((* it_row)["rank"] == "2") | 290 | // skip the opening and closing balance row, | ||
296 | result += QString("<tr class=\"%1\">").arg(row_odd ? "item1" : "item0"); | 291 | // if the balance column is not shown | ||
297 | else if ((* it_row)["rank"] == "4") { | 292 | // rank = 0 for opening balance, rank = 3 for closing balance | ||
298 | if (m_config.rowType() == MyMoneyReport::eTag || //If we order by Tags don't show the Grand total as we can have multiple tags per transaction | 293 | if (!columns.contains("balance")) | ||
299 | !m_config.isConvertCurrency() && std::next(it_row) == m_rows.end())// grand total may be invalid if multiple currencies are used, so don't display it | 294 | continue; | ||
300 | continue; | 295 | result += QString("<tr class=\"item%1\">").arg((* it_row)["id"]); | ||
301 | else | 296 | // ***DV*** | ||
302 | result += QString("<tr class=\"sectionfooter\">"); | 297 | } else if ((* it_row)["rank"] == "1") { | ||
298 | row_odd = ! row_odd; | ||||
299 | tlink = QString("id=%1&tid=%2") | ||||
300 | .arg((* it_row)["accountid"], (* it_row)["id"]); | ||||
301 | result += QString("<tr class=\"%1\">").arg(row_odd ? "row-odd " : "row-even"); | ||||
302 | } else if ((* it_row)["rank"] == "2") | ||||
303 | result += QString("<tr class=\"%1\">").arg(row_odd ? "item1" : "item0"); | ||||
304 | else if ((* it_row)["rank"] == "4") { | ||||
305 | if ((m_config.rowType() == MyMoneyReport::eTag) || //If we order by Tags don't show the Grand total as we can have multiple tags per transaction | ||||
306 | (!m_config.isConvertCurrency() && std::next(it_row) == m_rows.end()))// grand total may be invalid if multiple currencies are used, so don't display it | ||||
307 | continue; | ||||
308 | // display special footer (i.e. without horizontal separator) only for lowest group totals | ||||
309 | else if (m_config.isHideTransactions() && !isHigherGroupTotal && std::next(it_row) != m_rows.end()) { | ||||
310 | result += QString("<tr class=\"sectionfooterbasic\">"); | ||||
311 | isHigherGroupTotal = true; | ||||
312 | } else | ||||
313 | result += QString("<tr class=\"sectionfooter\">"); | ||||
314 | } else | ||||
315 | result += QString("<tr class=\"%1\">").arg(row_odd ? "row-odd " : "row-even"); | ||||
303 | } else | 316 | } else | ||
304 | result += QString("<tr class=\"%1\">").arg(row_odd ? "row-odd " : "row-even"); | 317 | continue; | ||
305 | 318 | | |||
306 | QStringList::const_iterator it_column = columns.constBegin(); | 319 | QStringList::const_iterator it_column = columns.constBegin(); | ||
307 | while (it_column != columns.constEnd()) { | 320 | while (it_column != columns.constEnd()) { | ||
Context not available. |