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::Row::kText = 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(','); | ||||
37 | const MyMoneyReport::Report::Type MyMoneyReport::Report::kTypeArray[] = { NoReport, PivotTable, PivotTable, QueryTable, QueryTable, QueryTable, QueryTable, QueryTable, QueryTable, QueryTable, QueryTable, QueryTable, QueryTable, QueryTable, QueryTable, PivotTable, PivotTable, InfoTable, InfoTable, InfoTable, QueryTable, QueryTable, NoReport }; | 38 | const MyMoneyReport::Report::Type MyMoneyReport::Report::kTypeArray[] = { NoReport, PivotTable, PivotTable, QueryTable, QueryTable, QueryTable, QueryTable, QueryTable, QueryTable, QueryTable, QueryTable, QueryTable, QueryTable, QueryTable, QueryTable, PivotTable, PivotTable, InfoTable, InfoTable, InfoTable, QueryTable, QueryTable, NoReport }; | ||
38 | const QStringList MyMoneyReport::Column::kTypeText = QString("none,months,bimonths,quarters,4,5,6,weeks,8,9,10,11,years").split(','); | 39 | const QStringList MyMoneyReport::Column::kTypeText = QString("none,months,bimonths,quarters,4,5,6,weeks,8,9,10,11,years").split(','); | ||
39 | // if you add names here, don't forget to update the bitmap for QueryColumns::Type | 40 | // if you add names here, don't forget to update the bitmap for QueryColumns::Type | ||
40 | // and shift the bit for QueryColumns::end one position to the left | 41 | // and shift the bit for QueryColumns::end one position to the left | ||
41 | const QStringList MyMoneyReport::QueryColumns::kText = QString("none,number,payee,category,tag,memo,account,reconcileflag,action,shares,price,performance,loan,balance").split(','); | 42 | const QStringList MyMoneyReport::QueryColumns::kText = QString("none,number,payee,category,tag,memo,account,reconcileflag,action,shares,price,performance,loan,balance").split(','); | ||
42 | | ||||
43 | 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(','); | | |||
44 | | ||||
45 | const QStringList MyMoneyReport::kDetailLevelText = QString("none,all,top,group,total,invalid").split(','); | 43 | 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(','); | 44 | const QStringList MyMoneyReport::kChartTypeText = QString("none,line,bar,pie,ring,stackedbar,invalid").split(','); | ||
47 | 45 | | |||
48 | // This should live in mymoney/mymoneytransactionfilter.h | 46 | // This should live in mymoney/mymoneytransactionfilter.h | ||
49 | const QStringList kTypeText = QString("all,payments,deposits,transfers,none").split(','); | 47 | const QStringList kTypeText = QString("all,payments,deposits,transfers,none").split(','); | ||
50 | const QStringList kStateText = QString("all,notreconciled,cleared,reconciled,frozen,none").split(','); | 48 | const QStringList kStateText = QString("all,notreconciled,cleared,reconciled,frozen,none").split(','); | ||
51 | 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 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(','); | ||
52 | 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(','); | ||
53 | 51 | | |||
52 | QString MyMoneyReport::Row::toString(Type type) | ||||
53 | { | ||||
54 | switch(type) { | ||||
55 | case NoRows : return "NoRows"; | ||||
56 | case AssetLiability : return "AssetLiability"; | ||||
57 | case ExpenseIncome : return "ExpenseIncome"; | ||||
58 | case Category : return "Category"; | ||||
59 | case TopCategory : return "TopCategory"; | ||||
60 | case Account : return "Account"; | ||||
61 | case Tag : return "Tag"; | ||||
62 | case Payee : return "Payee"; | ||||
63 | case Month : return "Month"; | ||||
64 | case Week : return "Week"; | ||||
65 | case TopAccount : return "TopAccount"; | ||||
66 | case AccountByTopAccount: return "AccountByTopAccount"; | ||||
67 | case EquityType : return "EquityType"; | ||||
68 | case AccountType : return "AccountType"; | ||||
69 | case Institution : return "Institution"; | ||||
70 | case Budget : return "Budget"; | ||||
71 | case BudgetActual : return "BudgetActual"; | ||||
72 | case Schedule : return "Schedule"; | ||||
73 | case AccountInfo : return "AccountInfo"; | ||||
74 | case AccountLoanInfo : return "AccountLoanInfo"; | ||||
75 | case AccountReconcile : return "AccountReconcile"; | ||||
76 | case CashFlow : return "CashFlow"; | ||||
77 | default : return "undefined"; | ||||
78 | } | ||||
79 | } | ||||
80 | | ||||
54 | QString MyMoneyReport::Report::toString(Type type) | 81 | QString MyMoneyReport::Report::toString(Type type) | ||
55 | { | 82 | { | ||
56 | switch(type) { | 83 | switch(type) { | ||
57 | case NoReport: return "NoReport"; | 84 | case NoReport: return "NoReport"; | ||
58 | case PivotTable: return "PivotTable"; | 85 | case PivotTable: return "PivotTable"; | ||
59 | case QueryTable: return "QueryTable"; | 86 | case QueryTable: return "QueryTable"; | ||
60 | case InfoTable: return "InfoTable"; | 87 | case InfoTable: return "InfoTable"; | ||
61 | default: return "undefined"; | 88 | default: return "undefined"; | ||
62 | } | 89 | } | ||
63 | } | 90 | } | ||
64 | 91 | | |||
65 | MyMoneyReport::MyMoneyReport() : | 92 | MyMoneyReport::MyMoneyReport() : | ||
66 | m_name("Unconfigured Pivot Table Report"), | 93 | m_name("Unconfigured Pivot Table Report"), | ||
67 | m_detailLevel(eDetailNone), | 94 | m_detailLevel(eDetailNone), | ||
68 | m_convertCurrency(true), | 95 | m_convertCurrency(true), | ||
69 | m_favorite(false), | 96 | m_favorite(false), | ||
70 | m_tax(false), | 97 | m_tax(false), | ||
71 | m_investments(false), | 98 | m_investments(false), | ||
72 | m_loans(false), | 99 | m_loans(false), | ||
73 | m_reportType(Report::kTypeArray[eExpenseIncome]), | 100 | m_reportType(Report::kTypeArray[Row::ExpenseIncome]), | ||
74 | m_rowType(eExpenseIncome), | 101 | m_rowType(Row::ExpenseIncome), | ||
75 | m_columnType(Column::Months), | 102 | m_columnType(Column::Months), | ||
76 | m_columnsAreDays(false), | 103 | m_columnsAreDays(false), | ||
77 | m_queryColumns(QueryColumns::None), | 104 | m_queryColumns(QueryColumns::None), | ||
78 | m_dateLock(userDefined), | 105 | m_dateLock(userDefined), | ||
79 | m_accountGroupFilter(false), | 106 | m_accountGroupFilter(false), | ||
80 | m_chartType(eChartLine), | 107 | m_chartType(eChartLine), | ||
81 | m_chartDataLabels(true), | 108 | m_chartDataLabels(true), | ||
82 | m_chartGridLines(true), | 109 | m_chartGridLines(true), | ||
Show All 19 Lines | 128 | MyMoneyReport::MyMoneyReport(const QString& id, const MyMoneyReport& right) : | |||
102 | MyMoneyObject(id), | 129 | MyMoneyObject(id), | ||
103 | m_movingAverageDays(0), | 130 | m_movingAverageDays(0), | ||
104 | m_currentDateColumn(0) | 131 | m_currentDateColumn(0) | ||
105 | { | 132 | { | ||
106 | *this = right; | 133 | *this = right; | ||
107 | setId(id); | 134 | setId(id); | ||
108 | } | 135 | } | ||
109 | 136 | | |||
110 | MyMoneyReport::MyMoneyReport(ERowType _rt, unsigned _ct, dateOptionE _dl, EDetailLevel _ss, const QString& _name, const QString& _comment) : | 137 | MyMoneyReport::MyMoneyReport(Row::Type _rt, unsigned _ct, dateOptionE _dl, EDetailLevel _ss, const QString& _name, const QString& _comment) : | ||
111 | m_name(_name), | 138 | m_name(_name), | ||
112 | m_comment(_comment), | 139 | m_comment(_comment), | ||
113 | m_detailLevel(_ss), | 140 | m_detailLevel(_ss), | ||
114 | m_convertCurrency(true), | 141 | m_convertCurrency(true), | ||
115 | m_favorite(false), | 142 | m_favorite(false), | ||
116 | m_tax(false), | 143 | m_tax(false), | ||
117 | m_investments(false), | 144 | m_investments(false), | ||
118 | m_loans(false), | 145 | m_loans(false), | ||
Show All 28 Lines | 170 | { | |||
147 | //set report type | 174 | //set report type | ||
148 | if (m_reportType == Report::PivotTable) | 175 | if (m_reportType == Report::PivotTable) | ||
149 | m_columnType = static_cast<Column::Type>(_ct); | 176 | m_columnType = static_cast<Column::Type>(_ct); | ||
150 | if (m_reportType == Report::QueryTable) | 177 | if (m_reportType == Report::QueryTable) | ||
151 | m_queryColumns = static_cast<QueryColumns::Type>(_ct); | 178 | m_queryColumns = static_cast<QueryColumns::Type>(_ct); | ||
152 | setDateFilter(_dl); | 179 | setDateFilter(_dl); | ||
153 | 180 | | |||
154 | //throw exception if the type is inconsistent | 181 | //throw exception if the type is inconsistent | ||
155 | if ((_rt > static_cast<ERowType>(sizeof(Report::kTypeArray) / sizeof(Report::kTypeArray[0]))) | 182 | if ((_rt > static_cast<Row::Type>(sizeof(Report::kTypeArray) / sizeof(Report::kTypeArray[0]))) | ||
156 | || (m_reportType == Report::NoReport)) | 183 | || (m_reportType == Report::NoReport)) | ||
157 | throw MYMONEYEXCEPTION("Invalid report type"); | 184 | throw MYMONEYEXCEPTION("Invalid report type"); | ||
158 | 185 | | |||
159 | //add the corresponding account groups | 186 | //add the corresponding account groups | ||
160 | if (_rt == MyMoneyReport::eAssetLiability) { | 187 | if (_rt == MyMoneyReport::Row::AssetLiability) { | ||
161 | addAccountGroup(MyMoneyAccount::Asset); | 188 | addAccountGroup(MyMoneyAccount::Asset); | ||
162 | addAccountGroup(MyMoneyAccount::Liability); | 189 | addAccountGroup(MyMoneyAccount::Liability); | ||
163 | m_showRowTotals = true; | 190 | m_showRowTotals = true; | ||
164 | } | 191 | } | ||
165 | if (_rt == MyMoneyReport::eAccount) { | 192 | if (_rt == MyMoneyReport::Row::Account) { | ||
166 | addAccountGroup(MyMoneyAccount::Asset); | 193 | addAccountGroup(MyMoneyAccount::Asset); | ||
167 | addAccountGroup(MyMoneyAccount::AssetLoan); | 194 | addAccountGroup(MyMoneyAccount::AssetLoan); | ||
168 | addAccountGroup(MyMoneyAccount::Cash); | 195 | addAccountGroup(MyMoneyAccount::Cash); | ||
169 | addAccountGroup(MyMoneyAccount::Checkings); | 196 | addAccountGroup(MyMoneyAccount::Checkings); | ||
170 | addAccountGroup(MyMoneyAccount::CreditCard); | 197 | addAccountGroup(MyMoneyAccount::CreditCard); | ||
171 | if (KMyMoneyGlobalSettings::expertMode()) | 198 | if (KMyMoneyGlobalSettings::expertMode()) | ||
172 | addAccountGroup(MyMoneyAccount::Equity); | 199 | addAccountGroup(MyMoneyAccount::Equity); | ||
173 | addAccountGroup(MyMoneyAccount::Expense); | 200 | addAccountGroup(MyMoneyAccount::Expense); | ||
174 | addAccountGroup(MyMoneyAccount::Income); | 201 | addAccountGroup(MyMoneyAccount::Income); | ||
175 | addAccountGroup(MyMoneyAccount::Liability); | 202 | addAccountGroup(MyMoneyAccount::Liability); | ||
176 | addAccountGroup(MyMoneyAccount::Loan); | 203 | addAccountGroup(MyMoneyAccount::Loan); | ||
177 | addAccountGroup(MyMoneyAccount::Savings); | 204 | addAccountGroup(MyMoneyAccount::Savings); | ||
178 | addAccountGroup(MyMoneyAccount::Stock); | 205 | addAccountGroup(MyMoneyAccount::Stock); | ||
179 | m_showRowTotals = true; | 206 | m_showRowTotals = true; | ||
180 | } | 207 | } | ||
181 | if (_rt == MyMoneyReport::eExpenseIncome) { | 208 | if (_rt == MyMoneyReport::Row::ExpenseIncome) { | ||
182 | addAccountGroup(MyMoneyAccount::Expense); | 209 | addAccountGroup(MyMoneyAccount::Expense); | ||
183 | addAccountGroup(MyMoneyAccount::Income); | 210 | addAccountGroup(MyMoneyAccount::Income); | ||
184 | m_showRowTotals = true; | 211 | m_showRowTotals = true; | ||
185 | } | 212 | } | ||
186 | //FIXME take this out once we have sorted out all issues regarding budget of assets and liabilities -- asoliverez@gmail.com | 213 | //FIXME take this out once we have sorted out all issues regarding budget of assets and liabilities -- asoliverez@gmail.com | ||
187 | if (_rt == MyMoneyReport::eBudget || _rt == MyMoneyReport::eBudgetActual) { | 214 | if (_rt == MyMoneyReport::Row::Budget || _rt == MyMoneyReport::Row::BudgetActual) { | ||
188 | addAccountGroup(MyMoneyAccount::Expense); | 215 | addAccountGroup(MyMoneyAccount::Expense); | ||
189 | addAccountGroup(MyMoneyAccount::Income); | 216 | addAccountGroup(MyMoneyAccount::Income); | ||
190 | } | 217 | } | ||
191 | if (_rt == MyMoneyReport::eAccountInfo) { | 218 | if (_rt == MyMoneyReport::Row::AccountInfo) { | ||
192 | addAccountGroup(MyMoneyAccount::Asset); | 219 | addAccountGroup(MyMoneyAccount::Asset); | ||
193 | addAccountGroup(MyMoneyAccount::Liability); | 220 | addAccountGroup(MyMoneyAccount::Liability); | ||
194 | } | 221 | } | ||
195 | //cash flow reports show splits for all account groups | 222 | //cash flow reports show splits for all account groups | ||
196 | if (_rt == MyMoneyReport::eCashFlow) { | 223 | if (_rt == MyMoneyReport::Row::CashFlow) { | ||
197 | addAccountGroup(MyMoneyAccount::Expense); | 224 | addAccountGroup(MyMoneyAccount::Expense); | ||
198 | addAccountGroup(MyMoneyAccount::Income); | 225 | addAccountGroup(MyMoneyAccount::Income); | ||
199 | addAccountGroup(MyMoneyAccount::Asset); | 226 | addAccountGroup(MyMoneyAccount::Asset); | ||
200 | addAccountGroup(MyMoneyAccount::Liability); | 227 | addAccountGroup(MyMoneyAccount::Liability); | ||
201 | } | 228 | } | ||
202 | #ifdef DEBUG_REPORTS | 229 | #ifdef DEBUG_REPORTS | ||
203 | QDebug dbg = qDebug(); | 230 | QDebug dbg = qDebug(); | ||
204 | dbg << _name << toString(_rt) << Report::toString(m_reportType); | 231 | dbg << _name << Row::toString(_rt) << Report::toString(m_reportType); | ||
205 | foreach(const MyMoneyAccount::accountTypeE accountType, m_accountGroups) | 232 | foreach(const MyMoneyAccount::accountTypeE accountType, m_accountGroups) | ||
206 | dbg << MyMoneyAccount::accountTypeToString(accountType); | 233 | dbg << MyMoneyAccount::accountTypeToString(accountType); | ||
207 | if (m_accounts.size() > 0) | 234 | if (m_accounts.size() > 0) | ||
208 | dbg << m_accounts; | 235 | dbg << m_accounts; | ||
209 | #endif | 236 | #endif | ||
210 | } | 237 | } | ||
211 | 238 | | |||
212 | MyMoneyReport::MyMoneyReport(const QDomElement& node) : | 239 | MyMoneyReport::MyMoneyReport(const QDomElement& node) : | ||
▲ Show 20 Lines • Show All 53 Lines • ▼ Show 20 Line(s) | 292 | if (!_db.isValid()) | |||
266 | _db = tmpBegin; | 293 | _db = tmpBegin; | ||
267 | if (!_de.isValid()) | 294 | if (!_de.isValid()) | ||
268 | _de = tmpEnd; | 295 | _de = tmpEnd; | ||
269 | } | 296 | } | ||
270 | if (_db > _de) | 297 | if (_db > _de) | ||
271 | _db = _de; | 298 | _db = _de; | ||
272 | } | 299 | } | ||
273 | 300 | | |||
274 | void MyMoneyReport::setRowType(ERowType _rt) | 301 | void MyMoneyReport::setRowType(Row::Type _rt) | ||
275 | { | 302 | { | ||
276 | m_rowType = _rt; | 303 | m_rowType = _rt; | ||
277 | m_reportType = Report::kTypeArray[_rt]; | 304 | m_reportType = Report::kTypeArray[_rt]; | ||
278 | 305 | | |||
279 | m_accountGroupFilter = false; | 306 | m_accountGroupFilter = false; | ||
280 | m_accountGroups.clear(); | 307 | m_accountGroups.clear(); | ||
281 | 308 | | |||
282 | if (_rt == MyMoneyReport::eAssetLiability) { | 309 | if (_rt == MyMoneyReport::Row::AssetLiability) { | ||
283 | addAccountGroup(MyMoneyAccount::Asset); | 310 | addAccountGroup(MyMoneyAccount::Asset); | ||
284 | addAccountGroup(MyMoneyAccount::Liability); | 311 | addAccountGroup(MyMoneyAccount::Liability); | ||
285 | } | 312 | } | ||
286 | if (_rt == MyMoneyReport::eExpenseIncome) { | 313 | if (_rt == MyMoneyReport::Row::ExpenseIncome) { | ||
287 | addAccountGroup(MyMoneyAccount::Expense); | 314 | addAccountGroup(MyMoneyAccount::Expense); | ||
288 | addAccountGroup(MyMoneyAccount::Income); | 315 | addAccountGroup(MyMoneyAccount::Income); | ||
289 | } | 316 | } | ||
290 | } | 317 | } | ||
291 | 318 | | |||
292 | bool MyMoneyReport::accountGroups(QList<MyMoneyAccount::accountTypeE>& list) const | 319 | bool MyMoneyReport::accountGroups(QList<MyMoneyAccount::accountTypeE>& list) const | ||
293 | 320 | | |||
294 | { | 321 | { | ||
Show All 18 Lines | 335 | { | |||
313 | m_accountGroupFilter = true; | 340 | m_accountGroupFilter = true; | ||
314 | if (type != MyMoneyAccount::UnknownAccountType) | 341 | if (type != MyMoneyAccount::UnknownAccountType) | ||
315 | m_accountGroups.push_back(type); | 342 | m_accountGroups.push_back(type); | ||
316 | } | 343 | } | ||
317 | 344 | | |||
318 | bool MyMoneyReport::includesAccountGroup(MyMoneyAccount::accountTypeE type) const | 345 | bool MyMoneyReport::includesAccountGroup(MyMoneyAccount::accountTypeE type) const | ||
319 | { | 346 | { | ||
320 | bool result = (! m_accountGroupFilter) | 347 | bool result = (! m_accountGroupFilter) | ||
321 | || (isIncludingTransfers() && m_rowType == MyMoneyReport::eExpenseIncome) | 348 | || (isIncludingTransfers() && m_rowType == MyMoneyReport::Row::ExpenseIncome) | ||
322 | || m_accountGroups.contains(type); | 349 | || m_accountGroups.contains(type); | ||
323 | 350 | | |||
324 | return result; | 351 | return result; | ||
325 | } | 352 | } | ||
326 | 353 | | |||
327 | bool MyMoneyReport::includes(const MyMoneyAccount& acc) const | 354 | bool MyMoneyReport::includes(const MyMoneyAccount& acc) const | ||
328 | { | 355 | { | ||
329 | bool result = false; | 356 | bool result = false; | ||
330 | 357 | | |||
331 | if (includesAccountGroup(acc.accountGroup())) { | 358 | if (includesAccountGroup(acc.accountGroup())) { | ||
332 | switch (acc.accountGroup()) { | 359 | switch (acc.accountGroup()) { | ||
333 | case MyMoneyAccount::Income: | 360 | case MyMoneyAccount::Income: | ||
334 | case MyMoneyAccount::Expense: | 361 | case MyMoneyAccount::Expense: | ||
335 | if (isTax()) | 362 | if (isTax()) | ||
336 | result = (acc.value("Tax") == "Yes") && includesCategory(acc.id()); | 363 | result = (acc.value("Tax") == "Yes") && includesCategory(acc.id()); | ||
337 | else | 364 | else | ||
338 | result = includesCategory(acc.id()); | 365 | result = includesCategory(acc.id()); | ||
339 | break; | 366 | break; | ||
340 | case MyMoneyAccount::Asset: | 367 | case MyMoneyAccount::Asset: | ||
341 | case MyMoneyAccount::Liability: | 368 | case MyMoneyAccount::Liability: | ||
342 | if (isLoansOnly()) | 369 | if (isLoansOnly()) | ||
343 | result = acc.isLoan() && includesAccount(acc.id()); | 370 | result = acc.isLoan() && includesAccount(acc.id()); | ||
344 | else if (isInvestmentsOnly()) | 371 | else if (isInvestmentsOnly()) | ||
345 | result = acc.isInvest() && includesAccount(acc.id()); | 372 | result = acc.isInvest() && includesAccount(acc.id()); | ||
346 | else if (isIncludingTransfers() && m_rowType == MyMoneyReport::eExpenseIncome) | 373 | else if (isIncludingTransfers() && m_rowType == MyMoneyReport::Row::ExpenseIncome) | ||
347 | // If transfers are included, ONLY include this account if it is NOT | 374 | // If transfers are included, ONLY include this account if it is NOT | ||
348 | // included in the report itself!! | 375 | // included in the report itself!! | ||
349 | result = ! includesAccount(acc.id()); | 376 | result = ! includesAccount(acc.id()); | ||
350 | else | 377 | else | ||
351 | result = includesAccount(acc.id()); | 378 | result = includesAccount(acc.id()); | ||
352 | break; | 379 | break; | ||
353 | default: | 380 | default: | ||
354 | result = includesAccount(acc.id()); | 381 | result = includesAccount(acc.id()); | ||
Show All 19 Lines | 399 | } else { | |||
374 | e.setAttribute("comment", m_comment); | 401 | e.setAttribute("comment", m_comment); | ||
375 | } | 402 | } | ||
376 | e.setAttribute("group", m_group); | 403 | e.setAttribute("group", m_group); | ||
377 | e.setAttribute("convertcurrency", m_convertCurrency); | 404 | e.setAttribute("convertcurrency", m_convertCurrency); | ||
378 | e.setAttribute("favorite", m_favorite); | 405 | e.setAttribute("favorite", m_favorite); | ||
379 | e.setAttribute("tax", m_tax); | 406 | e.setAttribute("tax", m_tax); | ||
380 | e.setAttribute("investments", m_investments); | 407 | e.setAttribute("investments", m_investments); | ||
381 | e.setAttribute("loans", m_loans); | 408 | e.setAttribute("loans", m_loans); | ||
382 | e.setAttribute("rowtype", kRowTypeText[m_rowType]); | 409 | e.setAttribute("rowtype", Row::kText[m_rowType]); | ||
383 | e.setAttribute("datelock", kDateLockText[m_dateLock]); | 410 | e.setAttribute("datelock", kDateLockText[m_dateLock]); | ||
384 | e.setAttribute("includeschedules", m_includeSchedules); | 411 | e.setAttribute("includeschedules", m_includeSchedules); | ||
385 | e.setAttribute("columnsaredays", m_columnsAreDays); | 412 | e.setAttribute("columnsaredays", m_columnsAreDays); | ||
386 | e.setAttribute("includestransfers", m_includeTransfers); | 413 | e.setAttribute("includestransfers", m_includeTransfers); | ||
387 | if (!m_budgetId.isEmpty()) | 414 | if (!m_budgetId.isEmpty()) | ||
388 | e.setAttribute("budget", m_budgetId); | 415 | e.setAttribute("budget", m_budgetId); | ||
389 | e.setAttribute("includesactuals", m_includeBudgetActuals); | 416 | e.setAttribute("includesactuals", m_includeBudgetActuals); | ||
390 | e.setAttribute("includeunused", m_includeUnusedAccounts); | 417 | e.setAttribute("includeunused", m_includeUnusedAccounts); | ||
▲ Show 20 Lines • Show All 328 Lines • ▼ Show 20 Line(s) | 660 | ) { | |||
719 | i = datelockstr.toUInt(&ok); | 746 | i = datelockstr.toUInt(&ok); | ||
720 | if (!ok) { | 747 | if (!ok) { | ||
721 | i = kDateLockText.indexOf(datelockstr); | 748 | i = kDateLockText.indexOf(datelockstr); | ||
722 | if (i == -1) | 749 | if (i == -1) | ||
723 | i = userDefined; | 750 | i = userDefined; | ||
724 | } | 751 | } | ||
725 | setDateFilter(static_cast<dateOptionE>(i)); | 752 | setDateFilter(static_cast<dateOptionE>(i)); | ||
726 | 753 | | |||
727 | i = kRowTypeText.indexOf(e.attribute("rowtype", "expenseincome")); | 754 | i = Row::kText.indexOf(e.attribute("rowtype", "expenseincome")); | ||
728 | if (i != -1) { | 755 | if (i != -1) { | ||
729 | setRowType(static_cast<ERowType>(i)); | 756 | setRowType(static_cast<Row::Type>(i)); | ||
730 | // recent versions of KMyMoney always showed a total column for | 757 | // recent versions of KMyMoney always showed a total column for | ||
731 | // income/expense reports. We turn it on for backward compatibility | 758 | // income/expense reports. We turn it on for backward compatibility | ||
732 | // here. If the total column is turned off, the flag will be reset | 759 | // here. If the total column is turned off, the flag will be reset | ||
733 | // in the next step | 760 | // in the next step | ||
734 | if (i == eExpenseIncome) | 761 | if (i == Row::ExpenseIncome) | ||
735 | m_showRowTotals = true; | 762 | m_showRowTotals = true; | ||
736 | } | 763 | } | ||
737 | if (e.hasAttribute("showrowtotals")) | 764 | if (e.hasAttribute("showrowtotals")) | ||
738 | m_showRowTotals = e.attribute("showrowtotals").toUInt(); | 765 | m_showRowTotals = e.attribute("showrowtotals").toUInt(); | ||
739 | 766 | | |||
740 | i = Column::kTypeText.indexOf(e.attribute("columntype", "months")); | 767 | i = Column::kTypeText.indexOf(e.attribute("columntype", "months")); | ||
741 | if (i != -1) | 768 | if (i != -1) | ||
742 | setColumnType(static_cast<Column::Type>(i)); | 769 | setColumnType(static_cast<Column::Type>(i)); | ||
▲ Show 20 Lines • Show All 89 Lines • ▼ Show 20 Line(s) | |||||
832 | } | 859 | } | ||
833 | 860 | | |||
834 | int MyMoneyReport::m_lineWidth = 2; | 861 | int MyMoneyReport::m_lineWidth = 2; | ||
835 | 862 | | |||
836 | void MyMoneyReport::setLineWidth(int width) | 863 | void MyMoneyReport::setLineWidth(int width) | ||
837 | { | 864 | { | ||
838 | m_lineWidth = width; | 865 | m_lineWidth = width; | ||
839 | } | 866 | } | ||
840 | | ||||
841 | QString MyMoneyReport::toString(ERowType type) | | |||
842 | { | | |||
843 | switch(type) { | | |||
844 | case eNoRows : return "eNoRows"; | | |||
845 | case eAssetLiability : return "eAssetLiability"; | | |||
846 | case eExpenseIncome : return "eExpenseIncome"; | | |||
847 | case eCategory : return "eCategory"; | | |||
848 | case eTopCategory : return "eTopCategory"; | | |||
849 | case eAccount : return "eAccount"; | | |||
850 | case eTag : return "eTag"; | | |||
851 | case ePayee : return "ePayee"; | | |||
852 | case eMonth : return "eMonth"; | | |||
853 | case eWeek : return "eWeek"; | | |||
854 | case eTopAccount : return "eTopAccount"; | | |||
855 | case eAccountByTopAccount: return "eAccountByTopAccount"; | | |||
856 | case eEquityType : return "eEquityType"; | | |||
857 | case eAccountType : return "eAccountType"; | | |||
858 | case eInstitution : return "eInstitution"; | | |||
859 | case eBudget : return "eBudget"; | | |||
860 | case eBudgetActual : return "eBudgetActual"; | | |||
861 | case eSchedule : return "eSchedule"; | | |||
862 | case eAccountInfo : return "eAccountInfo"; | | |||
863 | case eAccountLoanInfo : return "eAccountLoanInfo"; | | |||
864 | case eAccountReconcile : return "eAccountReconcile"; | | |||
865 | case eCashFlow : return "eCashFlow"; | | |||
866 | default : return "undefined"; | | |||
867 | } | | |||
868 | } | |