You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
93 lines
1.4 KiB
C++
93 lines
1.4 KiB
C++
#include "commoditydata.h"
|
|
#include <define.h>
|
|
|
|
CommodityData::CommodityData(QObject *parent)
|
|
:ShopItem(parent)
|
|
{
|
|
m_count = 0;
|
|
m_price = 0;
|
|
m_vat = Enums::NONE;
|
|
}
|
|
int CommodityData::id() const
|
|
{
|
|
return m_id;
|
|
}
|
|
|
|
void CommodityData::setId(int id)
|
|
{
|
|
m_id = id;
|
|
}
|
|
QString CommodityData::name() const
|
|
{
|
|
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<QObject> CommodityData::type() const
|
|
{
|
|
return m_type;
|
|
}
|
|
|
|
void CommodityData::setType(const QSharedPointer<QObject> &type)
|
|
{
|
|
if (qobject_cast<CommodityTypeData*>(type.data()) != NULL) {
|
|
m_type = qSharedPointerDynamicCast<CommodityTypeData, QObject>(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;
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|