Implemented vat rate settings for Camp module.

master
Josef Rokos 5 years ago
parent 32a836d3cf
commit c8658ba77f

@ -110,10 +110,13 @@ void CampGrid::addToVoucher(CampDataPtr data)
return;
}
SettingsService settSrv("CAMP");
CampSettingsPtr settings = settSrv.loadSettings<CampSettings>();
CampShopItemPtr campItem(new CampShopItem);
campItem->setId(data->id());
campItem->setUnitPrice(data->totalPrice());
campItem->setVatType(settings->vatType());
ShopService shopSrv;
VoucherPtr voucher = shopSrv.createVoucher();

@ -22,9 +22,14 @@ void CampSeller::prepareItem()
wizard->show();
connect(wizard, &QDialog::accepted, [this, data](){
SettingsService settSrv("CAMP");
CampSettingsPtr settings = settSrv.loadSettings<CampSettings>();
CampShopItemPtr item(new CampShopItem);
item->setUnitPrice(data->totalPrice());
item->setId(data->id());
item->setVatType(settings->vatType());
emit itemPrepared(item, 1);
});
}

@ -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;
}

@ -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;
};

@ -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<ComboData> 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()

@ -321,6 +321,16 @@
<item row="5" column="1">
<widget class="QLineEdit" name="accFeeText"/>
</item>
<item row="8" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string>Vat type</string>
</property>
</widget>
</item>
<item row="8" column="1">
<widget class="QComboBox" name="vatType"/>
</item>
</layout>
</widget>
</item>

Loading…
Cancel
Save