diff --git a/commodity/data/commoditydata.cpp b/commodity/data/commoditydata.cpp index 09ce104..b0b9769 100644 --- a/commodity/data/commoditydata.cpp +++ b/commodity/data/commoditydata.cpp @@ -6,6 +6,7 @@ CommodityData::CommodityData(QObject *parent) { m_count = 0; m_price = 0; + m_vat = Enums::NONE; } int CommodityData::id() const { diff --git a/core/enums.h b/core/enums.h index e41e5de..65adf26 100644 --- a/core/enums.h +++ b/core/enums.h @@ -11,7 +11,13 @@ class CORESHARED_EXPORT Enums : public QObject Q_ENUMS(VatType) public: - enum VatType { HIGH,FIRST_LOWER,SECOND_LOWER }; + enum VatType + { + NONE, + HIGH, + FIRST_LOWER, + SECOND_LOWER + }; Enums() { diff --git a/core/settings/globalsettings.cpp b/core/settings/globalsettings.cpp index c2cf97d..9256782 100644 --- a/core/settings/globalsettings.cpp +++ b/core/settings/globalsettings.cpp @@ -1,8 +1,12 @@ #include "globalsettings.h" +#include GlobalSettings::GlobalSettings(QObject *parent) : QObject(parent) { m_ic = 0; + m_vatHigh = 0; + m_vatFirstLower = 0; + m_vatSecondLower = 0; } QString GlobalSettings::firmName() const @@ -94,3 +98,33 @@ void GlobalSettings::setLogoPath(const QString &logoPath) { m_logoPath = logoPath; } +QDecDouble GlobalSettings::vatHigh() const +{ + return TO_DEC(m_vatHigh); +} + +void GlobalSettings::setVatHigh(QDecDouble vatHigh) +{ + m_vatHigh = FROM_DEC(vatHigh); +} +QDecDouble GlobalSettings::vatFirstLower() const +{ + return TO_DEC(m_vatFirstLower); +} + +void GlobalSettings::setVatFirstLower(QDecDouble vatFirstLower) +{ + m_vatFirstLower = FROM_DEC(vatFirstLower); +} +QDecDouble GlobalSettings::vatSecondLower() const +{ + return TO_DEC(m_vatSecondLower); +} + +void GlobalSettings::setVatSecondLower(QDecDouble vatSecondLower) +{ + m_vatSecondLower = FROM_DEC(vatSecondLower); +} + + + diff --git a/core/settings/globalsettings.h b/core/settings/globalsettings.h index 2a6425e..e4a2051 100644 --- a/core/settings/globalsettings.h +++ b/core/settings/globalsettings.h @@ -3,6 +3,7 @@ #include #include +#include class GlobalSettings : public QObject { @@ -17,6 +18,9 @@ class GlobalSettings : public QObject Q_PROPERTY(QString dic READ dic WRITE setDic) Q_PROPERTY(bool vatPayer READ vatPayer WRITE setVatPayer) Q_PROPERTY(QString logoPath READ logoPath WRITE setLogoPath) + Q_PROPERTY(QDecDouble vatHigh READ vatHigh WRITE setVatHigh) + Q_PROPERTY(QDecDouble vatFirstLower READ vatFirstLower WRITE setVatFirstLower) + Q_PROPERTY(QDecDouble vatSecondLower READ vatSecondLower WRITE setVatSecondLower) public: explicit GlobalSettings(QObject *parent = 0); @@ -47,6 +51,15 @@ public: QString logoPath() const; void setLogoPath(const QString &logoPath); + QDecDouble vatHigh() const; + void setVatHigh(QDecDouble vatHigh); + + QDecDouble vatFirstLower() const; + void setVatFirstLower(QDecDouble vatFirstLower); + + QDecDouble vatSecondLower() const; + void setVatSecondLower(QDecDouble vatSecondLower); + private: QString m_firmName; QString m_street; @@ -57,6 +70,9 @@ private: QString m_dic; bool m_vatPayer; QString m_logoPath; + int m_vatHigh; + int m_vatFirstLower; + int m_vatSecondLower; signals: diff --git a/shop/data/voucheritem.cpp b/shop/data/voucheritem.cpp index d0615e8..bc92ac5 100644 --- a/shop/data/voucheritem.cpp +++ b/shop/data/voucheritem.cpp @@ -7,7 +7,7 @@ VoucherItem::VoucherItem(QObject *parent) : QObject(parent) m_unitPrice = 0; m_count = 0; m_refId = 0; - m_vatType = Enums::HIGH; + m_vatType = Enums::NONE; } int VoucherItem::id() const diff --git a/shop/directsaleitem.cpp b/shop/directsaleitem.cpp index f08bdde..615d6c1 100644 --- a/shop/directsaleitem.cpp +++ b/shop/directsaleitem.cpp @@ -3,6 +3,7 @@ DirectSaleItem::DirectSaleItem(QObject *parent) : QObject(parent) { m_count = 1; + m_vat = Enums::NONE; } int DirectSaleItem::id() @@ -25,6 +26,11 @@ QString DirectSaleItem::pluginId() return ""; } +Enums::VatType DirectSaleItem::vatType() +{ + return m_vat; +} + int DirectSaleItem::count() const { return m_count; @@ -44,3 +50,8 @@ void DirectSaleItem::setUnitPrice(const QDecDouble &unitPrice) { m_unitPrice = unitPrice; } + +void DirectSaleItem::setVatType(Enums::VatType vat) +{ + m_vat = vat; +} diff --git a/shop/directsaleitem.h b/shop/directsaleitem.h index 243ec5d..25aac87 100644 --- a/shop/directsaleitem.h +++ b/shop/directsaleitem.h @@ -25,6 +25,7 @@ public: QString name() override; QDecDouble unitPrice() override; QString pluginId() override; + Enums::VatType vatType() override; int count() const; void setCount(int count); @@ -33,10 +34,13 @@ public: void setUnitPrice(const QDecDouble &unitPrice); + void setVatType(Enums::VatType vatType); + private: QString m_name; QDecDouble m_unitPrice; int m_count; + Enums::VatType m_vat; }; #endif // DIRECTSALEITEM_H diff --git a/shop/ishopitem.h b/shop/ishopitem.h index 5a9c799..81c753f 100644 --- a/shop/ishopitem.h +++ b/shop/ishopitem.h @@ -4,6 +4,7 @@ #include "shop_global.h" #include #include +#include class SHOPSHARED_EXPORT IShopItem { @@ -12,6 +13,7 @@ public: virtual int id() = 0; virtual QString name() = 0; virtual QDecDouble unitPrice() = 0; + virtual Enums::VatType vatType() = 0; virtual QString pluginId() = 0; }; diff --git a/shop/shopservice.cpp b/shop/shopservice.cpp index 57e618f..ac9f4de 100644 --- a/shop/shopservice.cpp +++ b/shop/shopservice.cpp @@ -20,6 +20,7 @@ void ShopService::addShopItem(QSharedPointer voucher, QSharedPointersetCount(count); vItem->setRefId(item->id()); vItem->setItemPlugin(item->pluginId()); + vItem->setVatType(item->vatType()); voucher->addItem(vItem); }