📄 lxaccount.h
字号:
// -*- C++ -*-// ****************************************************************************// // LxBank - home-banking for Linux using the HBCI standard// // Author: Franz Zimmermann 83043 Bad Aibling// // Copyright (C) 2002-2003 Franz Zimmermann - arafang@users.sourceforge.net// // This program is free software; you can redistribute it and/or modify// it under the terms of the GNU General Public License as published by// the Free Software Foundation; either version 2 of the License, or// (at your option) any later version.// // This program is distributed in the hope that it will be useful,// but WITHOUT ANY WARRANTY; without even the implied warranty of// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the// GNU General Public License for more details.// // You should have received a copy of the GNU General Public License// along with this program; if not, write to the Free Software// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.// // ***************************************************************************//// ***************************************************************************// /*! \file \brief LxAccount: Account classes for LxBank*/ // ***************************************************************************//// $Name: $//// $State: Exp $//// $Log: LxAccount.h,v $// Revision 1.18 2003/05/08 02:39:53 arafang// Error checking of money transfer improved. Use library ktoblzcheck to validate account id's.//// Revision 1.17 2003/03/26 22:24:35 arafang// Add method to check outgoing money transfers syntactically.//// Revision 1.16 2003/02/20 02:38:03 arafang// Default args in some constructor implementions removed.//// Revision 1.15 2003/02/08 15:25:20 franz// Mail address changed.//// Revision 1.14 2003/02/08 11:45:19 franz// Money transfer (single mode) works.//// Revision 1.13 2003/02/04 00:42:27 franz// Account config split into three parts:// o account_config// o account_current_remittances_config// o account_processed_remittances_config//// Revision 1.12 2003/02/03 23:06:10 franz// Class LxRemittance adapted to needs of HBCI. Remittances saved on Account// config. LxRemittanceWorkDialog and constructor of class LxRemittance improved// to avoid possible core dumps with QString method latin1 and class QStringList.// Make checks in LxAccount::updateBalanceAndAccStmt weather a job has been// performed successfully or not.//// Revision 1.11 2003/01/29 22:41:30 franz// Account config file introduced. Saving starting balance and last account// statement date.// Started to adapt class LxRemittance to needs of HBCI.//// Revision 1.10 2003/01/26 23:09:41 franz// LxAccountSelectDialog: New method to delete accounts (remove).// Class LxAccountStmtPrint adapted to new account statement view layout.// Account update implemented.//// Revision 1.9 2003/01/18 15:36:09 franz// New class LxAccountStmtView implemented.//// Revision 1.8 2003/01/17 00:56:42 franz// Getting account statements work.//// Revision 1.7 2003/01/11 18:35:22 franz// Complete methods of class LxInteractor.// Worked on class LxPinDialog.// Improve class LxUserAddWizard.// Implement methods removeUser and getAccounts in class LxUserListDialog.// Button enable/dissable bug fixed in class LxRemittanceView.//// Revision 1.6 2002/09/20 20:44:32 franz// Worked on LxTextEdit.// Two digit year numbers are now considered by class LxRemittance as:// o year 20xx if it is <= 80// o year 19xx if it is > 80//// Revision 1.5 2002/07/04 23:18:31 franz// Optimize performance of class LxAccount.// Add account close function.//// Revision 1.4 2002/07/02 23:09:45 franz// Now the accounts from the global accounts list are used within the program//// Revision 1.3 2002/06/02 22:03:19 franz// Remittance view lists improved.// Remittance work dialogs implemented.//// Revision 1.2 2002/05/05 18:31:35 franz// Started with the implementatation of remittance views.//// Revision 1.1 2002/04/23 22:13:15 franz// File LxAccountStmtList.h renamed to LxAccount.h// File LxAccountStmtList.cc renamed to LxAccount.cc//// Revision 1.2 2002/04/22 23:53:16 franz// Account open dialog implemented. This dialog presents a list of all// existing accounts. The information where the account data files are// located is stored in the LxBank resource directory '~/.LxBank' in the// file 'accounts.dat'.//// Revision 1.1 2002/04/07 23:20:47 franz// Worked on account view window.//////#ifndef LX_ACCOUNT_H#define LX_ACCOUNT_H#include <qobject.h> #include <qdatetime.h> #include <qptrlist.h>#include <qstring.h> #include <qstringlist.h> #include <ktoblzcheck.hh> #include "LxHbci.h"class LxAccount;class LxRemittanceList;class LxAccountStmt {public: LxAccountStmt (int num, QString srtKey, double preSaldo, const HBCI::Transaction &tr); virtual ~LxAccountStmt (){} QDate getDatum () const { return datum; } QDate getValuta () const { return valuta; } QString getOtherBank () { return otherBank; } QString getOtherAccountId () { return otherAccountId; } QString getCode () { return code; } QStringList getBuchungsText () const { return BuchungsText; } double getUmsatz () { return umsatz; } double getSaldo () { return saldo; } QString getDatumSortKey () const { return datumSortKey; } QString getValutaSortKey () const { return valutaSortKey; } QString getOtherBankSortKey () const { return otherBankSortKey; } QString getOtherAccountIdSortKey () const { return otherAccountIdSortKey; } QString getCodeSortKey () const { return codeSortKey; } QString getUmsatzSortKey () const { return umsatzSortKey; } QString getSaldoSortKey () const { return saldoSortKey; }protected: int number; QDate datum; QDate valuta; QString otherBank; QString otherAccountId; QString code; QStringList BuchungsText; double umsatz; double saldo; QString datumSortKey; QString valutaSortKey; QString otherBankSortKey; QString otherAccountIdSortKey; QString codeSortKey; QString umsatzSortKey; QString saldoSortKey; void setUmsatzSortKey (int base, int digits, double mf); void setSaldoSortKey (int base, int digits, double mf); friend class LxAccount;};typedef QPtrList<LxAccountStmt> AccountStmtList;class LxRemittance {public: enum RemittanceStatus { current, processed }; enum CheckResult { Passed, Warning, Error }; LxRemittance ( LxAccount *acc, const HBCI::Transaction &tra, RemittanceStatus sta ); LxRemittance (LxAccount *acc, const QString& dat, const QString& tan, const QString& am, const QString& cur, const QString& rec, const QString& recaccno, const QString& recblz, const QString& txt1, const QString& txt2); virtual ~LxRemittance (){} LxAccount *getAccount () { return account; } const HBCI::Transaction &HBCItransaction(){ return hbciTransaction; } int getNumber () const { return number; } QDate getDate () const { return date; } QDate getDateOfExecution () const { return dateOfExecution; } double getAmount () const { return amount; } QString getAmountStr () const { return amountStr; } QString getCurrency () const { return currency; } QString getReceiver () const { return receiver; } QString getAccountNo () const { return receiverAccountNo; } QString getTAN () const { return tan; } QString getBLZ () const { return receiverBLZ; } QStringList getText () const { return text; } RemittanceStatus getStatus () const { return status; } void setStatus ( RemittanceStatus sta ) { status = sta; } QString getNumberSortKey () const { return numberSortKey; } QString getDateSortKey () const { return dateSortKey; } QString getAmountSortKey () const { return amountSortKey; } QString getRecAccNoSortKey () const { return recAccNoSortKey; } QTextStream& write ( QTextStream& out ); void setNumberAndSortKey (int num, int digits); CheckResult check (QString &msg);protected: int number; RemittanceStatus status; LxAccount *account; HBCI::Transaction hbciTransaction; QDate date; QDate dateOfExecution; QString tan; double amount; QString amountStr; QString currency; QString receiver; QString receiverAccountNo; QString receiverBLZ; QStringList text; QString numberSortKey; QString dateSortKey; QString amountSortKey; // 12 digits QString recAccNoSortKey; // 10 digits// double extractAmountValue( QString & a); int checkYear(int y); void setupDataMembers (const QString& dat, const QString& am, const QString& cur, const QString& rec, const QString& recaccno, const QString& recblz, const QString& txt1, const QString& txt2, const QString& exdat = QString::null); void setupTransaction (); void setupFromTransaction ();private: LxRemittance (LxAccount *acc, const QString& exdat, const QString& dat, const QString& tan, const QString& am, const QString& cur, const QString& rec, const QString& recaccno, const QString& recblz, const QString& txt1, const QString& txt2);};typedef QPtrList<LxRemittance> RemittanceList;class LxAccount : public QObject{ Q_OBJECTpublic: LxAccount( int n, LxHbci *hbciapi, HBCI::Pointer<HBCI::Account> acc ); virtual ~LxAccount( ); int getId () const { return id;} bool isOpened () const { return isOpen;}// void setId ( int n ) { id = n; } QString getName () const { return accountName;} QString getInstitut () const { return institut;} QString getInhaber () const { return inhaber;} QString getBLZ () const { return bankLeitZahl;} int getCountry () const { return country;} QString getAccountNo () const { return kontoNummer;} QString getCurrency () const { return currency;} QString getLastAccountStmtDate () const { return lastUpdatedStr;} QString getKontoStand () const { return kontoStand;} const HBCI::Pointer<HBCI::Account> &HBCIaccount(){ return hbciAccount; }// QString getKontoDatenFile () const { return accountDataFile;}// QString getAuszugsFile () const { return auszugsFile;}// QString getRemittanceFile () const { return remittanceFile;} void open ( );// void update ( ); void clearConfig (); void close ( ); void updateBalanceAndAccStmt ( ); void addRemittance ( LxRemittance *rm ); void modifyRemittance ( LxRemittance *rm, LxRemittance *rmm ); void removeRemittance ( LxRemittance *rm ); void submitRemittance ( LxRemittance *rm ); int checkForBank (unsigned long b); AccountNumberCheck::Result checkForAccount (const QString &b, const QString &a, string &m);// static bool isDataLine ( QString & );protected: int id; LxHbci *hbciApi; HBCI::Pointer<HBCI::Account> hbciAccount; bool isOpen; HBCI::SimpleConfig accConfig; HBCI::SimpleConfig currRemConfig; HBCI::SimpleConfig procRemConfig; string accConfigFile; string currRemConfigFile; string procRemConfigFile; HBCI::Balance startingBalance; bool startingBalanceIsSet; HBCI::Date lastUpdated; HBCI::Date lastTransactionDate; bool lastUpdatedIsSet; QString accountName; QString institut; QString inhaber; QString bankLeitZahl; int country; QString kontoNummer; QString currency; QString lastUpdatedStr; QString kontoStand; // booked balance QString notedBalance;// QString auszugsFile; AccountStmtList accountStmtList;// QString remittanceFile; RemittanceList currentRemittanceList; RemittanceList processedRemittanceList; RemittanceList emptyRemittanceList;// bool remittanceListsRead; void updateAccount ( ); void initAccount ( ); void updateAccountData ( ); void setupAccountStmtList ( );// void setupRemittanceLists ( );// void saveRemittances ( ); double computeBalance ( ); void setupStartingBalance ( ); HBCI::Error loadAccountConfig ( ); HBCI::Error saveAccountConfig ( ); HBCI::Error loadCurrentRemittances ( ); HBCI::Error saveCurrentRemittances ( ); HBCI::Error loadProcessedRemittances ( ); HBCI::Error saveProcessedRemittances ( );signals: void updateAccountDataView ( const LxAccount& ); void updateAccountStmtView ( AccountStmtList& ); void updateCurrentRemittanceView ( RemittanceList& ); void updateProcessedRemittanceView ( RemittanceList& );private: LxAccount( ){}};typedef QPtrList<LxAccount> AccountList;#endif // LxAccount.h
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -