diff --git a/camp/campgrid.cpp b/camp/campgrid.cpp index f6e7889..c53c1fd 100644 --- a/camp/campgrid.cpp +++ b/camp/campgrid.cpp @@ -110,10 +110,13 @@ void CampGrid::addToVoucher(CampDataPtr data) return; } + SettingsService settSrv("CAMP"); + CampSettingsPtr settings = settSrv.loadSettings(); CampShopItemPtr campItem(new CampShopItem); campItem->setId(data->id()); campItem->setUnitPrice(data->totalPrice()); + campItem->setVatType(settings->vatType()); ShopService shopSrv; VoucherPtr voucher = shopSrv.createVoucher(); diff --git a/camp/campseller.cpp b/camp/campseller.cpp index 4f4011f..79d96ce 100644 --- a/camp/campseller.cpp +++ b/camp/campseller.cpp @@ -22,9 +22,14 @@ void CampSeller::prepareItem() wizard->show(); connect(wizard, &QDialog::accepted, [this, data](){ + SettingsService settSrv("CAMP"); + CampSettingsPtr settings = settSrv.loadSettings(); CampShopItemPtr item(new CampShopItem); + item->setUnitPrice(data->totalPrice()); item->setId(data->id()); + item->setVatType(settings->vatType()); + emit itemPrepared(item, 1); }); } diff --git a/camp/settings/campsettings.cpp b/camp/settings/campsettings.cpp index 0178dc1..5278c74 100644 --- a/camp/settings/campsettings.cpp +++ b/camp/settings/campsettings.cpp @@ -7,6 +7,7 @@ CampSettings::CampSettings(QObject *parent) : QObject(parent) m_accFee = 0; m_rounding = Enums::R_MATH; m_decimalPlaces = 0; + m_vatType = Enums::NONE; } QDecDouble CampSettings::accFee() const @@ -68,3 +69,13 @@ void CampSettings::setAccFeeText(const QString &accFeeText) { m_accFeeText = accFeeText; } + +Enums::VatType CampSettings::vatType() const +{ + return m_vatType; +} + +void CampSettings::setVatType(const Enums::VatType &vatType) +{ + m_vatType = vatType; +} diff --git a/camp/settings/campsettings.h b/camp/settings/campsettings.h index cf12832..aa82307 100644 --- a/camp/settings/campsettings.h +++ b/camp/settings/campsettings.h @@ -13,6 +13,7 @@ class CampSettings : public QObject Q_PROPERTY(int accFeeStartAge READ accFeeStartAge WRITE setAccFeeStartAge) Q_PROPERTY(int accFeeEndAge READ accFeeEndAge WRITE setAccFeeEndAge) Q_PROPERTY(Enums::Rounding rounding READ rounding WRITE setRounding) + Q_PROPERTY(Enums::VatType vatType READ vatType WRITE setVatType) Q_PROPERTY(int decimalPlaces READ decimalPlaces WRITE setDecimalPlaces) Q_PROPERTY(QString accFeeText READ accFeeText WRITE setAccFeeText) @@ -37,12 +38,16 @@ public: QString accFeeText() const; void setAccFeeText(const QString &accFeeText); + Enums::VatType vatType() const; + void setVatType(const Enums::VatType &vatType); + private: int m_accFee; int m_accFeeStartAge; int m_accFeeEndAge; QString m_accFeeText; Enums::Rounding m_rounding; + Enums::VatType m_vatType; int m_decimalPlaces; }; diff --git a/camp/settings/campsettingsform.cpp b/camp/settings/campsettingsform.cpp index ed481cb..b64d68c 100644 --- a/camp/settings/campsettingsform.cpp +++ b/camp/settings/campsettingsform.cpp @@ -47,6 +47,12 @@ CampSettingsForm::CampSettingsForm(QWidget *parent) : << ComboData(Enums::R_DOWN, tr("Down")) << ComboData(Enums::R_MATH, tr("Mathematic")); registerBinding(ui->rounding, roundings); + QList vatTypes; + vatTypes << ComboData(Enums::NONE, tr("None")) + << ComboData(Enums::HIGH, tr("High")) + << ComboData(Enums::FIRST_LOWER, tr("First lower")) + << ComboData(Enums::SECOND_LOWER, tr("Second lower")); + registerBinding(ui->vatType, vatTypes); } CampSettingsForm::~CampSettingsForm() diff --git a/camp/settings/campsettingsform.ui b/camp/settings/campsettingsform.ui index 7747570..b53838c 100644 --- a/camp/settings/campsettingsform.ui +++ b/camp/settings/campsettingsform.ui @@ -321,6 +321,16 @@ + + + + Vat type + + + + + +