Changeset View
Changeset View
Standalone View
Standalone View
kmymoney/mymoney/mymoneyreport.cpp
Show First 20 Lines • Show All 46 Lines • ▼ Show 20 Line(s) | |||||
47 | const QStringList kStateText = QString("all,notreconciled,cleared,reconciled,frozen,none").split(','); | 47 | const QStringList kStateText = QString("all,notreconciled,cleared,reconciled,frozen,none").split(','); | ||
48 | const QStringList kDateLockText = QString("alldates,untiltoday,currentmonth,currentyear,monthtodate,yeartodate,yeartomonth,lastmonth,lastyear,last7days,last30days,last3months,last6months,last12months,next7days,next30days,next3months,next6months,next12months,userdefined,last3tonext3months,last11Months,currentQuarter,lastQuarter,nextQuarter,currentFiscalYear,lastFiscalYear,today,next18months").split(','); | 48 | const QStringList kDateLockText = QString("alldates,untiltoday,currentmonth,currentyear,monthtodate,yeartodate,yeartomonth,lastmonth,lastyear,last7days,last30days,last3months,last6months,last12months,next7days,next30days,next3months,next6months,next12months,userdefined,last3tonext3months,last11Months,currentQuarter,lastQuarter,nextQuarter,currentFiscalYear,lastFiscalYear,today,next18months").split(','); | ||
49 | const QStringList kDataLockText = QString("automatic,userdefined").split(','); | 49 | const QStringList kDataLockText = QString("automatic,userdefined").split(','); | ||
50 | const QStringList kAccountTypeText = QString("unknown,checkings,savings,cash,creditcard,loan,certificatedep,investment,moneymarket,asset,liability,currency,income,expense,assetloan,stock,equity,invalid").split(','); | 50 | const QStringList kAccountTypeText = QString("unknown,checkings,savings,cash,creditcard,loan,certificatedep,investment,moneymarket,asset,liability,currency,income,expense,assetloan,stock,equity,invalid").split(','); | ||
51 | 51 | | |||
52 | MyMoneyReport::MyMoneyReport() : | 52 | MyMoneyReport::MyMoneyReport() : | ||
53 | m_name("Unconfigured Pivot Table Report"), | 53 | m_name("Unconfigured Pivot Table Report"), | ||
54 | m_detailLevel(eDetailNone), | 54 | m_detailLevel(eDetailNone), | ||
55 | m_investmentSum(eSumSold), | ||||
55 | m_hideTransactions(false), | 56 | m_hideTransactions(false), | ||
56 | m_convertCurrency(true), | 57 | m_convertCurrency(true), | ||
57 | m_favorite(false), | 58 | m_favorite(false), | ||
58 | m_tax(false), | 59 | m_tax(false), | ||
59 | m_investments(false), | 60 | m_investments(false), | ||
60 | m_loans(false), | 61 | m_loans(false), | ||
61 | m_reportType(kTypeArray[eExpenseIncome]), | 62 | m_reportType(kTypeArray[eExpenseIncome]), | ||
62 | m_rowType(eExpenseIncome), | 63 | m_rowType(eExpenseIncome), | ||
▲ Show 20 Lines • Show All 43 Lines • ▼ Show 20 Line(s) | 106 | { | |||
106 | *this = right; | 107 | *this = right; | ||
107 | setId(id); | 108 | setId(id); | ||
108 | } | 109 | } | ||
109 | 110 | | |||
110 | MyMoneyReport::MyMoneyReport(ERowType _rt, unsigned _ct, dateOptionE _dl, EDetailLevel _ss, const QString& _name, const QString& _comment) : | 111 | MyMoneyReport::MyMoneyReport(ERowType _rt, unsigned _ct, dateOptionE _dl, EDetailLevel _ss, const QString& _name, const QString& _comment) : | ||
111 | m_name(_name), | 112 | m_name(_name), | ||
112 | m_comment(_comment), | 113 | m_comment(_comment), | ||
113 | m_detailLevel(_ss), | 114 | m_detailLevel(_ss), | ||
115 | m_investmentSum(_ct & eQCcapitalgain ? eSumSold : eSumPeriod), | ||||
114 | m_hideTransactions(false), | 116 | m_hideTransactions(false), | ||
115 | m_convertCurrency(true), | 117 | m_convertCurrency(true), | ||
116 | m_favorite(false), | 118 | m_favorite(false), | ||
117 | m_tax(false), | 119 | m_tax(false), | ||
118 | m_investments(false), | 120 | m_investments(false), | ||
119 | m_loans(false), | 121 | m_loans(false), | ||
120 | m_reportType(kTypeArray[_rt]), | 122 | m_reportType(kTypeArray[_rt]), | ||
121 | m_rowType(_rt), | 123 | m_rowType(_rt), | ||
▲ Show 20 Lines • Show All 265 Lines • ▼ Show 20 Line(s) | 382 | if (m_reportType == ePivotTable) { | |||
387 | e.setAttribute("investments", m_investments); // it's setable in rows/columns tab of querytable, but here it is internal setting | 389 | e.setAttribute("investments", m_investments); // it's setable in rows/columns tab of querytable, but here it is internal setting | ||
388 | 390 | | |||
389 | // write rows/columns tab | 391 | // write rows/columns tab | ||
390 | if (!m_budgetId.isEmpty()) | 392 | if (!m_budgetId.isEmpty()) | ||
391 | e.setAttribute("budget", m_budgetId); | 393 | e.setAttribute("budget", m_budgetId); | ||
392 | 394 | | |||
393 | e.setAttribute("rowtype", kRowTypeText[m_rowType]); | 395 | e.setAttribute("rowtype", kRowTypeText[m_rowType]); | ||
394 | e.setAttribute("showrowtotals", m_showRowTotals); | 396 | e.setAttribute("showrowtotals", m_showRowTotals); | ||
397 | e.setAttribute("showcolumntotals", m_showColumnTotals); | ||||
395 | e.setAttribute("detail", kDetailLevelText[m_detailLevel]); | 398 | e.setAttribute("detail", kDetailLevelText[m_detailLevel]); | ||
396 | 399 | | |||
397 | e.setAttribute("includesmovingaverage", m_includeMovingAverage); | 400 | e.setAttribute("includesmovingaverage", m_includeMovingAverage); | ||
398 | if (m_includeMovingAverage) | 401 | if (m_includeMovingAverage) | ||
399 | e.setAttribute("movingaveragedays", m_movingAverageDays); | 402 | e.setAttribute("movingaveragedays", m_movingAverageDays); | ||
400 | 403 | | |||
401 | e.setAttribute("includeschedules", m_includeSchedules); | 404 | e.setAttribute("includeschedules", m_includeSchedules); | ||
402 | e.setAttribute("includestransfers", m_includeTransfers); | 405 | e.setAttribute("includestransfers", m_includeTransfers); | ||
Show All 34 Lines | 436 | while (it_qc != eQCend) { | |||
437 | index++; | 440 | index++; | ||
438 | } | 441 | } | ||
439 | e.setAttribute("querycolumns", columns.join(",")); | 442 | e.setAttribute("querycolumns", columns.join(",")); | ||
440 | 443 | | |||
441 | e.setAttribute("tax", m_tax); | 444 | e.setAttribute("tax", m_tax); | ||
442 | e.setAttribute("investments", m_investments); | 445 | e.setAttribute("investments", m_investments); | ||
443 | e.setAttribute("loans", m_loans); | 446 | e.setAttribute("loans", m_loans); | ||
444 | e.setAttribute("hidetransactions", m_hideTransactions); | 447 | e.setAttribute("hidetransactions", m_hideTransactions); | ||
448 | e.setAttribute("showcolumntotals", m_showColumnTotals); | ||||
445 | e.setAttribute("detail", kDetailLevelText[m_detailLevel]); | 449 | e.setAttribute("detail", kDetailLevelText[m_detailLevel]); | ||
446 | 450 | | |||
451 | // write performance tab | ||||
452 | if (m_queryColumns & eQCperformance || m_queryColumns & eQCcapitalgain) | ||||
453 | e.setAttribute("investmentsum", m_investmentSum); | ||||
454 | | ||||
447 | // write capital gains tab | 455 | // write capital gains tab | ||
448 | if (m_queryColumns & eQCcapitalgain) { | 456 | if (m_queryColumns & eQCcapitalgain) { | ||
457 | if (m_investmentSum == MyMoneyReport::eSumSold) { | ||||
449 | e.setAttribute("settlementperiod", m_settlementPeriod); | 458 | e.setAttribute("settlementperiod", m_settlementPeriod); | ||
450 | e.setAttribute("showSTLTCapitalGains", m_showSTLTCapitalGains); | 459 | e.setAttribute("showSTLTCapitalGains", m_showSTLTCapitalGains); | ||
451 | e.setAttribute("tseparator", m_tseparator.toString(Qt::ISODate)); | 460 | e.setAttribute("tseparator", m_tseparator.toString(Qt::ISODate)); | ||
452 | } | 461 | } | ||
462 | } | ||||
453 | } else if (m_reportType == eInfoTable) | 463 | } else if (m_reportType == eInfoTable) | ||
454 | e.setAttribute("showrowtotals", m_showRowTotals); | 464 | e.setAttribute("showrowtotals", m_showRowTotals); | ||
455 | 465 | | |||
456 | // | 466 | // | ||
457 | // Text Filter | 467 | // Text Filter | ||
458 | // | 468 | // | ||
459 | 469 | | |||
460 | QRegExp textfilter; | 470 | QRegExp textfilter; | ||
▲ Show 20 Lines • Show All 304 Lines • ▼ Show 20 Line(s) | 774 | if (i > 0) | |||
765 | qc |= (1 << (i - 1)); | 775 | qc |= (1 << (i - 1)); | ||
766 | } | 776 | } | ||
767 | setQueryColumns(static_cast<EQueryColumns>(qc)); | 777 | setQueryColumns(static_cast<EQueryColumns>(qc)); | ||
768 | 778 | | |||
769 | m_tax = e.attribute("tax", "0").toUInt(); | 779 | m_tax = e.attribute("tax", "0").toUInt(); | ||
770 | m_investments = e.attribute("investments", "0").toUInt(); | 780 | m_investments = e.attribute("investments", "0").toUInt(); | ||
771 | m_loans = e.attribute("loans", "0").toUInt(); | 781 | m_loans = e.attribute("loans", "0").toUInt(); | ||
772 | m_hideTransactions = e.attribute("hidetransactions", "0").toUInt(); | 782 | m_hideTransactions = e.attribute("hidetransactions", "0").toUInt(); | ||
783 | m_showColumnTotals = e.attribute("showcolumntotals", "1").toUInt(); | ||||
773 | m_detailLevel = kDetailLevelText.indexOf(e.attribute("detail", "none")) == eDetailAll ? eDetailAll : eDetailNone; | 784 | m_detailLevel = kDetailLevelText.indexOf(e.attribute("detail", "none")) == eDetailAll ? eDetailAll : eDetailNone; | ||
774 | 785 | | |||
786 | // read performance or capital gains tab | ||||
787 | if (m_queryColumns & eQCperformance) | ||||
788 | m_investmentSum = static_cast<EInvestmentSum>(e.attribute("investmentsum", QString().setNum(MyMoneyReport::eSumPeriod)).toInt()); | ||||
789 | | ||||
775 | // read capital gains tab | 790 | // read capital gains tab | ||
776 | if (m_queryColumns & eQCcapitalgain) { | 791 | if (m_queryColumns & eQCcapitalgain) { | ||
792 | m_investmentSum = static_cast<EInvestmentSum>(e.attribute("investmentsum", QString().setNum(MyMoneyReport::eSumSold)).toInt()); | ||||
793 | if (m_investmentSum == MyMoneyReport::eSumSold) { | ||||
777 | m_showSTLTCapitalGains = e.attribute("showSTLTCapitalGains", "0").toUInt(); | 794 | m_showSTLTCapitalGains = e.attribute("showSTLTCapitalGains", "0").toUInt(); | ||
778 | m_settlementPeriod = e.attribute("settlementperiod", "3").toUInt(); | 795 | m_settlementPeriod = e.attribute("settlementperiod", "3").toUInt(); | ||
779 | m_tseparator = QDate::fromString(e.attribute("tseparator", QDate::currentDate().addYears(-1).toString(Qt::ISODate)),Qt::ISODate); | 796 | m_tseparator = QDate::fromString(e.attribute("tseparator", QDate::currentDate().addYears(-1).toString(Qt::ISODate)),Qt::ISODate); | ||
780 | } | 797 | } | ||
798 | } | ||||
781 | } else if (m_reportType == eInfoTable) { | 799 | } else if (m_reportType == eInfoTable) { | ||
782 | if (e.hasAttribute("showrowtotals")) | 800 | if (e.hasAttribute("showrowtotals")) | ||
783 | m_showRowTotals = e.attribute("showrowtotals").toUInt(); | 801 | m_showRowTotals = e.attribute("showrowtotals").toUInt(); | ||
784 | else | 802 | else | ||
785 | m_showRowTotals = true; | 803 | m_showRowTotals = true; | ||
786 | } | 804 | } | ||
787 | 805 | | |||
788 | QDomNode child = e.firstChild(); | 806 | QDomNode child = e.firstChild(); | ||
▲ Show 20 Lines • Show All 76 Lines • Show Last 20 Lines |