File indexing completed on 2024-05-12 16:42:40
0001 /* 0002 SPDX-FileCopyrightText: 2004-2006 Ace Jones <acejones@users.sourceforge.net> 0003 SPDX-FileCopyrightText: 2006 Darren Gould <darren_gould@gmx.de> 0004 SPDX-FileCopyrightText: 2007-2010 Alvaro Soliverez <asoliverez@gmail.com> 0005 SPDX-FileCopyrightText: 2017-2018 Łukasz Wojniłowicz <lukasz.wojnilowicz@gmail.com> 0006 SPDX-FileCopyrightText: 2018 Michael Kiefer <Michael-Kiefer@web.de> 0007 SPDX-License-Identifier: GPL-2.0-or-later 0008 */ 0009 0010 #ifndef MYMONEYREPORT_P_H 0011 #define MYMONEYREPORT_P_H 0012 0013 #include "mymoneyreport.h" 0014 0015 // ---------------------------------------------------------------------------- 0016 // QT Includes 0017 0018 #include <QString> 0019 #include <QHash> 0020 #include <QDate> 0021 #include <QList> 0022 0023 // ---------------------------------------------------------------------------- 0024 // KDE Includes 0025 0026 // ---------------------------------------------------------------------------- 0027 // Project Includes 0028 0029 #include "mymoneyobject_p.h" 0030 #include "mymoneyenums.h" 0031 0032 class MyMoneyReportPrivate : public MyMoneyObjectPrivate 0033 { 0034 public: 0035 MyMoneyReportPrivate() : 0036 m_name(QStringLiteral("Unconfigured Pivot Table Report")), 0037 m_detailLevel(eMyMoney::Report::DetailLevel::None), 0038 m_investmentSum(eMyMoney::Report::InvestmentSum::Sold), 0039 m_hideTransactions(false), 0040 m_convertCurrency(true), 0041 m_favorite(false), 0042 m_tax(false), 0043 m_investments(false), 0044 m_loans(false), 0045 m_reportType(rowTypeToReportType(eMyMoney::Report::RowType::ExpenseIncome)), 0046 m_rowType(eMyMoney::Report::RowType::ExpenseIncome), 0047 m_columnType(eMyMoney::Report::ColumnType::Months), 0048 m_columnsAreDays(false), 0049 m_queryColumns(eMyMoney::Report::QueryColumn::None), 0050 m_dateLock(eMyMoney::TransactionFilter::Date::UserDefined), 0051 m_accountGroupFilter(false), 0052 m_chartType(eMyMoney::Report::ChartType::Line), 0053 m_chartPalette(eMyMoney::Report::ChartPalette::Application), 0054 m_chartDataLabels(true), 0055 m_chartCHGridLines(true), 0056 m_chartSVGridLines(true), 0057 m_chartByDefault(false), 0058 m_chartLineWidth(MyMoneyReport::m_lineWidth), 0059 m_logYaxis(false), 0060 m_negExpenses(false), 0061 m_dataRangeStart('0'), 0062 m_dataRangeEnd('0'), 0063 m_dataMajorTick('0'), 0064 m_dataMinorTick('0'), 0065 m_yLabelsPrecision(2), 0066 m_dataLock(eMyMoney::Report::DataLock::Automatic), 0067 m_includeSchedules(false), 0068 m_includeTransfers(false), 0069 m_includeBudgetActuals(false), 0070 m_includeUnusedAccounts(false), 0071 m_showRowTotals(false), 0072 m_showColumnTotals(true), 0073 m_includeForecast(false), 0074 m_includeMovingAverage(false), 0075 m_movingAverageDays(0), 0076 m_includePrice(false), 0077 m_includeAveragePrice(false), 0078 m_mixedTime(false), 0079 m_currentDateColumn(0), 0080 m_settlementPeriod(3), 0081 m_showSTLTCapitalGains(false), 0082 m_tseparator(QDate::currentDate().addYears(-1)), 0083 m_skipZero(false) 0084 { 0085 } 0086 0087 static eMyMoney::Report::ReportType rowTypeToReportType(eMyMoney::Report::RowType rowType) 0088 { 0089 static const QHash<eMyMoney::Report::RowType, eMyMoney::Report::ReportType> reportTypes { 0090 {eMyMoney::Report::RowType::NoRows, eMyMoney::Report::ReportType::NoReport}, 0091 {eMyMoney::Report::RowType::AssetLiability, eMyMoney::Report::ReportType::PivotTable}, 0092 {eMyMoney::Report::RowType::ExpenseIncome, eMyMoney::Report::ReportType::PivotTable}, 0093 {eMyMoney::Report::RowType::Category, eMyMoney::Report::ReportType::QueryTable}, 0094 {eMyMoney::Report::RowType::TopCategory, eMyMoney::Report::ReportType::QueryTable}, 0095 {eMyMoney::Report::RowType::Account, eMyMoney::Report::ReportType::QueryTable}, 0096 {eMyMoney::Report::RowType::Tag, eMyMoney::Report::ReportType::QueryTable}, 0097 {eMyMoney::Report::RowType::Payee, eMyMoney::Report::ReportType::QueryTable}, 0098 {eMyMoney::Report::RowType::Month, eMyMoney::Report::ReportType::QueryTable}, 0099 {eMyMoney::Report::RowType::Week, eMyMoney::Report::ReportType::QueryTable}, 0100 {eMyMoney::Report::RowType::TopAccount, eMyMoney::Report::ReportType::QueryTable}, 0101 {eMyMoney::Report::RowType::AccountByTopAccount, eMyMoney::Report::ReportType::QueryTable}, 0102 {eMyMoney::Report::RowType::EquityType, eMyMoney::Report::ReportType::QueryTable}, 0103 {eMyMoney::Report::RowType::AccountType, eMyMoney::Report::ReportType::QueryTable}, 0104 {eMyMoney::Report::RowType::Institution, eMyMoney::Report::ReportType::QueryTable}, 0105 {eMyMoney::Report::RowType::Budget, eMyMoney::Report::ReportType::PivotTable}, 0106 {eMyMoney::Report::RowType::BudgetActual, eMyMoney::Report::ReportType::PivotTable}, 0107 {eMyMoney::Report::RowType::Schedule, eMyMoney::Report::ReportType::InfoTable}, 0108 {eMyMoney::Report::RowType::AccountInfo, eMyMoney::Report::ReportType::InfoTable}, 0109 {eMyMoney::Report::RowType::AccountLoanInfo, eMyMoney::Report::ReportType::InfoTable}, 0110 {eMyMoney::Report::RowType::AccountReconcile, eMyMoney::Report::ReportType::QueryTable}, 0111 {eMyMoney::Report::RowType::CashFlow, eMyMoney::Report::ReportType::QueryTable}, 0112 }; 0113 return reportTypes.value(rowType, eMyMoney::Report::ReportType::Invalid); 0114 } 0115 0116 /** 0117 * The user-assigned name of the report 0118 */ 0119 QString m_name; 0120 /** 0121 * The user-assigned comment for the report, in case they want to make 0122 * additional notes for themselves about the report. 0123 */ 0124 QString m_comment; 0125 /** 0126 * Where to group this report amongst the others in the UI view. This 0127 * should be assigned by the UI system. 0128 */ 0129 QString m_group; 0130 /** 0131 * How much detail to show in the accounts 0132 */ 0133 eMyMoney::Report::DetailLevel m_detailLevel; 0134 /** 0135 * Whether to sum: all, sold, bought or owned value 0136 */ 0137 eMyMoney::Report::InvestmentSum m_investmentSum; 0138 /** 0139 * Whether to show transactions or just totals. 0140 */ 0141 bool m_hideTransactions; 0142 /** 0143 * Whether to convert all currencies to the base currency of the file (true). 0144 * If this is false, it's up to the report generator to decide how to handle 0145 * the currency. 0146 */ 0147 bool m_convertCurrency; 0148 /** 0149 * Whether this is one of the users' favorite reports 0150 */ 0151 bool m_favorite; 0152 /** 0153 * Whether this report should only include categories marked as "Tax"="Yes" 0154 */ 0155 bool m_tax; 0156 /** 0157 * Whether this report should only include investment accounts 0158 */ 0159 bool m_investments; 0160 /** 0161 * Whether this report should only include loan accounts 0162 * Applies only to querytable reports. Mutually exclusive with 0163 * m_investments. 0164 */ 0165 bool m_loans; 0166 /** 0167 * What sort of algorithm should be used to run the report 0168 */ 0169 eMyMoney::Report::ReportType m_reportType; 0170 /** 0171 * What sort of values should show up on the ROWS of this report 0172 */ 0173 eMyMoney::Report::RowType m_rowType; 0174 /** 0175 * What sort of values should show up on the COLUMNS of this report, 0176 * in the case of a 'PivotTable' report. Really this is used more as a 0177 * QUANTITY of months or days. Whether it's months or days is determined 0178 * by m_columnsAreDays. 0179 */ 0180 eMyMoney::Report::ColumnType m_columnType; 0181 /** 0182 * Whether the base unit of columns of this report is days. Only applies to 0183 * 'PivotTable' reports. If false, then columns are months or multiples thereof. 0184 */ 0185 bool m_columnsAreDays; 0186 /** 0187 * What sort of values should show up on the COLUMNS of this report, 0188 * in the case of a 'QueryTable' report 0189 */ 0190 eMyMoney::Report::QueryColumn m_queryColumns; 0191 0192 /** 0193 * The plain-language description of what the date range should be locked 0194 * to. 'userDefined' means NO locking, in any other case, the report 0195 * will be adjusted to match the date lock. So if the date lock is 0196 * 'currentMonth', the start and end dates of the underlying filter will 0197 * be updated to whatever the current month is. This updating happens 0198 * automatically when the report is loaded, and should also be done 0199 * manually by calling updateDateFilter() before generating the report 0200 */ 0201 eMyMoney::TransactionFilter::Date m_dateLock; 0202 /** 0203 * Which account groups should be included in the report. This filter 0204 * is applied to the individual splits AFTER a transaction has been 0205 * matched using the underlying filter. 0206 */ 0207 QList<eMyMoney::Account::Type> m_accountGroups; 0208 /** 0209 * Whether an account group filter has been set (see m_accountGroups) 0210 */ 0211 bool m_accountGroupFilter; 0212 /** 0213 * What format should be used to draw this report as a chart 0214 */ 0215 eMyMoney::Report::ChartType m_chartType; 0216 /** 0217 * What color palette should be used to draw this report as a chart 0218 */ 0219 eMyMoney::Report::ChartPalette m_chartPalette; 0220 /** 0221 * Whether the value of individual data points should be drawn on the chart 0222 */ 0223 bool m_chartDataLabels; 0224 /** 0225 * Whether grid lines should be drawn on the chart 0226 */ 0227 bool m_chartCHGridLines; 0228 bool m_chartSVGridLines; 0229 /** 0230 * Whether this report should be shown as a chart by default (otherwise it 0231 * should be shown as a textual report) 0232 */ 0233 bool m_chartByDefault; 0234 /** 0235 * Width of the chart lines 0236 */ 0237 uint m_chartLineWidth; 0238 0239 /** 0240 * Whether Y axis is logarithmic or linear 0241 */ 0242 bool m_logYaxis; 0243 0244 /** 0245 * Whether expenses should be plotted downwards 0246 */ 0247 bool m_negExpenses; 0248 0249 /** 0250 * Y data range 0251 */ 0252 QString m_dataRangeStart; 0253 QString m_dataRangeEnd; 0254 0255 /** 0256 * Y data range division 0257 */ 0258 QString m_dataMajorTick; 0259 QString m_dataMinorTick; 0260 0261 /** 0262 * Y labels precision 0263 */ 0264 uint m_yLabelsPrecision; 0265 0266 /** 0267 * Whether data range should be calculated automatically or is user defined 0268 */ 0269 eMyMoney::Report::DataLock m_dataLock; 0270 0271 /** 0272 * Whether to include scheduled transactions 0273 */ 0274 bool m_includeSchedules; 0275 /** 0276 * Whether to include transfers. Only applies to Income/Expense reports 0277 */ 0278 bool m_includeTransfers; 0279 /** 0280 * The id of the budget associated with this report. 0281 */ 0282 QString m_budgetId; 0283 /** 0284 * Whether this report should print the actual data to go along with 0285 * the budget. This is only valid if the report has a budget. 0286 */ 0287 bool m_includeBudgetActuals; 0288 /** 0289 * Whether this report should include all accounts and not only 0290 * accounts with transactions. 0291 */ 0292 bool m_includeUnusedAccounts; 0293 /** 0294 * Whether this report should include columns for row totals 0295 */ 0296 bool m_showRowTotals; 0297 /** 0298 * Whether this report should include rows for column totals 0299 */ 0300 bool m_showColumnTotals; 0301 /** 0302 * Whether this report should include forecast balance 0303 */ 0304 bool m_includeForecast; 0305 /** 0306 * Whether this report should include moving average 0307 */ 0308 bool m_includeMovingAverage; 0309 /** 0310 * The amount of days that spans each moving average 0311 */ 0312 int m_movingAverageDays; 0313 /** 0314 * Whether this report should include prices 0315 */ 0316 bool m_includePrice; 0317 /** 0318 * Whether this report should include moving average prices 0319 */ 0320 bool m_includeAveragePrice; 0321 /** 0322 * Make the actual and forecast lines display as one 0323 */ 0324 bool m_mixedTime; 0325 /** 0326 * This stores the column for the current date 0327 * This value is calculated dynamically and thus it is not saved in the file 0328 */ 0329 int m_currentDateColumn; 0330 /** 0331 * Time in days between the settlement date and the transaction date. 0332 */ 0333 uint m_settlementPeriod; 0334 /** 0335 * Controls showing short-term and long-term capital gains. 0336 */ 0337 bool m_showSTLTCapitalGains; 0338 /** 0339 * Date separating shot-term from long-term gains. 0340 */ 0341 QDate m_tseparator; 0342 0343 /** 0344 * This option is for investments reports only which 0345 * show prices instead of balances as all other reports do. 0346 * <p> 0347 * Select this option to include prices for the given period (week, month, 0348 * quarter, ...) only. 0349 * </p> 0350 * <p> 0351 * If this option is off the last existing price is shown for a period, if 0352 * it is on, in a table the value is '0' shown and in a chart a linear 0353 * interpolation for the missing values will be performed. 0354 * <br>Example: 0355 * <br>There are prices for January and March, but there is no price for 0356 * February. 0357 * <ul> 0358 * <li><b>OFF</b>: shows the price for February as the last price of 0359 * January 0360 * <li><b>ON</b>: in a table the value is '0', in a chart a linear 0361 * interpolation for the February-price will be performed 0362 * (so it makes a kind of average-value using the January- and the 0363 * March-price in the chart) 0364 * </ul> 0365 * </p> 0366 */ 0367 bool m_skipZero; 0368 }; 0369 0370 #endif