00001 #ifndef DATAACCOUNT_H 00002 #define DATAACCOUNT_H 00003 00004 #include <QString> 00005 #include <QDomNode> 00006 #include <QDomDocument> 00007 #include <QDomElement> 00008 #include <QObject> 00009 00011 00014 class DataBasicAccount : public QObject 00015 { 00016 public: 00017 int accountNumber() { return accountNumberValue; } 00018 QString name() { return nameValue; } 00019 00020 void setAccountNumber(int number) { accountNumberValue = number; } 00021 void setName(QString name) { nameValue = name; } 00022 00024 virtual void hash(unsigned int &startValue); 00026 virtual bool loadDataNode(const QDomNode data); 00028 virtual QDomElement saveDataNode(QDomDocument *xml, bool displayName = true); 00029 00030 DataBasicAccount(); 00031 virtual ~DataBasicAccount() {} 00032 00033 private: 00034 int accountNumberValue; 00035 QString nameValue; 00036 }; 00037 00038 class DataAccount: public DataBasicAccount 00039 { 00040 Q_OBJECT 00041 public: 00042 double openingStockDebit() { return debitValue; } 00043 double openingStockCredit() { return creditValue; } 00044 QString openingDate() { return date; } 00045 00046 void setOpeningStockDebit(double debit) { debitValue = debit; } 00047 void setOpeningStockCredit(double credit) { creditValue = credit; } 00048 void setOpeningDate(QString dateValue) { date = dateValue; } 00049 00051 void hash(unsigned int &startValue); 00053 bool loadDataNode(const QDomNode data); 00055 QDomElement saveDataNode(QDomDocument *xml); 00056 00057 DataAccount(); 00058 ~DataAccount() {} 00059 00060 public slots: 00061 void dataChanged() { emit changed(); } 00062 00063 signals: 00064 void changed(); 00065 00066 private: 00067 // KEEP-IN-MIND: Precision... fixpoint datatype would be nice 00068 double debitValue; // is any value on debit-side 00069 double creditValue; // is any value on credit-side 00070 QString date; // needed to know which year 2007 or 2008 or 2009 ..... 00071 }; 00072 00073 class DataTableAccount: public DataBasicAccount 00074 { 00075 public: 00076 QString description() { return accountDescription; } 00077 void setDescription(QString description) { accountDescription = description; } 00078 00080 void hash(unsigned int &startValue); 00082 bool loadDataNode(const QDomNode data); 00084 QDomElement saveDataNode(QDomDocument *xml); 00085 00086 DataTableAccount(); 00087 ~DataTableAccount() {} 00088 00089 private: 00090 QString accountDescription; 00091 }; 00092 00093 #endif // DATAACCOUNT_H