FactDev  0.1
contributorieslist.h
1 #ifndef CONTRIBUTORIESLIST_H
2 #define CONTRIBUTORIESLIST_H
3 
4 #include <QMap>
5 
6 #include "models/project.h"
7 #include "models/contributory.h"
8 #include "models/rate.h"
9 #include "models/user.h"
10 #include "models/calculable.h"
11 
12 #include "utils/double.h"
13 
14 namespace Models {
20  : private QMap<QPair<Project*,Models::Rate>*,QList<Contributory> >, public Calculable
21 {
22 public:
29 
34  double getPrice(bool isPaied=false);
35 
41  double getPrice(Models::Project *project);
42 
48  double getSumQuantity();
49 
56  double getSumQuantity(Models::Project *project);
57 
64 
68  virtual void commit();
69 
74  void addContributory(Models::Contributory& contributory);
75 
82  void addProject(Project* p, Models::Rate rate);
83 
90  QList<Contributory> &getContributories(Project* p);
91 
96  int getIdBilling() const;
97 
103  void setIdBilling(int idBilling);
104 
110  void setAllIdContributories(int idContributory);
111 
117  bool isInsert() const;
118 
123  void setInsert(bool insert);
124 
129  int getNbProjects();
130 
136  QSharedPointer<Customer> getCustomer();
137 
142  QList<Project *> getProjects();
143 
149  QList<Contributory> *getAllContributories();
150 
156  QVariantList getDataMap();
157 private:
164  double getPrice(const QList<Contributory> &contributories, Models::Rate r);
165 
171  double getSumQuantity(const QList<Contributory>& contributories);
172 
173  int _idBilling;
174  bool _insert;
175 
176 };
177 }
178 #endif // CONTRIBUTORIESLIST_H
bool isInsert() const
ContributoriesList::isInsert Return TRUE if an element is inserting else FALSE.
Definition: contributorieslist.cpp:251
double getSumQuantity()
ContributoriesList::getSumQuantity Return the sum of quantity (number of hours) of the Contributories...
Definition: contributorieslist.cpp:211
void addProject(Project *p, Models::Rate rate)
ContributoriesList::addProject Add a Project p and it rate
Definition: contributorieslist.cpp:120
QList< Contributory > & getContributories(Project *p)
ContributoriesList::getContributories Return a list of Contributories for the Project p ...
Definition: contributorieslist.cpp:126
The Project class : Project linked to a Customer.
Definition: project.h:17
int getNbProjects()
ContributoriesList::getNbProjects Return the number of projects.
Definition: contributorieslist.cpp:206
The Rate class Rate of a prestation.
Definition: rate.h:13
void addContributory(Models::Contributory &contributory)
ContributoriesList::addContributory Add a new contributory
Definition: contributorieslist.cpp:98
ContributoriesList()
ContributoriesList::ContributoriesList Construct a ContributoriesList.
Definition: contributorieslist.cpp:9
void setIdBilling(int idBilling)
ContributoriesList::setIdBilling Change the Billing id by the new idBilling
Definition: contributorieslist.cpp:238
void setInsert(bool insert)
ContributoriesList::setInsert Change the state of insertion.
Definition: contributorieslist.cpp:256
QList< Contributory > * getAllContributories()
ContributoriesList::getAllContributories List of all contributories (all contributories from all proj...
Definition: contributorieslist.cpp:139
QSharedPointer< Customer > getCustomer()
ContributoriesList::getCustomer Return the Customers linked to theses contributories.
Definition: contributorieslist.cpp:228
The Unit enum Unity of work : hour or day.
Definition: contributory.h:18
Models::Rate getRate(Models::Project *project)
ContributoriesList::getRate.
Definition: contributorieslist.cpp:61
int getIdBilling() const
ContributoriesList::getIdBilling Return the Billing ID.
Definition: contributorieslist.cpp:233
The Calculable interface Models who are calculable.
Definition: calculable.h:9
double getPrice(bool isPaied=false)
getPrice Return the price of a contributories list
Definition: contributorieslist.cpp:37
virtual void commit()
ContributoriesList::commit Update or insert data into the database.
Definition: contributorieslist.cpp:71
The ContributoriesList class List of contributories.
Definition: contributorieslist.h:19
QList< Project * > getProjects()
ContributoriesList::getProjects List of Projects.
Definition: contributorieslist.cpp:148
void setAllIdContributories(int idContributory)
ContributoriesList::setAllIdContributories Change all Contributory id with the same id...
Definition: contributorieslist.cpp:243
QVariantList getDataMap()
ContributoriesList::getDataMap Return a list of Billing and it value linked which indicates if it is ...
Definition: contributorieslist.cpp:158