Build system changed to Cmake, ORM changed to QxORM, Qt6 compatibility.
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
#include "favoritgroup.h"
|
||||
|
||||
FavoritGroup::FavoritGroup()
|
||||
{
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
#ifndef FAVORITGROUP_H
|
||||
#define FAVORITGROUP_H
|
||||
|
||||
|
||||
class FavoritGroup
|
||||
{
|
||||
public:
|
||||
FavoritGroup();
|
||||
};
|
||||
|
||||
#endif // FAVORITGROUP_H
|
||||
@@ -1,19 +1,16 @@
|
||||
#include "favorititem.h"
|
||||
#include <define.h>
|
||||
|
||||
FavoritItem::FavoritItem()
|
||||
{
|
||||
m_id = 0;
|
||||
m_vatType = Enums::NONE;
|
||||
m_unitPrice = 0;
|
||||
}
|
||||
QX_REGISTER_CPP_SHOP(FavoritItem)
|
||||
|
||||
int FavoritItem::id()
|
||||
QX_REGISTER_ALL_QT_PROPERTIES(FavoritItem, "id")
|
||||
|
||||
long FavoritItem::id()
|
||||
{
|
||||
return m_id;
|
||||
}
|
||||
|
||||
void FavoritItem::setId(int id)
|
||||
void FavoritItem::setId(long id)
|
||||
{
|
||||
m_id = id;
|
||||
}
|
||||
@@ -78,12 +75,12 @@ void FavoritItem::setFavButtonName(const QString &favButtonName)
|
||||
m_favButtonName = favButtonName;
|
||||
}
|
||||
|
||||
int FavoritItem::refId() const
|
||||
long FavoritItem::refId() const
|
||||
{
|
||||
return m_refId;
|
||||
}
|
||||
|
||||
void FavoritItem::setRefId(int refId)
|
||||
void FavoritItem::setRefId(long refId)
|
||||
{
|
||||
m_refId = refId;
|
||||
}
|
||||
|
||||
+16
-16
@@ -1,21 +1,21 @@
|
||||
#ifndef FAVORITITEM_H
|
||||
#define FAVORITITEM_H
|
||||
|
||||
#include "../ishopitem.h"
|
||||
|
||||
#include <QObject>
|
||||
#include <QSharedPointer>
|
||||
#include <QString>
|
||||
#include <QDecDouble.hh>
|
||||
//#include <QxOrm.h>
|
||||
#include <enums.h>
|
||||
#include <ishopitem.h>
|
||||
#include <odb/core.hxx>
|
||||
|
||||
class IShopItem;
|
||||
|
||||
#pragma db object
|
||||
class FavoritItem : public QObject, public IShopItem
|
||||
class FavoritItem : public IShopItem
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
QX_REGISTER_FRIEND_CLASS(FavoritItem)
|
||||
Q_PROPERTY(int id READ id WRITE setId)
|
||||
Q_PROPERTY(int refId READ refId WRITE setRefId)
|
||||
Q_PROPERTY(QString name READ name WRITE setName)
|
||||
@@ -26,12 +26,12 @@ class FavoritItem : public QObject, public IShopItem
|
||||
Q_PROPERTY(QString favButtonName READ favButtonName WRITE setFavButtonName)
|
||||
|
||||
public:
|
||||
FavoritItem();
|
||||
FavoritItem() = default;
|
||||
|
||||
// IShopItem interface
|
||||
public:
|
||||
int id() override;
|
||||
void setId(int id);
|
||||
long id() override;
|
||||
void setId(long id);
|
||||
|
||||
QString name() override;
|
||||
void setName(const QString &name);
|
||||
@@ -51,17 +51,15 @@ public:
|
||||
QString favButtonName() const;
|
||||
void setFavButtonName(const QString &favButtonName);
|
||||
|
||||
int refId() const;
|
||||
void setRefId(int refId);
|
||||
long refId() const;
|
||||
void setRefId(long refId);
|
||||
|
||||
private:
|
||||
friend class odb::access;
|
||||
#pragma db id auto
|
||||
int m_id;
|
||||
int m_refId;
|
||||
long m_id{0};
|
||||
long m_refId{0};
|
||||
QString m_name;
|
||||
int m_unitPrice;
|
||||
Enums::VatType m_vatType;
|
||||
int m_unitPrice{0};
|
||||
Enums::VatType m_vatType{Enums::NONE};
|
||||
QString m_pluginId;
|
||||
QString m_favButtonName;
|
||||
QString m_shortName;
|
||||
@@ -69,4 +67,6 @@ private:
|
||||
|
||||
typedef QSharedPointer<FavoritItem> FavoritItemPtr;
|
||||
|
||||
QX_REGISTER_HPP_SHOP(FavoritItem, QObject, 0)
|
||||
|
||||
#endif // FAVORITITEM_H
|
||||
|
||||
+58
-9
@@ -1,6 +1,47 @@
|
||||
#include <data/addressbookdata.h>
|
||||
#include "voucher.h"
|
||||
#include <define.h>
|
||||
|
||||
QX_REGISTER_CPP_SHOP(Voucher)
|
||||
|
||||
namespace qx {
|
||||
template<> void register_class(QxClass<Voucher>& t) {
|
||||
t.setName("Voucher");
|
||||
t.id(&Voucher::m_id, "id");
|
||||
t.data(&Voucher::m_numSer, "numSer");
|
||||
t.data(&Voucher::m_payDateTime, "payDateTime");
|
||||
t.data(&Voucher::m_name, "name");
|
||||
t.data(&Voucher::m_description, "description");
|
||||
t.data(&Voucher::m_vatRateHigh, "vatRateHigh");
|
||||
t.data(&Voucher::m_vatRateFirstLower, "vatRateFirstLower");
|
||||
t.data(&Voucher::m_vatRateSecondLower, "vatRateSecondLower");
|
||||
t.data(&Voucher::m_priceNoVat, "priceNoVat");
|
||||
t.data(&Voucher::m_priceVatHigh, "priceVatHigh");
|
||||
t.data(&Voucher::m_priceVatFirstLower, "priceVatFirstLower");
|
||||
t.data(&Voucher::m_priceVatSecondLower, "priceVatSecondLower");
|
||||
t.data(&Voucher::m_priceWitouthVat, "priceWitouthVat");
|
||||
t.data(&Voucher::m_totalPriceVatHigh, "totalPriceVatHigh");
|
||||
t.data(&Voucher::m_totalPriceVatFirstLower, "totalPriceVatFirstLower");
|
||||
t.data(&Voucher::m_totalPriceVatSecondLower, "totalPriceVatSecondLower");
|
||||
t.data(&Voucher::m_totalPrice, "totalPrice");
|
||||
t.data(&Voucher::m_status, "status");
|
||||
t.data(&Voucher::m_eetStatus, "eetStatus");
|
||||
t.data(&Voucher::m_eetSendDateTime, "eetSendDateTime");
|
||||
t.data(&Voucher::m_eetPkp, "eetPkp");
|
||||
t.data(&Voucher::m_eetBkp, "eetBkp");
|
||||
t.data(&Voucher::m_eetFik, "eetFik");
|
||||
t.data(&Voucher::m_saveDateTime, "saveDateTime");
|
||||
t.data(&Voucher::m_createdBy, "createdBy");
|
||||
t.data(&Voucher::m_created, "created");
|
||||
t.data(&Voucher::m_updatedBy, "updatedBy");
|
||||
t.data(&Voucher::m_updated, "updated");
|
||||
|
||||
t.relationOneToMany(&Voucher::m_items, "voucher", "voucher");
|
||||
t.relationManyToOne(&Voucher::m_season, "season");
|
||||
t.relationManyToOne(&Voucher::m_contact, "contact");
|
||||
}
|
||||
}
|
||||
|
||||
Voucher::Voucher(QObject *parent) : QObject(parent)
|
||||
{
|
||||
m_id = 0;
|
||||
@@ -17,6 +58,7 @@ Voucher::Voucher(QObject *parent) : QObject(parent)
|
||||
m_totalPriceVatSecondLower = 0;
|
||||
m_totalPrice = 0;
|
||||
m_eetStatus = EET_FOR_SEND;
|
||||
m_status = NEW;
|
||||
}
|
||||
|
||||
QString Voucher::name() const
|
||||
@@ -341,20 +383,28 @@ void Voucher::setUpdated(const QDateTime &updated)
|
||||
m_updated = updated;
|
||||
}
|
||||
|
||||
int Voucher::id() const
|
||||
long Voucher::id() const
|
||||
{
|
||||
return m_id;
|
||||
}
|
||||
|
||||
void Voucher::setId(int id)
|
||||
void Voucher::setId(long id)
|
||||
{
|
||||
m_id = id;
|
||||
}
|
||||
|
||||
VoucherSum::VoucherSum()
|
||||
{
|
||||
m_totalPrice = 0;
|
||||
m_count = 0;
|
||||
QStringList Voucher::eagerLoad() {
|
||||
return { "season", "contact" };
|
||||
}
|
||||
|
||||
QX_REGISTER_CPP_SHOP(VoucherSum)
|
||||
|
||||
namespace qx {
|
||||
template<> void register_class(QxClass<VoucherSum>& t) {
|
||||
t.setName("VoucherSum");
|
||||
t.data(&VoucherSum::m_count, "count");
|
||||
t.data(&VoucherSum::m_totalPrice, "totalPrice");
|
||||
}
|
||||
}
|
||||
|
||||
QDecDouble VoucherSum::totalPrice() const
|
||||
@@ -362,7 +412,6 @@ QDecDouble VoucherSum::totalPrice() const
|
||||
return TO_DEC(m_totalPrice);
|
||||
}
|
||||
|
||||
void VoucherSum::setTotalPrice(QDecDouble totalPrice)
|
||||
{
|
||||
m_totalPrice = FROM_DEC(totalPrice);
|
||||
int VoucherSum::count() const {
|
||||
return m_count;
|
||||
}
|
||||
|
||||
+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
|
||||
|
||||
@@ -1,8 +1,31 @@
|
||||
#include "voucher.h"
|
||||
#include "voucheritem.h"
|
||||
#include <define.h>
|
||||
|
||||
QX_REGISTER_CPP_SHOP(VoucherItem)
|
||||
|
||||
namespace qx {
|
||||
template<> void register_class(QxClass<VoucherItem> &t) {
|
||||
t.setName("VoucherItem");
|
||||
t.id(&VoucherItem::m_id, "id");
|
||||
t.data(&VoucherItem::m_name, "name");
|
||||
t.data(&VoucherItem::m_count, "count");
|
||||
t.data(&VoucherItem::m_unitPrice, "unitPrice");
|
||||
t.data(&VoucherItem::m_vatRate, "vatRate");
|
||||
t.data(&VoucherItem::m_priceWitouthVat, "priceWitouthVat");
|
||||
t.data(&VoucherItem::m_price, "price");
|
||||
t.data(&VoucherItem::m_refId, "refId");
|
||||
t.data(&VoucherItem::m_itemPlugin, "itemPlugin");
|
||||
t.data(&VoucherItem::m_vatType, "vatType");
|
||||
t.data(&VoucherItem::m_insertDate, "insertDate");
|
||||
|
||||
t.relationManyToOne(&VoucherItem::m_voucher, "voucher");
|
||||
}
|
||||
}
|
||||
|
||||
VoucherItem::VoucherItem(QObject *parent) : QObject(parent)
|
||||
{
|
||||
m_id = 0;
|
||||
m_price = 0;
|
||||
m_unitPrice = 0;
|
||||
m_count = 0;
|
||||
@@ -12,12 +35,12 @@ VoucherItem::VoucherItem(QObject *parent) : QObject(parent)
|
||||
m_priceWitouthVat = 0;
|
||||
}
|
||||
|
||||
int VoucherItem::id() const
|
||||
long VoucherItem::id() const
|
||||
{
|
||||
return m_id;
|
||||
}
|
||||
|
||||
void VoucherItem::setId(int id)
|
||||
void VoucherItem::setId(long id)
|
||||
{
|
||||
m_id = id;
|
||||
}
|
||||
@@ -117,12 +140,12 @@ QDecDouble VoucherItem::vatAmount() const
|
||||
return TO_DEC(m_price) - TO_DEC(m_priceWitouthVat);
|
||||
}
|
||||
|
||||
QWeakPointer<Voucher> VoucherItem::voucher() const
|
||||
QSharedPointer<Voucher> VoucherItem::voucher() const
|
||||
{
|
||||
return m_voucher;
|
||||
}
|
||||
|
||||
void VoucherItem::setVoucher(const QWeakPointer<Voucher> &voucher)
|
||||
void VoucherItem::setVoucher(const QSharedPointer<Voucher> &voucher)
|
||||
{
|
||||
m_voucher = voucher;
|
||||
}
|
||||
|
||||
+11
-18
@@ -4,27 +4,21 @@
|
||||
#include <QObject>
|
||||
#include <QString>
|
||||
#include <QDecDouble.hh>
|
||||
#include <odb/core.hxx>
|
||||
#include <QSharedPointer>
|
||||
#include <QDateTime>
|
||||
|
||||
#include <enums.h>
|
||||
#include "../shop_global.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
|
||||
|
||||
QX_REGISTER_FRIEND_CLASS(VoucherItem)
|
||||
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)
|
||||
@@ -35,10 +29,10 @@ class SHOPSHARED_EXPORT VoucherItem : public QObject
|
||||
Q_PROPERTY(QDecDouble price READ price WRITE setPrice)
|
||||
|
||||
public:
|
||||
explicit VoucherItem(QObject *parent = 0);
|
||||
explicit VoucherItem(QObject *parent = nullptr);
|
||||
|
||||
int id() const;
|
||||
void setId(int id);
|
||||
long id() const;
|
||||
void setId(long id);
|
||||
|
||||
QString name() const;
|
||||
void setName(const QString &name);
|
||||
@@ -69,8 +63,8 @@ public:
|
||||
|
||||
QDecDouble vatAmount() const;
|
||||
|
||||
QWeakPointer<Voucher> voucher() const;
|
||||
void setVoucher(const QWeakPointer<Voucher> &voucher);
|
||||
QSharedPointer<Voucher> voucher() const;
|
||||
void setVoucher(const QSharedPointer<Voucher> &voucher);
|
||||
|
||||
QDateTime insertDate() const;
|
||||
void setInsertDate(const QDateTime &insertDate);
|
||||
@@ -79,9 +73,7 @@ signals:
|
||||
void countChanged(int oldCount);
|
||||
|
||||
private:
|
||||
friend class odb::access;
|
||||
#pragma db id auto
|
||||
int m_id;
|
||||
long m_id;
|
||||
QString m_name;
|
||||
int m_count;
|
||||
int m_unitPrice;
|
||||
@@ -92,10 +84,11 @@ private:
|
||||
QDateTime m_insertDate;
|
||||
QString m_itemPlugin;
|
||||
Enums::VatType m_vatType;
|
||||
#pragma db not_null
|
||||
QWeakPointer<Voucher> m_voucher;
|
||||
QSharedPointer<Voucher> m_voucher;
|
||||
};
|
||||
|
||||
typedef QSharedPointer<VoucherItem> VoucherItemPtr;
|
||||
|
||||
QX_REGISTER_HPP_SHOP(VoucherItem, QObject, 0);
|
||||
|
||||
#endif // VOUCHERITEM_H
|
||||
|
||||
Reference in New Issue
Block a user