#include "sale.h"
#include <define.h>

Sale::Sale(QObject *parent) : ComboItem(parent)
{
    m_id = 0;
    m_sale = 0;
    m_fixed = false;
}

int Sale::id() const
{
    return m_id;
}

void Sale::setId(int id)
{
    m_id = id;
}

QDecDouble Sale::sale() const
{
    return TO_DEC(m_sale);
}

void Sale::setSale(QDecDouble sale)
{
    m_sale = FROM_DEC(sale);
}

bool Sale::fixed() const
{
    return m_fixed;
}

void Sale::setFixed(bool fixed)
{
    m_fixed = fixed;
}

QString Sale::description() const
{
    return m_description;
}

void Sale::setDescription(const QString &description)
{
    m_description = description;
}

bool Sale::eq(ComboItem *other)
{
    Sale *sale = qobject_cast<Sale*>(other);

    if (sale == NULL)
    {
        return false;
    }

    return this->m_id == sale->m_id && this->m_sale == sale->m_sale && this->m_fixed == sale->m_fixed;
}

QString Sale::toString()
{
    return m_description;
}
