File indexing completed on 2024-05-12 16:44:10
0001 /* 0002 SPDX-FileCopyrightText: 2000 Michael Edwardes <mte@users.sourceforge.net> 0003 SPDX-License-Identifier: GPL-2.0-or-later 0004 */ 0005 0006 #ifndef KENDINGBALANCEDLG_H 0007 #define KENDINGBALANCEDLG_H 0008 0009 // ---------------------------------------------------------------------------- 0010 // QT Includes 0011 0012 #include <QWizard> 0013 0014 // ---------------------------------------------------------------------------- 0015 // KDE Includes 0016 0017 // ---------------------------------------------------------------------------- 0018 // Project Includes 0019 0020 class QDate; 0021 0022 class MyMoneyMoney; 0023 class MyMoneyAccount; 0024 class MyMoneyTransaction; 0025 0026 /** 0027 * This dialog is wizard based and used to enter additional 0028 * information required to start the reconciliation process. 0029 * This version implements the behaviour for checkings, 0030 * savings and credit card accounts. 0031 * 0032 * @author Thomas Baumgart 0033 */ 0034 0035 class KEndingBalanceDlgPrivate; 0036 class KEndingBalanceDlg : public QWizard 0037 { 0038 Q_OBJECT 0039 Q_DISABLE_COPY(KEndingBalanceDlg) 0040 0041 public: 0042 enum { Page_CheckingStart, Page_PreviousPostpone, 0043 Page_CheckingStatementInfo, Page_InterestChargeCheckings, 0044 }; 0045 0046 explicit KEndingBalanceDlg(const MyMoneyAccount& account, QWidget *parent = nullptr); 0047 ~KEndingBalanceDlg(); 0048 0049 MyMoneyMoney endingBalance() const; 0050 MyMoneyMoney previousBalance() const; 0051 QDate statementDate() const; 0052 0053 MyMoneyTransaction interestTransaction(); 0054 MyMoneyTransaction chargeTransaction(); 0055 0056 /** 0057 * This method returns the id of the next page in the wizard. 0058 * It is overloaded here to support the dynamic nature of this wizard. 0059 * 0060 * @return id of the next page or -1 if there is no next page 0061 */ 0062 int nextId() const final override; 0063 0064 protected: 0065 bool createTransaction(MyMoneyTransaction& t, const int sign, const MyMoneyMoney& amount, const QString& category, const QDate& date); 0066 MyMoneyMoney adjustedReturnValue(const MyMoneyMoney& v) const; 0067 void createCategory(const QString& txt, QString& id, const MyMoneyAccount& parent); 0068 0069 protected Q_SLOTS: 0070 void slotReloadEditWidgets(); 0071 void help(); 0072 void slotCreateInterestCategory(const QString& txt, QString& id); 0073 void slotCreateChargesCategory(const QString& txt, QString& id); 0074 void accept() final override; 0075 void slotUpdateBalances(); 0076 0077 Q_SIGNALS: 0078 /** 0079 * proxy signal for KMyMoneyPayeeCombo::createItem(const QString&, QString&) 0080 */ 0081 void createPayee(const QString&, QString&); 0082 0083 /** 0084 * emit when a category is about to be created 0085 */ 0086 void createCategory(MyMoneyAccount& acc, const MyMoneyAccount& parent); 0087 0088 private: 0089 KEndingBalanceDlgPrivate * const d_ptr; 0090 Q_DECLARE_PRIVATE(KEndingBalanceDlg) 0091 0092 private Q_SLOTS: 0093 void slotNewPayee(const QString& newnameBase, QString& id); 0094 }; 0095 0096 #endif