FactDev  0.1
billing.h
1 #ifndef BILLING_H
2 #define BILLING_H
3 #include <QString>
4 #include <QDate>
5 #include <QMap>
6 #include <QList>
7 #include <QIcon>
8 
9 #include "models/imodel.h"
10 #include "models/project.h"
11 #include "models/contributory.h"
12 #include "models/user.h"
13 #include "models/contributorieslist.h"
14 #include "models/calculable.h"
15 
16 #include "database/contributorydatabase.h"
17 
18 #include "generator/texgenerator.h"
19 #include "generator/pdfgenerator.h"
20 
21 #include "utils/double.h"
22 namespace Models {
28 class Billing : public IModel, public Calculable
29 {
30 public:
34  Billing();
39  Billing(int id);
43  ~Billing();
44 
49  void commit();
50 
56  void hydrat(int getId);
57 
61  void remove();
62 
67  QVariantHash getDataMap();
68 
73  double getPrice(bool paied=false);
74 
80  double getSumQuantity();
81 
85  void generateTex();
86 
90  void generatePdf();
91 
97  QString getPath();
98 
103  QString getFolder();
104 
110  QString getFilename();
117 
123  void addContributory(Contributory &c);
124 
129  QString getTitle() const;
130 
135  void setTitle(const QString &getTitle);
136 
141  QString getDescription() const;
142 
147  void setDescription(const QString &getDescription);
148 
153  int getNumber() const;
154 
159  void setNumber(int getNumber);
160 
165  bool isBilling() const;
166 
172  void setIsBilling(bool isBilling);
173 
178  QDate getDate() const;
179 
184  void setDate(const QDate &getDate);
190  bool isPaid() const;
191 
197  void setIsPaid(bool isPaid);
198 
205  bool operator ==(const Billing &b);
212  bool operator !=(const Billing &b);
213  void setContributories(const ContributoriesList &contributories);
214 
221  bool operator <(const Billing &b) const;
222 
223 
228  QStandardItem* getItem();
229 
230 private:
231  ContributoriesList _contributories;
232  QString _title;
233  QString _description;
234  int _number;
235  bool _isBilling;
236  QDate _date;
237  bool _isPaid;
238 };
239 
240 }
241 #endif // BILLING_H
QDate getDate() const
Billing::getDate. return date of the Billing
Definition: billing.cpp:241
void setDate(const QDate &getDate)
Billing::setDate. Modify date of the Billing
Definition: billing.cpp:246
bool isBilling() const
Billing::isBilling. Return if it's a billing or a quote.
Definition: billing.cpp:231
The IModel class.
Definition: imodel.h:13
QStandardItem * getItem()
Billing::getItem Return the bill/quote item.
Definition: billing.cpp:166
QString getPath()
Billing::getPath Return the path of billing filename (without extension)
Definition: billing.cpp:130
QVariantHash getDataMap()
Billing::getDataMap Get all data of model with a HashMap key/value.
Definition: billing.cpp:62
void hydrat(int getId)
Billing::hydrat. Update of the Billing which is specified by getId
Definition: billing.cpp:42
void generatePdf()
Billing::generatePdf Generate a .pdf file for the billing.
Definition: billing.cpp:112
void setIsPaid(bool isPaid)
Billing::setIsPaid Define the current billing according the argument isPaid
Definition: billing.cpp:181
double getSumQuantity()
ContributoriesList::getSumQuantity Return the sum of quantity (number of days) of the Contributories...
Definition: billing.cpp:197
void setDescription(const QString &getDescription)
Billing::setDescription. Modify the description of Billing
Definition: billing.cpp:217
void commit()
Billing::commit. Insert a modification in Billing table on the database.
Definition: billing.cpp:24
QString getFilename()
Billing::getFilename Return the filename of billing (without extension)
Definition: billing.cpp:134
void addContributory(Contributory &c)
Billing::addContributories Add a new contributory for project p.
Definition: billing.cpp:192
void setNumber(int getNumber)
Billing::setNumber. Modify _number of Billing.
Definition: billing.cpp:227
QString getDescription() const
Billing::getDescription. return description of Billing
Definition: billing.cpp:212
The Billing class : Billing or Quote of a Customer.
Definition: billing.h:28
The Unit enum Unity of work : hour or day.
Definition: contributory.h:18
QString getTitle() const
Billing::getTitle. return title of Billing
Definition: billing.cpp:202
The Calculable interface Models who are calculable.
Definition: calculable.h:9
bool operator!=(const Billing &b)
Billing::operator != defines the operator "!=" to compare two Billing and to see if they are differen...
Definition: billing.cpp:150
int getNumber() const
Billing::getNumber. Return number of the Billing.
Definition: billing.cpp:222
void generateTex()
Billing::generateTex Generate a .tex file for the billing.
Definition: billing.cpp:105
QString getFolder()
Billing::getFolder Return the directory of billing.
Definition: billing.cpp:119
int getId() const
IModel::getId Return the identify of the element of the database.
Definition: imodel.h:46
The ContributoriesList class List of contributories.
Definition: contributorieslist.h:19
bool isPaid() const
Billing::isPaid Return TRUE if thee current billing is paid else return FALSE.
Definition: billing.cpp:176
bool operator<(const Billing &b) const
Billing::operator < defines the operator "< to compare two Billing and to see if the fisrt is anterio...
Definition: billing.cpp:161
double getPrice(bool paied=false)
getPrice Return the price of a calculable object
Definition: billing.cpp:100
~Billing()
destruct a billing object
Definition: billing.cpp:20
void setIsBilling(bool isBilling)
Billing::setIsBilling. Modify isBilling of Billing.
Definition: billing.cpp:236
ContributoriesList & getContributories()
Billing::getContributories. Return a map of Contributory for each Project of the Billing ...
Definition: billing.cpp:187
Billing()
Billing::Billing. Construct a Billing.
Definition: billing.cpp:8
void setTitle(const QString &getTitle)
Billing::setTitle. Modify the title of Billing
Definition: billing.cpp:207
bool operator==(const Billing &b)
Billing::operator == define the operator "==" to compare two billings and to see if they are the same...
Definition: billing.cpp:140