|
|
|
#ifndef VOUCHERITEM_H
|
|
|
|
#define VOUCHERITEM_H
|
|
|
|
|
|
|
|
#include <QObject>
|
|
|
|
#include <QString>
|
|
|
|
#include <QDecDouble.hh>
|
|
|
|
#include <odb/core.hxx>
|
|
|
|
#include <QSharedPointer>
|
|
|
|
#include <QDateTime>
|
|
|
|
|
|
|
|
#include <enums.h>
|
|
|
|
|
|
|
|
#include <QtCore/qglobal.h>
|
|
|
|
|
|
|
|
#if defined(SHOP_LIBRARY)
|
|
|
|
# define SHOPSHARED_EXPORT Q_DECL_EXPORT
|
|
|
|
#else
|
|
|
|
# define SHOPSHARED_EXPORT Q_DECL_IMPORT
|
|
|
|
#endif
|
|
|
|
|
|
|
|
class Voucher;
|
|
|
|
|
|
|
|
#pragma db object
|
|
|
|
class SHOPSHARED_EXPORT VoucherItem : public QObject
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
Q_PROPERTY(QDateTime insertDate READ insertDate WRITE setInsertDate)
|
|
|
|
Q_PROPERTY(QString name READ name WRITE setName)
|
|
|
|
Q_PROPERTY(int count READ count WRITE setCount NOTIFY countChanged)
|
|
|
|
Q_PROPERTY(QDecDouble unitPrice READ unitPrice WRITE setUnitPrice)
|
|
|
|
Q_PROPERTY(Enums::VatType vatType READ vatType WRITE setVatType)
|
|
|
|
Q_PROPERTY(QDecDouble vatRate READ vatRate WRITE setVatRate)
|
|
|
|
Q_PROPERTY(QDecDouble vatAmount READ vatAmount)
|
|
|
|
Q_PROPERTY(QDecDouble price READ price WRITE setPrice)
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
QDecDouble vatRate() const;
|
|
|
|
void setVatRate(QDecDouble vatRate);
|
|
|
|
|
|
|
|
QDecDouble priceWitouthVat() const;
|
|
|
|
void setPriceWitouthVat(QDecDouble priceWitouthVat);
|
|
|
|
|
|
|
|
QDecDouble vatAmount() const;
|
|
|
|
|
|
|
|
QWeakPointer<Voucher> voucher() const;
|
|
|
|
void setVoucher(const QWeakPointer<Voucher> &voucher);
|
|
|
|
|
|
|
|
QDateTime insertDate() const;
|
|
|
|
void setInsertDate(const QDateTime &insertDate);
|
|
|
|
|
|
|
|
signals:
|
|
|
|
void countChanged(int oldCount);
|
|
|
|
|
|
|
|
private:
|
|
|
|
friend class odb::access;
|
|
|
|
#pragma db id auto
|
|
|
|
int m_id;
|
|
|
|
QString m_name;
|
|
|
|
int m_count;
|
|
|
|
int m_unitPrice;
|
|
|
|
int m_vatRate;
|
|
|
|
int m_priceWitouthVat;
|
|
|
|
int m_price;
|
|
|
|
int m_refId;
|
|
|
|
QDateTime m_insertDate;
|
|
|
|
QString m_itemPlugin;
|
|
|
|
Enums::VatType m_vatType;
|
|
|
|
#pragma db not_null
|
|
|
|
QWeakPointer<Voucher> m_voucher;
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef QSharedPointer<VoucherItem> VoucherItemPtr;
|
|
|
|
|
|
|
|
#endif // VOUCHERITEM_H
|