Build system changed to Cmake, ORM changed to QxORM, Qt6 compatibility.
This commit is contained in:
@@ -0,0 +1,83 @@
|
||||
cmake_minimum_required(VERSION 3.24)
|
||||
project(camp)
|
||||
|
||||
include(../3rdparty/QxOrm/QxOrm.cmake)
|
||||
|
||||
set (CMAKE_LIBRARY_OUTPUT_DIRECTORY ../plugins)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
set(CMAKE_AUTORCC ON)
|
||||
set(CMAKE_AUTOUIC ON)
|
||||
|
||||
find_package(Qt6 COMPONENTS
|
||||
Core
|
||||
Gui
|
||||
Widgets
|
||||
REQUIRED)
|
||||
|
||||
add_library(camp SHARED
|
||||
addservicedialog.cpp
|
||||
addservicedialog.h
|
||||
addservicedialog.ui
|
||||
camp.cpp
|
||||
camp.h
|
||||
camp_global.h
|
||||
campform.cpp
|
||||
campform.h
|
||||
campform.ui
|
||||
campgrid.cpp
|
||||
campgrid.h
|
||||
camprc.qrc
|
||||
campseller.cpp
|
||||
campseller.h
|
||||
campservice.cpp
|
||||
campservice.h
|
||||
campshopitem.cpp
|
||||
campshopitem.h
|
||||
campwizard.cpp
|
||||
campwizard.h
|
||||
campwizard.ui
|
||||
detailwidget.cpp
|
||||
detailwidget.h
|
||||
detailwidget.ui
|
||||
data/addressitem.cpp
|
||||
data/addressitem.h
|
||||
data/camp-data.h
|
||||
data/campdata.cpp
|
||||
data/campdata.h
|
||||
data/personprice.cpp
|
||||
data/personprice.h
|
||||
data/sale.cpp
|
||||
data/sale.h
|
||||
data/serviceitem.cpp
|
||||
data/serviceitem.h
|
||||
settings/campsettings.cpp
|
||||
settings/campsettings.h
|
||||
settings/campsettingsform.cpp
|
||||
settings/campsettingsform.h
|
||||
settings/campsettingsform.ui)
|
||||
|
||||
target_compile_definitions(camp PRIVATE -DCAMP_LIBRARY)
|
||||
|
||||
include_directories(../core)
|
||||
include_directories(../countryregister
|
||||
../addressbook
|
||||
../services
|
||||
../shop)
|
||||
|
||||
target_link_libraries(camp
|
||||
Qt::Core
|
||||
Qt::Gui
|
||||
Qt::Widgets
|
||||
qdecimal
|
||||
decnumber
|
||||
QxOrm
|
||||
core
|
||||
addressbook
|
||||
services
|
||||
shop
|
||||
)
|
||||
|
||||
install(TARGETS addressbook
|
||||
LIBRARY DESTINATION ../plugins)
|
||||
@@ -14,8 +14,8 @@ class AddServiceDialog : public QDialog
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit AddServiceDialog(AccServicePtr service, QWidget *parent = 0);
|
||||
~AddServiceDialog();
|
||||
explicit AddServiceDialog(AccServicePtr service, QWidget *parent = nullptr);
|
||||
~AddServiceDialog() override;
|
||||
|
||||
QString description();
|
||||
QDecDouble price();
|
||||
|
||||
@@ -5,10 +5,6 @@
|
||||
#include "campservice.h"
|
||||
#include "settings/campsettingsform.h"
|
||||
|
||||
Camp::Camp()
|
||||
{
|
||||
}
|
||||
|
||||
void Camp::initServiceUi()
|
||||
{
|
||||
m_service = new CampService();
|
||||
|
||||
+4
-4
@@ -14,16 +14,16 @@ class CAMPSHARED_EXPORT Camp : public QObject, IMetaDataPlugin
|
||||
Q_INTERFACES(IPlugin)
|
||||
|
||||
public:
|
||||
Camp();
|
||||
Camp() = default;
|
||||
|
||||
protected:
|
||||
void initServiceUi() Q_DECL_OVERRIDE;
|
||||
|
||||
// IPlugin interface
|
||||
public:
|
||||
virtual QIcon pluginIcon();
|
||||
QTranslator *translator();
|
||||
bool hasNumberSeries();
|
||||
QIcon pluginIcon() override;
|
||||
QTranslator *translator() override;
|
||||
bool hasNumberSeries() override;
|
||||
};
|
||||
|
||||
#endif // CAMP_H
|
||||
|
||||
-110
@@ -1,110 +0,0 @@
|
||||
#-------------------------------------------------
|
||||
#
|
||||
# Project created by QtCreator 2017-04-19T09:20:32
|
||||
#
|
||||
#-------------------------------------------------
|
||||
|
||||
QT += widgets sql
|
||||
|
||||
TARGET = camp
|
||||
TEMPLATE = lib
|
||||
|
||||
DEFINES += CAMP_LIBRARY
|
||||
|
||||
# The following define makes your compiler emit warnings if you use
|
||||
# any feature of Qt which as been marked as deprecated (the exact warnings
|
||||
# depend on your compiler). Please consult the documentation of the
|
||||
# deprecated API in order to know how to port your code away from it.
|
||||
DEFINES += QT_DEPRECATED_WARNINGS
|
||||
|
||||
# You can also make your code fail to compile if you use deprecated APIs.
|
||||
# In order to do so, uncomment the following line.
|
||||
# You can also select to disable deprecated APIs only up to a certain version of Qt.
|
||||
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
|
||||
|
||||
SOURCES += camp.cpp \
|
||||
data/campdata.cpp \
|
||||
data/addressitem.cpp \
|
||||
data/serviceitem.cpp \
|
||||
campgrid.cpp \
|
||||
campform.cpp \
|
||||
data/sale.cpp \
|
||||
settings/campsettingsform.cpp \
|
||||
data/personprice.cpp \
|
||||
settings/campsettings.cpp \
|
||||
campwizard.cpp \
|
||||
campservice.cpp \
|
||||
addservicedialog.cpp \
|
||||
campshopitem.cpp \
|
||||
campseller.cpp \
|
||||
detailwidget.cpp
|
||||
|
||||
HEADERS += camp.h\
|
||||
camp_global.h \
|
||||
data/campdata.h \
|
||||
data/addressitem.h \
|
||||
data/serviceitem.h \
|
||||
data/camp-data.h \
|
||||
campgrid.h \
|
||||
campform.h \
|
||||
data/sale.h \
|
||||
settings/campsettingsform.h \
|
||||
data/personprice.h \
|
||||
settings/campsettings.h \
|
||||
campwizard.h \
|
||||
campservice.h \
|
||||
addservicedialog.h \
|
||||
campshopitem.h \
|
||||
campseller.h \
|
||||
detailwidget.h
|
||||
|
||||
include(../config_plugin.pri)
|
||||
|
||||
ODB_FILES = camp/data/camp-data.h
|
||||
H_DIR = $$PWD/data/*.h
|
||||
ODB_OTHER_INCLUDES = -I $$PWD/../shop -I $$PWD/../addressbook/data -I $$PWD/../countryregister/data -I $$PWD/../services/data
|
||||
include(../odb.pri)
|
||||
|
||||
win32:CONFIG(release, debug|release): LIBS += -L$$OUT_PWD/../plugins/ -lshop
|
||||
else:win32:CONFIG(debug, debug|release): LIBS += -L$$OUT_PWD/../plugins/ -lshop
|
||||
else:unix: LIBS += -L$$OUT_PWD/../plugins/ -lshop
|
||||
|
||||
INCLUDEPATH += $$PWD/../shop
|
||||
DEPENDPATH += $$PWD/../shop
|
||||
|
||||
win32:CONFIG(release, debug|release): LIBS += -L$$OUT_PWD/../plugins/ -laddressbook
|
||||
else:win32:CONFIG(debug, debug|release): LIBS += -L$$OUT_PWD/../plugins/ -laddressbook
|
||||
else:unix: LIBS += -L$$OUT_PWD/../plugins/ -laddressbook
|
||||
|
||||
INCLUDEPATH += $$PWD/../addressbook
|
||||
INCLUDEPATH += $$PWD/../addressbook/data
|
||||
DEPENDPATH += $$PWD/../addressbook
|
||||
|
||||
win32:CONFIG(release, debug|release): LIBS += -L$$OUT_PWD/../plugins/ -lcountryregister
|
||||
else:win32:CONFIG(debug, debug|release): LIBS += -L$$OUT_PWD/../plugins/ -lcountryregister
|
||||
|
||||
INCLUDEPATH += $$PWD/../countryregister/data
|
||||
INCLUDEPATH += $$PWD/../countryregister
|
||||
|
||||
win32:CONFIG(release, debug|release): LIBS += -L$$OUT_PWD/../plugins/ -lservices
|
||||
else:win32:CONFIG(debug, debug|release): LIBS += -L$$OUT_PWD/../plugins/ -lservices
|
||||
else:unix: LIBS += -L$$OUT_PWD/../plugins/ -lservices
|
||||
|
||||
INCLUDEPATH += $$PWD/../services
|
||||
INCLUDEPATH += $$PWD/../services/data
|
||||
DEPENDPATH += $$PWD/../services
|
||||
|
||||
TRANSLATIONS = translations/camp_cs_CZ.ts
|
||||
|
||||
DISTFILES += \
|
||||
camp.json
|
||||
|
||||
RESOURCES += \
|
||||
camprc.qrc
|
||||
|
||||
FORMS += \
|
||||
campform.ui \
|
||||
settings/campsettingsform.ui \
|
||||
campwizard.ui \
|
||||
addservicedialog.ui \
|
||||
detailwidget.ui
|
||||
@@ -2,6 +2,7 @@
|
||||
#define CAMP_GLOBAL_H
|
||||
|
||||
#include <QtCore/qglobal.h>
|
||||
#include <QxOrm.h>
|
||||
|
||||
#if defined(CAMP_LIBRARY)
|
||||
# define CAMPSHARED_EXPORT Q_DECL_EXPORT
|
||||
@@ -9,4 +10,12 @@
|
||||
# define CAMPSHARED_EXPORT Q_DECL_IMPORT
|
||||
#endif
|
||||
|
||||
#ifdef CAMP_LIBRARY
|
||||
#define QX_REGISTER_HPP_CAMP QX_REGISTER_HPP_EXPORT_DLL
|
||||
#define QX_REGISTER_CPP_CAMP QX_REGISTER_CPP_EXPORT_DLL
|
||||
#else // CAMP_LIBRARY
|
||||
#define QX_REGISTER_HPP_CAMP QX_REGISTER_HPP_IMPORT_DLL
|
||||
#define QX_REGISTER_CPP_CAMP QX_REGISTER_CPP_IMPORT_DLL
|
||||
#endif
|
||||
|
||||
#endif // CAMP_GLOBAL_H
|
||||
|
||||
+2
-3
@@ -4,7 +4,6 @@
|
||||
#include <QWidget>
|
||||
#include <core.h>
|
||||
#include "data/camp-data.h"
|
||||
#include "camp-odb.hxx"
|
||||
|
||||
namespace Ui {
|
||||
class CampForm;
|
||||
@@ -15,8 +14,8 @@ class CampForm : public AutoForm<CampData>
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit CampForm(QWidget *parent = 0);
|
||||
~CampForm();
|
||||
explicit CampForm(QWidget *parent = nullptr);
|
||||
~CampForm() override;
|
||||
|
||||
private:
|
||||
Ui::CampForm *ui;
|
||||
|
||||
+10
-7
@@ -13,7 +13,7 @@ CampGrid::CampGrid(QWidget *parent) : GridForm<CampData>(parent)
|
||||
|
||||
QHBoxLayout *tbLayout = qobject_cast<QHBoxLayout*>(this->toolbar()->layout());
|
||||
|
||||
if (tbLayout != NULL)
|
||||
if (tbLayout != nullptr)
|
||||
{
|
||||
QToolButton *btnImport = new QToolButton(this->toolbar());
|
||||
btnImport->setIcon(QIcon(":/icons/pay.svg"));
|
||||
@@ -76,8 +76,10 @@ void CampGrid::handleEditRecord()
|
||||
return;
|
||||
}
|
||||
|
||||
CampService srv;
|
||||
srv.loadItems(data);
|
||||
if (data->people().isEmpty() || data->services().isEmpty()) {
|
||||
CampService srv;
|
||||
srv.load(data);
|
||||
}
|
||||
|
||||
CampWizard *wizard = new CampWizard();
|
||||
wizard->setAttribute(Qt::WA_DeleteOnClose);
|
||||
@@ -99,10 +101,10 @@ void CampGrid::doDelete(CampDataPtr entity)
|
||||
}
|
||||
|
||||
CampService srv;
|
||||
srv.eraseCamp(entity);
|
||||
srv.erase(entity);
|
||||
}
|
||||
|
||||
void CampGrid::addToVoucher(CampDataPtr data)
|
||||
void CampGrid::addToVoucher(const CampDataPtr& data)
|
||||
{
|
||||
if (data->onVoucher())
|
||||
{
|
||||
@@ -143,7 +145,7 @@ void CampGrid::addToVoucher(CampDataPtr data)
|
||||
data->setOnVoucher(false);
|
||||
srvCamp.update(data);
|
||||
voucher->clearItems();
|
||||
shopSrv.eraseVoucher(voucher);
|
||||
shopSrv.erase(voucher);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -151,7 +153,8 @@ void CampGrid::currentIndexChanged(const QModelIndex ¤t)
|
||||
{
|
||||
if (current.isValid())
|
||||
{
|
||||
m_detail->setData(currentEntity());
|
||||
auto current = currentEntity();
|
||||
m_detail->setData(current);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+7
-8
@@ -3,7 +3,6 @@
|
||||
|
||||
#include <core.h>
|
||||
#include "data/camp-data.h"
|
||||
#include "camp-odb.hxx"
|
||||
|
||||
#include "detailwidget.h"
|
||||
|
||||
@@ -11,29 +10,29 @@ class CampGrid : public GridForm<CampData>
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
CampGrid(QWidget *parent = NULL);
|
||||
explicit CampGrid(QWidget *parent = nullptr);
|
||||
|
||||
// IGridForm interface
|
||||
protected:
|
||||
void handleNewRecord();
|
||||
void handleEditRecord();
|
||||
void handleNewRecord() override;
|
||||
void handleEditRecord() override;
|
||||
|
||||
// GridForm interface
|
||||
protected:
|
||||
void doDelete(CampDataPtr entity);
|
||||
void doDelete(CampDataPtr entity) override;
|
||||
|
||||
private:
|
||||
void addToVoucher(CampDataPtr data);
|
||||
void addToVoucher(const CampDataPtr& data);
|
||||
DetailWidget *m_detail;
|
||||
|
||||
|
||||
// IGridForm interface
|
||||
protected:
|
||||
void currentIndexChanged(const QModelIndex ¤t);
|
||||
void currentIndexChanged(const QModelIndex ¤t) override;
|
||||
|
||||
// GridForm interface
|
||||
protected:
|
||||
virtual QList<CampDataPtr> listForGrid() override;
|
||||
QList<CampDataPtr> listForGrid() override;
|
||||
};
|
||||
|
||||
#endif // CAMPGRID_H
|
||||
|
||||
+2
-2
@@ -7,11 +7,11 @@ class CampSeller : public ISeller
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit CampSeller(QObject *parent = 0);
|
||||
explicit CampSeller(QObject *parent = nullptr);
|
||||
|
||||
// ISeller interface
|
||||
public:
|
||||
void prepareItem();
|
||||
void prepareItem() override;
|
||||
};
|
||||
|
||||
#endif // CAMPSELLER_H
|
||||
|
||||
+25
-50
@@ -4,7 +4,7 @@
|
||||
#include <numberseriesservice.h>
|
||||
#include "campshopitem.h"
|
||||
#include "campseller.h"
|
||||
#include <math.h>
|
||||
#include <cmath>
|
||||
|
||||
#ifdef _WIN32
|
||||
double round(double value) { return value < 0 ? -std::floor(0.5 - value) : std::floor(0.5 + value); }
|
||||
@@ -16,7 +16,7 @@ CampService::CampService()
|
||||
m_seller = new CampSeller(this);
|
||||
}
|
||||
|
||||
void CampService::addPerson(CampDataPtr data, AddressbookDataPtr address)
|
||||
void CampService::addPerson(const CampDataPtr& data, const AddressbookDataPtr& address)
|
||||
{
|
||||
AddressItemPtr addrItem(new AddressItem);
|
||||
|
||||
@@ -34,7 +34,7 @@ void CampService::addPerson(CampDataPtr data, AddressbookDataPtr address)
|
||||
data->addPerson(addrItem);
|
||||
}
|
||||
|
||||
void CampService::addService(CampDataPtr data, AccServicePtr service)
|
||||
void CampService::addService(const CampDataPtr& data, const AccServicePtr& service)
|
||||
{
|
||||
ServiceItemPtr serviceItem(new ServiceItem);
|
||||
|
||||
@@ -47,14 +47,14 @@ void CampService::addService(CampDataPtr data, AccServicePtr service)
|
||||
data->addServiceItem(serviceItem);
|
||||
}
|
||||
|
||||
void CampService::addService(CampDataPtr data, AccServicePtr service, QDecDouble price, QString description)
|
||||
void CampService::addService(CampDataPtr data, AccServicePtr service, QDecDouble price, const QString& description)
|
||||
{
|
||||
ServiceItemPtr item = addServiceInt(data, service);
|
||||
item->setPrice(price);
|
||||
item->setDescription(description);
|
||||
}
|
||||
|
||||
void CampService::setOwner(CampDataPtr data, AddressItemPtr person)
|
||||
void CampService::setOwner(const CampDataPtr& data, const AddressItemPtr& person)
|
||||
{
|
||||
foreach (AddressItemPtr p, data->people()) {
|
||||
p->setOwner(false);
|
||||
@@ -76,7 +76,7 @@ CampDataPtr CampService::create()
|
||||
return data;
|
||||
}
|
||||
|
||||
void CampService::calculate(CampDataPtr data)
|
||||
void CampService::calculate(const CampDataPtr& data)
|
||||
{
|
||||
SettingsService srv("CAMP");
|
||||
m_settings = srv.loadSettings<CampSettings>();
|
||||
@@ -86,7 +86,7 @@ void CampService::calculate(CampDataPtr data)
|
||||
calcPrice(data);
|
||||
}
|
||||
|
||||
void CampService::saveCamp(CampDataPtr data)
|
||||
void CampService::saveCamp(const CampDataPtr& data)
|
||||
{
|
||||
if (!checkPermission(PERM_ADD))
|
||||
{
|
||||
@@ -97,39 +97,16 @@ void CampService::saveCamp(CampDataPtr data)
|
||||
SeasonPtr season = seasonSrv.active();
|
||||
data->setSeason(season);
|
||||
|
||||
Transaction tr;
|
||||
try
|
||||
{
|
||||
odb::database *db = Context::instance().db();
|
||||
qx::QxSession session;
|
||||
|
||||
NumberSeriesService numSrv;
|
||||
data->setNumSer(numSrv.nextStrForPlugin("CAMP"));
|
||||
NumberSeriesService numSrv;
|
||||
data->setNumSer(numSrv.nextStrForPlugin("CAMP", &session));
|
||||
|
||||
addDateAndUser(data, true);
|
||||
|
||||
db->persist(data);
|
||||
|
||||
foreach (ServiceItemPtr item, data->services()) {
|
||||
item->setCampData(data.toWeakRef());
|
||||
db->persist(item);
|
||||
}
|
||||
|
||||
foreach (AddressItemPtr item, data->people()) {
|
||||
item->setCampData(data.toWeakRef());
|
||||
db->persist(item);
|
||||
}
|
||||
|
||||
tr.commit();
|
||||
}
|
||||
catch (const odb::exception &ex)
|
||||
{
|
||||
emit dbError(ex.what());
|
||||
emit dbErrorInsert(ex.what());
|
||||
return;
|
||||
}
|
||||
addDateAndUser(data, true);
|
||||
save(data, &session);
|
||||
}
|
||||
|
||||
void CampService::updateCamp(CampDataPtr data)
|
||||
/*void CampService::updateCamp(CampDataPtr data)
|
||||
{
|
||||
if (!checkPermission(PERM_EDIT))
|
||||
{
|
||||
@@ -166,9 +143,9 @@ void CampService::updateCamp(CampDataPtr data)
|
||||
emit dbErrorUpdate(ex.what());
|
||||
return;
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
void CampService::eraseCamp(CampDataPtr data)
|
||||
/*void CampService::eraseCamp(CampDataPtr data)
|
||||
{
|
||||
if (!checkPermission(PERM_DELETE))
|
||||
{
|
||||
@@ -193,16 +170,16 @@ void CampService::eraseCamp(CampDataPtr data)
|
||||
emit dbErrorDelete(ex.what());
|
||||
return;
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
void CampService::loadItems(CampDataPtr data)
|
||||
/*void CampService::loadItems(CampDataPtr data)
|
||||
{
|
||||
Service<AddressItem> srv;
|
||||
data->setPeople(srv.all(QString("campData = %1").arg(data->id())));
|
||||
|
||||
Service<ServiceItem> srvService;
|
||||
data->setServices(srvService.all(QString("campData = %1").arg(data->id())));
|
||||
}
|
||||
}*/
|
||||
|
||||
QList<CampDataPtr> CampService::allForSeason()
|
||||
{
|
||||
@@ -278,7 +255,7 @@ void CampService::calcPeople(CampDataPtr data)
|
||||
}
|
||||
}
|
||||
|
||||
void CampService::calcServices(CampDataPtr data)
|
||||
void CampService::calcServices(const CampDataPtr& data)
|
||||
{
|
||||
QDecDouble sale = data->sale();
|
||||
bool fixedSale = data->fixedSale();
|
||||
@@ -301,7 +278,7 @@ void CampService::calcServices(CampDataPtr data)
|
||||
}
|
||||
}
|
||||
|
||||
void CampService::calcPrice(CampDataPtr data)
|
||||
void CampService::calcPrice(const CampDataPtr& data)
|
||||
{
|
||||
QDecDouble totalPrice(0);
|
||||
QDecDouble sale(0);
|
||||
@@ -340,7 +317,7 @@ void CampService::calcPrice(CampDataPtr data)
|
||||
data->setTotalSale(sale);
|
||||
}
|
||||
|
||||
void CampService::addAccFee(CampDataPtr data, AddressItemPtr item, int startAge, int endAge, int days)
|
||||
void CampService::addAccFee(const CampDataPtr& data, const AddressItemPtr& item, int startAge, int endAge, int days)
|
||||
{
|
||||
if (item->adbItem()->ztp())
|
||||
{
|
||||
@@ -380,24 +357,23 @@ void CampService::addAccFee(CampDataPtr data, AddressItemPtr item, int startAge,
|
||||
}
|
||||
}
|
||||
|
||||
QList<ShopItemPtr> CampService::shopItems()
|
||||
QList<IShopItemPtr> CampService::shopItems()
|
||||
{
|
||||
CampShopItemPtr item(new CampShopItem);
|
||||
|
||||
QList<ShopItemPtr> items;
|
||||
QList<IShopItemPtr> items;
|
||||
items.append(item);
|
||||
|
||||
return items;
|
||||
}
|
||||
|
||||
ShopItemPtr CampService::shopItem(int )
|
||||
IShopItemPtr CampService::shopItem(int )
|
||||
{
|
||||
return CampShopItemPtr(new CampShopItem);
|
||||
}
|
||||
|
||||
void CampService::addedToVoucher(int itemId, int countAdded)
|
||||
{
|
||||
Transaction tx;
|
||||
CampDataPtr data = loadById(itemId);
|
||||
|
||||
if (countAdded > 0)
|
||||
@@ -410,7 +386,6 @@ void CampService::addedToVoucher(int itemId, int countAdded)
|
||||
}
|
||||
|
||||
this->update(data);
|
||||
tx.commit();
|
||||
}
|
||||
|
||||
ISeller *CampService::seller()
|
||||
@@ -418,7 +393,7 @@ ISeller *CampService::seller()
|
||||
return m_seller;
|
||||
}
|
||||
|
||||
ServiceItemPtr CampService::addServiceInt(CampDataPtr data, AccServicePtr service)
|
||||
ServiceItemPtr CampService::addServiceInt(const CampDataPtr& data, const AccServicePtr& service)
|
||||
{
|
||||
ServiceItemPtr serviceItem(new ServiceItem);
|
||||
|
||||
|
||||
+19
-20
@@ -2,45 +2,44 @@
|
||||
#define CAMPSERVICE_H
|
||||
|
||||
#include <core.h>
|
||||
#include <addressbookdata.h>
|
||||
#include <accservice.h>
|
||||
#include <data/addressbookdata.h>
|
||||
#include <data/accservice.h>
|
||||
#include <isellableservice.h>
|
||||
#include "data/camp-data.h"
|
||||
#include "settings/campsettings.h"
|
||||
#include "camp-odb.hxx"
|
||||
|
||||
class CampService : public Service<CampData>, public ISellableService
|
||||
{
|
||||
public:
|
||||
CampService();
|
||||
|
||||
void addPerson(CampDataPtr data, AddressbookDataPtr address);
|
||||
void addService(CampDataPtr data, AccServicePtr service);
|
||||
void addService(CampDataPtr data, AccServicePtr service, QDecDouble price, QString description);
|
||||
void setOwner(CampDataPtr data, AddressItemPtr person);
|
||||
void addPerson(const CampDataPtr& data, const AddressbookDataPtr& address);
|
||||
void addService(const CampDataPtr& data, const AccServicePtr& service);
|
||||
void addService(CampDataPtr data, AccServicePtr service, QDecDouble price, const QString& description);
|
||||
void setOwner(const CampDataPtr& data, const AddressItemPtr& person);
|
||||
CampDataPtr create();
|
||||
void calculate(CampDataPtr data);
|
||||
void saveCamp(CampDataPtr data);
|
||||
void updateCamp(CampDataPtr data);
|
||||
void eraseCamp(CampDataPtr data);
|
||||
void loadItems(CampDataPtr data);
|
||||
void calculate(const CampDataPtr& data);
|
||||
void saveCamp(const CampDataPtr& data);
|
||||
//void updateCamp(CampDataPtr data);
|
||||
//void eraseCamp(CampDataPtr data);
|
||||
//void loadItems(CampDataPtr data);
|
||||
QList<CampDataPtr> allForSeason();
|
||||
|
||||
private:
|
||||
ServiceItemPtr addServiceInt(CampDataPtr data, AccServicePtr service);
|
||||
ServiceItemPtr addServiceInt(const CampDataPtr& data, const AccServicePtr& service);
|
||||
void calcPeople(CampDataPtr data);
|
||||
void calcServices(CampDataPtr data);
|
||||
void calcPrice(CampDataPtr data);
|
||||
void addAccFee(CampDataPtr data, AddressItemPtr item, int startAge, int endAge, int days);
|
||||
void calcServices(const CampDataPtr& data);
|
||||
void calcPrice(const CampDataPtr& data);
|
||||
void addAccFee(const CampDataPtr& data, const AddressItemPtr& item, int startAge, int endAge, int days);
|
||||
CampSettingsPtr m_settings;
|
||||
ISeller *m_seller;
|
||||
|
||||
// ISellableService interface
|
||||
public:
|
||||
QList<ShopItemPtr> shopItems();
|
||||
ShopItemPtr shopItem(int itemId);
|
||||
void addedToVoucher(int itemId, int countAdded);
|
||||
ISeller *seller();
|
||||
QList<IShopItemPtr> shopItems() override;
|
||||
IShopItemPtr shopItem(int itemId) override;
|
||||
void addedToVoucher(int itemId, int countAdded) override;
|
||||
ISeller *seller() override;
|
||||
};
|
||||
|
||||
#endif // CAMPSERVICE_H
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
#include "campshopitem.h"
|
||||
|
||||
CampShopItem::CampShopItem(QObject *parent)
|
||||
:ShopItem(parent)
|
||||
:IShopItem(parent)
|
||||
{
|
||||
m_id = 0;
|
||||
m_unitPrice = QDecDouble(0);
|
||||
m_vatType = Enums::NONE;
|
||||
}
|
||||
@@ -47,12 +48,12 @@ void CampShopItem::setVatType(const Enums::VatType &vatType)
|
||||
m_vatType = vatType;
|
||||
}
|
||||
|
||||
int CampShopItem::id()
|
||||
long CampShopItem::id()
|
||||
{
|
||||
return m_id;
|
||||
}
|
||||
|
||||
void CampShopItem::setId(int id)
|
||||
void CampShopItem::setId(long id)
|
||||
{
|
||||
m_id = id;
|
||||
}
|
||||
|
||||
+11
-11
@@ -3,30 +3,30 @@
|
||||
|
||||
#include <shopitem.h>
|
||||
|
||||
class CampShopItem : public ShopItem
|
||||
class CampShopItem : public IShopItem
|
||||
{
|
||||
public:
|
||||
CampShopItem(QObject *parent = 0);
|
||||
explicit CampShopItem(QObject *parent = nullptr);
|
||||
|
||||
// IShopItem interface
|
||||
public:
|
||||
int id();
|
||||
QString name();
|
||||
QString shortName();
|
||||
QDecDouble unitPrice();
|
||||
Enums::VatType vatType();
|
||||
QString pluginId();
|
||||
long id() override;
|
||||
QString name() override;
|
||||
QString shortName() override;
|
||||
QDecDouble unitPrice() override;
|
||||
Enums::VatType vatType() override;
|
||||
QString pluginId() override;
|
||||
|
||||
// ShopItem interface
|
||||
public:
|
||||
QString code();
|
||||
QString code() override;
|
||||
|
||||
void setUnitPrice(const QDecDouble &unitPrice);
|
||||
void setVatType(const Enums::VatType &vatType);
|
||||
void setId(int id);
|
||||
void setId(long id);
|
||||
|
||||
private:
|
||||
int m_id;
|
||||
long m_id;
|
||||
QDecDouble m_unitPrice;
|
||||
Enums::VatType m_vatType;
|
||||
};
|
||||
|
||||
+4
-4
@@ -5,7 +5,7 @@
|
||||
|
||||
#include <core.h>
|
||||
#include <addressbookservice.h>
|
||||
#include <accservice.h>
|
||||
#include <data/accservice.h>
|
||||
#include <reporting/reportviewer.h>
|
||||
|
||||
#include <QScroller>
|
||||
@@ -129,7 +129,7 @@ CampWizard::CampWizard(QWidget *parent) :
|
||||
|
||||
Service<AddressbookData> addrSrv;
|
||||
m_addrHelperBinder = new ObjectBinder(this);
|
||||
m_addrHelperBinder->registerBinding(ui->address, ComboData::createComboData(addrSrv.all("", "lastName, firstName")));
|
||||
m_addrHelperBinder->registerBinding(ui->address, ComboData::createComboData(addrSrv.all("")));
|
||||
m_addrHelperBinder->setData(m_addrHelper);
|
||||
|
||||
m_addressBinder = new ObjectBinder(this);
|
||||
@@ -437,7 +437,7 @@ void CampWizard::accept()
|
||||
}
|
||||
else
|
||||
{
|
||||
srv.updateCamp(m_data);
|
||||
srv.update(m_data);
|
||||
}
|
||||
|
||||
if (success)
|
||||
@@ -472,7 +472,7 @@ void CampWizard::on_btnPrint_clicked()
|
||||
}
|
||||
else
|
||||
{
|
||||
srv.updateCamp(m_data);
|
||||
srv.update(m_data);
|
||||
}
|
||||
|
||||
if(!success)
|
||||
|
||||
+6
-6
@@ -14,7 +14,7 @@ class AddressHelper : public QObject
|
||||
Q_PROPERTY(QSharedPointer<QObject> address READ address WRITE setAddress)
|
||||
|
||||
public:
|
||||
AddressHelper(QObject *parent = NULL);
|
||||
explicit AddressHelper(QObject *parent = nullptr);
|
||||
|
||||
QSharedPointer<QObject> address() const;
|
||||
void setAddress(const QSharedPointer<QObject> &address);
|
||||
@@ -36,7 +36,7 @@ class SaleHelper : public QObject
|
||||
Q_PROPERTY(QSharedPointer<QObject> sale READ sale WRITE setSale NOTIFY saleChanged)
|
||||
|
||||
public:
|
||||
SaleHelper(QObject *parent = NULL);
|
||||
explicit SaleHelper(QObject *parent = nullptr);
|
||||
|
||||
SalePtr salePtr() const;
|
||||
void setSalePtr(const SalePtr &sale);
|
||||
@@ -60,8 +60,8 @@ class CampWizard : public QWizard
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit CampWizard(QWidget *parent = 0);
|
||||
~CampWizard();
|
||||
explicit CampWizard(QWidget *parent = nullptr);
|
||||
~CampWizard() override;
|
||||
|
||||
void setData(const CampDataPtr &data);
|
||||
void setNewRecord(bool newRecord);
|
||||
@@ -109,10 +109,10 @@ private:
|
||||
|
||||
// QWizard interface
|
||||
public:
|
||||
bool validateCurrentPage();
|
||||
bool validateCurrentPage() override;
|
||||
|
||||
public slots:
|
||||
void accept();
|
||||
void accept() override;
|
||||
};
|
||||
|
||||
#endif // CAMPWIZARD_H
|
||||
|
||||
@@ -1,6 +1,26 @@
|
||||
#include "addressitem.h"
|
||||
#include <define.h>
|
||||
|
||||
QX_REGISTER_CPP_CAMP(AddressItem)
|
||||
|
||||
namespace qx {
|
||||
template<> void register_class(QxClass<AddressItem>& t) {
|
||||
t.setName("AddressItem");
|
||||
t.id(&AddressItem::m_id, "id");
|
||||
t.data(&AddressItem::m_firstName, "firstName");
|
||||
t.data(&AddressItem::m_lastName, "lastName");
|
||||
t.data(&AddressItem::m_address, "address");
|
||||
t.data(&AddressItem::m_price, "price");
|
||||
t.data(&AddressItem::m_owner, "owner");
|
||||
t.data(&AddressItem::m_sale, "sale");
|
||||
t.data(&AddressItem::m_totalPrice, "totalPrice");
|
||||
|
||||
t.relationManyToOne(&AddressItem::m_adbItem, "adbItem");
|
||||
t.relationManyToOne(&AddressItem::m_campData, "campData");
|
||||
t.relationManyToOne(&AddressItem::m_personPrice, "personPrice");
|
||||
}
|
||||
}
|
||||
|
||||
AddressItem::AddressItem(QObject *parent) : QObject(parent)
|
||||
{
|
||||
m_id = 0;
|
||||
@@ -10,12 +30,12 @@ AddressItem::AddressItem(QObject *parent) : QObject(parent)
|
||||
m_totalPrice = 0;
|
||||
}
|
||||
|
||||
int AddressItem::id() const
|
||||
long AddressItem::id() const
|
||||
{
|
||||
return m_id;
|
||||
}
|
||||
|
||||
void AddressItem::setId(int id)
|
||||
void AddressItem::setId(long id)
|
||||
{
|
||||
m_id = id;
|
||||
}
|
||||
@@ -60,12 +80,12 @@ void AddressItem::setPrice(QDecDouble price)
|
||||
m_price = FROM_DEC(price);
|
||||
}
|
||||
|
||||
QWeakPointer<CampData> AddressItem::campData() const
|
||||
QSharedPointer<CampData> AddressItem::campData() const
|
||||
{
|
||||
return m_campData;
|
||||
}
|
||||
|
||||
void AddressItem::setCampData(const QWeakPointer<CampData> &campData)
|
||||
void AddressItem::setCampData(const QSharedPointer<CampData> &campData)
|
||||
{
|
||||
m_campData = campData;
|
||||
}
|
||||
|
||||
+12
-12
@@ -6,16 +6,17 @@
|
||||
#include <QSharedPointer>
|
||||
#include <QWeakPointer>
|
||||
#include <QDecDouble.hh>
|
||||
#include <odb/core.hxx>
|
||||
#include <data/addressbookdata.h>
|
||||
|
||||
#include <addressbookdata.h>
|
||||
#include "../camp_global.h"
|
||||
|
||||
class CampData;
|
||||
|
||||
#pragma db object
|
||||
class AddressItem : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
QX_REGISTER_FRIEND_CLASS(AddressItem)
|
||||
Q_PROPERTY(QString firstName READ firstName WRITE setFirstName)
|
||||
Q_PROPERTY(QString lastName READ lastName WRITE setLastName)
|
||||
Q_PROPERTY(QString address READ address WRITE setAddress)
|
||||
@@ -27,8 +28,8 @@ class AddressItem : public QObject
|
||||
public:
|
||||
explicit AddressItem(QObject *parent = 0);
|
||||
|
||||
int id() const;
|
||||
void setId(int id);
|
||||
long id() const;
|
||||
void setId(long id);
|
||||
|
||||
QString firstName() const;
|
||||
void setFirstName(const QString &firstName);
|
||||
@@ -42,8 +43,8 @@ public:
|
||||
QDecDouble price() const;
|
||||
void setPrice(QDecDouble price);
|
||||
|
||||
QWeakPointer<CampData> campData() const;
|
||||
void setCampData(const QWeakPointer<CampData> &campData);
|
||||
QSharedPointer<CampData> campData() const;
|
||||
void setCampData(const QSharedPointer<CampData> &campData);
|
||||
|
||||
PersonPricePtr personPrice() const;
|
||||
void setPersonPrice(const PersonPricePtr &personPrice);
|
||||
@@ -61,9 +62,7 @@ public:
|
||||
void setSale(QDecDouble sale);
|
||||
|
||||
private:
|
||||
friend class odb::access;
|
||||
#pragma db id auto
|
||||
int m_id;
|
||||
long m_id;
|
||||
QString m_firstName;
|
||||
QString m_lastName;
|
||||
QString m_address;
|
||||
@@ -71,10 +70,11 @@ private:
|
||||
int m_price;
|
||||
int m_totalPrice;
|
||||
int m_sale;
|
||||
#pragma db not_null
|
||||
QWeakPointer<CampData> m_campData;
|
||||
CampDataPtr m_campData;
|
||||
PersonPricePtr m_personPrice;
|
||||
bool m_owner;
|
||||
};
|
||||
|
||||
QX_REGISTER_HPP_CAMP(AddressItem, QObject, 0)
|
||||
|
||||
#endif // ADDRESSITEM_H
|
||||
|
||||
+39
-10
@@ -1,6 +1,35 @@
|
||||
#include "campdata.h"
|
||||
#include <define.h>
|
||||
|
||||
QX_REGISTER_CPP_CAMP(CampData)
|
||||
|
||||
namespace qx {
|
||||
template<> void register_class(QxClass<CampData>& t) {
|
||||
t.setName("CampData");
|
||||
t.id(&CampData::m_id, "id");
|
||||
t.data(&CampData::m_numSer, "numSer");
|
||||
t.data(&CampData::m_start, "start");
|
||||
t.data(&CampData::m_end, "end");
|
||||
t.data(&CampData::m_ownerFirstame, "ownerFirstame");
|
||||
t.data(&CampData::m_ownerLastname, "ownerLastname");
|
||||
t.data(&CampData::m_ownerAddress, "ownerAddress");
|
||||
t.data(&CampData::m_totalPrice, "totalPrice");
|
||||
t.data(&CampData::m_sale, "sale");
|
||||
t.data(&CampData::m_fixedSale, "fixedSale");
|
||||
t.data(&CampData::m_fullPrice, "fullPrice");
|
||||
t.data(&CampData::m_totalSale, "totalSale");
|
||||
t.data(&CampData::m_onVoucher, "onVoucher");
|
||||
t.data(&CampData::m_createdBy, "createdBy");
|
||||
t.data(&CampData::m_created, "created");
|
||||
t.data(&CampData::m_updatedBy, "updatedBy");
|
||||
t.data(&CampData::m_updated, "updated");
|
||||
|
||||
t.relationManyToOne(&CampData::m_season, "season");
|
||||
t.relationOneToMany(&CampData::m_people, "people", "campData");
|
||||
t.relationOneToMany(&CampData::m_services, "services", "campData");
|
||||
}
|
||||
}
|
||||
|
||||
CampData::CampData(QObject *parent) : QObject(parent)
|
||||
{
|
||||
m_id = 0;
|
||||
@@ -12,12 +41,12 @@ CampData::CampData(QObject *parent) : QObject(parent)
|
||||
m_onVoucher = false;
|
||||
}
|
||||
|
||||
int CampData::id() const
|
||||
long CampData::id() const
|
||||
{
|
||||
return m_id;
|
||||
}
|
||||
|
||||
void CampData::setId(int id)
|
||||
void CampData::setId(long id)
|
||||
{
|
||||
m_id = id;
|
||||
}
|
||||
@@ -72,42 +101,42 @@ void CampData::setOwnerAddress(const QString &ownerAddress)
|
||||
m_ownerAddress = ownerAddress;
|
||||
}
|
||||
|
||||
QOdbList<ServiceItemPtr> CampData::services() const
|
||||
QList<ServiceItemPtr> CampData::services() const
|
||||
{
|
||||
return m_services;
|
||||
}
|
||||
|
||||
void CampData::setServices(const QOdbList<QSharedPointer<ServiceItem> > &services)
|
||||
void CampData::setServices(const QList<QSharedPointer<ServiceItem> > &services)
|
||||
{
|
||||
m_services = services;
|
||||
}
|
||||
|
||||
void CampData::addServiceItem(ServiceItemPtr serviceItem)
|
||||
void CampData::addServiceItem(const ServiceItemPtr& serviceItem)
|
||||
{
|
||||
m_services.append(serviceItem);
|
||||
}
|
||||
|
||||
void CampData::removeServiceItem(ServiceItemPtr serviceItem)
|
||||
void CampData::removeServiceItem(const ServiceItemPtr& serviceItem)
|
||||
{
|
||||
m_services.removeOne(serviceItem);
|
||||
}
|
||||
|
||||
QOdbList<AddressItemPtr> CampData::people() const
|
||||
QList<AddressItemPtr> CampData::people() const
|
||||
{
|
||||
return m_people;
|
||||
}
|
||||
|
||||
void CampData::setPeople(const QOdbList<AddressItemPtr> &people)
|
||||
void CampData::setPeople(const QList<AddressItemPtr> &people)
|
||||
{
|
||||
m_people = people;
|
||||
}
|
||||
|
||||
void CampData::addPerson(AddressItemPtr person)
|
||||
void CampData::addPerson(const AddressItemPtr& person)
|
||||
{
|
||||
m_people.append(person);
|
||||
}
|
||||
|
||||
void CampData::removePerson(AddressItemPtr person)
|
||||
void CampData::removePerson(const AddressItemPtr& person)
|
||||
{
|
||||
m_people.removeOne(person);
|
||||
}
|
||||
|
||||
+20
-22
@@ -5,15 +5,15 @@
|
||||
#include <QObject>
|
||||
#include <QDate>
|
||||
#include <QDecDouble.hh>
|
||||
#include <odb/core.hxx>
|
||||
#include <odb/qt/list.hxx>
|
||||
|
||||
#include <data/season.h>
|
||||
|
||||
#pragma db object
|
||||
#include "../camp_global.h"
|
||||
|
||||
class CampData : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
QX_REGISTER_FRIEND_CLASS(CampData)
|
||||
Q_PROPERTY(QString numSer READ numSer WRITE setNumSer)
|
||||
Q_PROPERTY(QDate start READ start WRITE setStart)
|
||||
Q_PROPERTY(QDate end READ end WRITE setEnd)
|
||||
@@ -31,10 +31,10 @@ class CampData : public QObject
|
||||
Q_PROPERTY(QDateTime updated READ updated WRITE setUpdated)
|
||||
|
||||
public:
|
||||
explicit CampData(QObject *parent = 0);
|
||||
explicit CampData(QObject *parent = nullptr);
|
||||
|
||||
int id() const;
|
||||
void setId(int id);
|
||||
long id() const;
|
||||
void setId(long id);
|
||||
|
||||
QDate start() const;
|
||||
void setStart(const QDate &start);
|
||||
@@ -51,15 +51,15 @@ public:
|
||||
QString ownerAddress() const;
|
||||
void setOwnerAddress(const QString &ownerAddress);
|
||||
|
||||
QOdbList<QSharedPointer<ServiceItem> > services() const;
|
||||
void setServices(const QOdbList<QSharedPointer<ServiceItem> > &services);
|
||||
void addServiceItem(ServiceItemPtr serviceItem);
|
||||
void removeServiceItem(ServiceItemPtr serviceItem);
|
||||
QList<ServiceItemPtr> services() const;
|
||||
void setServices(const QList<ServiceItemPtr> &services);
|
||||
void addServiceItem(const ServiceItemPtr& serviceItem);
|
||||
void removeServiceItem(const ServiceItemPtr& serviceItem);
|
||||
|
||||
QOdbList<AddressItemPtr> people() const;
|
||||
void setPeople(const QOdbList<AddressItemPtr> &people);
|
||||
void addPerson(AddressItemPtr person);
|
||||
void removePerson(AddressItemPtr person);
|
||||
QList<AddressItemPtr> people() const;
|
||||
void setPeople(const QList<AddressItemPtr> &people);
|
||||
void addPerson(const AddressItemPtr& person);
|
||||
void removePerson(const AddressItemPtr& person);
|
||||
|
||||
QDecDouble totalPrice() const;
|
||||
void setTotalPrice(QDecDouble totalPrice);
|
||||
@@ -98,19 +98,15 @@ public:
|
||||
void setUpdated(const QDateTime &updated);
|
||||
|
||||
private:
|
||||
friend class odb::access;
|
||||
#pragma db id auto
|
||||
int m_id;
|
||||
long m_id;
|
||||
QString m_numSer;
|
||||
QDate m_start;
|
||||
QDate m_end;
|
||||
QString m_ownerFirstame;
|
||||
QString m_ownerLastname;
|
||||
QString m_ownerAddress;
|
||||
#pragma db value_not_null inverse(m_campData)
|
||||
QOdbList<ServiceItemPtr> m_services;
|
||||
#pragma db value_not_null inverse(m_campData)
|
||||
QOdbList<AddressItemPtr> m_people;
|
||||
QList<ServiceItemPtr> m_services;
|
||||
QList<AddressItemPtr> m_people;
|
||||
int m_fullPrice;
|
||||
int m_totalPrice;
|
||||
int m_sale;
|
||||
@@ -124,4 +120,6 @@ private:
|
||||
QDateTime m_updated;
|
||||
};
|
||||
|
||||
QX_REGISTER_HPP_CAMP(CampData, QObject, 0)
|
||||
|
||||
#endif // CAMPDATA_H
|
||||
|
||||
@@ -1,6 +1,20 @@
|
||||
#include "personprice.h"
|
||||
#include <define.h>
|
||||
|
||||
QX_REGISTER_CPP_CAMP(PersonPrice)
|
||||
|
||||
namespace qx {
|
||||
template<> void register_class(QxClass<PersonPrice>& t) {
|
||||
t.setName("PersonPrice");
|
||||
t.id(&PersonPrice::m_id, "id");
|
||||
t.data(&PersonPrice::m_description, "description");
|
||||
t.data(&PersonPrice::m_fromAge, "fromAge");
|
||||
t.data(&PersonPrice::m_toAge, "toAge");
|
||||
t.data(&PersonPrice::m_price, "price");
|
||||
t.data(&PersonPrice::m_active, "active");
|
||||
}
|
||||
}
|
||||
|
||||
PersonPrice::PersonPrice(QObject *parent) : QObject(parent)
|
||||
{
|
||||
m_id = 0;
|
||||
@@ -10,12 +24,12 @@ PersonPrice::PersonPrice(QObject *parent) : QObject(parent)
|
||||
m_active = true;
|
||||
}
|
||||
|
||||
int PersonPrice::id() const
|
||||
long PersonPrice::id() const
|
||||
{
|
||||
return m_id;
|
||||
}
|
||||
|
||||
void PersonPrice::setId(int id)
|
||||
void PersonPrice::setId(long id)
|
||||
{
|
||||
m_id = id;
|
||||
}
|
||||
|
||||
@@ -3,12 +3,14 @@
|
||||
|
||||
#include <QObject>
|
||||
#include <QDecDouble.hh>
|
||||
#include <odb/core.hxx>
|
||||
|
||||
#pragma db object
|
||||
#include "../camp_global.h"
|
||||
|
||||
class PersonPrice : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
QX_REGISTER_FRIEND_CLASS(PersonPrice)
|
||||
Q_PROPERTY(QString description READ description WRITE setDescription)
|
||||
Q_PROPERTY(int fromAge READ fromAge WRITE setFromAge)
|
||||
Q_PROPERTY(int toAge READ toAge WRITE setToAge)
|
||||
@@ -18,8 +20,8 @@ class PersonPrice : public QObject
|
||||
public:
|
||||
explicit PersonPrice(QObject *parent = 0);
|
||||
|
||||
int id() const;
|
||||
void setId(int id);
|
||||
long id() const;
|
||||
void setId(long id);
|
||||
|
||||
QString description() const;
|
||||
void setDescription(const QString &description);
|
||||
@@ -37,9 +39,7 @@ public:
|
||||
void setActive(bool active);
|
||||
|
||||
private:
|
||||
friend class odb::access;
|
||||
#pragma db id auto
|
||||
int m_id;
|
||||
long m_id;
|
||||
QString m_description;
|
||||
int m_fromAge;
|
||||
int m_toAge;
|
||||
@@ -47,4 +47,6 @@ private:
|
||||
bool m_active;
|
||||
};
|
||||
|
||||
QX_REGISTER_HPP_CAMP(PersonPrice, QObject, 0)
|
||||
|
||||
#endif // PERSONPRICE_H
|
||||
|
||||
+14
-2
@@ -1,6 +1,18 @@
|
||||
#include "sale.h"
|
||||
#include <define.h>
|
||||
|
||||
QX_REGISTER_CPP_CAMP(Sale)
|
||||
|
||||
namespace qx {
|
||||
template<> void register_class(QxClass<Sale>& t) {
|
||||
t.setName("Sale");
|
||||
t.id(&Sale::m_id, "id");
|
||||
t.data(&Sale::m_sale, "sale");
|
||||
t.data(&Sale::m_fixed, "fixed");
|
||||
t.data(&Sale::m_description, "description");
|
||||
}
|
||||
}
|
||||
|
||||
Sale::Sale(QObject *parent) : ComboItem(parent)
|
||||
{
|
||||
m_id = 0;
|
||||
@@ -8,12 +20,12 @@ Sale::Sale(QObject *parent) : ComboItem(parent)
|
||||
m_fixed = false;
|
||||
}
|
||||
|
||||
int Sale::id() const
|
||||
long Sale::id() const
|
||||
{
|
||||
return m_id;
|
||||
}
|
||||
|
||||
void Sale::setId(int id)
|
||||
void Sale::setId(long id)
|
||||
{
|
||||
m_id = id;
|
||||
}
|
||||
|
||||
+12
-10
@@ -2,23 +2,25 @@
|
||||
#define SALE_H
|
||||
|
||||
#include <QObject>
|
||||
#include <odb/core.hxx>
|
||||
#include <QDecDouble.hh>
|
||||
#include <combodata.h>
|
||||
|
||||
#pragma db object
|
||||
#include "../camp_global.h"
|
||||
|
||||
class Sale : public ComboItem
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
QX_REGISTER_FRIEND_CLASS(Sale)
|
||||
Q_PROPERTY(QString description READ description WRITE setDescription)
|
||||
Q_PROPERTY(QDecDouble sale READ sale WRITE setSale)
|
||||
Q_PROPERTY(bool fixed READ fixed WRITE setFixed)
|
||||
|
||||
public:
|
||||
explicit Sale(QObject *parent = 0);
|
||||
explicit Sale(QObject *parent = nullptr);
|
||||
|
||||
int id() const;
|
||||
void setId(int id);
|
||||
long id() const;
|
||||
void setId(long id);
|
||||
|
||||
QDecDouble sale() const;
|
||||
void setSale(QDecDouble sale);
|
||||
@@ -30,17 +32,17 @@ public:
|
||||
void setDescription(const QString &description);
|
||||
|
||||
private:
|
||||
friend class odb::access;
|
||||
#pragma db id auto
|
||||
int m_id;
|
||||
long m_id;
|
||||
QString m_description;
|
||||
int m_sale;
|
||||
bool m_fixed;
|
||||
|
||||
// ComboItem interface
|
||||
public:
|
||||
bool eq(ComboItem *other);
|
||||
QString toString();
|
||||
bool eq(ComboItem *other) override;
|
||||
QString toString() override;
|
||||
};
|
||||
|
||||
QX_REGISTER_HPP_CAMP(Sale, ComboItem, 0)
|
||||
|
||||
#endif // SALE_H
|
||||
|
||||
@@ -1,6 +1,26 @@
|
||||
#include "serviceitem.h"
|
||||
#include <define.h>
|
||||
|
||||
QX_REGISTER_CPP_CAMP(ServiceItem)
|
||||
|
||||
namespace qx {
|
||||
template<> void register_class(QxClass<ServiceItem>& t) {
|
||||
t.setName("ServiceItem");
|
||||
t.id(&ServiceItem::m_id, "id");
|
||||
t.data(&ServiceItem::m_name, "name");
|
||||
t.data(&ServiceItem::m_code, "code");
|
||||
t.data(&ServiceItem::m_price, "price");
|
||||
t.data(&ServiceItem::m_salePossible, "salePossible");
|
||||
t.data(&ServiceItem::m_type, "type");
|
||||
t.data(&ServiceItem::m_sale, "sale");
|
||||
t.data(&ServiceItem::m_description, "description");
|
||||
t.data(&ServiceItem::m_totalPrice, "totalPrice");
|
||||
t.data(&ServiceItem::m_fullPrice, "fullPrice");
|
||||
|
||||
t.relationManyToOne(&ServiceItem::m_campData, "campData");
|
||||
}
|
||||
}
|
||||
|
||||
ServiceItem::ServiceItem(QObject *parent) : QObject(parent)
|
||||
{
|
||||
m_id = 0;
|
||||
@@ -8,15 +28,16 @@ ServiceItem::ServiceItem(QObject *parent) : QObject(parent)
|
||||
m_sale = 0;
|
||||
m_price = 0;
|
||||
m_totalPrice = 0;
|
||||
m_fullPrice = 0;
|
||||
m_type = AccService::OTHER;
|
||||
}
|
||||
|
||||
int ServiceItem::id() const
|
||||
long ServiceItem::id() const
|
||||
{
|
||||
return m_id;
|
||||
}
|
||||
|
||||
void ServiceItem::setId(int id)
|
||||
void ServiceItem::setId(long id)
|
||||
{
|
||||
m_id = id;
|
||||
}
|
||||
|
||||
+11
-11
@@ -6,16 +6,17 @@
|
||||
#include <QSharedPointer>
|
||||
#include <QWeakPointer>
|
||||
#include <QDecDouble.hh>
|
||||
#include <data/accservice.h>
|
||||
|
||||
#include <odb/core.hxx>
|
||||
#include <accservice.h>
|
||||
#include "../camp_global.h"
|
||||
|
||||
class CampData;
|
||||
|
||||
#pragma db object
|
||||
class ServiceItem : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
QX_REGISTER_FRIEND_CLASS(ServiceItem)
|
||||
Q_PROPERTY(QString name READ name WRITE setName)
|
||||
Q_PROPERTY(QString code READ code WRITE setCode)
|
||||
Q_PROPERTY(QString description READ description WRITE setDescription)
|
||||
@@ -27,10 +28,10 @@ class ServiceItem : public QObject
|
||||
Q_ENUMS(AccService::ServiceType)
|
||||
|
||||
public:
|
||||
explicit ServiceItem(QObject *parent = 0);
|
||||
explicit ServiceItem(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);
|
||||
@@ -63,9 +64,7 @@ public:
|
||||
void setFullPrice(QDecDouble fullPrice);
|
||||
|
||||
private:
|
||||
friend class odb::access;
|
||||
#pragma db id auto
|
||||
int m_id;
|
||||
long m_id;
|
||||
QString m_name;
|
||||
QString m_code;
|
||||
QString m_description;
|
||||
@@ -75,8 +74,9 @@ private:
|
||||
int m_sale;
|
||||
bool m_salePossible;
|
||||
AccService::ServiceType m_type;
|
||||
#pragma db not_null
|
||||
QWeakPointer<CampData> m_campData;
|
||||
CampDataPtr m_campData;
|
||||
};
|
||||
|
||||
QX_REGISTER_HPP_CAMP(ServiceItem, QObject, 0)
|
||||
|
||||
#endif // SREVICEITEM_H
|
||||
|
||||
@@ -40,10 +40,12 @@ DetailWidget::~DetailWidget()
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void DetailWidget::setData(const CampDataPtr &data)
|
||||
void DetailWidget::setData(CampDataPtr &data)
|
||||
{
|
||||
CampService srv;
|
||||
srv.loadItems(data);
|
||||
if (data->people().isEmpty() || data->services().isEmpty()) {
|
||||
CampService srv;
|
||||
srv.load(data);
|
||||
}
|
||||
|
||||
m_peopleModel->setData(data->people());
|
||||
m_servicesModel->setData(data->services());
|
||||
|
||||
+3
-3
@@ -14,10 +14,10 @@ class DetailWidget : public QWidget
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit DetailWidget(QWidget *parent = 0);
|
||||
~DetailWidget();
|
||||
explicit DetailWidget(QWidget *parent = nullptr);
|
||||
~DetailWidget() override;
|
||||
|
||||
void setData(const CampDataPtr &data);
|
||||
void setData(CampDataPtr &data);
|
||||
|
||||
private:
|
||||
Ui::DetailWidget *ui;
|
||||
|
||||
@@ -8,6 +8,8 @@ CampSettings::CampSettings(QObject *parent) : QObject(parent)
|
||||
m_rounding = Enums::R_MATH;
|
||||
m_decimalPlaces = 0;
|
||||
m_vatType = Enums::NONE;
|
||||
m_accFeeStartAge = 0;
|
||||
m_accFeeEndAge = 0;
|
||||
}
|
||||
|
||||
QDecDouble CampSettings::accFee() const
|
||||
|
||||
@@ -18,7 +18,7 @@ class CampSettings : public QObject
|
||||
Q_PROPERTY(QString accFeeText READ accFeeText WRITE setAccFeeText)
|
||||
|
||||
public:
|
||||
explicit CampSettings(QObject *parent = 0);
|
||||
explicit CampSettings(QObject *parent = nullptr);
|
||||
|
||||
QDecDouble accFee() const;
|
||||
void setAccFee(QDecDouble accFee);
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
#include "camp-odb.hxx"
|
||||
#include "campsettingsform.h"
|
||||
#include "ui_campsettingsform.h"
|
||||
|
||||
#include <settingsservice.h>
|
||||
#include <QScroller>
|
||||
#include <QMessageBox>
|
||||
#include <QHeaderView>
|
||||
|
||||
CampSettingsForm::CampSettingsForm(QWidget *parent) :
|
||||
FormBinder<CampSettings>(parent),
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#include <QList>
|
||||
|
||||
#include "campsettings.h"
|
||||
#include "data/camp-data.h"
|
||||
#include "../data/camp-data.h"
|
||||
#include <formbinder.h>
|
||||
#include <autotablemodel.h>
|
||||
|
||||
@@ -18,16 +18,16 @@ class CampSettingsForm : public FormBinder<CampSettings>
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit CampSettingsForm(QWidget *parent = 0);
|
||||
~CampSettingsForm();
|
||||
explicit CampSettingsForm(QWidget *parent = nullptr);
|
||||
~CampSettingsForm() override;
|
||||
|
||||
// IForm interface
|
||||
public slots:
|
||||
bool saveRecord();
|
||||
bool saveRecord() override;
|
||||
|
||||
// IForm interface
|
||||
public:
|
||||
void loadEntity();
|
||||
void loadEntity() override;
|
||||
|
||||
private slots:
|
||||
void on_btnPriceAdd_clicked();
|
||||
|
||||
Reference in New Issue
Block a user