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.

221 lines
4.4 KiB
C++

#include "voucher.h"
#include <define.h>
Voucher::Voucher(QObject *parent) : QObject(parent)
{
m_vatRateHigh = 0;
m_vatRateFirstLower = 0;
m_vatRateSecondLower = 0;
m_priceNoVat = 0;
m_priceVatHigh = 0;
m_priceVatFirstLower = 0;
m_priceVatSecondLower = 0;
m_priceWitouthVat = 0;
m_totalPriceVatHigh = 0;
m_totalPriceVatFirstLower = 0;
m_totalPriceVatSecondLower = 0;
m_totalPrice = 0;
}
QString Voucher::name() const
{
return m_name;
}
void Voucher::setName(const QString &name)
{
m_name = name;
}
QString Voucher::description() const
{
return m_description;
}
void Voucher::setDescription(const QString &description)
{
m_description = description;
}
QSharedPointer<QObject> Voucher::contact() const
{
return m_contact;
}
void Voucher::setContact(const QSharedPointer<QObject> &contact)
{
if (qobject_cast<AddressbookData*>(contact.data()) != NULL)
{
m_contact = qSharedPointerDynamicCast<AddressbookData, QObject>(contact);
}
}
Voucher::VoucherStatus Voucher::status() const
{
return m_status;
}
void Voucher::setStatus(const Voucher::VoucherStatus &status)
{
m_status = status;
}
QDecDouble Voucher::totalPrice() const
{
return TO_DEC(m_totalPrice);
}
void Voucher::setTotalPrice(QDecDouble totalPrice)
{
m_totalPrice = FROM_DEC(totalPrice);
}
QList<QSharedPointer<VoucherItem> > Voucher::items() const
{
return m_items;
}
void Voucher::setItems(const QList<QSharedPointer<VoucherItem> > &items)
{
m_items = items;
}
void Voucher::addItem(QSharedPointer<VoucherItem> item)
{
m_items.append(item);
}
void Voucher::removeItem(QSharedPointer<VoucherItem> item)
{
m_items.removeOne(item);
}
void Voucher::clearItems()
{
m_items.clear();
}
QDecDouble Voucher::vatRateHigh() const
{
return TO_DEC(m_vatRateHigh);
}
void Voucher::setVatRateHigh(QDecDouble vatRateHigh)
{
m_vatRateHigh = FROM_DEC(vatRateHigh);
}
QDecDouble Voucher::vatRateFirstLower() const
{
return TO_DEC(m_vatRateFirstLower);
}
void Voucher::setVatRateFirstLower(QDecDouble vatRateFirstLower)
{
m_vatRateFirstLower = FROM_DEC(vatRateFirstLower);
}
QDecDouble Voucher::vatRateSecondLower() const
{
return TO_DEC(m_vatRateSecondLower);
}
void Voucher::setVatRateSecondLower(QDecDouble vatRateSecondLower)
{
m_vatRateSecondLower = FROM_DEC(vatRateSecondLower);
}
QDecDouble Voucher::priceVatHigh() const
{
return TO_DEC(m_priceVatHigh);
}
void Voucher::setPriceVatHigh(QDecDouble priceVatHigh)
{
m_priceVatHigh = FROM_DEC(priceVatHigh);
}
QDecDouble Voucher::priceVatFirstLower() const
{
return TO_DEC(m_priceVatFirstLower);
}
void Voucher::setPriceVatFirstLower(QDecDouble priceVatFirstLower)
{
m_priceVatFirstLower = FROM_DEC(priceVatFirstLower);
}
QDecDouble Voucher::priceVatSecondLower() const
{
return TO_DEC(m_priceVatSecondLower);
}
void Voucher::setPriceVatSecondLower(QDecDouble priceVatSecondLower)
{
m_priceVatSecondLower = FROM_DEC(priceVatSecondLower);
}
QDecDouble Voucher::priceNoVat() const
{
return TO_DEC(m_priceNoVat);
}
void Voucher::setPriceNoVat(QDecDouble priceNoVat)
{
m_priceNoVat = FROM_DEC(priceNoVat);
}
QDecDouble Voucher::priceWitouthVat() const
{
return TO_DEC(m_priceWitouthVat);
}
void Voucher::setPriceWitouthVat(QDecDouble priceWitouthVat)
{
m_priceWitouthVat = FROM_DEC(priceWitouthVat);
}
QDecDouble Voucher::totalPriceVatHigh() const
{
return TO_DEC(m_totalPriceVatHigh);
}
void Voucher::setTotalPriceVatHigh(QDecDouble totalPriceVatHigh)
{
m_totalPriceVatHigh = FROM_DEC(totalPriceVatHigh);
}
QDecDouble Voucher::totalPriceVatFirstLower() const
{
return TO_DEC(m_totalPriceVatFirstLower);
}
void Voucher::setTotalPriceVatFirstLower(QDecDouble totalPriceVatFirstLower)
{
m_totalPriceVatFirstLower = FROM_DEC(totalPriceVatFirstLower);
}
QDecDouble Voucher::totalPriceVatSecondLower() const
{
return TO_DEC(m_totalPriceVatSecondLower);
}
void Voucher::setTotalPriceVatSecondLower(QDecDouble totalPriceVatSecondLower)
{
m_totalPriceVatSecondLower = FROM_DEC(totalPriceVatSecondLower);
}
QDecDouble Voucher::vatAmountHigh()
{
return m_totalPriceVatHigh - m_priceVatHigh;
}
QDecDouble Voucher::vatAmountFirstLower()
{
return m_totalPriceVatFirstLower - m_priceVatFirstLower;
}
QDecDouble Voucher::VatAmountSecondLower()
{
return m_totalPriceVatSecondLower - m_priceVatSecondLower;
}
int Voucher::id() const
{
return m_id;
}
void Voucher::setId(int id)
{
m_id = id;
}