00001 #ifndef ACCOUNTINGRECORD_H
00002 #define ACCOUNTINGRECORD_H
00003
00004 #include "../Models/accountmodel.h"
00005 #include "../Data/dataexercise.h"
00006 #include "../Data/datadefinitions.h"
00007 #include "../Widgets/alineedit.h"
00008 #include "../Widgets/acombobox.h"
00009 #include <QWidget>
00010 #include <QList>
00011 #include <QString>
00012 #include <QLabel>
00013 #include <QVBoxLayout>
00014 #include <QSvgWidget>
00015 #include "../Widgets/datecalendar.h"
00016
00017
00018
00019
00020
00021
00022 class AccountingRecord : public QWidget
00023 {
00024 Q_OBJECT
00025 public:
00026 AccountingRecord(QWidget *parent, DateCalendar *dc);
00027 ~AccountingRecord();
00028
00029 void createWidgetForExercise(bool editable, AccountModel *model, bool solution = false, DataAccountingRecord *records = 0);
00030 void createWidgetForPrinter(AccountModel *model, DataAccountingRecord *record = 0);
00031
00032 void setAccountModel(AccountModel *model) { p_currentAccountModel = model; }
00033 void setExercise(DataExercise *ex) { p_exercise = ex; }
00034 void deleteWidget();
00035 void saveIntoData(DataExercise *ex);
00036 AccountingInformation* accountingRowInfos();
00037 QList<AccountingInformation>* debitList() { return p_debitList; }
00038 QList<AccountingInformation>* creditList() { return p_creditList; }
00039 void resetStyle();
00040 void save();
00041
00042 bool isSolution;
00043
00044 private:
00045 void createAccountingInformation(bool editable, QString date = "", QString accountingNumber = "", bool onlyLabel = false);
00046 void createAccounts(bool editable, bool debit, AccountModel *model, DataAccountingRecord *record, bool onlyLabel = false);
00047 void createEmptyAccounts(bool debit, AccountModel *model);
00048 void createLayout(bool printer);
00049 void printAccountingRecord();
00050 void makeConnects();
00051 void setOriginalStyle(QWidget *widget);
00052
00053 QWidget *p_date;
00054 QWidget *p_accountingNumber;
00055
00056 QList<AccountingInformation> *p_debitList;
00057 QList<AccountingInformation> *p_creditList;
00058 QVBoxLayout *p_debitLayout;
00059 QVBoxLayout *p_creditLayout;
00060 QHBoxLayout *p_all;
00061
00062 AccountModel *p_currentAccountModel;
00063 DataExercise *p_exercise;
00064
00065 DateCalendar *dateCalendar;
00066
00067 private slots:
00068 void addMoreDebit(int index);
00069 void addMoreCredit(int index);
00070 void checkDeletionNeeded();
00071 void checkAmount();
00072
00073 signals:
00074 void actualizeAccounts();
00075 void sendErrorMessage(QString);
00076
00077 };
00078
00079 #endif // ACCOUNTINGRECORD_H