File indexing completed on 2024-06-16 04:47:30
0001 /*************************************************************************** 0002 * SPDX-FileCopyrightText: 2022 S. MANKOWSKI stephane@mankowski.fr 0003 * SPDX-FileCopyrightText: 2022 G. DE BURE support@mankowski.fr 0004 * SPDX-License-Identifier: GPL-3.0-or-later 0005 ***************************************************************************/ 0006 #ifndef SKGREPORTPLUGINWIDGET_H 0007 #define SKGREPORTPLUGINWIDGET_H 0008 /** @file 0009 * This file is Skrooge plugin for bank management. 0010 * 0011 * @author Stephane MANKOWSKI / Guillaume DE BURE 0012 */ 0013 #include <qdom.h> 0014 #include <qstringlist.h> 0015 #include <qtimer.h> 0016 0017 #include "skgtabpage.h" 0018 #include "ui_skgreportpluginwidget_base.h" 0019 0020 class SKGDocumentBank; 0021 0022 /** 0023 * This file is Skrooge plugin to generate report 0024 */ 0025 class SKGReportPluginWidget : public SKGTabPage 0026 { 0027 Q_OBJECT 0028 0029 public: 0030 /** 0031 * Default Constructor 0032 * @param iParent the parent widget 0033 * @param iDocument the document 0034 * @param iMinimmumMode the panel will be displayed with minimum widgets 0035 */ 0036 explicit SKGReportPluginWidget(QWidget* iParent, SKGDocumentBank* iDocument, bool iMinimmumMode = false); 0037 0038 /** 0039 * Default Destructor 0040 */ 0041 ~SKGReportPluginWidget() override; 0042 0043 /** 0044 * Get the current state 0045 * MUST BE OVERWRITTEN 0046 * @return a string containing all information needed to set the same state. 0047 * Could be an XML stream 0048 */ 0049 QString getState() override; 0050 0051 /** 0052 * Set the current state 0053 * MUST BE OVERWRITTEN 0054 * @param iState must be interpreted to set the state of the widget 0055 */ 0056 void setState(const QString& iState) override; 0057 0058 /** 0059 * Get attribute name to save the default state 0060 * MUST BE OVERWRITTEN 0061 * @return attribute name to save the default state. 0062 */ 0063 QString getDefaultStateAttribute() override; 0064 0065 /** 0066 * Get the zoomable widget. 0067 * The default implementation returns the main widget. 0068 * @return the zoomable widget. 0069 */ 0070 QWidget* zoomableWidget() override; 0071 0072 /** 0073 * Get the printable widgets. 0074 * The default implementation returns the main widget. 0075 * @return the printable widgets. 0076 */ 0077 QList<QWidget*> printableWidgets() override; 0078 0079 public Q_SLOTS: 0080 /** 0081 * Refresh the panel 0082 */ 0083 void refresh(); 0084 0085 /** 0086 * data are modified 0087 * @param iTableName table name 0088 * @param iIdTransaction the id of the transaction for direct modifications of the table (update of modify objects is enough) 0089 *or 0 in case of modifications by impact (full table must be refreshed) 0090 */ 0091 virtual void dataModified(const QString& iTableName = QString(), int iIdTransaction = 0); 0092 0093 private Q_SLOTS: 0094 void pageChanged(); 0095 void onDoubleClick(int row, int column); 0096 void onOpen(); 0097 void onOpenReport(); 0098 void onSelectionChanged(); 0099 void onOneLevelMore(); 0100 void onOneLevelLess(); 0101 void onAddLine(); 0102 void onRemoveLine(); 0103 void onBtnModeClicked(int mode); 0104 0105 void setSettings(); 0106 0107 private: 0108 Q_DISABLE_COPY(SKGReportPluginWidget) 0109 0110 QString getConsolidatedWhereClause(QString* oWhereClausForPreviousData = nullptr, QString* oWhereClausForForecastData = nullptr); 0111 void getWhereClauseAndTitleForItem(int row, int column, QString& oWc, QString& oTitle); 0112 void getWhereClauseAndTitleForSelection(QString& oWc, QString& oTitle); 0113 QString getWhereClauseForProperty(const QString& iProperty) const; 0114 0115 Ui::skgreportplugin_base ui{}; 0116 QString m_previousParametersUsed; 0117 QStringList m_attsForColumns; 0118 QStringList m_attsForLines; 0119 QStringList m_attsForLinesAdded; 0120 QAction* m_openReportAction; 0121 QAction* m_openAction; 0122 QTimer m_timer; 0123 int m_mode; 0124 int m_nbLevelLines; 0125 int m_nbLevelColumns; 0126 bool m_refreshNeeded; 0127 }; 0128 0129 #endif // SKGREPORTPLUGINWIDGET_H