Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

account.h

Go to the documentation of this file.
00001 #ifndef ACCOUNT_H
00002 #define ACCOUNT_H
00003 
00004 #include <qstring.h>
00005 #include <qlistview.h>
00006 #include <qcombobox.h>
00007 #include <sqlite3.h>
00008 
00009 class Account
00010   {
00011     public:
00012 
00013       Account ();
00014       ~Account ();
00015 
00016       // This function adds a new account to the database.  It takes the account name, parent,
00017       // initial balance and the account type, description, credit limit, statementbalancedate
00018       // as three integers, and the statementbalance amount
00019       // The parent is an integer account id.  Its -1 if there is no parent
00020       // The account types (so far)  are 0=not defined 1=parent checking 2=child checking
00021       void addAccount ( QString, int, float, int, QString, float, int, int, int, float, const char * );
00022 
00023       // updates certain parts of an account
00024       void updateAccount ( QString name, QString description, QString currencycode, int accountid );
00025 
00026       void setAccountExpanded ( int expanded, int accountid );
00027       int getAccountExpanded ( int id );
00028 
00029       // Deletes an account
00030       // Takes the accountid as its parameter
00031       void deleteAccount ( int );
00032 
00033       // Returns the number of accounts
00034       int getNumberOfAccounts ();
00035 
00036       // returns number of child accounts for a given parent
00037       // this function is useless for child accounts.  It will
00038       // always return 0
00039       int getNumberOfChildAccounts ( int );
00040 
00041       // This function retrieves all transactions for an account and updates the
00042       // account balance based on the transactions
00043       void updateAccountBalance ( int accountid );
00044       //void changeAccountBalance ( int accountid, float amount );
00045 
00046       // updates a parent account
00047       void changeParentAccountBalance ( int parentid );
00048 
00049       // Returns the parent account ID for an account
00050       // Takes the account name as its parameter or the account id
00051       int getParentAccountID ( QString accountname );
00052       int getParentAccountID ( int id );
00053 
00054       // This takes a QListView and puts parents and children memorys
00055       // into the list view
00056       void displayAccounts ( QListView * );
00057 
00058       // This function displays a sorted list of account names in a combobox
00059       // Takes the combobox address for its parameter
00060       int displayParentAccountNames ( QComboBox *, QString );
00061 
00062       int getAccountType ( int );  // returns account type for given account id
00063 
00064       // The next three collectively return a date or balance
00065       // They take the accountid as their parameters
00066       int getStatementDay ( int );
00067       int getStatementMonth ( int );
00068       int getStatementYear ( int );
00069       float getStatementBalance ( int );
00070 
00071       // Returns account description and name
00072       QString getAccountDescription ( int accountid );
00073       QString getCurrencyCode ( int accountid );
00074       QString getAccountName ( int accountid );
00075       QStringList getAccountNames ();
00076       QStringList getAccountIDs ();
00077       QString getAccountBalance ( int accountid );
00078 
00079       // returns account credit limit
00080       float getAccountCreditLimit ( int );
00081 
00082       // The primary database that stores all our data
00083       sqlite3 *adb;
00084   };
00085 
00086 class GreyBackgroundItem : public QListViewItem
00087   {
00088     public:
00089 
00090       GreyBackgroundItem ( QListView *parent );
00091       GreyBackgroundItem ( QListView *parent, QString label1, QString label2, QString label3 );
00092       GreyBackgroundItem ( QListView *parent, QString label1, QString label2, QString label3, QString label4 );
00093       GreyBackgroundItem ( QListView *parent, QString label1, QString label2, QString label3, QString label4, QString label5 );
00094 
00095       virtual void paintCell ( QPainter *p, const QColorGroup &cg, int column, int width, int alignment );
00096 
00097   };
00098 
00099 #endif
00100 

Generated on Sat Nov 5 16:18:10 2005 for OPIE by  doxygen 1.4.2