FactDev  0.1
Databases::BillingDatabase Class Reference

The BillingDatabase class Billing (or Quote) table database. More...

#include <billingdatabase.h>

Inheritance diagram for Databases::BillingDatabase:
Databases::Database

Public Member Functions

Models::BillinggetBilling (const int pId)
 BillingDatabase::getBilling get informations about the billing identified by pId More...
 
WdgModels::BillingsTableModelgetBillingsTable (const int idProject) throw (DbException*)
 BillingDatabase::getBillingsTable Return an item model of billings for QTableView. More...
 
int addBilling (const Models::Billing &)
 BillingDatabase::addBilling Add the billing pBilling to the database. More...
 
void updateBilling (const Models::Billing &)
 BillingDatabase::updateCustomer Update informations about the billing pCustomer
 
void removeBilling (const int pId)
 BillingDatabase::removeCustomer Remove the billing with the id pId More...
 
void addBillingProject (const int idProject, const int idBilling, const int idContributory)
 BillingDatabase::addBillingProject Link a project, a billing and a contributory in the table BillingProject. More...
 
bool isBillingPaid (const int pId)
 BillingDatabase::isBillingPaid Return TRUE if the id pId correspond to a Billing and not quote (isBilling = 1) and if this billing is paid (isPaid = 1) else return FALSE. More...
 
void removeBillingProject (const int idProject, const int idBilling, const int idContributory)
 BillingDatabase::removeBillingProject remove a link between a project, a billing and a contributory in the table BillingProject. More...
 
int getMaxBillingNumber ()
 getMaxBillingNumber Get the last number of a billing More...
 
int getMaxQuoteNumber ()
 getMaxQuoteNumber Get the last number of a quote More...
 
int getMaxBillingNumberOfCustomer (const int idCustomer)
 BillingDatabase::getMaxBillingNumberOfCustomer Get the last number of a Customer's Billing. More...
 
int getMaxQuoteNumberOfCustomer (const int idCustomer)
 BillingDatabase::getMaxQuoteNumberOfCustomer Get the last number of a Customer's quote. More...
 
QSharedPointer< Models::BillinggetBilling (QSqlQuery &q)
 BillingDatabase::getBilling Add the element of the q request and return their. More...
 
QMap< Project *, Billing * > getAllBillingsOfProject ()
 BillingDatabase::getAllBillingsOfProject Return a map with the project id as key linked to the billing. More...
 
QList< BillinggetBillsBetweenDates (QDate begin, QDate end)
 Get the bills between begin and end dates. More...
 
QList< BillinggetBills (const int projectId=0)
 Get the bills. More...
 
QList< BillinggetBillsPaid (const int projectId=0)
 Get the bills paid. More...
 
int getNbBills (const int customerId=0)
 Get the number of bills. More...
 
int getNbBillsPaid (const int customerId=0)
 Get the number of bills paid. More...
 
int getNbQuotes (const int customerId=0)
 Get the number of quotes. More...
 
int getNbDocs (const int customerId=0)
 Get the number of documents. More...
 
- Public Member Functions inherited from Databases::Database
QString lastError (const QSqlQuery &q) const
 Database::lastError Return an error message on the last error occured during the SQL request q More...
 
void testCases ()
 Database::testCases Realise a test cases.
 
void executeFile (QString pName)
 Database::executerFichier Exeute a specified file named pName More...
 
void openTransaction ()
 Database::openTransaction Open new transaction.
 
void closeTransaction ()
 Database::closeTransaction Close current transaction.
 
void close ()
 Database::close Close database access.
 
void open ()
 Database::open Open database.
 
 ~Database ()
 Database::~Database Suppression object, and close database access.
 
void setDatabase (QSqlDatabase sql)
 Database::setDatabase Set database. More...
 
void updateBillingNumber ()
 Database::updateBillingNumber Update the billing number.
 
void cleanDatabase ()
 Database::clearDatabase Drop alls tables of Database WARNING: We can't restore data after.
 
void changeDatabase (Databases::DbType dbType)
 changeDatabase Change the current database : mysql to sqlite or sqlite to mysql More...
 

Static Public Member Functions

static BillingDatabaseinstance () throw (DbException*)
 BillingDatabase::getInstance Return an instance of BillingDatabase More...
 
- Static Public Member Functions inherited from Databases::Database
static Databaseinstance (bool tests=false) throw (DbException*)
 Database::getInstance Return an instance of Database. More...
 

Additional Inherited Members

- Protected Member Functions inherited from Databases::Database
 Database (bool tests=false) throw (DbException*)
 Database::Database Database is a singleton.
 
QVariant value (const QSqlQuery &q, const QString &champ) const
 Database::valeur Value of database field. More...
 
- Protected Attributes inherited from Databases::Database
QSettings * _settings
 settings
 
QSqlDatabase mDatabase
 contains Database
 
QList< Database * > _instances
 List of instances.
 
- Static Protected Attributes inherited from Databases::Database
static Database_instance = 0
 Instance.
 
static bool _dbInstance = 0
 an instance of db is open
 
static bool isOpen = false
 Database is open.
 
static bool _isMysql = false
 

Detailed Description

The BillingDatabase class Billing (or Quote) table database.

Author
See Also
Database
Billing/Quote

Member Function Documentation

int Databases::BillingDatabase::addBilling ( const Models::Billing pBilling)

BillingDatabase::addBilling Add the billing pBilling to the database.

Returns
billing id
void Databases::BillingDatabase::addBillingProject ( const int  idProject,
const int  idBilling,
const int  idContributory 
)

BillingDatabase::addBillingProject Link a project, a billing and a contributory in the table BillingProject.

Parameters
idProjectProject id
idBillingBilling id
idContributoryContributory id
QMap< Project *, Billing * > Databases::BillingDatabase::getAllBillingsOfProject ( )

BillingDatabase::getAllBillingsOfProject Return a map with the project id as key linked to the billing.

Returns
Map with projects and Billing
Models::Billing * Databases::BillingDatabase::getBilling ( const int  pId)

BillingDatabase::getBilling get informations about the billing identified by pId

Parameters
pIdbilling id
Returns
the Billing
QSharedPointer< Billing > Databases::BillingDatabase::getBilling ( QSqlQuery &  q)

BillingDatabase::getBilling Add the element of the q request and return their.

Parameters
qSQL request
Returns
a billing formed according to QSharedPointer
WdgModels::BillingsTableModel * Databases::BillingDatabase::getBillingsTable ( const int  idProject)
throw (DbException *
)

BillingDatabase::getBillingsTable Return an item model of billings for QTableView.

Parameters
pIdthe project id of the billings returned
Exceptions
DbException
Returns
QStandardItemModel an item model for QTableView
QList< Billing > Databases::BillingDatabase::getBills ( const int  projectId = 0)

Get the bills.

Parameters
projectIdGet the specified project bills
Returns
The list of bills
QList< Billing > Databases::BillingDatabase::getBillsBetweenDates ( QDate  begin,
QDate  end 
)

Get the bills between begin and end dates.

Parameters
begin
end
Returns
the list of Bills
QList< Billing > Databases::BillingDatabase::getBillsPaid ( const int  projectId = 0)

Get the bills paid.

Parameters
projectIdGet the specified project bills paid
Returns
The list of bills paid
int Databases::BillingDatabase::getMaxBillingNumber ( )

getMaxBillingNumber Get the last number of a billing

Returns
The max number
int Databases::BillingDatabase::getMaxBillingNumberOfCustomer ( const int  idCustomer)

BillingDatabase::getMaxBillingNumberOfCustomer Get the last number of a Customer's Billing.

Parameters
idCustomerCustomer id
Returns
the last number of the Customer's Billing
int Databases::BillingDatabase::getMaxQuoteNumber ( )

getMaxQuoteNumber Get the last number of a quote

Returns
The last number
int Databases::BillingDatabase::getMaxQuoteNumberOfCustomer ( const int  idCustomer)

BillingDatabase::getMaxQuoteNumberOfCustomer Get the last number of a Customer's quote.

Parameters
idCustomerCustomer id
Returns
the last number of the Customer's quote
int Databases::BillingDatabase::getNbBills ( const int  customerId = 0)

Get the number of bills.

Parameters
customerIdIf customerId isn't specified or if it's not valid, get all bills else get the specified customer bills
Returns
Number of bills in the database for all or for a customer
int Databases::BillingDatabase::getNbBillsPaid ( const int  customerId = 0)

Get the number of bills paid.

Parameters
customerIdIf customerId isn't specified if it's not valid, get all bills paid else get the specified customer bills paid
Returns
Number of bills paid in the database for all or for a customer
int Databases::BillingDatabase::getNbDocs ( const int  customerId = 0)

Get the number of documents.

Parameters
customerIdIf customerId isn't specified or if if it's not valid, get all documents else get the specified customer documents
Returns
Number of quotes in the database for all or for a customer
int Databases::BillingDatabase::getNbQuotes ( const int  customerId = 0)

Get the number of quotes.

Parameters
customerIdIf customerId isn't specified or if it's not valid, get all quotes else get the specified customer quotes
Returns
Number of quotes in the database for all or for a customer
BillingDatabase * Databases::BillingDatabase::instance ( )
throw (DbException *
)
static

BillingDatabase::getInstance Return an instance of BillingDatabase

See Also
DbException
Returns
Instance of BillingDatabase
bool Databases::BillingDatabase::isBillingPaid ( const int  pId)

BillingDatabase::isBillingPaid Return TRUE if the id pId correspond to a Billing and not quote (isBilling = 1) and if this billing is paid (isPaid = 1) else return FALSE.

Parameters
pIdBilling id
Returns
TRUE if billing is paid
void Databases::BillingDatabase::removeBilling ( const int  pId)

BillingDatabase::removeCustomer Remove the billing with the id pId

Parameters
pIdbilling id
void Databases::BillingDatabase::removeBillingProject ( const int  idProject,
const int  idBilling,
const int  idContributory 
)

BillingDatabase::removeBillingProject remove a link between a project, a billing and a contributory in the table BillingProject.

Parameters
idProjectProject id
idBillingBilling id
idContributoryContributory id

The documentation for this class was generated from the following files: