#include "commoditydata.h" #include CommodityData::CommodityData(QObject *parent) :ShopItem(parent) { m_count = 0; m_price = 0; m_vat = Enums::NONE; } int CommodityData::id() { return m_id; } void CommodityData::setId(int id) { m_id = id; } QString CommodityData::name() { return m_name; } void CommodityData::setName(const QString &name) { m_name = name; } QString CommodityData::shortName() const { return m_shortName; } void CommodityData::setShortName(const QString &shortName) { m_shortName = shortName; } QString CommodityData::code() const { return m_code; } void CommodityData::setCode(const QString &code) { m_code = code; } QSharedPointer CommodityData::type() const { return m_type; } void CommodityData::setType(const QSharedPointer &type) { if (qobject_cast(type.data()) != NULL) { m_type = qSharedPointerDynamicCast(type); } } QDecDouble CommodityData::price() const { return QDecDouble((double)m_price / DEC_MULTIPLE); } void CommodityData::setPrice(const QDecDouble &price) { m_price = price.toDouble() * DEC_MULTIPLE; } Enums::VatType CommodityData::vat() const { return m_vat; } void CommodityData::setVat(const Enums::VatType &vat) { m_vat = vat; } int CommodityData::count() const { return m_count; } void CommodityData::setCount(int count) { m_count = count; } QDecDouble CommodityData::unitPrice() { return price(); } Enums::VatType CommodityData::vatType() { return vat(); } QString CommodityData::pluginId() { return "COMMODITY"; }