File indexing completed on 2024-05-12 05:06:44

0001 /*
0002     SPDX-FileCopyrightText: 2002-2017 Thomas Baumgart <tbaumgart@kde.org>
0003     SPDX-FileCopyrightText: 2004 Kevin Tambascio <ktambascio@users.sourceforge.net>
0004     SPDX-FileCopyrightText: 2005-2006 Ace Jones <acejones@users.sourceforge.net>
0005     SPDX-FileCopyrightText: 2017-2018 Łukasz Wojniłowicz <lukasz.wojnilowicz@gmail.com>
0006     SPDX-License-Identifier: GPL-2.0-or-later
0007 */
0008 
0009 #ifndef MYMONEYSPLIT_P_H
0010 #define MYMONEYSPLIT_P_H
0011 
0012 #include "mymoneysplit.h"
0013 
0014 // ----------------------------------------------------------------------------
0015 // QT Includes
0016 
0017 #include <QDate>
0018 #include <QList>
0019 #include <QString>
0020 
0021 // ----------------------------------------------------------------------------
0022 // KDE Includes
0023 
0024 // ----------------------------------------------------------------------------
0025 // Project Includes
0026 
0027 #include "mymoneyobject_p.h"
0028 #include "mymoneymoney.h"
0029 #include "mymoneytransaction.h"
0030 #include "mymoneyenums.h"
0031 
0032 using namespace eMyMoney;
0033 
0034 class MyMoneySplitPrivate : public MyMoneyObjectPrivate
0035 {
0036 
0037 public:
0038     MyMoneySplitPrivate() :
0039         m_reconcileFlag(eMyMoney::Split::State::NotReconciled),
0040         m_isMatched(false)
0041     {
0042     }
0043 
0044     void collectReferencedObjects() override
0045     {
0046         if (m_isMatched) {
0047             m_referencedObjects.unite(m_matchedTransaction.referencedObjects());
0048         }
0049         for (int i = 0; i < m_tagList.size(); i++) {
0050             m_referencedObjects.insert(m_tagList[i]);
0051         }
0052         m_referencedObjects.insert(m_account);
0053         m_referencedObjects.insert(m_payee);
0054         m_referencedObjects.insert(m_costCenter);
0055     }
0056 
0057     /**
0058       * This member contains the ID of the payee
0059       */
0060     QString        m_payee;
0061 
0062     /**
0063       * This member contains a list of the IDs of the tags
0064       */
0065     QList<QString> m_tagList;
0066 
0067     /**
0068       * This member contains the ID of the account
0069       */
0070     QString        m_account;
0071 
0072     /**
0073      * This member contains the ID of the cost center
0074      */
0075     QString        m_costCenter;
0076 
0077     /**
0078       */
0079     MyMoneyMoney   m_shares;
0080 
0081     /**
0082       */
0083     MyMoneyMoney   m_value;
0084 
0085     /**
0086       * If the quotient of m_shares divided by m_values is not the correct price
0087       * because of truncation, the price can be stored in this member. For display
0088       * purpose and transaction edit this value can be used by the application.
0089       */
0090     MyMoneyMoney   m_price;
0091 
0092     QString        m_memo;
0093 
0094     /**
0095       * This member contains information about the reconciliation
0096       * state of the split. Possible values are
0097       *
0098       * @li NotReconciled
0099       * @li Cleared
0100       * @li Reconciled
0101       * @li Frozen
0102       *
0103       */
0104     eMyMoney::Split::State m_reconcileFlag;
0105 
0106     /**
0107       * In case the reconciliation flag is set to Reconciled or Frozen
0108       * this member contains the date of the reconciliation.
0109       */
0110     QDate          m_reconcileDate;
0111 
0112     /**
0113       * The m_action member is an arbitrary string, but is intended to
0114       * be conveniently limited to a menu of selections such as
0115       * "Buy", "Sell", "Interest", etc.
0116       */
0117     QString        m_action;
0118 
0119     /**
0120       * The m_number member is used to store a reference number to
0121       * the split supplied by the user (e.g. check number, etc.).
0122       */
0123     QString        m_number;
0124 
0125     /**
0126       * This member keeps the bank's unique ID for the split, so we can
0127       * avoid duplicates.  This is only used for electronic statement downloads.
0128       *
0129       * This should only be set on the split which refers to the account
0130       * that was downloaded.
0131       */
0132     QString        m_bankID;
0133 
0134     /**
0135       * This member keeps a backward id to the transaction that this
0136       * split can be found in. It is the purpose of the MyMoneyTransaction
0137       * object to maintain this member variable.
0138       */
0139     QString        m_transactionId;
0140 
0141     MyMoneyTransaction m_matchedTransaction;
0142     bool m_isMatched;
0143 
0144 };
0145 
0146 #endif