FactDev  0.1
billingdatabase.h
1 #ifndef BILLINGDATABASE_H
2 #define BILLINGDATABASE_H
3 
4 #include "models/billing.h"
5 #include "database.h"
6 #include "utils/log.h"
7 #include "utils/string.h"
8 #include "gui/widgets/widgetsmodels/billingstablemodel.h"
9 
10 using namespace Exceptions;
11 using namespace Utils;
12 using namespace Gui::Widgets;
13 
14 namespace Databases {
21 class BillingDatabase : public Database
22 {
23 public:
30  static BillingDatabase* instance()throw(DbException*);
31 
38  Models::Billing *getBilling(const int pId);
39 
47  WdgModels::BillingsTableModel *getBillingsTable(const int idProject)
48  throw(DbException*);
49 
55  int addBilling(const Models::Billing&);
56 
61  void updateBilling(const Models::Billing&);
62 
68  void removeBilling(const int pId);
69 
77  void addBillingProject(
78  const int idProject, const int idBilling, const int idContributory);
79 
87  bool isBillingPaid(const int pId);
88 
96  void removeBillingProject(
97  const int idProject, const int idBilling, const int idContributory);
98 
103  int getMaxBillingNumber();
104 
109  int getMaxQuoteNumber();
110 
117  int getMaxBillingNumberOfCustomer(const int idCustomer);
118 
125  int getMaxQuoteNumberOfCustomer(const int idCustomer);
126 
133  QSharedPointer<Models::Billing> getBilling(QSqlQuery &q);
134 
140  QMap<Project *, Billing *> getAllBillingsOfProject();
141 
148  QList<Billing> getBillsBetweenDates(QDate begin, QDate end);
149 
155  QList<Billing> getBills(const int projectId = 0);
156 
162  QList<Billing> getBillsPaid(const int projectId = 0);
163 
170  int getNbBills(const int customerId = 0);
171 
178  int getNbBillsPaid(const int customerId = 0);
179 
186  int getNbQuotes(const int customerId = 0);
187 
194  int getNbDocs(const int customerId = 0);
195 
196 private:
197  static BillingDatabase* _instance;
198 
202  BillingDatabase() throw(DbException*) ;
203 };
204 }
205 #endif // BILLINGDATABASE_H
The DbException class for database exception : queries, db file, …
Definition: dbexception.h:18
The BillingDatabase class Billing (or Quote) table database.
Definition: billingdatabase.h:21
The Database class Master class for all database access.
Definition: database.h:34
The BillingsTableModel class for a Billing table.
Definition: billingstablemodel.h:22
The Billing class : Billing or Quote of a Customer.
Definition: billing.h:28