File indexing completed on 2024-05-12 16:42:33

0001 /*
0002     SPDX-FileCopyrightText: 2001-2002 Michael Edwardes <mte@users.sourceforge.net>
0003     SPDX-FileCopyrightText: 2001 Felix Rodriguez <frodriguez@users.sourceforge.net>
0004     SPDX-FileCopyrightText: 2002-2003 Kevin Tambascio <ktambascio@users.sourceforge.net>
0005     SPDX-FileCopyrightText: 2006-2017 Thomas Baumgart <tbaumgart@kde.org>
0006     SPDX-FileCopyrightText: 2006 Ace Jones <acejones@users.sourceforge.net>
0007     SPDX-FileCopyrightText: 2017-2018 Łukasz Wojniłowicz <lukasz.wojnilowicz@gmail.com>
0008     SPDX-License-Identifier: GPL-2.0-or-later
0009 */
0010 
0011 #ifndef MYMONEYACCOUNTLOAN_H
0012 #define MYMONEYACCOUNTLOAN_H
0013 
0014 // ----------------------------------------------------------------------------
0015 // QT Includes
0016 
0017 // ----------------------------------------------------------------------------
0018 // Project Includes
0019 
0020 #include "mymoneyaccount.h"
0021 
0022 /**
0023   * This class is a convenience class to access data for loan accounts.
0024   * It does contain the same member variables as a MyMoneyAccount object,
0025   * but serves a set of getter/setter methods to ease the access to
0026   * laon relevant data stored in the key value container of the MyMoneyAccount
0027   * object.
0028   */
0029 class MyMoneyMoney;
0030 class KMM_MYMONEY_EXPORT MyMoneyAccountLoan : public MyMoneyAccount
0031 {
0032 public:
0033     enum interestDueE {
0034         paymentDue = 0,
0035         paymentReceived,
0036     };
0037 
0038     enum interestChangeUnitE {
0039         changeDaily = 0,
0040         changeWeekly,
0041         changeMonthly,
0042         changeYearly,
0043     };
0044 
0045     MyMoneyAccountLoan() {}
0046     MyMoneyAccountLoan(const MyMoneyAccount&); // krazy:exclude=explicit
0047     ~MyMoneyAccountLoan() {}
0048 
0049     const MyMoneyMoney loanAmount() const;
0050     void setLoanAmount(const MyMoneyMoney& amount);
0051     const MyMoneyMoney interestRate(const QDate& date) const;
0052     void setInterestRate(const QDate& date, const MyMoneyMoney& rate);
0053     interestDueE interestCalculation() const;
0054     void setInterestCalculation(const interestDueE onReception);
0055     const QDate nextInterestChange() const;
0056     void setNextInterestChange(const QDate& date);
0057     const QString schedule() const;
0058     void setSchedule(const QString& sched);
0059     bool fixedInterestRate() const;
0060     void setFixedInterestRate(const bool fixed);
0061     const MyMoneyMoney finalPayment() const;
0062     void setFinalPayment(const MyMoneyMoney& finalPayment);
0063     unsigned int term() const;
0064     void setTerm(const unsigned int payments);
0065     int interestChangeFrequency(int* unit = 0) const;
0066     void setInterestChangeFrequency(const int amount, const int unit);
0067     const MyMoneyMoney periodicPayment() const;
0068     void setPeriodicPayment(const MyMoneyMoney& payment);
0069     int interestCompounding() const;
0070     void setInterestCompounding(int frequency);
0071     const QString payee() const;
0072     void setPayee(const QString& payee);
0073     const QString interestAccountId() const;
0074     void setInterestAccountId(const QString& id);
0075 
0076     /**
0077       * This method checks if a reference to the given object exists. It returns,
0078       * a @p true if the object is referencing the one requested by the
0079       * parameter @p id. If it does not, this method returns @p false.
0080       *
0081       * @param id id of the object to be checked for references
0082       * @retval true This object references object with id @p id.
0083       * @retval false This object does not reference the object with id @p id.
0084       */
0085     bool hasReferenceTo(const QString& id) const final override;
0086 
0087 };
0088 
0089 #endif