00001 #ifndef TRANSACTION_H
00002 #define TRANSACTION_H
00003
00004 #include <qstring.h>
00005 #include <qlistview.h>
00006 #include <qdatetime.h>
00007 #include <sqlite3.h>
00008
00009 #include "preferences.h"
00010
00011 class Transaction
00012 {
00013 public:
00014
00015 Transaction ();
00016 ~Transaction ();
00017
00018
00019
00020 void addTransaction ( QString description, QString payee, int accountid, int parentid, int number, int day, int month, int year, float amount, int cleared, int budgetid, int lineitemid );
00021
00022
00023 void updateTransaction ( QString, QString, int, int, int, int, float, int, int, int, int );
00024
00025
00026 void deleteTransaction ( int );
00027
00028
00029 int getNumberOfTransactions ();
00030
00031
00032
00033 int getNumberOfTransactions ( int );
00034
00035
00036 void deleteAllTransactions ( int accountid );
00037
00038 QString getBudgetTotal ( int budgetid, int lineitemid, int year, int month, int viewtype );
00039 QString getActualTotal ( int budgetid, int year, int month, int viewtype );
00040
00041
00042 void clearBudgetIDs ( int, int );
00043 void clearBudgetIDs ( int );
00044
00045 public slots:
00046
00047 void displayTransactions ( QListView *, int, bool, const char *, QDate );
00048 char ** selectAllTransactions ( QDate fromdate, bool children, const char *limit, int id );
00049 char ** selectNonClearedTransactions ( QDate fromdate, bool children, const char *limit, int id );
00050 QString getPayee ( int );
00051 QString getTransactionDescription ( int );
00052 QString getNumber ( int );
00053 QString getAmount ( int );
00054 QString getAbsoluteAmount ( int );
00055 int getCleared ( int );
00056 void setCleared ( int id, int cleared );
00057 int getBudgetID ( int id );
00058 int getLineItemID ( int id );
00059 int getDay ( int );
00060 int getMonth ( int );
00061 int getYear ( int );
00062 int getAccountID ( int id );
00063
00064 private:
00065
00066 sqlite3 *tdb;
00067 int rows, columns;
00068 };
00069
00070 #endif
00071
00072
00073