Changeset View
Changeset View
Standalone View
Standalone View
kmymoney/views/kreportsview.cpp
Show First 20 Lines • Show All 232 Lines • ▼ Show 20 Line(s) | 228 | } else { | |||
---|---|---|---|---|---|
233 | m_control->buttonChart->setText(i18n("Report")); | 233 | m_control->buttonChart->setText(i18n("Report")); | ||
234 | m_control->buttonChart->setToolTip(i18n("Show the report version of this chart")); | 234 | m_control->buttonChart->setToolTip(i18n("Show the report version of this chart")); | ||
235 | m_control->buttonChart->setIcon(QIcon::fromTheme(QStringLiteral("view-financial-list"), | 235 | m_control->buttonChart->setIcon(QIcon::fromTheme(QStringLiteral("view-financial-list"), | ||
236 | QIcon::fromTheme(QStringLiteral("ledger")))); | 236 | QIcon::fromTheme(QStringLiteral("ledger")))); | ||
237 | } | 237 | } | ||
238 | m_showingChart = ! m_showingChart; | 238 | m_showingChart = ! m_showingChart; | ||
239 | } | 239 | } | ||
240 | 240 | | |||
241 | void KReportsView::KReportTab::updateDataRange() | ||||
242 | { | ||||
243 | QList<DataDimension> grids = m_chartView->coordinatePlane()->gridDimensionsList(); | ||||
244 | if (grids.isEmpty()) | ||||
245 | return; | ||||
246 | QChar separator = locale().groupSeparator(); | ||||
247 | QChar decimalPoint = locale().decimalPoint(); | ||||
248 | int precision = KMyMoneyGlobalSettings().pricePrecision(); | ||||
249 | QList<QPair<QString, qreal>> dims; | ||||
250 | dims.append(qMakePair(QString(), grids.at(1).start)); | ||||
251 | dims.append(qMakePair(QString(), grids.at(1).end)); | ||||
252 | dims.append(qMakePair(QString(), grids.at(1).stepWidth)); | ||||
253 | dims.append(qMakePair(QString(), grids.at(1).subStepWidth)); | ||||
254 | | ||||
255 | for (int i = 0; i < 4; ++i) { | ||||
256 | dims[i].first = locale().toString(dims.at(i).second, 'f', precision).remove(separator).remove(QRegularExpression("0+$")).remove(QRegularExpression("\\" + decimalPoint + "$")); | ||||
257 | } | ||||
258 | | ||||
259 | m_report.setDataRangeStart(dims.at(0).first); | ||||
260 | m_report.setDataRangeEnd(dims.at(1).first); | ||||
261 | m_report.setDataMajorTick(dims.at(2).first); | ||||
262 | m_report.setDataMinorTick(dims.at(3).first); | ||||
263 | } | ||||
264 | | ||||
241 | /** | 265 | /** | ||
242 | * KReportsView Implementation | 266 | * KReportsView Implementation | ||
243 | */ | 267 | */ | ||
244 | 268 | | |||
245 | KReportsView::KReportsView(QWidget *parent, const char *name) : | 269 | KReportsView::KReportsView(QWidget *parent, const char *name) : | ||
246 | KMyMoneyViewBase(parent, name, i18n("Reports")), | 270 | KMyMoneyViewBase(parent, name, i18n("Reports")), | ||
247 | m_needReload(false), | 271 | m_needReload(false), | ||
248 | m_reportListView(0) | 272 | m_reportListView(0) | ||
▲ Show 20 Lines • Show All 409 Lines • ▼ Show 20 Line(s) | 680 | { | |||
658 | 682 | | |||
659 | KReportTab* tab = dynamic_cast<KReportTab*>(m_reportTabWidget->currentWidget()); | 683 | KReportTab* tab = dynamic_cast<KReportTab*>(m_reportTabWidget->currentWidget()); | ||
660 | 684 | | |||
661 | if (!tab) { | 685 | if (!tab) { | ||
662 | // nothing to do | 686 | // nothing to do | ||
663 | return; | 687 | return; | ||
664 | } | 688 | } | ||
665 | 689 | | |||
690 | tab->updateDataRange(); // range will be needed during configuration, but cannot be obtained earlier | ||||
691 | | ||||
666 | MyMoneyReport report = tab->report(); | 692 | MyMoneyReport report = tab->report(); | ||
667 | if (report.comment() == i18n("Default Report") || report.comment() == i18n("Generated Report")) { | 693 | if (report.comment() == i18n("Default Report") || report.comment() == i18n("Generated Report")) { | ||
668 | report.setComment(i18n("Custom Report")); | 694 | report.setComment(i18n("Custom Report")); | ||
669 | report.setName(i18n("%1 (Customized)", report.name())); | 695 | report.setName(i18n("%1 (Customized)", report.name())); | ||
670 | } | 696 | } | ||
671 | 697 | | |||
672 | QPointer<KReportConfigurationFilterDlg> dlg = new KReportConfigurationFilterDlg(report); | 698 | QPointer<KReportConfigurationFilterDlg> dlg = new KReportConfigurationFilterDlg(report); | ||
673 | 699 | | |||
▲ Show 20 Lines • Show All 494 Lines • ▼ Show 20 Line(s) | 1193 | list.push_back(MyMoneyReport( | |||
1168 | MyMoneyReport::eAssetLiability, | 1194 | MyMoneyReport::eAssetLiability, | ||
1169 | MyMoneyReport::eMonths, | 1195 | MyMoneyReport::eMonths, | ||
1170 | MyMoneyTransactionFilter::last12Months, | 1196 | MyMoneyTransactionFilter::last12Months, | ||
1171 | MyMoneyReport::eDetailTotal, | 1197 | MyMoneyReport::eDetailTotal, | ||
1172 | i18n("Net Worth Graph"), | 1198 | i18n("Net Worth Graph"), | ||
1173 | i18n("Default Report") | 1199 | i18n("Default Report") | ||
1174 | )); | 1200 | )); | ||
1175 | list.back().setChartByDefault(true); | 1201 | list.back().setChartByDefault(true); | ||
1176 | list.back().setChartGridLines(false); | 1202 | list.back().setChartCHGridLines(false); | ||
1203 | list.back().setChartSVGridLines(false); | ||||
1177 | list.back().setChartType(MyMoneyReport::eChartLine); | 1204 | list.back().setChartType(MyMoneyReport::eChartLine); | ||
1178 | 1205 | | |||
1179 | list.push_back(MyMoneyReport( | 1206 | list.push_back(MyMoneyReport( | ||
1180 | MyMoneyReport::eInstitution, | 1207 | MyMoneyReport::eInstitution, | ||
1181 | MyMoneyReport::eQCnone, | 1208 | MyMoneyReport::eQCnone, | ||
1182 | MyMoneyTransactionFilter::yearToDate, | 1209 | MyMoneyTransactionFilter::yearToDate, | ||
1183 | MyMoneyReport::eDetailTop, | 1210 | MyMoneyReport::eDetailTop, | ||
1184 | i18n("Account Balances by Institution"), | 1211 | i18n("Account Balances by Institution"), | ||
▲ Show 20 Lines • Show All 171 Lines • ▼ Show 20 Line(s) | 1382 | list.push_back(MyMoneyReport( | |||
1356 | MyMoneyReport::eAssetLiability, | 1383 | MyMoneyReport::eAssetLiability, | ||
1357 | MyMoneyReport::eMonths, | 1384 | MyMoneyReport::eMonths, | ||
1358 | MyMoneyTransactionFilter::today, | 1385 | MyMoneyTransactionFilter::today, | ||
1359 | MyMoneyReport::eDetailAll, | 1386 | MyMoneyReport::eDetailAll, | ||
1360 | i18n("Investment Holdings Pie"), | 1387 | i18n("Investment Holdings Pie"), | ||
1361 | i18n("Default Report") | 1388 | i18n("Default Report") | ||
1362 | )); | 1389 | )); | ||
1363 | list.back().setChartByDefault(true); | 1390 | list.back().setChartByDefault(true); | ||
1364 | list.back().setChartGridLines(false); | 1391 | list.back().setChartCHGridLines(false); | ||
1392 | list.back().setChartSVGridLines(false); | ||||
1365 | list.back().setChartType(MyMoneyReport::eChartPie); | 1393 | list.back().setChartType(MyMoneyReport::eChartPie); | ||
1366 | list.back().setInvestmentsOnly(true); | 1394 | list.back().setInvestmentsOnly(true); | ||
1367 | 1395 | | |||
1368 | list.push_back(MyMoneyReport( | 1396 | list.push_back(MyMoneyReport( | ||
1369 | MyMoneyReport::eAssetLiability, | 1397 | MyMoneyReport::eAssetLiability, | ||
1370 | MyMoneyReport::eMonths, | 1398 | MyMoneyReport::eMonths, | ||
1371 | MyMoneyTransactionFilter::last12Months, | 1399 | MyMoneyTransactionFilter::last12Months, | ||
1372 | MyMoneyReport::eDetailAll, | 1400 | MyMoneyReport::eDetailAll, | ||
1373 | i18n("Investment Worth Graph"), | 1401 | i18n("Investment Worth Graph"), | ||
1374 | i18n("Default Report") | 1402 | i18n("Default Report") | ||
1375 | )); | 1403 | )); | ||
1376 | list.back().setChartByDefault(true); | 1404 | list.back().setChartByDefault(true); | ||
1377 | list.back().setChartGridLines(false); | 1405 | list.back().setChartCHGridLines(false); | ||
1406 | list.back().setChartSVGridLines(false); | ||||
1378 | list.back().setChartType(MyMoneyReport::eChartLine); | 1407 | list.back().setChartType(MyMoneyReport::eChartLine); | ||
1379 | list.back().setColumnsAreDays(true); | 1408 | list.back().setColumnsAreDays(true); | ||
1380 | list.back().setInvestmentsOnly(true); | 1409 | list.back().setInvestmentsOnly(true); | ||
1381 | 1410 | | |||
1382 | list.push_back(MyMoneyReport( | 1411 | list.push_back(MyMoneyReport( | ||
1383 | MyMoneyReport::eAssetLiability, | 1412 | MyMoneyReport::eAssetLiability, | ||
1384 | MyMoneyReport::eMonths, | 1413 | MyMoneyReport::eMonths, | ||
1385 | MyMoneyTransactionFilter::last12Months, | 1414 | MyMoneyTransactionFilter::last12Months, | ||
1386 | MyMoneyReport::eDetailAll, | 1415 | MyMoneyReport::eDetailAll, | ||
1387 | i18n("Investment Price Graph"), | 1416 | i18n("Investment Price Graph"), | ||
1388 | i18n("Default Report") | 1417 | i18n("Default Report") | ||
1389 | )); | 1418 | )); | ||
1390 | list.back().setChartByDefault(true); | 1419 | list.back().setChartByDefault(true); | ||
1391 | list.back().setChartGridLines(false); | 1420 | list.back().setChartCHGridLines(false); | ||
1421 | list.back().setChartSVGridLines(false); | ||||
1392 | list.back().setChartType(MyMoneyReport::eChartLine); | 1422 | list.back().setChartType(MyMoneyReport::eChartLine); | ||
1393 | list.back().setColumnsAreDays(true); | 1423 | list.back().setColumnsAreDays(true); | ||
1394 | list.back().setInvestmentsOnly(true); | 1424 | list.back().setInvestmentsOnly(true); | ||
1395 | list.back().setIncludingBudgetActuals(false); | 1425 | list.back().setIncludingBudgetActuals(false); | ||
1396 | list.back().setIncludingPrice(true); | 1426 | list.back().setIncludingPrice(true); | ||
1397 | list.back().setConvertCurrency(true); | 1427 | list.back().setConvertCurrency(true); | ||
1398 | list.back().setChartDataLabels(false); | 1428 | list.back().setChartDataLabels(false); | ||
1399 | list.back().setSkipZero(true); | 1429 | list.back().setSkipZero(true); | ||
1400 | 1430 | | |||
1401 | list.push_back(MyMoneyReport( | 1431 | list.push_back(MyMoneyReport( | ||
1402 | MyMoneyReport::eAssetLiability, | 1432 | MyMoneyReport::eAssetLiability, | ||
1403 | MyMoneyReport::eMonths, | 1433 | MyMoneyReport::eMonths, | ||
1404 | MyMoneyTransactionFilter::last12Months, | 1434 | MyMoneyTransactionFilter::last12Months, | ||
1405 | MyMoneyReport::eDetailAll, | 1435 | MyMoneyReport::eDetailAll, | ||
1406 | i18n("Investment Moving Average Price Graph"), | 1436 | i18n("Investment Moving Average Price Graph"), | ||
1407 | i18n("Default Report") | 1437 | i18n("Default Report") | ||
1408 | )); | 1438 | )); | ||
1409 | list.back().setChartByDefault(true); | 1439 | list.back().setChartByDefault(true); | ||
1410 | list.back().setChartGridLines(false); | 1440 | list.back().setChartCHGridLines(false); | ||
1441 | list.back().setChartSVGridLines(false); | ||||
1411 | list.back().setChartType(MyMoneyReport::eChartLine); | 1442 | list.back().setChartType(MyMoneyReport::eChartLine); | ||
1412 | list.back().setColumnsAreDays(true); | 1443 | list.back().setColumnsAreDays(true); | ||
1413 | list.back().setInvestmentsOnly(true); | 1444 | list.back().setInvestmentsOnly(true); | ||
1414 | list.back().setIncludingBudgetActuals(false); | 1445 | list.back().setIncludingBudgetActuals(false); | ||
1415 | list.back().setIncludingAveragePrice(true); | 1446 | list.back().setIncludingAveragePrice(true); | ||
1416 | list.back().setMovingAverageDays(10); | 1447 | list.back().setMovingAverageDays(10); | ||
1417 | list.back().setConvertCurrency(true); | 1448 | list.back().setConvertCurrency(true); | ||
1418 | list.back().setChartDataLabels(false); | 1449 | list.back().setChartDataLabels(false); | ||
1419 | 1450 | | |||
1420 | list.push_back(MyMoneyReport( | 1451 | list.push_back(MyMoneyReport( | ||
1421 | MyMoneyReport::eAssetLiability, | 1452 | MyMoneyReport::eAssetLiability, | ||
1422 | MyMoneyReport::eMonths, | 1453 | MyMoneyReport::eMonths, | ||
1423 | MyMoneyTransactionFilter::last30Days, | 1454 | MyMoneyTransactionFilter::last30Days, | ||
1424 | MyMoneyReport::eDetailAll, | 1455 | MyMoneyReport::eDetailAll, | ||
1425 | i18n("Investment Moving Average"), | 1456 | i18n("Investment Moving Average"), | ||
1426 | i18n("Default Report") | 1457 | i18n("Default Report") | ||
1427 | )); | 1458 | )); | ||
1428 | list.back().setChartGridLines(false); | 1459 | list.back().setChartCHGridLines(false); | ||
1460 | list.back().setChartSVGridLines(false); | ||||
1429 | list.back().setChartType(MyMoneyReport::eChartLine); | 1461 | list.back().setChartType(MyMoneyReport::eChartLine); | ||
1430 | list.back().setColumnsAreDays(true); | 1462 | list.back().setColumnsAreDays(true); | ||
1431 | list.back().setInvestmentsOnly(true); | 1463 | list.back().setInvestmentsOnly(true); | ||
1432 | list.back().setIncludingBudgetActuals(false); | 1464 | list.back().setIncludingBudgetActuals(false); | ||
1433 | list.back().setIncludingMovingAverage(true); | 1465 | list.back().setIncludingMovingAverage(true); | ||
1434 | list.back().setMovingAverageDays(10); | 1466 | list.back().setMovingAverageDays(10); | ||
1435 | 1467 | | |||
1436 | list.push_back(MyMoneyReport( | 1468 | list.push_back(MyMoneyReport( | ||
1437 | MyMoneyReport::eAssetLiability, | 1469 | MyMoneyReport::eAssetLiability, | ||
1438 | MyMoneyReport::eMonths, | 1470 | MyMoneyReport::eMonths, | ||
1439 | MyMoneyTransactionFilter::last30Days, | 1471 | MyMoneyTransactionFilter::last30Days, | ||
1440 | MyMoneyReport::eDetailAll, | 1472 | MyMoneyReport::eDetailAll, | ||
1441 | i18n("Investment Moving Average vs Actual"), | 1473 | i18n("Investment Moving Average vs Actual"), | ||
1442 | i18n("Default Report") | 1474 | i18n("Default Report") | ||
1443 | )); | 1475 | )); | ||
1444 | list.back().setChartByDefault(true); | 1476 | list.back().setChartByDefault(true); | ||
1445 | list.back().setChartGridLines(false); | 1477 | list.back().setChartCHGridLines(false); | ||
1478 | list.back().setChartSVGridLines(false); | ||||
1446 | list.back().setChartType(MyMoneyReport::eChartLine); | 1479 | list.back().setChartType(MyMoneyReport::eChartLine); | ||
1447 | list.back().setColumnsAreDays(true); | 1480 | list.back().setColumnsAreDays(true); | ||
1448 | list.back().setInvestmentsOnly(true); | 1481 | list.back().setInvestmentsOnly(true); | ||
1449 | list.back().setIncludingBudgetActuals(true); | 1482 | list.back().setIncludingBudgetActuals(true); | ||
1450 | list.back().setIncludingMovingAverage(true); | 1483 | list.back().setIncludingMovingAverage(true); | ||
1451 | list.back().setMovingAverageDays(10); | 1484 | list.back().setMovingAverageDays(10); | ||
1452 | groups.push_back(list); | 1485 | groups.push_back(list); | ||
1453 | } | 1486 | } | ||
▲ Show 20 Lines • Show All 112 Lines • ▼ Show 20 Line(s) | 1598 | list.push_back(MyMoneyReport( | |||
1566 | MyMoneyReport::eBudgetActual, | 1599 | MyMoneyReport::eBudgetActual, | ||
1567 | MyMoneyReport::eMonths, | 1600 | MyMoneyReport::eMonths, | ||
1568 | MyMoneyTransactionFilter::currentYear, | 1601 | MyMoneyTransactionFilter::currentYear, | ||
1569 | MyMoneyReport::eDetailGroup, | 1602 | MyMoneyReport::eDetailGroup, | ||
1570 | i18n("Yearly Budgeted vs Actual Graph"), | 1603 | i18n("Yearly Budgeted vs Actual Graph"), | ||
1571 | i18n("Default Report") | 1604 | i18n("Default Report") | ||
1572 | )); | 1605 | )); | ||
1573 | list.back().setChartByDefault(true); | 1606 | list.back().setChartByDefault(true); | ||
1574 | list.back().setChartGridLines(false); | 1607 | list.back().setChartCHGridLines(false); | ||
1608 | list.back().setChartSVGridLines(false); | ||||
1575 | list.back().setBudget("Any", true); | 1609 | list.back().setBudget("Any", true); | ||
1576 | list.back().setChartType(MyMoneyReport::eChartLine); | 1610 | list.back().setChartType(MyMoneyReport::eChartLine); | ||
1577 | 1611 | | |||
1578 | groups.push_back(list); | 1612 | groups.push_back(list); | ||
1579 | } | 1613 | } | ||
1580 | { | 1614 | { | ||
1581 | ReportGroup list("Forecast", i18n("Forecast")); | 1615 | ReportGroup list("Forecast", i18n("Forecast")); | ||
1582 | 1616 | | |||
Show All 34 Lines | 1648 | list.push_back(MyMoneyReport( | |||
1617 | MyMoneyTransactionFilter::next3Months, | 1651 | MyMoneyTransactionFilter::next3Months, | ||
1618 | MyMoneyReport::eDetailTotal, | 1652 | MyMoneyReport::eDetailTotal, | ||
1619 | i18n("Net Worth Forecast Graph"), | 1653 | i18n("Net Worth Forecast Graph"), | ||
1620 | i18n("Default Report") | 1654 | i18n("Default Report") | ||
1621 | )); | 1655 | )); | ||
1622 | list.back().setColumnsAreDays(true); | 1656 | list.back().setColumnsAreDays(true); | ||
1623 | list.back().setIncludingForecast(true); | 1657 | list.back().setIncludingForecast(true); | ||
1624 | list.back().setChartByDefault(true); | 1658 | list.back().setChartByDefault(true); | ||
1625 | list.back().setChartGridLines(false); | 1659 | list.back().setChartCHGridLines(false); | ||
1660 | list.back().setChartSVGridLines(false); | ||||
1626 | list.back().setChartType(MyMoneyReport::eChartLine); | 1661 | list.back().setChartType(MyMoneyReport::eChartLine); | ||
1627 | groups.push_back(list); | 1662 | groups.push_back(list); | ||
1628 | } | 1663 | } | ||
1629 | { | 1664 | { | ||
1630 | ReportGroup list("Information", i18n("General Information")); | 1665 | ReportGroup list("Information", i18n("General Information")); | ||
1631 | 1666 | | |||
1632 | list.push_back(MyMoneyReport( | 1667 | list.push_back(MyMoneyReport( | ||
1633 | MyMoneyReport::eSchedule, | 1668 | MyMoneyReport::eSchedule, | ||
▲ Show 20 Lines • Show All 75 Lines • Show Last 20 Lines |