transactionmatcher.h

Go to the documentation of this file.
00001 /***************************************************************************
00002                              transactionmatcher.h
00003                              ----------
00004     begin                : Tue Jul 08 2008
00005     copyright            : (C) 2008 by Thomas Baumgart
00006     email                : Thomas Baumgart <ipwizard@users.sourceforge.net>
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This program is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU General Public License as published by  *
00013  *   the Free Software Foundation; either version 2 of the License, or     *
00014  *   (at your option) any later version.                                   *
00015  *                                                                         *
00016  ***************************************************************************/
00017 
00018 #ifndef TRANSACTIONMATCHER_H
00019 #define TRANSACTIONMATCHER_H
00020 
00021 // ----------------------------------------------------------------------------
00022 // QT Includes
00023 
00024 // ----------------------------------------------------------------------------
00025 // KDE Includes
00026 
00027 // ----------------------------------------------------------------------------
00028 // Project Includes
00029 
00030 #include <kmymoney/mymoneytransaction.h>
00031 #include <kmymoney/mymoneyaccount.h>
00032 class MyMoneySchedule;
00033 
00034 class TransactionMatcher
00035 {
00036 public:
00037   typedef enum {
00038     notMatched = 0,          
00039     matched,                 
00040     matchedExact,            
00041     matchedDuplicate         
00042   } autoMatchResultE;
00043 
00044   TransactionMatcher(const MyMoneyAccount& acc);
00045 
00078   void match(MyMoneyTransaction tm, MyMoneySplit sm, MyMoneyTransaction ti, MyMoneySplit si, bool allowImportedTransactions = false);
00079 
00097   void unmatch(const MyMoneyTransaction& t, const MyMoneySplit& s);
00098 
00110   void accept(const MyMoneyTransaction& t, const MyMoneySplit& s);
00111 
00129   MyMoneyObject const * findMatch(const MyMoneyTransaction& ti, const MyMoneySplit& si, MyMoneySplit& sm, autoMatchResultE& result);
00130 
00134   void setMatchWindow(int days) { m_days = days; }
00135 
00136 private:
00137   void checkTransaction(const MyMoneyTransaction& tm, const MyMoneyTransaction& ti, const MyMoneySplit& si, QPair<MyMoneyTransaction, MyMoneySplit>& lastMatch, autoMatchResultE& result, int variation = 0) const;
00138 
00139 private:
00140   MyMoneyAccount            m_account;
00141   int                       m_days;
00142 };
00143 
00144 
00145 #endif

Generated on Wed Jan 26 13:03:18 2011 for KMyMoney by  doxygen 1.5.6