Data structures prepared for VAT.

print
Josef Rokos 9 years ago
parent 9fbf216bba
commit 7b9bc06c52

@ -6,6 +6,7 @@ CommodityData::CommodityData(QObject *parent)
{ {
m_count = 0; m_count = 0;
m_price = 0; m_price = 0;
m_vat = Enums::NONE;
} }
int CommodityData::id() const int CommodityData::id() const
{ {

@ -11,7 +11,13 @@ class CORESHARED_EXPORT Enums : public QObject
Q_ENUMS(VatType) Q_ENUMS(VatType)
public: public:
enum VatType { HIGH,FIRST_LOWER,SECOND_LOWER }; enum VatType
{
NONE,
HIGH,
FIRST_LOWER,
SECOND_LOWER
};
Enums() Enums()
{ {

@ -1,8 +1,12 @@
#include "globalsettings.h" #include "globalsettings.h"
#include <define.h>
GlobalSettings::GlobalSettings(QObject *parent) : QObject(parent) GlobalSettings::GlobalSettings(QObject *parent) : QObject(parent)
{ {
m_ic = 0; m_ic = 0;
m_vatHigh = 0;
m_vatFirstLower = 0;
m_vatSecondLower = 0;
} }
QString GlobalSettings::firmName() const QString GlobalSettings::firmName() const
@ -94,3 +98,33 @@ void GlobalSettings::setLogoPath(const QString &logoPath)
{ {
m_logoPath = 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);
}

@ -3,6 +3,7 @@
#include <QObject> #include <QObject>
#include <QString> #include <QString>
#include <QDecDouble.hh>
class GlobalSettings : public QObject class GlobalSettings : public QObject
{ {
@ -17,6 +18,9 @@ class GlobalSettings : public QObject
Q_PROPERTY(QString dic READ dic WRITE setDic) Q_PROPERTY(QString dic READ dic WRITE setDic)
Q_PROPERTY(bool vatPayer READ vatPayer WRITE setVatPayer) Q_PROPERTY(bool vatPayer READ vatPayer WRITE setVatPayer)
Q_PROPERTY(QString logoPath READ logoPath WRITE setLogoPath) 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: public:
explicit GlobalSettings(QObject *parent = 0); explicit GlobalSettings(QObject *parent = 0);
@ -47,6 +51,15 @@ public:
QString logoPath() const; QString logoPath() const;
void setLogoPath(const QString &logoPath); 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: private:
QString m_firmName; QString m_firmName;
QString m_street; QString m_street;
@ -57,6 +70,9 @@ private:
QString m_dic; QString m_dic;
bool m_vatPayer; bool m_vatPayer;
QString m_logoPath; QString m_logoPath;
int m_vatHigh;
int m_vatFirstLower;
int m_vatSecondLower;
signals: signals:

@ -7,7 +7,7 @@ VoucherItem::VoucherItem(QObject *parent) : QObject(parent)
m_unitPrice = 0; m_unitPrice = 0;
m_count = 0; m_count = 0;
m_refId = 0; m_refId = 0;
m_vatType = Enums::HIGH; m_vatType = Enums::NONE;
} }
int VoucherItem::id() const int VoucherItem::id() const

@ -3,6 +3,7 @@
DirectSaleItem::DirectSaleItem(QObject *parent) : QObject(parent) DirectSaleItem::DirectSaleItem(QObject *parent) : QObject(parent)
{ {
m_count = 1; m_count = 1;
m_vat = Enums::NONE;
} }
int DirectSaleItem::id() int DirectSaleItem::id()
@ -25,6 +26,11 @@ QString DirectSaleItem::pluginId()
return ""; return "";
} }
Enums::VatType DirectSaleItem::vatType()
{
return m_vat;
}
int DirectSaleItem::count() const int DirectSaleItem::count() const
{ {
return m_count; return m_count;
@ -44,3 +50,8 @@ void DirectSaleItem::setUnitPrice(const QDecDouble &unitPrice)
{ {
m_unitPrice = unitPrice; m_unitPrice = unitPrice;
} }
void DirectSaleItem::setVatType(Enums::VatType vat)
{
m_vat = vat;
}

@ -25,6 +25,7 @@ public:
QString name() override; QString name() override;
QDecDouble unitPrice() override; QDecDouble unitPrice() override;
QString pluginId() override; QString pluginId() override;
Enums::VatType vatType() override;
int count() const; int count() const;
void setCount(int count); void setCount(int count);
@ -33,10 +34,13 @@ public:
void setUnitPrice(const QDecDouble &unitPrice); void setUnitPrice(const QDecDouble &unitPrice);
void setVatType(Enums::VatType vatType);
private: private:
QString m_name; QString m_name;
QDecDouble m_unitPrice; QDecDouble m_unitPrice;
int m_count; int m_count;
Enums::VatType m_vat;
}; };
#endif // DIRECTSALEITEM_H #endif // DIRECTSALEITEM_H

@ -4,6 +4,7 @@
#include "shop_global.h" #include "shop_global.h"
#include <QDecDouble.hh> #include <QDecDouble.hh>
#include <QString> #include <QString>
#include <enums.h>
class SHOPSHARED_EXPORT IShopItem class SHOPSHARED_EXPORT IShopItem
{ {
@ -12,6 +13,7 @@ public:
virtual int id() = 0; virtual int id() = 0;
virtual QString name() = 0; virtual QString name() = 0;
virtual QDecDouble unitPrice() = 0; virtual QDecDouble unitPrice() = 0;
virtual Enums::VatType vatType() = 0;
virtual QString pluginId() = 0; virtual QString pluginId() = 0;
}; };

@ -20,6 +20,7 @@ void ShopService::addShopItem(QSharedPointer<Voucher> voucher, QSharedPointer<IS
vItem->setCount(count); vItem->setCount(count);
vItem->setRefId(item->id()); vItem->setRefId(item->id());
vItem->setItemPlugin(item->pluginId()); vItem->setItemPlugin(item->pluginId());
vItem->setVatType(item->vatType());
voucher->addItem(vItem); voucher->addItem(vItem);
} }

Loading…
Cancel
Save