Added data entities for shop plugin.
							parent
							
								
									aa5b3cf76f
								
							
						
					
					
						commit
						e06f951307
					
				@ -0,0 +1,7 @@
 | 
			
		||||
#ifndef SHOPDATA_H
 | 
			
		||||
#define SHOPDATA_H
 | 
			
		||||
 | 
			
		||||
#include "voucher.h"
 | 
			
		||||
#include "voucheritem.h"
 | 
			
		||||
 | 
			
		||||
#endif // SHOPDATA_H
 | 
			
		||||
@ -1,6 +1,90 @@
 | 
			
		||||
#include "voucher.h"
 | 
			
		||||
#include <define.h>
 | 
			
		||||
 | 
			
		||||
Voucher::Voucher(QObject *parent) : QObject(parent)
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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::clearItems()
 | 
			
		||||
{
 | 
			
		||||
    m_items.clear();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int Voucher::id() const
 | 
			
		||||
{
 | 
			
		||||
    return m_id;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void Voucher::setId(int id)
 | 
			
		||||
{
 | 
			
		||||
    m_id = id;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -0,0 +1,87 @@
 | 
			
		||||
#include "voucheritem.h"
 | 
			
		||||
#include <define.h>
 | 
			
		||||
 | 
			
		||||
VoucherItem::VoucherItem(QObject *parent) : QObject(parent)
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int VoucherItem::id() const
 | 
			
		||||
{
 | 
			
		||||
    return m_id;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void VoucherItem::setId(int id)
 | 
			
		||||
{
 | 
			
		||||
    m_id = id;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
QString VoucherItem::name() const
 | 
			
		||||
{
 | 
			
		||||
    return m_name;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void VoucherItem::setName(const QString &name)
 | 
			
		||||
{
 | 
			
		||||
    m_name = name;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int VoucherItem::count() const
 | 
			
		||||
{
 | 
			
		||||
    return m_count;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void VoucherItem::setCount(int count)
 | 
			
		||||
{
 | 
			
		||||
    m_count = count;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
QDecDouble VoucherItem::unitPrice() const
 | 
			
		||||
{
 | 
			
		||||
    return TO_DEC(m_unitPrice);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void VoucherItem::setUnitPrice(QDecDouble unitPrice)
 | 
			
		||||
{
 | 
			
		||||
    m_unitPrice = FROM_DEC(unitPrice);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
QDecDouble VoucherItem::price() const
 | 
			
		||||
{
 | 
			
		||||
    return TO_DEC(m_price);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void VoucherItem::setPrice(QDecDouble price)
 | 
			
		||||
{
 | 
			
		||||
    m_price = FROM_DEC(price);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int VoucherItem::refId() const
 | 
			
		||||
{
 | 
			
		||||
    return m_refId;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void VoucherItem::setRefId(int refId)
 | 
			
		||||
{
 | 
			
		||||
    m_refId = refId;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
QString VoucherItem::itemPlugin() const
 | 
			
		||||
{
 | 
			
		||||
    return m_itemPlugin;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void VoucherItem::setItemPlugin(const QString &itemPlugin)
 | 
			
		||||
{
 | 
			
		||||
    m_itemPlugin = itemPlugin;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
Enums::VatType VoucherItem::vatType() const
 | 
			
		||||
{
 | 
			
		||||
    return m_vatType;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void VoucherItem::setVatType(const Enums::VatType &vatType)
 | 
			
		||||
{
 | 
			
		||||
    m_vatType = vatType;
 | 
			
		||||
}
 | 
			
		||||
@ -0,0 +1,64 @@
 | 
			
		||||
#ifndef VOUCHERITEM_H
 | 
			
		||||
#define VOUCHERITEM_H
 | 
			
		||||
 | 
			
		||||
#include <QObject>
 | 
			
		||||
#include <QString>
 | 
			
		||||
#include <QDecDouble.hh>
 | 
			
		||||
#include <odb/core.hxx>
 | 
			
		||||
 | 
			
		||||
#include <enums.h>
 | 
			
		||||
 | 
			
		||||
#pragma db object
 | 
			
		||||
class VoucherItem : public QObject
 | 
			
		||||
{
 | 
			
		||||
    Q_OBJECT
 | 
			
		||||
 | 
			
		||||
    Q_PROPERTY(QString name READ name WRITE setName)
 | 
			
		||||
    Q_PROPERTY(int count READ count WRITE setCount)
 | 
			
		||||
    Q_PROPERTY(QDecDouble unitPrice READ unitPrice WRITE setUnitPrice)
 | 
			
		||||
    Q_PROPERTY(QDecDouble price READ price WRITE setPrice)
 | 
			
		||||
    Q_PROPERTY(int refId READ refId WRITE setRefId)
 | 
			
		||||
    Q_PROPERTY(QString itemPlugin READ itemPlugin WRITE setItemPlugin)
 | 
			
		||||
    Q_PROPERTY(Enums::VatType vatType READ vatType WRITE setVatType)
 | 
			
		||||
 | 
			
		||||
public:
 | 
			
		||||
    explicit VoucherItem(QObject *parent = 0);
 | 
			
		||||
 | 
			
		||||
    int id() const;
 | 
			
		||||
    void setId(int id);
 | 
			
		||||
 | 
			
		||||
    QString name() const;
 | 
			
		||||
    void setName(const QString &name);
 | 
			
		||||
 | 
			
		||||
    int count() const;
 | 
			
		||||
    void setCount(int count);
 | 
			
		||||
 | 
			
		||||
    QDecDouble unitPrice() const;
 | 
			
		||||
    void setUnitPrice(QDecDouble unitPrice);
 | 
			
		||||
 | 
			
		||||
    QDecDouble price() const;
 | 
			
		||||
    void setPrice(QDecDouble price);
 | 
			
		||||
 | 
			
		||||
    int refId() const;
 | 
			
		||||
    void setRefId(int refId);
 | 
			
		||||
 | 
			
		||||
    QString itemPlugin() const;
 | 
			
		||||
    void setItemPlugin(const QString &itemPlugin);
 | 
			
		||||
 | 
			
		||||
    Enums::VatType vatType() const;
 | 
			
		||||
    void setVatType(const Enums::VatType &vatType);
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
    friend class odb::access;
 | 
			
		||||
#pragma db id auto
 | 
			
		||||
    int m_id;
 | 
			
		||||
    QString m_name;
 | 
			
		||||
    int m_count;
 | 
			
		||||
    int m_unitPrice;
 | 
			
		||||
    int m_price;
 | 
			
		||||
    int m_refId;
 | 
			
		||||
    QString m_itemPlugin;
 | 
			
		||||
    Enums::VatType m_vatType;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#endif // VOUCHERITEM_H
 | 
			
		||||
@ -0,0 +1,15 @@
 | 
			
		||||
#ifndef ISELLABLESERVICE_H
 | 
			
		||||
#define ISELLABLESERVICE_H
 | 
			
		||||
 | 
			
		||||
#include "shop_global.h"
 | 
			
		||||
#include "ishopitem.h"
 | 
			
		||||
#include <QList>
 | 
			
		||||
#include <QSharedPointer>
 | 
			
		||||
 | 
			
		||||
class SHOPSHARED_EXPORT ISellableService
 | 
			
		||||
{
 | 
			
		||||
public:
 | 
			
		||||
    QList<QSharedPointer<IShopItem> > shopItems() = 0;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#endif // ISELLABLESERVICE_H
 | 
			
		||||
@ -0,0 +1,16 @@
 | 
			
		||||
#ifndef ISHOPITEM_H
 | 
			
		||||
#define ISHOPITEM_H
 | 
			
		||||
 | 
			
		||||
#include "shop_global.h"
 | 
			
		||||
#include <QDecDouble.hh>
 | 
			
		||||
#include <QString>
 | 
			
		||||
 | 
			
		||||
class SHOPSHARED_EXPORT IShopItem
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
public:
 | 
			
		||||
    QString name() = 0;
 | 
			
		||||
    QDecDouble unitPrice() = 0;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#endif // ISHOPITEM_H
 | 
			
		||||
					Loading…
					
					
				
		Reference in New Issue