Implemented camp wizard and service methods for camp calculation.

This commit is contained in:
2017-05-29 21:40:22 +02:00
parent 9a087e1874
commit b0f129f38d
24 changed files with 1180 additions and 227 deletions
+21
View File
@@ -6,6 +6,7 @@ CampData::CampData(QObject *parent) : QObject(parent)
m_id = 0;
m_totalPrice = 0;
m_sale = 0;
m_totalSale = 0;
m_ownerFirstame = false;
}
@@ -158,3 +159,23 @@ void CampData::setNumSer(const QString &numSer)
{
m_numSer = numSer;
}
QDecDouble CampData::totalSale() const
{
return TO_DEC(m_totalSale);
}
void CampData::setTotalSale(QDecDouble totalSale)
{
m_totalSale = FROM_DEC(totalSale);
}
QDecDouble CampData::fullPrice() const
{
return TO_DEC(m_fullPrice);
}
void CampData::setFullPrice(QDecDouble fullPrice)
{
m_fullPrice = FROM_DEC(fullPrice);
}
+9
View File
@@ -23,6 +23,7 @@ class CampData : public QObject
Q_PROPERTY(QDecDouble totalPrice READ totalPrice WRITE setTotalPrice)
Q_PROPERTY(QDecDouble sale READ sale WRITE setSale)
Q_PROPERTY(bool fixedSale READ fixedSale WRITE setFixedSale)
Q_PROPERTY(QDecDouble totalSale READ totalSale WRITE setTotalSale)
public:
explicit CampData(QObject *parent = 0);
@@ -70,6 +71,12 @@ public:
QString numSer() const;
void setNumSer(const QString &numSer);
QDecDouble totalSale() const;
void setTotalSale(QDecDouble totalSale);
QDecDouble fullPrice() const;
void setFullPrice(QDecDouble fullPrice);
private:
friend class odb::access;
#pragma db id auto
@@ -84,8 +91,10 @@ private:
QOdbList<ServiceItemPtr> m_services;
#pragma db value_not_null inverse(m_campData)
QOdbList<AddressItemPtr> m_people;
int m_fullPrice;
int m_totalPrice;
int m_sale;
int m_totalSale;
bool m_fixedSale;
SeasonPtr m_season;
};
+18 -1
View File
@@ -1,7 +1,7 @@
#include "sale.h"
#include <define.h>
Sale::Sale(QObject *parent) : QObject(parent)
Sale::Sale(QObject *parent) : ComboItem(parent)
{
m_id = 0;
m_sale = 0;
@@ -47,3 +47,20 @@ void Sale::setDescription(const QString &description)
{
m_description = description;
}
bool Sale::eq(ComboItem *other)
{
Sale *sale = qobject_cast<Sale*>(other);
if (sale == NULL)
{
return false;
}
return this->m_id == sale->m_id && this->m_sale == sale->m_sale && this->m_fixed == sale->m_fixed;
}
QString Sale::toString()
{
return m_description;
}
+7 -1
View File
@@ -4,9 +4,10 @@
#include <QObject>
#include <odb/core.hxx>
#include <QDecDouble.hh>
#include <combodata.h>
#pragma db object
class Sale : public QObject
class Sale : public ComboItem
{
Q_OBJECT
Q_PROPERTY(QString description READ description WRITE setDescription)
@@ -35,6 +36,11 @@ private:
QString m_description;
int m_sale;
bool m_fixed;
// ComboItem interface
public:
bool eq(ComboItem *other);
QString toString();
};
#endif // SALE_H
+42
View File
@@ -5,7 +5,9 @@ ServiceItem::ServiceItem(QObject *parent) : QObject(parent)
{
m_id = 0;
m_salePossible = false;
m_sale = 0;
m_price = 0;
m_totalPrice = 0;
m_type = AccService::OTHER;
}
@@ -78,3 +80,43 @@ void ServiceItem::setCampData(const QWeakPointer<CampData> &campData)
{
m_campData = campData;
}
QString ServiceItem::description() const
{
return m_description;
}
void ServiceItem::setDescription(const QString &description)
{
m_description = description;
}
QDecDouble ServiceItem::sale() const
{
return TO_DEC(m_sale);
}
void ServiceItem::setSale(QDecDouble sale)
{
m_sale = FROM_DEC(sale);
}
QDecDouble ServiceItem::totalPrice() const
{
return TO_DEC(m_totalPrice);
}
void ServiceItem::setTotalPrice(QDecDouble totalPrice)
{
m_totalPrice = FROM_DEC(totalPrice);
}
QDecDouble ServiceItem::fullPrice() const
{
return TO_DEC(m_fullPrice);
}
void ServiceItem::setFullPrice(QDecDouble fullPrice)
{
m_fullPrice = FROM_DEC(fullPrice);
}
+19 -1
View File
@@ -18,8 +18,10 @@ class ServiceItem : public QObject
Q_OBJECT
Q_PROPERTY(QString name READ name WRITE setName)
Q_PROPERTY(QString code READ code WRITE setCode)
Q_PROPERTY(QString description READ description WRITE setDescription)
Q_PROPERTY(QDecDouble price READ price WRITE setPrice)
Q_PROPERTY(bool salePossible READ salePossible WRITE setSalePossible)
Q_PROPERTY(QDecDouble sale READ sale WRITE setSale)
Q_PROPERTY(QDecDouble totalPrice READ totalPrice WRITE setTotalPrice)
Q_PROPERTY(AccService::ServiceType type READ type WRITE setType)
Q_ENUMS(AccService::ServiceType)
@@ -47,13 +49,29 @@ public:
QWeakPointer<CampData> campData() const;
void setCampData(const QWeakPointer<CampData> &campData);
QString description() const;
void setDescription(const QString &description);
QDecDouble sale() const;
void setSale(QDecDouble sale);
QDecDouble totalPrice() const;
void setTotalPrice(QDecDouble totalPrice);
QDecDouble fullPrice() const;
void setFullPrice(QDecDouble fullPrice);
private:
friend class odb::access;
#pragma db id auto
int m_id;
QString m_name;
QString m_code;
QString m_description;
int m_price;
int m_fullPrice;
int m_totalPrice;
int m_sale;
bool m_salePossible;
AccService::ServiceType m_type;
#pragma db not_null