Build system changed to Cmake, ORM changed to QxORM, Qt6 compatibility.
This commit is contained in:
+26
-33
@@ -5,27 +5,19 @@
|
||||
#include <QDecDouble.hh>
|
||||
#include <QString>
|
||||
#include <QSharedPointer>
|
||||
#include <addressbookdata.h>
|
||||
#include <season.h>
|
||||
#include <odb/core.hxx>
|
||||
#include <odb/qt/list.hxx>
|
||||
#include <odb/section.hxx>
|
||||
#include <data/addressbookdata.h>
|
||||
#include <data/season.h>
|
||||
|
||||
#include "../shop_global.h"
|
||||
#include "voucheritem.h"
|
||||
|
||||
#include <QtCore/qglobal.h>
|
||||
|
||||
#if defined(SHOP_LIBRARY)
|
||||
# define SHOPSHARED_EXPORT Q_DECL_EXPORT
|
||||
#else
|
||||
# define SHOPSHARED_EXPORT Q_DECL_IMPORT
|
||||
#endif
|
||||
|
||||
#pragma db object
|
||||
class SHOPSHARED_EXPORT Voucher : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
QX_REGISTER_FRIEND_CLASS(Voucher)
|
||||
Q_PROPERTY(QString numSer READ numSer WRITE setNumSer)
|
||||
Q_PROPERTY(QDateTime payDateTime READ payDateTime WRITE setPayDateTime)
|
||||
Q_PROPERTY(QDateTime saveDateTime READ saveDateTime WRITE setSaveDateTime)
|
||||
@@ -44,8 +36,6 @@ class SHOPSHARED_EXPORT Voucher : public QObject
|
||||
Q_PROPERTY(QString eetBkp READ eetBkp WRITE setEetBkp)
|
||||
Q_PROPERTY(QString eetPkp READ eetPkp WRITE setEetPkp)
|
||||
Q_PROPERTY(QString eetFik READ eetFik WRITE setEetFik)
|
||||
Q_ENUMS(VoucherStatus)
|
||||
Q_ENUMS(EetStatus)
|
||||
Q_PROPERTY(VoucherStatus status READ status WRITE setStatus)
|
||||
Q_PROPERTY(QString createdBy READ createdBy WRITE setCreatedBy)
|
||||
Q_PROPERTY(QString updatedBy READ updatedBy WRITE setUpdatedBy)
|
||||
@@ -53,7 +43,7 @@ class SHOPSHARED_EXPORT Voucher : public QObject
|
||||
Q_PROPERTY(QDateTime updated READ updated WRITE setUpdated)
|
||||
|
||||
public:
|
||||
explicit Voucher(QObject *parent = 0);
|
||||
explicit Voucher(QObject *parent = nullptr);
|
||||
|
||||
enum VoucherStatus
|
||||
{
|
||||
@@ -71,8 +61,11 @@ public:
|
||||
EET_ERROR
|
||||
};
|
||||
|
||||
int id() const;
|
||||
void setId(int id);
|
||||
Q_ENUM(VoucherStatus)
|
||||
Q_ENUM(EetStatus)
|
||||
|
||||
long id() const;
|
||||
void setId(long id);
|
||||
|
||||
QString name() const;
|
||||
void setName(const QString &name);
|
||||
@@ -172,13 +165,10 @@ public:
|
||||
QDateTime updated() const;
|
||||
void setUpdated(const QDateTime &updated);
|
||||
|
||||
#pragma db load(lazy)
|
||||
odb::section m_itemsSection;
|
||||
Q_INVOKABLE QStringList eagerLoad();
|
||||
|
||||
private:
|
||||
friend class odb::access;
|
||||
#pragma db id auto
|
||||
int m_id;
|
||||
long m_id;
|
||||
QString m_numSer;
|
||||
QDateTime m_payDateTime;
|
||||
QDateTime m_saveDateTime;
|
||||
@@ -202,8 +192,7 @@ private:
|
||||
QString m_eetPkp;
|
||||
QString m_eetBkp;
|
||||
QString m_eetFik;
|
||||
#pragma db value_not_null inverse(m_voucher) section(m_itemsSection)
|
||||
QOdbList<QSharedPointer<VoucherItem> > m_items;
|
||||
QList<QSharedPointer<VoucherItem>> m_items;
|
||||
VoucherStatus m_status;
|
||||
SeasonPtr m_season;
|
||||
QString m_createdBy;
|
||||
@@ -214,18 +203,22 @@ private:
|
||||
|
||||
typedef QSharedPointer<Voucher> VoucherPtr;
|
||||
|
||||
#pragma db view object(Voucher)
|
||||
struct VoucherSum
|
||||
QX_REGISTER_HPP_SHOP(Voucher, QObject, 0)
|
||||
|
||||
class VoucherSum
|
||||
{
|
||||
VoucherSum();
|
||||
QX_REGISTER_FRIEND_CLASS(VoucherSum)
|
||||
public:
|
||||
VoucherSum() = default;
|
||||
|
||||
QDecDouble totalPrice() const;
|
||||
void setTotalPrice(QDecDouble totalPrice);
|
||||
|
||||
#pragma db column("count(id)")
|
||||
int m_count;
|
||||
#pragma db column("sum(totalPrice)")
|
||||
int m_totalPrice;
|
||||
int count() const;
|
||||
|
||||
private:
|
||||
int m_count{0};
|
||||
int m_totalPrice{0};
|
||||
};
|
||||
|
||||
QX_REGISTER_HPP_SHOP(VoucherSum, qx::trait::no_base_class_defined, 0)
|
||||
|
||||
#endif // VOUCHER_H
|
||||
|
||||
Reference in New Issue
Block a user