Changeset View
Changeset View
Standalone View
Standalone View
kmymoney/mymoney/mymoneyreport.cpp
Show All 28 Lines | |||||
29 | // KDE Includes | 29 | // KDE Includes | ||
30 | 30 | | |||
31 | // ---------------------------------------------------------------------------- | 31 | // ---------------------------------------------------------------------------- | ||
32 | // Project Includes | 32 | // Project Includes | ||
33 | 33 | | |||
34 | #include "mymoneyfile.h" | 34 | #include "mymoneyfile.h" | ||
35 | #include "reportdebug.h" | 35 | #include "reportdebug.h" | ||
36 | 36 | | |||
37 | const QStringList MyMoneyReport::Column::kTypeText = QString("none,months,bimonths,quarters,4,5,6,weeks,8,9,10,11,years").split(','); | ||||
38 | | ||||
37 | const QStringList MyMoneyReport::kRowTypeText = QString("none,assetliability,expenseincome,category,topcategory,account,tag,payee,month,week,topaccount,topaccount-account,equitytype,accounttype,institution,budget,budgetactual,schedule,accountinfo,accountloaninfo,accountreconcile,cashflow").split(','); | 39 | const QStringList MyMoneyReport::kRowTypeText = QString("none,assetliability,expenseincome,category,topcategory,account,tag,payee,month,week,topaccount,topaccount-account,equitytype,accounttype,institution,budget,budgetactual,schedule,accountinfo,accountloaninfo,accountreconcile,cashflow").split(','); | ||
38 | const QStringList MyMoneyReport::kColumnTypeText = QString("none,months,bimonths,quarters,4,5,6,weeks,8,9,10,11,years").split(','); | | |||
39 | 40 | | |||
40 | // if you add names here, don't forget to update the bitmap for EQueryColumns | 41 | // if you add names here, don't forget to update the bitmap for EQueryColumns | ||
41 | // and shift the bit for eQCend one position to the left | 42 | // and shift the bit for eQCend one position to the left | ||
42 | const QStringList MyMoneyReport::kQueryColumnsText = QString("none,number,payee,category,tag,memo,account,reconcileflag,action,shares,price,performance,loan,balance").split(','); | 43 | const QStringList MyMoneyReport::kQueryColumnsText = QString("none,number,payee,category,tag,memo,account,reconcileflag,action,shares,price,performance,loan,balance").split(','); | ||
43 | 44 | | |||
44 | const MyMoneyReport::EReportType MyMoneyReport::kTypeArray[] = { eNoReport, ePivotTable, ePivotTable, eQueryTable, eQueryTable, eQueryTable, eQueryTable, eQueryTable, eQueryTable, eQueryTable, eQueryTable, eQueryTable, eQueryTable, eQueryTable, eQueryTable, ePivotTable, ePivotTable, eInfoTable, eInfoTable, eInfoTable, eQueryTable, eQueryTable, eNoReport }; | 45 | const MyMoneyReport::EReportType MyMoneyReport::kTypeArray[] = { eNoReport, ePivotTable, ePivotTable, eQueryTable, eQueryTable, eQueryTable, eQueryTable, eQueryTable, eQueryTable, eQueryTable, eQueryTable, eQueryTable, eQueryTable, eQueryTable, eQueryTable, ePivotTable, ePivotTable, eInfoTable, eInfoTable, eInfoTable, eQueryTable, eQueryTable, eNoReport }; | ||
45 | const QStringList MyMoneyReport::kDetailLevelText = QString("none,all,top,group,total,invalid").split(','); | 46 | const QStringList MyMoneyReport::kDetailLevelText = QString("none,all,top,group,total,invalid").split(','); | ||
46 | const QStringList MyMoneyReport::kChartTypeText = QString("none,line,bar,pie,ring,stackedbar,invalid").split(','); | 47 | const QStringList MyMoneyReport::kChartTypeText = QString("none,line,bar,pie,ring,stackedbar,invalid").split(','); | ||
Show All 9 Lines | 55 | MyMoneyReport::MyMoneyReport() : | |||
56 | m_detailLevel(eDetailNone), | 57 | m_detailLevel(eDetailNone), | ||
57 | m_convertCurrency(true), | 58 | m_convertCurrency(true), | ||
58 | m_favorite(false), | 59 | m_favorite(false), | ||
59 | m_tax(false), | 60 | m_tax(false), | ||
60 | m_investments(false), | 61 | m_investments(false), | ||
61 | m_loans(false), | 62 | m_loans(false), | ||
62 | m_reportType(kTypeArray[eExpenseIncome]), | 63 | m_reportType(kTypeArray[eExpenseIncome]), | ||
63 | m_rowType(eExpenseIncome), | 64 | m_rowType(eExpenseIncome), | ||
64 | m_columnType(eMonths), | 65 | m_columnType(Column::Months), | ||
65 | m_columnsAreDays(false), | 66 | m_columnsAreDays(false), | ||
66 | m_queryColumns(eQCnone), | 67 | m_queryColumns(eQCnone), | ||
67 | m_dateLock(userDefined), | 68 | m_dateLock(userDefined), | ||
68 | m_accountGroupFilter(false), | 69 | m_accountGroupFilter(false), | ||
69 | m_chartType(eChartLine), | 70 | m_chartType(eChartLine), | ||
70 | m_chartDataLabels(true), | 71 | m_chartDataLabels(true), | ||
71 | m_chartGridLines(true), | 72 | m_chartGridLines(true), | ||
72 | m_chartByDefault(false), | 73 | m_chartByDefault(false), | ||
Show All 29 Lines | 100 | MyMoneyReport::MyMoneyReport(ERowType _rt, unsigned _ct, dateOptionE _dl, EDetailLevel _ss, const QString& _name, const QString& _comment) : | |||
102 | m_detailLevel(_ss), | 103 | m_detailLevel(_ss), | ||
103 | m_convertCurrency(true), | 104 | m_convertCurrency(true), | ||
104 | m_favorite(false), | 105 | m_favorite(false), | ||
105 | m_tax(false), | 106 | m_tax(false), | ||
106 | m_investments(false), | 107 | m_investments(false), | ||
107 | m_loans(false), | 108 | m_loans(false), | ||
108 | m_reportType(kTypeArray[_rt]), | 109 | m_reportType(kTypeArray[_rt]), | ||
109 | m_rowType(_rt), | 110 | m_rowType(_rt), | ||
110 | m_columnType(eMonths), | 111 | m_columnType(Column::Months), | ||
111 | m_columnsAreDays(false), | 112 | m_columnsAreDays(false), | ||
112 | m_queryColumns(eQCnone), | 113 | m_queryColumns(eQCnone), | ||
113 | m_dateLock(_dl), | 114 | m_dateLock(_dl), | ||
114 | m_accountGroupFilter(false), | 115 | m_accountGroupFilter(false), | ||
115 | m_chartType(eChartLine), | 116 | m_chartType(eChartLine), | ||
116 | m_chartDataLabels(true), | 117 | m_chartDataLabels(true), | ||
117 | m_chartGridLines(true), | 118 | m_chartGridLines(true), | ||
118 | m_chartByDefault(false), | 119 | m_chartByDefault(false), | ||
Show All 11 Lines | |||||
130 | m_currentDateColumn(0), | 131 | m_currentDateColumn(0), | ||
131 | m_skipZero(false) | 132 | m_skipZero(false) | ||
132 | { | 133 | { | ||
133 | //set initial values | 134 | //set initial values | ||
134 | m_chartLineWidth = m_lineWidth; | 135 | m_chartLineWidth = m_lineWidth; | ||
135 | 136 | | |||
136 | //set report type | 137 | //set report type | ||
137 | if (m_reportType == ePivotTable) | 138 | if (m_reportType == ePivotTable) | ||
138 | m_columnType = static_cast<EColumnType>(_ct); | 139 | m_columnType = static_cast<Column::Type>(_ct); | ||
139 | if (m_reportType == eQueryTable) | 140 | if (m_reportType == eQueryTable) | ||
140 | m_queryColumns = static_cast<EQueryColumns>(_ct); | 141 | m_queryColumns = static_cast<EQueryColumns>(_ct); | ||
141 | setDateFilter(_dl); | 142 | setDateFilter(_dl); | ||
142 | 143 | | |||
143 | //throw exception if the type is inconsistent | 144 | //throw exception if the type is inconsistent | ||
144 | if ((_rt > static_cast<ERowType>(sizeof(kTypeArray) / sizeof(kTypeArray[0]))) | 145 | if ((_rt > static_cast<ERowType>(sizeof(kTypeArray) / sizeof(kTypeArray[0]))) | ||
145 | || (m_reportType == eNoReport)) | 146 | || (m_reportType == eNoReport)) | ||
146 | throw MYMONEYEXCEPTION("Invalid report type"); | 147 | throw MYMONEYEXCEPTION("Invalid report type"); | ||
▲ Show 20 Lines • Show All 248 Lines • ▼ Show 20 Line(s) | 351 | { | |||
395 | e.setAttribute("chartgridlines", m_chartGridLines); | 396 | e.setAttribute("chartgridlines", m_chartGridLines); | ||
396 | e.setAttribute("chartbydefault", m_chartByDefault); | 397 | e.setAttribute("chartbydefault", m_chartByDefault); | ||
397 | e.setAttribute("chartlinewidth", m_chartLineWidth); | 398 | e.setAttribute("chartlinewidth", m_chartLineWidth); | ||
398 | e.setAttribute("skipZero", m_skipZero); | 399 | e.setAttribute("skipZero", m_skipZero); | ||
399 | 400 | | |||
400 | if (m_reportType == ePivotTable) { | 401 | if (m_reportType == ePivotTable) { | ||
401 | e.setAttribute("type", "pivottable 1.15"); | 402 | e.setAttribute("type", "pivottable 1.15"); | ||
402 | e.setAttribute("detail", kDetailLevelText[m_detailLevel]); | 403 | e.setAttribute("detail", kDetailLevelText[m_detailLevel]); | ||
403 | e.setAttribute("columntype", kColumnTypeText[m_columnType]); | 404 | e.setAttribute("columntype", Column::kTypeText[m_columnType]); | ||
404 | e.setAttribute("showrowtotals", m_showRowTotals); | 405 | e.setAttribute("showrowtotals", m_showRowTotals); | ||
405 | } else if (m_reportType == eQueryTable) { | 406 | } else if (m_reportType == eQueryTable) { | ||
406 | e.setAttribute("type", "querytable 1.14"); | 407 | e.setAttribute("type", "querytable 1.14"); | ||
407 | 408 | | |||
408 | QStringList columns; | 409 | QStringList columns; | ||
409 | unsigned qc = m_queryColumns; | 410 | unsigned qc = m_queryColumns; | ||
410 | unsigned it_qc = eQCbegin; | 411 | unsigned it_qc = eQCbegin; | ||
411 | unsigned index = 1; | 412 | unsigned index = 1; | ||
▲ Show 20 Lines • Show All 309 Lines • ▼ Show 20 Line(s) | 718 | if (i != -1) { | |||
721 | // here. If the total column is turned off, the flag will be reset | 722 | // here. If the total column is turned off, the flag will be reset | ||
722 | // in the next step | 723 | // in the next step | ||
723 | if (i == eExpenseIncome) | 724 | if (i == eExpenseIncome) | ||
724 | m_showRowTotals = true; | 725 | m_showRowTotals = true; | ||
725 | } | 726 | } | ||
726 | if (e.hasAttribute("showrowtotals")) | 727 | if (e.hasAttribute("showrowtotals")) | ||
727 | m_showRowTotals = e.attribute("showrowtotals").toUInt(); | 728 | m_showRowTotals = e.attribute("showrowtotals").toUInt(); | ||
728 | 729 | | |||
729 | i = kColumnTypeText.indexOf(e.attribute("columntype", "months")); | 730 | i = Column::kTypeText.indexOf(e.attribute("columntype", "months")); | ||
730 | if (i != -1) | 731 | if (i != -1) | ||
731 | setColumnType(static_cast<EColumnType>(i)); | 732 | setColumnType(static_cast<Column::Type>(i)); | ||
732 | 733 | | |||
733 | unsigned qc = 0; | 734 | unsigned qc = 0; | ||
734 | QStringList columns = e.attribute("querycolumns", "none").split(','); | 735 | QStringList columns = e.attribute("querycolumns", "none").split(','); | ||
735 | QStringList::const_iterator it_column = columns.constBegin(); | 736 | QStringList::const_iterator it_column = columns.constBegin(); | ||
736 | while (it_column != columns.constEnd()) { | 737 | while (it_column != columns.constEnd()) { | ||
737 | i = kQueryColumnsText.indexOf(*it_column); | 738 | i = kQueryColumnsText.indexOf(*it_column); | ||
738 | if (i > 0) | 739 | if (i > 0) | ||
739 | qc |= (1 << (i - 1)); | 740 | qc |= (1 << (i - 1)); | ||
▲ Show 20 Lines • Show All 129 Lines • Show Last 20 Lines |