File indexing completed on 2024-05-12 16:41:58

0001 /*
0002     KMyMoney transaction importing module - searches for a matching scheduled transaction
0003 
0004     SPDX-FileCopyrightText: 2012 Lukasz Maszczynski <lukasz@maszczynski.net>
0005     SPDX-License-Identifier: GPL-2.0-or-later
0006 */
0007 
0008 #ifndef SCHEDULEDTRANSACTIONMATCHFINDER_H
0009 #define SCHEDULEDTRANSACTIONMATCHFINDER_H
0010 
0011 #include <QList>
0012 
0013 #include "transactionmatchfinder.h"
0014 #include "mymoneyaccount.h"
0015 
0016 /** Implements searching for a matching transaction in the scheduled transactions
0017  */
0018 class ScheduledTransactionMatchFinder : public TransactionMatchFinder
0019 {
0020 public:
0021     /** Ctor, initializes the match finder
0022      * @param account the account for which the scheduled transactions shall be considered
0023      * @param matchWindow max number of days the transactions may vary and still be considered to be matching
0024      */
0025     ScheduledTransactionMatchFinder(const MyMoneyAccount& m_account, int m_matchWindow);
0026 
0027 private:
0028     MyMoneyAccount          m_account;
0029     QList<MyMoneySchedule>  listOfMatchCandidates;
0030 
0031     /** Fills @ref listOfSchedules member with list of scheduled transactions for the @ref account
0032      */
0033     void createListOfMatchCandidates() final override;
0034 
0035     /** Searches for a matching transaction in the scheduled transactions
0036      *
0037      * The search result can be set to any value except @ref MatchDuplicate as described in
0038      * @ref TransactionMatchFinder::findMatch().
0039      * @ref MatchImprecise is returned when transaction dates are not equal, but within matchWindow range
0040      */
0041     void findMatchInMatchCandidatesList() final override;
0042 };
0043 
0044 #endif // SCHEDULEDTRANSACTIONMATCHFINDER_H