Compare commits
114 Commits
print
...
30e6180c82
| Author | SHA1 | Date | |
|---|---|---|---|
| 30e6180c82 | |||
| ab20fe9b34 | |||
| ad9a66ab32 | |||
| 43e95eeb6f | |||
| 4f2380f3db | |||
| c8658ba77f | |||
| 32a836d3cf | |||
| bb5b136aea | |||
| 2f1250e61d | |||
| ee5130f719 | |||
| d5844ab73d | |||
| 65df276e7b | |||
| da9b062dbb | |||
| b113d5fca1 | |||
| dd39ebb5cb | |||
| 1c22eb3c0a | |||
| 6b4c20eccf | |||
| 0bca412d27 | |||
| 653f8eac30 | |||
| 22936f2a3f | |||
| 5794510bd2 | |||
| 34e1585327 | |||
| 0ddf8bce92 | |||
| fe3602fcfc | |||
| b69637165d | |||
| b8ed333c3a | |||
| 8e7137f3bb | |||
| 5ebea2f7c9 | |||
| 6f30949343 | |||
| 836521e533 | |||
| eff4190c99 | |||
| c7d7886d0e | |||
| 9efa6c52bb | |||
| b10f21ad3c | |||
| b56e58146a | |||
| c782d89c72 | |||
| 562268afa7 | |||
| 1df897e5c8 | |||
| b83e1ee56e | |||
| c17b3b6d92 | |||
| bce139d7cd | |||
| e724a3b234 | |||
| 50ac5238da | |||
| 5848bb5609 | |||
| 8406dc584f | |||
| 761fcad3b7 | |||
| a33992b9b9 | |||
| cc6111d09f | |||
| e5b33fa973 | |||
| cf937aee96 | |||
| 47e21a85d7 | |||
| 8b99eea25a | |||
| d163a92293 | |||
| 35696fbfea | |||
| fe53d90d50 | |||
| b916d626d1 | |||
| 27ec7282eb | |||
| f6bcb86aab | |||
| b397d9382d | |||
| 13d90445cc | |||
| 397ec82d06 | |||
| 33913c3b42 | |||
| 44c916cb68 | |||
| 1e785fd488 | |||
| 37b2dd7246 | |||
| c3598673c6 | |||
| 328352f91a | |||
| b0f129f38d | |||
| 9a087e1874 | |||
| b941acf9a0 | |||
| 87290d4be4 | |||
| d53fed72d8 | |||
| 6a042c46a1 | |||
| 9c30d416e0 | |||
| 09899d618c | |||
| 80c9d21576 | |||
| 0608e277e7 | |||
| 7cfeac3f81 | |||
| 22ec64e9f4 | |||
| 0fd0d53c0b | |||
| 1d393cf3fb | |||
| 3c588cd8cf | |||
| 123aefdab5 | |||
| cd4d58749a | |||
| d5ead1b187 | |||
| 4c00364698 | |||
| 87ec7098ff | |||
| 78c80199b2 | |||
| 50ecd60c9a | |||
| 0e803c23cb | |||
| 25c481f5f1 | |||
| a0f325708b | |||
| cb67b48138 | |||
| af9edeafae | |||
| dbbf4a0a67 | |||
| 39ab4b74e2 | |||
| f85b1c75d3 | |||
| 8a651871d0 | |||
| 6e2ee642ce | |||
| fc2ed29d25 | |||
| 8814a0e2a1 | |||
| fe5eac9cd9 | |||
| ace78877a3 | |||
| afb2218150 | |||
| da3aa2987c | |||
| 03fd0adf12 | |||
| 4b3a2e1dd7 | |||
| aa91acbe17 | |||
| de665f9659 | |||
| b0d67cf93a | |||
| 7aa00f1b1e | |||
| 31beac537b | |||
| ae95ae1bda | |||
| 21bb6696d6 |
@@ -8,7 +8,7 @@
|
||||
"default" : "",
|
||||
"CZ" : ""
|
||||
},
|
||||
"schemaVersion" : 1,
|
||||
"schemaVersion" : 2,
|
||||
"sql" : [
|
||||
"CREATE TABLE \"AddressbookData\" (
|
||||
\"id\" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
|
||||
@@ -21,10 +21,14 @@
|
||||
\"addressCity\" TEXT NULL,
|
||||
\"addressStreet\" TEXT NULL,
|
||||
\"addressHouseNumber\" TEXT NULL,
|
||||
\"addressZipCode\" TEXT NULL);"
|
||||
\"addressZipCode\" TEXT NULL);
|
||||
",
|
||||
|
||||
"ALTER TABLE AddressbookData ADD \"country\" INTEGER NULL;
|
||||
"
|
||||
|
||||
],
|
||||
"dependencies" : [],
|
||||
"dependencies" : [ "COUNTRYREGISTER" ],
|
||||
"translations" : {
|
||||
"CZ" : {
|
||||
"title" : "Titul",
|
||||
|
||||
@@ -32,6 +32,7 @@ include(../config_plugin.pri)
|
||||
|
||||
ODB_FILES = addressbook/data/addressbookdata.h
|
||||
H_DIR = $$PWD/data/*.h
|
||||
ODB_OTHER_INCLUDES = -I $$PWD/../countryregister/data
|
||||
include(../odb.pri)
|
||||
|
||||
OTHER_FILES += \
|
||||
@@ -43,3 +44,11 @@ FORMS += \
|
||||
RESOURCES += \
|
||||
addressbookrc.qrc
|
||||
TRANSLATIONS = translations/addressbook_cs_CZ.ts
|
||||
|
||||
win32:CONFIG(release, debug|release): LIBS += -L$$OUT_PWD/../plugins/ -lcountryregister
|
||||
else:win32:CONFIG(debug, debug|release): LIBS += -L$$OUT_PWD/../plugins/ -lcountryregister
|
||||
else:unix: LIBS += -L$$OUT_PWD/../plugins/ -lcountryregister
|
||||
|
||||
INCLUDEPATH += $$PWD/../countryregister/data
|
||||
INCLUDEPATH += $$PWD/../countryregister
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "addressbookform.h"
|
||||
#include "ui_addressbookform.h"
|
||||
#include <countrydata.h>
|
||||
|
||||
AddressbookForm::AddressbookForm(QWidget *parent) :
|
||||
AutoForm<AddressbookData>(parent),
|
||||
@@ -22,3 +23,9 @@ AddressbookForm::~AddressbookForm()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void AddressbookForm::registerCombos()
|
||||
{
|
||||
Service<CountryData> srv;
|
||||
registerBinding(ui->country, ComboData::createComboData(srv.all()));
|
||||
}
|
||||
|
||||
@@ -20,6 +20,10 @@ public:
|
||||
|
||||
private:
|
||||
Ui::AddressbookForm *ui;
|
||||
|
||||
// FormBinder interface
|
||||
protected:
|
||||
void registerCombos();
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
<width>610</width>
|
||||
<height>407</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@@ -115,8 +115,35 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="0">
|
||||
<widget class="QLabel" name="label_10">
|
||||
<property name="text">
|
||||
<string>Country</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="1">
|
||||
<widget class="QComboBox" name="country">
|
||||
<property name="editable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>title</tabstop>
|
||||
<tabstop>firstName</tabstop>
|
||||
<tabstop>lastName</tabstop>
|
||||
<tabstop>birthDate</tabstop>
|
||||
<tabstop>idCardNumber</tabstop>
|
||||
<tabstop>ztp</tabstop>
|
||||
<tabstop>addressCity</tabstop>
|
||||
<tabstop>addressStreet</tabstop>
|
||||
<tabstop>addressHouseNumber</tabstop>
|
||||
<tabstop>addressZipCode</tabstop>
|
||||
<tabstop>country</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
||||
@@ -10,9 +10,22 @@ AddressBookService::~AddressBookService()
|
||||
{
|
||||
}
|
||||
|
||||
QList<QSharedPointer<AddressbookData> > AddressBookService::all(const QString &where)
|
||||
AddressbookDataPtr AddressBookService::copyAddress(AddressbookDataPtr address)
|
||||
{
|
||||
Service<AddressbookData> srv;
|
||||
return srv.all(where);
|
||||
AddressbookDataPtr newAddress(new AddressbookData());
|
||||
|
||||
newAddress->setTitle(address->title());
|
||||
newAddress->setFirstName(address->firstName());
|
||||
newAddress->setLastName(address->lastName());
|
||||
newAddress->setBirthDate(address->birthDate());
|
||||
newAddress->setIdCardNumber(address->idCardNumber());
|
||||
newAddress->setZtp(address->ztp());
|
||||
newAddress->setAddressStreet(address->addressStreet());
|
||||
newAddress->setAddressHouseNumber(address->addressHouseNumber());
|
||||
newAddress->setAddressZipCode(address->addressZipCode());
|
||||
newAddress->setAddressCity(address->addressCity());
|
||||
newAddress->setCountry(address->country());
|
||||
|
||||
return newAddress;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,17 +3,18 @@
|
||||
|
||||
#include <QList>
|
||||
#include <QSharedPointer>
|
||||
#include <service.h>
|
||||
|
||||
#include "data/addressbookdata.h"
|
||||
#include "addressbook_global.h"
|
||||
|
||||
class ADDRESSBOOKSHARED_EXPORT AddressBookService
|
||||
class ADDRESSBOOKSHARED_EXPORT AddressBookService : public Service<AddressbookData>
|
||||
{
|
||||
public:
|
||||
AddressBookService();
|
||||
~AddressBookService();
|
||||
|
||||
QList<QSharedPointer<AddressbookData> > all(const QString &where = "");
|
||||
AddressbookDataPtr copyAddress(AddressbookDataPtr address);
|
||||
};
|
||||
|
||||
#endif // ADDRESSBOOKSERVICE_H
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
AddressbookData::AddressbookData(QObject * parent)
|
||||
:ComboItem(parent)
|
||||
{
|
||||
m_ztp = false;
|
||||
}
|
||||
|
||||
QString AddressbookData::title() const
|
||||
@@ -105,6 +106,19 @@ void AddressbookData::setId(int id)
|
||||
m_id = id;
|
||||
}
|
||||
|
||||
QSharedPointer<QObject> AddressbookData::country() const
|
||||
{
|
||||
return m_country;
|
||||
}
|
||||
|
||||
void AddressbookData::setCountry(const QSharedPointer<QObject> &country)
|
||||
{
|
||||
if (qobject_cast<CountryData*>(country.data()) != NULL)
|
||||
{
|
||||
m_country = qSharedPointerDynamicCast<CountryData, QObject>(country);
|
||||
}
|
||||
}
|
||||
|
||||
bool AddressbookData::eq(ComboItem *other)
|
||||
{
|
||||
AddressbookData *adb = qobject_cast<AddressbookData*>(other);
|
||||
@@ -113,7 +127,7 @@ bool AddressbookData::eq(ComboItem *other)
|
||||
|
||||
QString AddressbookData::toString()
|
||||
{
|
||||
return m_firstName + " " + m_lastName + ", " + m_addressStreet + " " + m_addressHouseNumber + ", " + m_addressCity;
|
||||
return m_lastName + " " + m_firstName + ", " + m_addressStreet + " " + m_addressHouseNumber + ", " + m_addressCity;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -6,8 +6,10 @@
|
||||
#include <QDate>
|
||||
#include <odb/core.hxx>
|
||||
#include <QtCore/qglobal.h>
|
||||
#include <QSharedPointer>
|
||||
|
||||
#include <data/comboitem.h>
|
||||
#include <countrydata.h>
|
||||
|
||||
#if defined(ADDRESSBOOK_LIBRARY)
|
||||
# define ADDRESSBOOKSHARED_EXPORT Q_DECL_EXPORT
|
||||
@@ -29,6 +31,7 @@ class ADDRESSBOOKSHARED_EXPORT AddressbookData : public ComboItem
|
||||
Q_PROPERTY(QString addressStreet READ addressStreet WRITE setAddressStreet)
|
||||
Q_PROPERTY(QString addressHouseNumber READ addressHouseNumber WRITE setAddressHouseNumber)
|
||||
Q_PROPERTY(QString addressZipCode READ addressZipCode WRITE setAddressZipCode)
|
||||
Q_PROPERTY(QSharedPointer<QObject> country READ country WRITE setCountry)
|
||||
|
||||
public:
|
||||
AddressbookData(QObject *parent = 0);
|
||||
@@ -65,6 +68,9 @@ public:
|
||||
int id() const;
|
||||
void setId(int id);
|
||||
|
||||
QSharedPointer<QObject> country() const;
|
||||
void setCountry(const QSharedPointer<QObject> &country);
|
||||
|
||||
private:
|
||||
friend class odb::access;
|
||||
#pragma db id auto
|
||||
@@ -79,6 +85,7 @@ private:
|
||||
QString m_addressStreet;
|
||||
QString m_addressHouseNumber;
|
||||
QString m_addressZipCode;
|
||||
CountryDataPtr m_country;
|
||||
|
||||
// ComboItem interface
|
||||
public:
|
||||
@@ -86,4 +93,6 @@ public:
|
||||
virtual QString toString();
|
||||
};
|
||||
|
||||
typedef QSharedPointer<AddressbookData> AddressbookDataPtr;
|
||||
|
||||
#endif // ADDRESSBOOKDATA_H
|
||||
|
||||
Binary file not shown.
@@ -58,5 +58,10 @@
|
||||
<source>ZIP</source>
|
||||
<translation>PSČ</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../addressbookform.ui" line="121"/>
|
||||
<source>Country</source>
|
||||
<translation>Stát</translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
#include "application.h"
|
||||
|
||||
Application::Application(int &argc, char **argv)
|
||||
:QApplication(argc, argv)
|
||||
{
|
||||
m_single = new QSharedMemory("ShredMemoryForOneInstanceOfProdejnaApp", this);
|
||||
}
|
||||
|
||||
Application::~Application()
|
||||
{
|
||||
if (m_single->isAttached())
|
||||
{
|
||||
m_single->detach();
|
||||
}
|
||||
}
|
||||
|
||||
bool Application::lock()
|
||||
{
|
||||
if (m_single->attach(QSharedMemory::ReadOnly))
|
||||
{
|
||||
m_single->detach();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (m_single->create(1))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
#ifndef APPLICATION_H
|
||||
#define APPLICATION_H
|
||||
|
||||
#include <QApplication>
|
||||
#include <QSharedMemory>
|
||||
|
||||
class Application : public QApplication
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
Application(int &argc, char **argv);
|
||||
~Application();
|
||||
|
||||
bool lock();
|
||||
|
||||
private:
|
||||
QSharedMemory *m_single;
|
||||
};
|
||||
|
||||
#endif // APPLICATION_H
|
||||
@@ -28,17 +28,41 @@ win32 {
|
||||
|
||||
SOURCES += main.cpp\
|
||||
mainwindow.cpp \
|
||||
logindialog.cpp
|
||||
logindialog.cpp \
|
||||
application.cpp
|
||||
|
||||
HEADERS += mainwindow.h \
|
||||
logindialog.h
|
||||
logindialog.h \
|
||||
application.h
|
||||
|
||||
FORMS += mainwindow.ui \
|
||||
logindialog.ui
|
||||
|
||||
|
||||
unix{
|
||||
ARCH_TYPE = unix
|
||||
macx{
|
||||
ARCH_TYPE = macx
|
||||
}
|
||||
linux{
|
||||
!contains(QT_ARCH, x86_64){
|
||||
ARCH_TYPE = linux32
|
||||
}else{
|
||||
ARCH_TYPE = linux64
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
unix {
|
||||
QMAKE_CXXFLAGS += -Wno-unknown-pragmas
|
||||
|
||||
CONFIG(debug, debug|release) {
|
||||
LIBS += -L$$PWD/../../LimeReport/build/$${QT_VERSION}/$${ARCH_TYPE}/debug/lib/ -llimereport -lQtZint
|
||||
#QMAKE_CXXFLAGS += -Wl,-rpath-link,$$PWD/../../LimeReport/build/$${QT_VERSION}/$${ARCH_TYPE}/debug/lib/
|
||||
} else {
|
||||
LIBS += -L$$PWD/../../LimeReport/build/$${QT_VERSION}/$${ARCH_TYPE}/release/lib/ -llimereport -lQtZint
|
||||
#QMAKE_CXXFLAGS += -Wl,-rpath-link,$$PWD/../../LimeReport/build/$${QT_VERSION}/$${ARCH_TYPE}/release/lib/
|
||||
}
|
||||
}
|
||||
|
||||
win32 {
|
||||
@@ -62,7 +86,7 @@ INCLUDEPATH += $$PWD/../qdecimal/decnumber
|
||||
RESOURCES += \
|
||||
appRc.qrc
|
||||
|
||||
TRANSLATIONS = translations/prodejna_cz.ts
|
||||
TRANSLATIONS = translations/prodejna_cs_CZ.ts
|
||||
|
||||
DISTFILES += \
|
||||
shop.rc
|
||||
|
||||
+26
-1
@@ -3,10 +3,35 @@
|
||||
#include <QDesktopWidget>
|
||||
#include <QTranslator>
|
||||
#include <QLibraryInfo>
|
||||
#include <QMessageBox>
|
||||
|
||||
#include "application.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <Windows.h>
|
||||
#endif
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QApplication a(argc, argv);
|
||||
Application a(argc, argv);
|
||||
|
||||
if (!a.lock())
|
||||
{
|
||||
QMessageBox::warning(NULL, "Prodejna is running", "Prodejna is allready running. Only one instance can be started.");
|
||||
return -42;
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
QString exePath = a.applicationDirPath();
|
||||
exePath = exePath.append("\\plugins");
|
||||
|
||||
wchar_t Path[10000];
|
||||
::GetEnvironmentVariable(L"PATH", Path, sizeof(Path) / sizeof(TCHAR));
|
||||
QString pathVar = QString::fromWCharArray(Path);
|
||||
QString newPath = exePath.append(";").append(pathVar);
|
||||
|
||||
::SetEnvironmentVariable(TEXT("PATH"), newPath.toStdWString().c_str());
|
||||
#endif
|
||||
|
||||
QTranslator qtTranslator;
|
||||
qtTranslator.load("qt_" + QLocale::system().name(),
|
||||
|
||||
+133
-19
@@ -19,6 +19,8 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
|
||||
m_loginDialog = new LoginDialog(this);
|
||||
|
||||
ui->tabWidget->setVisible(false);
|
||||
|
||||
QFile styleFile(":/style.css");
|
||||
|
||||
if (styleFile.open(QIODevice::ReadOnly | QIODevice::Text))
|
||||
@@ -29,9 +31,10 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
connect(m_loginDialog, &LoginDialog::accepted, [this]{
|
||||
PermissionService service;
|
||||
QSharedPointer<User> u = service.loadUser(m_loginDialog->login());
|
||||
m_lblUser->setText(u->name());
|
||||
m_loginDialog->reset();
|
||||
Context::instance().setCurrentUser(u);
|
||||
|
||||
openDashboard();
|
||||
m_loginDialog->reset();
|
||||
});
|
||||
|
||||
connect(m_loginDialog, &LoginDialog::rejected, [this]{
|
||||
@@ -42,7 +45,7 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
int i = 0;
|
||||
|
||||
foreach (IPlugin *plugin, Context::instance().plugins()) {
|
||||
if (plugin->pluginId() != "CORE")
|
||||
if (plugin->pluginId() != "CORE" && plugin->showIcon())
|
||||
{
|
||||
QToolButton *plugButton = new QToolButton(this);
|
||||
plugButton->setText(plugin->pluginName());
|
||||
@@ -81,26 +84,13 @@ void MainWindow::openPlugin()
|
||||
QVariant var = QObject::sender()->property(PLUGIN_INDEX);
|
||||
IPlugin *plugin = Context::instance().plugins().at(var.toInt());
|
||||
|
||||
for (int i = 0; i < ui->tabWidget->count(); i++) {
|
||||
if (ui->tabWidget->widget(i)->objectName() == plugin->pluginId()) {
|
||||
ui->tabWidget->setCurrentIndex(i);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (plugin->ui() != NULL)
|
||||
{
|
||||
ui->tabWidget->addTab(plugin->ui(), plugin->pluginIcon(), plugin->pluginName());
|
||||
ui->tabWidget->widget(ui->tabWidget->count() - 1)->setObjectName(plugin->pluginId());
|
||||
ui->tabWidget->setCurrentIndex(ui->tabWidget->count() - 1);
|
||||
}
|
||||
openPlugin(plugin);
|
||||
}
|
||||
|
||||
void MainWindow::on_actionOpen_database_triggered()
|
||||
{
|
||||
/*QFileDialog dialog(this);
|
||||
dialog.setNameFilter(tr("Database Files (*.db)"));
|
||||
dialog.setWindowTitle(tr("Open Database"));*/
|
||||
closaAllTabs();
|
||||
closeDashboard();
|
||||
|
||||
QString dbFile = QFileDialog::getOpenFileName(this, "Open Database", "", "Database Files (*.db)");
|
||||
if (!dbFile.isEmpty())
|
||||
@@ -114,10 +104,21 @@ void MainWindow::on_actionOpen_database_triggered()
|
||||
void MainWindow::on_tabWidget_tabCloseRequested(int index)
|
||||
{
|
||||
ui->tabWidget->removeTab(index);
|
||||
|
||||
if (ui->tabWidget->count() == 0)
|
||||
{
|
||||
ui->dashboard->setVisible(true);
|
||||
ui->tabWidget->setVisible(false);
|
||||
|
||||
refreshDashboard();
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::on_actionLogin_triggered()
|
||||
{
|
||||
closaAllTabs();
|
||||
closeDashboard();
|
||||
|
||||
QSharedPointer<User> u;
|
||||
Context::instance().setCurrentUser(u);
|
||||
m_lblUser->setText("");
|
||||
@@ -144,3 +145,116 @@ void MainWindow::on_actionSettings_triggered()
|
||||
SettingsForm *settings = new SettingsForm(this);
|
||||
settings->show();
|
||||
}
|
||||
|
||||
void MainWindow::on_actionPost_register_triggered()
|
||||
{
|
||||
IPlugin *plugZipCodes = Context::instance().plugin("POSTREGISTER");
|
||||
|
||||
if (plugZipCodes != NULL)
|
||||
{
|
||||
openPlugin(plugZipCodes);
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::openPlugin(IPlugin *plugin)
|
||||
{
|
||||
ui->tabWidget->setVisible(true);
|
||||
ui->dashboard->setVisible(false);
|
||||
|
||||
for (int i = 0; i < ui->tabWidget->count(); i++) {
|
||||
if (ui->tabWidget->widget(i)->objectName() == plugin->pluginId()) {
|
||||
ui->tabWidget->setCurrentIndex(i);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (plugin->ui() != NULL)
|
||||
{
|
||||
ui->tabWidget->addTab(plugin->ui(), plugin->pluginIcon(), plugin->pluginName());
|
||||
ui->tabWidget->widget(ui->tabWidget->count() - 1)->setObjectName(plugin->pluginId());
|
||||
ui->tabWidget->setCurrentIndex(ui->tabWidget->count() - 1);
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::on_actionCountry_register_triggered()
|
||||
{
|
||||
IPlugin *plugCountryReg = Context::instance().plugin("COUNTRYREGISTER");
|
||||
|
||||
if (plugCountryReg != NULL)
|
||||
{
|
||||
openPlugin(plugCountryReg);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void MainWindow::closeDashboard()
|
||||
{
|
||||
foreach (QFrame *dbFrame, m_dbWidgets) {
|
||||
dbFrame->setVisible(false);
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::openDashboard()
|
||||
{
|
||||
PermissionEvaluator permEv;
|
||||
|
||||
foreach (IPlugin *plugin, Context::instance().plugins()) {
|
||||
if (!plugin->dasboardWidgets().isEmpty()
|
||||
&& permEv.hasPermission(plugin->pluginId(), PERM_READ)) {
|
||||
foreach (QFrame *frame, plugin->dasboardWidgets()) {
|
||||
if (m_dbWidgets.contains(frame))
|
||||
{
|
||||
frame->setVisible(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->dbWidget->layout()->addWidget(frame);
|
||||
m_dbWidgets.append(frame);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!Context::instance().currentUser().isNull())
|
||||
{
|
||||
m_lblUser->setText(Context::instance().currentUser()->name());
|
||||
ui->labelUser->setText(Context::instance().currentUser()->name());
|
||||
}
|
||||
|
||||
refreshDashboard();
|
||||
}
|
||||
|
||||
void MainWindow::refreshDashboard()
|
||||
{
|
||||
foreach (QFrame *frame, m_dbWidgets) {
|
||||
IDashboardWidget *dbWidget = dynamic_cast<IDashboardWidget*>(frame);
|
||||
|
||||
if (dbWidget != nullptr)
|
||||
{
|
||||
dbWidget->refresh();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::closaAllTabs()
|
||||
{
|
||||
ui->tabWidget->setVisible(false);
|
||||
ui->dashboard->setVisible(true);
|
||||
|
||||
int tabCount = ui->tabWidget->count();
|
||||
for (int i = 0; i < tabCount; i++)
|
||||
{
|
||||
ui->tabWidget->removeTab(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::on_actionAbout_Qt_triggered()
|
||||
{
|
||||
QMessageBox::aboutQt(this);
|
||||
}
|
||||
|
||||
void MainWindow::on_actionAbout_triggered()
|
||||
{
|
||||
QMessageBox::about(this, tr("About prodejna"), tr("Modular cash register software under GPL license.\n(C) 2015 - 2017 Josef Rokos, Zdenek Jonák"));
|
||||
}
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
|
||||
#define PLUGIN_INDEX "plug_index"
|
||||
|
||||
class IPlugin;
|
||||
|
||||
namespace Ui {
|
||||
class MainWindow;
|
||||
}
|
||||
@@ -33,10 +35,25 @@ private slots:
|
||||
|
||||
void on_actionSettings_triggered();
|
||||
|
||||
void on_actionPost_register_triggered();
|
||||
|
||||
void on_actionCountry_register_triggered();
|
||||
|
||||
void on_actionAbout_Qt_triggered();
|
||||
|
||||
void on_actionAbout_triggered();
|
||||
|
||||
private:
|
||||
Ui::MainWindow *ui;
|
||||
LoginDialog *m_loginDialog;
|
||||
QLabel *m_lblUser;
|
||||
QList<QFrame*> m_dbWidgets;
|
||||
|
||||
void openPlugin(IPlugin *plugin);
|
||||
void closeDashboard();
|
||||
void openDashboard();
|
||||
void refreshDashboard();
|
||||
void closaAllTabs();
|
||||
|
||||
// QWidget interface
|
||||
protected:
|
||||
|
||||
+115
-2
@@ -11,7 +11,7 @@
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>MainWindow</string>
|
||||
<string>Prodejna</string>
|
||||
</property>
|
||||
<property name="windowIcon">
|
||||
<iconset resource="appRc.qrc">
|
||||
@@ -52,6 +52,83 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="dashboard" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QWidget" name="dbWidget" native="true">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QWidget" name="widget" native="true">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap resource="appRc.qrc">:/icons/login_32.png</pixmap>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="labelUser">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Prodejna 2.0</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QMenuBar" name="menuBar">
|
||||
@@ -60,7 +137,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1000</width>
|
||||
<height>19</height>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QMenu" name="menuFile">
|
||||
@@ -72,7 +149,23 @@
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionExit"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menuRegisters">
|
||||
<property name="title">
|
||||
<string>&Registers</string>
|
||||
</property>
|
||||
<addaction name="actionPost_register"/>
|
||||
<addaction name="actionCountry_register"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menuHelp">
|
||||
<property name="title">
|
||||
<string>Help</string>
|
||||
</property>
|
||||
<addaction name="actionAbout"/>
|
||||
<addaction name="actionAbout_Qt"/>
|
||||
</widget>
|
||||
<addaction name="menuFile"/>
|
||||
<addaction name="menuRegisters"/>
|
||||
<addaction name="menuHelp"/>
|
||||
</widget>
|
||||
<widget class="QToolBar" name="mainToolBar">
|
||||
<attribute name="toolBarArea">
|
||||
@@ -116,6 +209,26 @@
|
||||
<string>Settings</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionPost_register">
|
||||
<property name="text">
|
||||
<string>&Post register</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionCountry_register">
|
||||
<property name="text">
|
||||
<string>&Country register</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionAbout">
|
||||
<property name="text">
|
||||
<string>&About</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionAbout_Qt">
|
||||
<property name="text">
|
||||
<string>About &Qt</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<layoutdefault spacing="6" margin="11"/>
|
||||
<resources>
|
||||
|
||||
@@ -21,3 +21,7 @@
|
||||
min-width: 90px;
|
||||
font: 10pt;
|
||||
}
|
||||
|
||||
#dashboard {
|
||||
background-color: qlineargradient(spread:pad, x1:0.507, y1:1, x2:0.518, y2:0.291, stop:0 rgba(83, 145, 169, 255), stop:1 rgba(255, 255, 255, 255));
|
||||
}
|
||||
|
||||
Binary file not shown.
@@ -0,0 +1,131 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE TS>
|
||||
<TS version="2.1" language="cs_CZ">
|
||||
<context>
|
||||
<name>LoginDialog</name>
|
||||
<message>
|
||||
<location filename="../logindialog.ui" line="14"/>
|
||||
<location filename="../logindialog.ui" line="70"/>
|
||||
<source>Login</source>
|
||||
<translation>Login</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../logindialog.ui" line="80"/>
|
||||
<source>Password</source>
|
||||
<translation>Heslo</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>MainWindow</name>
|
||||
<message>
|
||||
<source>MainWindow</source>
|
||||
<translation type="vanished">Prodejna</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mainwindow.ui" line="14"/>
|
||||
<source>Prodejna</source>
|
||||
<translation></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mainwindow.ui" line="122"/>
|
||||
<source>Prodejna 2.0</source>
|
||||
<translation></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mainwindow.ui" line="145"/>
|
||||
<source>Fi&le</source>
|
||||
<translation>&Soubor</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mainwindow.ui" line="154"/>
|
||||
<source>&Registers</source>
|
||||
<translation>Číse&lníky</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mainwindow.ui" line="161"/>
|
||||
<source>Help</source>
|
||||
<translation>Pomoc</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mainwindow.ui" line="183"/>
|
||||
<source>&Exit</source>
|
||||
<translation>&Konec</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mainwindow.ui" line="188"/>
|
||||
<source>&Open database...</source>
|
||||
<translation>&Otevřít databázi...</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mainwindow.ui" line="197"/>
|
||||
<source>&Login...</source>
|
||||
<translation>&Přihlásit...</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mainwindow.ui" line="214"/>
|
||||
<source>&Post register</source>
|
||||
<translation>Čís&elník PSČ</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mainwindow.ui" line="219"/>
|
||||
<source>&Country register</source>
|
||||
<translation>Čísel&ník států</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mainwindow.ui" line="224"/>
|
||||
<source>&About</source>
|
||||
<translation>&O programu</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mainwindow.ui" line="229"/>
|
||||
<source>About &Qt</source>
|
||||
<translation>O knihovně &Qt</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>About</source>
|
||||
<translation type="vanished">O aplikaci</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>About Qt</source>
|
||||
<translation type="vanished">O QT</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Post register</source>
|
||||
<translation type="vanished">Číselník adres</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>File</source>
|
||||
<translation type="vanished">Soubor</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Exit</source>
|
||||
<translation type="vanished">Konec</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Open database...</source>
|
||||
<translation type="vanished">Otevřít databázi...</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Login...</source>
|
||||
<translation type="vanished">Přihlásit se...</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mainwindow.ui" line="206"/>
|
||||
<location filename="../mainwindow.ui" line="209"/>
|
||||
<source>Settings</source>
|
||||
<translation>Nastavení</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mainwindow.cpp" line="259"/>
|
||||
<source>About prodejna</source>
|
||||
<translation>O aplikaci prodejna</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mainwindow.cpp" line="259"/>
|
||||
<source>Modular cash register software under GPL license.
|
||||
(C) 2015 - 2017 Josef Rokos, Zdenek Jonák</source>
|
||||
<translation>Modulární pokladní aplikace pod GPL license.
|
||||
(C) 2015 - 2017 Josef Rokos, Zdenek Jonák</translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
||||
Binary file not shown.
@@ -1,68 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE TS>
|
||||
<TS version="2.1" language="cs_CZ">
|
||||
<context>
|
||||
<name>LoginDialog</name>
|
||||
<message>
|
||||
<location filename="../logindialog.ui" line="14"/>
|
||||
<location filename="../logindialog.ui" line="70"/>
|
||||
<source>Login</source>
|
||||
<translation>Login</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../logindialog.ui" line="80"/>
|
||||
<source>Password</source>
|
||||
<translation>Heslo</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>MainWindow</name>
|
||||
<message>
|
||||
<location filename="../mainwindow.ui" line="14"/>
|
||||
<source>MainWindow</source>
|
||||
<translation>Prodejna</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mainwindow.ui" line="68"/>
|
||||
<source>Fi&le</source>
|
||||
<translation>&Soubor</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mainwindow.ui" line="90"/>
|
||||
<source>&Exit</source>
|
||||
<translation>&Konec</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mainwindow.ui" line="95"/>
|
||||
<source>&Open database...</source>
|
||||
<translation>&Otevřít databázi...</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mainwindow.ui" line="104"/>
|
||||
<source>&Login...</source>
|
||||
<translation>&Přihlásit...</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>File</source>
|
||||
<translation type="vanished">Soubor</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Exit</source>
|
||||
<translation type="vanished">Konec</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Open database...</source>
|
||||
<translation type="vanished">Otevřít databázi...</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Login...</source>
|
||||
<translation type="vanished">Přihlásit se...</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mainwindow.ui" line="113"/>
|
||||
<location filename="../mainwindow.ui" line="116"/>
|
||||
<source>Settings</source>
|
||||
<translation>Nastavení</translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
||||
@@ -0,0 +1,27 @@
|
||||
#include "addservicedialog.h"
|
||||
#include "ui_addservicedialog.h"
|
||||
|
||||
AddServiceDialog::AddServiceDialog(AccServicePtr service, QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::AddServiceDialog)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
ui->editName->setText(service->accServiceName());
|
||||
ui->editPrice->setValue(service->price().toDouble());
|
||||
}
|
||||
|
||||
AddServiceDialog::~AddServiceDialog()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
QString AddServiceDialog::description()
|
||||
{
|
||||
return ui->editDescription->text();
|
||||
}
|
||||
|
||||
QDecDouble AddServiceDialog::price()
|
||||
{
|
||||
return QDecDouble(ui->editPrice->value());
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
#ifndef ADDSERVICEDIALOG_H
|
||||
#define ADDSERVICEDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
#include <QDecDouble.hh>
|
||||
#include <data/accservice.h>
|
||||
|
||||
namespace Ui {
|
||||
class AddServiceDialog;
|
||||
}
|
||||
|
||||
class AddServiceDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit AddServiceDialog(AccServicePtr service, QWidget *parent = 0);
|
||||
~AddServiceDialog();
|
||||
|
||||
QString description();
|
||||
QDecDouble price();
|
||||
|
||||
private:
|
||||
Ui::AddServiceDialog *ui;
|
||||
};
|
||||
|
||||
#endif // ADDSERVICEDIALOG_H
|
||||
@@ -0,0 +1,105 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>AddServiceDialog</class>
|
||||
<widget class="QDialog" name="AddServiceDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>143</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Dialog</string>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Service name</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="editName">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0" colspan="2">
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="editDescription"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Description</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QDoubleSpinBox" name="editPrice">
|
||||
<property name="buttonSymbols">
|
||||
<enum>QAbstractSpinBox::NoButtons</enum>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>999999.989999999990687</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Price</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>AddServiceDialog</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>248</x>
|
||||
<y>254</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>AddServiceDialog</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>316</x>
|
||||
<y>260</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
||||
@@ -0,0 +1,33 @@
|
||||
#include "camp.h"
|
||||
|
||||
#include "campgrid.h"
|
||||
#include "campform.h"
|
||||
#include "campservice.h"
|
||||
#include "settings/campsettingsform.h"
|
||||
|
||||
Camp::Camp()
|
||||
{
|
||||
}
|
||||
|
||||
void Camp::initServiceUi()
|
||||
{
|
||||
m_service = new CampService();
|
||||
m_ui = new CampGrid();
|
||||
((CampGrid*)m_ui)->setForm(new CampForm());
|
||||
m_settingsUi = new CampSettingsForm();
|
||||
}
|
||||
|
||||
QIcon Camp::pluginIcon()
|
||||
{
|
||||
return QIcon(":/icons/campPlugin.svg");
|
||||
}
|
||||
|
||||
QTranslator *Camp::translator()
|
||||
{
|
||||
return translatorFrom(":/translations/camp_");
|
||||
}
|
||||
|
||||
bool Camp::hasNumberSeries()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
#ifndef CAMP_H
|
||||
#define CAMP_H
|
||||
|
||||
#include "camp_global.h"
|
||||
#include <core.h>
|
||||
#include <QObject>
|
||||
#include <QtPlugin>
|
||||
|
||||
class CAMPSHARED_EXPORT Camp : public QObject, IMetaDataPlugin
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
Q_PLUGIN_METADATA(IID PluginInterface_iid FILE "camp.json")
|
||||
Q_INTERFACES(IPlugin)
|
||||
|
||||
public:
|
||||
Camp();
|
||||
|
||||
protected:
|
||||
void initServiceUi() Q_DECL_OVERRIDE;
|
||||
|
||||
// IPlugin interface
|
||||
public:
|
||||
virtual QIcon pluginIcon();
|
||||
QTranslator *translator();
|
||||
bool hasNumberSeries();
|
||||
};
|
||||
|
||||
#endif // CAMP_H
|
||||
+146
@@ -0,0 +1,146 @@
|
||||
{
|
||||
"id" : "CAMP",
|
||||
"name" : {
|
||||
"default" : "Camp",
|
||||
"CZ" : "Kemp"
|
||||
},
|
||||
"descriptoin" : {
|
||||
"default" : "",
|
||||
"CZ" : ""
|
||||
},
|
||||
"schemaVersion" : 8,
|
||||
"sql" : [
|
||||
"CREATE TABLE \"CampData\" (
|
||||
\"id\" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
|
||||
\"numSer\" TEXT NULL,
|
||||
\"start\" TEXT NULL,
|
||||
\"end\" TEXT NULL,
|
||||
\"ownerFirstame\" TEXT NULL,
|
||||
\"ownerLastname\" TEXT NULL,
|
||||
\"ownerAddress\" TEXT NULL,
|
||||
\"totalPrice\" INTEGER NOT NULL,
|
||||
\"sale\" INTEGER NOT NULL,
|
||||
\"fixedSale\" INTEGER NOT NULL,
|
||||
\"season\" INTEGER NULL,
|
||||
CONSTRAINT \"season_fk\"
|
||||
FOREIGN KEY (\"season\")
|
||||
REFERENCES \"Season\" (\"id\")
|
||||
DEFERRABLE INITIALLY DEFERRED);
|
||||
|
||||
CREATE TABLE \"AddressItem\" (
|
||||
\"id\" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
|
||||
\"firstName\" TEXT NULL,
|
||||
\"lastName\" TEXT NULL,
|
||||
\"address\" TEXT NULL,
|
||||
\"adbItem\" INTEGER NULL,
|
||||
\"price\" INTEGER NOT NULL,
|
||||
\"campData\" INTEGER NOT NULL,
|
||||
\"personPrice\" INTEGER NULL,
|
||||
CONSTRAINT \"adbItem_fk\"
|
||||
FOREIGN KEY (\"adbItem\")
|
||||
REFERENCES \"AddressbookData\" (\"id\")
|
||||
DEFERRABLE INITIALLY DEFERRED,
|
||||
CONSTRAINT \"campData_fk\"
|
||||
FOREIGN KEY (\"campData\")
|
||||
REFERENCES \"CampData\" (\"id\")
|
||||
DEFERRABLE INITIALLY DEFERRED,
|
||||
CONSTRAINT \"personPrice_fk\"
|
||||
FOREIGN KEY (\"personPrice\")
|
||||
REFERENCES \"PersonPrice\" (\"id\")
|
||||
DEFERRABLE INITIALLY DEFERRED);
|
||||
|
||||
CREATE TABLE \"ServiceItem\" (
|
||||
\"id\" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
|
||||
\"name\" TEXT NULL,
|
||||
\"code\" TEXT NULL,
|
||||
\"price\" INTEGER NOT NULL,
|
||||
\"salePossible\" INTEGER NOT NULL,
|
||||
\"type\" INTEGER NOT NULL,
|
||||
\"campData\" INTEGER NOT NULL,
|
||||
CONSTRAINT \"campData_fk\"
|
||||
FOREIGN KEY (\"campData\")
|
||||
REFERENCES \"CampData\" (\"id\")
|
||||
DEFERRABLE INITIALLY DEFERRED);
|
||||
|
||||
CREATE TABLE \"Sale\" (
|
||||
\"id\" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
|
||||
\"sale\" INTEGER NOT NULL,
|
||||
\"fixed\" INTEGER NOT NULL);
|
||||
|
||||
CREATE TABLE \"PersonPrice\" (
|
||||
\"id\" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
|
||||
\"description\" TEXT NULL,
|
||||
\"fromAge\" INTEGER NOT NULL,
|
||||
\"toAge\" INTEGER NOT NULL,
|
||||
\"price\" INTEGER NOT NULL,
|
||||
\"active\" INTEGER NOT NULL);
|
||||
",
|
||||
|
||||
"ALTER TABLE Sale ADD \"description\" TEXT NULL;
|
||||
",
|
||||
|
||||
"ALTER TABLE AddressItem ADD \"owner\" INTEGER NULL;
|
||||
",
|
||||
|
||||
"ALTER TABLE ServiceItem ADD \"sale\" INTEGER NULL;
|
||||
ALTER TABLE ServiceItem ADD \"description\" TEXT NULL;
|
||||
",
|
||||
|
||||
"ALTER TABLE ServiceItem ADD \"totalPrice\" INTEGER NULL;
|
||||
ALTER TABLE ServiceItem ADD \"fullPrice\" INTEGER NULL;
|
||||
ALTER TABLE CampData ADD \"fullPrice\" INTEGER NULL;
|
||||
ALTER TABLE CampData ADD \"totalSale\" INTEGER NULL;
|
||||
",
|
||||
|
||||
"ALTER TABLE CampData ADD \"onVoucher\" INTEGER NULL;
|
||||
",
|
||||
|
||||
"ALTER TABLE AddressItem ADD \"sale\" INTEGER NULL;
|
||||
ALTER TABLE AddressItem ADD \"totalPrice\" INTEGER NULL;
|
||||
",
|
||||
|
||||
"ALTER TABLE CampData ADD \"createdBy\" TEXT NULL;
|
||||
ALTER TABLE CampData ADD \"created\" TEXT NULL;
|
||||
ALTER TABLE CampData ADD \"updatedBy\" TEXT NULL;
|
||||
ALTER TABLE CampData ADD \"updated\" TEXT NULL;
|
||||
"
|
||||
],
|
||||
"dependencies" : [ "ADDRESSBOOK", "SHOP", "SERVICES" ],
|
||||
"translations" : {
|
||||
"CZ" : {
|
||||
"numSer" : "Číslo",
|
||||
"start" : "Od",
|
||||
"end" : "Do",
|
||||
"owner" : "Plátce",
|
||||
"ownerFirstame" : "Křestní jméno plátce",
|
||||
"ownerLastname" : "Příjmení plátce",
|
||||
"ownerAddress" : "Adresa plátce",
|
||||
"totalPrice" : "Cena celkem",
|
||||
"fullPrice" : "Plná cena",
|
||||
"sale" : "Sleva",
|
||||
"fixedSale" : "Pevná částka",
|
||||
"season" : "Sezona",
|
||||
"firstName" : "Křestní jméno",
|
||||
"lastName" : "Příjmení",
|
||||
"address" : "Adresa",
|
||||
"price" : "Cena",
|
||||
"name" : "Název",
|
||||
"code" : "Kód",
|
||||
"salePossible" : "Umožnit slevu",
|
||||
"type" : "Druh",
|
||||
"fixed" : "Pevná",
|
||||
"description" : "Popis",
|
||||
"fromAge" : "Od věku",
|
||||
"toAge" : "Do věku",
|
||||
"active" : "Aktivní",
|
||||
"totalSale" : "Sleva celkem",
|
||||
"accServiceName" : "Název",
|
||||
"onVoucher" : "Na účtence"
|
||||
}
|
||||
},
|
||||
|
||||
"reports" : [
|
||||
{ "name" : "Doklad", "description" : "Doklad k ubytování", "listReport" : false, "file" : "camp_accommodation_document.lrxml" },
|
||||
{ "name" : "Doklad jedna strana anglicky", "description" : "Doklad k ubytování jedna strana anglicky", "listReport" : false, "file" : "camp_accommodation_document_en.lrxml" }
|
||||
]
|
||||
}
|
||||
+110
@@ -0,0 +1,110 @@
|
||||
#-------------------------------------------------
|
||||
#
|
||||
# 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
|
||||
@@ -0,0 +1,12 @@
|
||||
#ifndef CAMP_GLOBAL_H
|
||||
#define CAMP_GLOBAL_H
|
||||
|
||||
#include <QtCore/qglobal.h>
|
||||
|
||||
#if defined(CAMP_LIBRARY)
|
||||
# define CAMPSHARED_EXPORT Q_DECL_EXPORT
|
||||
#else
|
||||
# define CAMPSHARED_EXPORT Q_DECL_IMPORT
|
||||
#endif
|
||||
|
||||
#endif // CAMP_GLOBAL_H
|
||||
@@ -0,0 +1,14 @@
|
||||
#include "campform.h"
|
||||
#include "ui_campform.h"
|
||||
|
||||
CampForm::CampForm(QWidget *parent) :
|
||||
AutoForm<CampData>(parent),
|
||||
ui(new Ui::CampForm)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
}
|
||||
|
||||
CampForm::~CampForm()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
#ifndef CAMPFORM_H
|
||||
#define CAMPFORM_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <core.h>
|
||||
#include "data/camp-data.h"
|
||||
#include "camp-odb.hxx"
|
||||
|
||||
namespace Ui {
|
||||
class CampForm;
|
||||
}
|
||||
|
||||
class CampForm : public AutoForm<CampData>
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit CampForm(QWidget *parent = 0);
|
||||
~CampForm();
|
||||
|
||||
private:
|
||||
Ui::CampForm *ui;
|
||||
};
|
||||
|
||||
#endif // CAMPFORM_H
|
||||
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>CampForm</class>
|
||||
<widget class="QWidget" name="CampForm">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>462</width>
|
||||
<height>403</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
@@ -0,0 +1,162 @@
|
||||
#include "campgrid.h"
|
||||
#include "campwizard.h"
|
||||
#include "campservice.h"
|
||||
#include "campshopitem.h"
|
||||
|
||||
#include <data/shop-data.h>
|
||||
#include <shopservice.h>
|
||||
#include <paydialog.h>
|
||||
|
||||
CampGrid::CampGrid(QWidget *parent) : GridForm<CampData>(parent)
|
||||
{
|
||||
setTableModel(new AutoTableModel<CampData>);
|
||||
|
||||
QHBoxLayout *tbLayout = qobject_cast<QHBoxLayout*>(this->toolbar()->layout());
|
||||
|
||||
if (tbLayout != NULL)
|
||||
{
|
||||
QToolButton *btnImport = new QToolButton(this->toolbar());
|
||||
btnImport->setIcon(QIcon(":/icons/pay.svg"));
|
||||
btnImport->setAutoRaise(true);
|
||||
btnImport->setIconSize(QSize(24, 24));
|
||||
btnImport->setToolTip(tr("Pay"));
|
||||
tbLayout->insertWidget(tbLayout->count() - 1, btnImport);
|
||||
|
||||
connect(btnImport, &QToolButton::clicked, [this](){
|
||||
CampDataPtr data = currentEntity();
|
||||
|
||||
if (!data.isNull())
|
||||
{
|
||||
addToVoucher(data);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
m_detail = new DetailWidget(this);
|
||||
mainLayout()->addWidget(m_detail);
|
||||
}
|
||||
|
||||
void CampGrid::handleNewRecord()
|
||||
{
|
||||
if (!checkPermAdd())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
CampService srv;
|
||||
CampDataPtr data = srv.create();
|
||||
CampWizard *wizard = new CampWizard();
|
||||
wizard->setAttribute(Qt::WA_DeleteOnClose);
|
||||
wizard->setData(data);
|
||||
wizard->setNewRecord(true);
|
||||
|
||||
connect(wizard, &QDialog::accepted, [this, data](){
|
||||
addRow(data);
|
||||
});
|
||||
|
||||
wizard->show();
|
||||
}
|
||||
|
||||
void CampGrid::handleEditRecord()
|
||||
{
|
||||
if (!checkPermEdit())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
CampDataPtr data = currentEntity();
|
||||
if (data.isNull())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (data->onVoucher())
|
||||
{
|
||||
QMessageBox::critical(this, tr("Can not edit"), tr("This record is asociated with voucher. Can not edit paid items"));
|
||||
return;
|
||||
}
|
||||
|
||||
CampService srv;
|
||||
srv.loadItems(data);
|
||||
|
||||
CampWizard *wizard = new CampWizard();
|
||||
wizard->setAttribute(Qt::WA_DeleteOnClose);
|
||||
wizard->setData(data);
|
||||
wizard->show();
|
||||
}
|
||||
|
||||
void CampGrid::doDelete(CampDataPtr entity)
|
||||
{
|
||||
if (!checkPermDelete())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (entity->onVoucher())
|
||||
{
|
||||
QMessageBox::critical(this, tr("Can not delete"), tr("This record is asociated with voucher. Can not delete paid items"));
|
||||
return;
|
||||
}
|
||||
|
||||
CampService srv;
|
||||
srv.eraseCamp(entity);
|
||||
}
|
||||
|
||||
void CampGrid::addToVoucher(CampDataPtr data)
|
||||
{
|
||||
if (data->onVoucher())
|
||||
{
|
||||
QMessageBox::information(this, tr("Can not pay"), tr("This record is already paid"));
|
||||
return;
|
||||
}
|
||||
|
||||
SettingsService settSrv("CAMP");
|
||||
CampSettingsPtr settings = settSrv.loadSettings<CampSettings>();
|
||||
CampShopItemPtr campItem(new CampShopItem);
|
||||
|
||||
campItem->setId(data->id());
|
||||
campItem->setUnitPrice(data->totalPrice());
|
||||
campItem->setVatType(settings->vatType());
|
||||
|
||||
ShopService shopSrv;
|
||||
VoucherPtr voucher = shopSrv.createVoucher();
|
||||
|
||||
shopSrv.addShopItem(voucher, campItem, 1);
|
||||
shopSrv.calculate(voucher);
|
||||
shopSrv.saveVoucher(voucher);
|
||||
|
||||
data->setOnVoucher(true);
|
||||
|
||||
CampService srvCamp;
|
||||
srvCamp.update(data);
|
||||
|
||||
PayDialog *payDlg = new PayDialog(voucher->totalPrice(), this);
|
||||
payDlg->setAttribute(Qt::WA_DeleteOnClose);
|
||||
payDlg->show();
|
||||
|
||||
connect(payDlg, &QDialog::accepted, [payDlg, voucher](){
|
||||
payVoucherFromUI(voucher, payDlg);
|
||||
});
|
||||
|
||||
connect(payDlg, &QDialog::rejected, [voucher, &shopSrv, data](){
|
||||
CampService srvCamp;
|
||||
data->setOnVoucher(false);
|
||||
srvCamp.update(data);
|
||||
voucher->clearItems();
|
||||
shopSrv.eraseVoucher(voucher);
|
||||
});
|
||||
}
|
||||
|
||||
void CampGrid::currentIndexChanged(const QModelIndex ¤t)
|
||||
{
|
||||
if (current.isValid())
|
||||
{
|
||||
m_detail->setData(currentEntity());
|
||||
}
|
||||
}
|
||||
|
||||
QList<CampDataPtr> CampGrid::listForGrid()
|
||||
{
|
||||
CampService srv;
|
||||
return srv.allForSeason();
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
#ifndef CAMPGRID_H
|
||||
#define CAMPGRID_H
|
||||
|
||||
#include <core.h>
|
||||
#include "data/camp-data.h"
|
||||
#include "camp-odb.hxx"
|
||||
|
||||
#include "detailwidget.h"
|
||||
|
||||
class CampGrid : public GridForm<CampData>
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
CampGrid(QWidget *parent = NULL);
|
||||
|
||||
// IGridForm interface
|
||||
protected:
|
||||
void handleNewRecord();
|
||||
void handleEditRecord();
|
||||
|
||||
// GridForm interface
|
||||
protected:
|
||||
void doDelete(CampDataPtr entity);
|
||||
|
||||
private:
|
||||
void addToVoucher(CampDataPtr data);
|
||||
DetailWidget *m_detail;
|
||||
|
||||
|
||||
// IGridForm interface
|
||||
protected:
|
||||
void currentIndexChanged(const QModelIndex ¤t);
|
||||
|
||||
// GridForm interface
|
||||
protected:
|
||||
virtual QList<CampDataPtr> listForGrid() override;
|
||||
};
|
||||
|
||||
#endif // CAMPGRID_H
|
||||
@@ -0,0 +1,6 @@
|
||||
<RCC>
|
||||
<qresource prefix="/">
|
||||
<file>icons/campPlugin.svg</file>
|
||||
<file>translations/camp_cs_CZ.qm</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
@@ -0,0 +1,35 @@
|
||||
#include "campseller.h"
|
||||
|
||||
#include "campwizard.h"
|
||||
#include "campservice.h"
|
||||
#include "data/camp-data.h"
|
||||
#include "campshopitem.h"
|
||||
|
||||
CampSeller::CampSeller(QObject *parent)
|
||||
:ISeller(parent)
|
||||
{
|
||||
}
|
||||
|
||||
void CampSeller::prepareItem()
|
||||
{
|
||||
CampWizard *wizard = new CampWizard();
|
||||
wizard->setAttribute(Qt::WA_DeleteOnClose);
|
||||
|
||||
CampService srv;
|
||||
CampDataPtr data = srv.create();
|
||||
wizard->setData(data);
|
||||
wizard->setNewRecord(true);
|
||||
wizard->show();
|
||||
|
||||
connect(wizard, &QDialog::accepted, [this, data](){
|
||||
SettingsService settSrv("CAMP");
|
||||
CampSettingsPtr settings = settSrv.loadSettings<CampSettings>();
|
||||
CampShopItemPtr item(new CampShopItem);
|
||||
|
||||
item->setUnitPrice(data->totalPrice());
|
||||
item->setId(data->id());
|
||||
item->setVatType(settings->vatType());
|
||||
|
||||
emit itemPrepared(item, 1);
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
#ifndef CAMPSELLER_H
|
||||
#define CAMPSELLER_H
|
||||
|
||||
#include <iseller.h>
|
||||
|
||||
class CampSeller : public ISeller
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit CampSeller(QObject *parent = 0);
|
||||
|
||||
// ISeller interface
|
||||
public:
|
||||
void prepareItem();
|
||||
};
|
||||
|
||||
#endif // CAMPSELLER_H
|
||||
@@ -0,0 +1,436 @@
|
||||
#include "campservice.h"
|
||||
#include <settingsservice.h>
|
||||
#include <seasonservice.h>
|
||||
#include <numberseriesservice.h>
|
||||
#include "campshopitem.h"
|
||||
#include "campseller.h"
|
||||
#include <math.h>
|
||||
|
||||
#ifdef _WIN32
|
||||
double round(double value) { return value < 0 ? -std::floor(0.5 - value) : std::floor(0.5 + value); }
|
||||
#endif
|
||||
|
||||
CampService::CampService()
|
||||
{
|
||||
m_pluginId = "CAMP";
|
||||
m_seller = new CampSeller(this);
|
||||
}
|
||||
|
||||
void CampService::addPerson(CampDataPtr data, AddressbookDataPtr address)
|
||||
{
|
||||
AddressItemPtr addrItem(new AddressItem);
|
||||
|
||||
addrItem->setAdbItem(address);
|
||||
addrItem->setAddress(address->toString());
|
||||
addrItem->setFirstName(address->firstName());
|
||||
addrItem->setLastName(address->lastName());
|
||||
addrItem->setCampData(data);
|
||||
|
||||
if (data->people().isEmpty())
|
||||
{
|
||||
setOwner(data, addrItem);
|
||||
}
|
||||
|
||||
data->addPerson(addrItem);
|
||||
}
|
||||
|
||||
void CampService::addService(CampDataPtr data, AccServicePtr service)
|
||||
{
|
||||
ServiceItemPtr serviceItem(new ServiceItem);
|
||||
|
||||
serviceItem->setName(service->accServiceName());
|
||||
serviceItem->setCode(service->accServiceCode());
|
||||
serviceItem->setPrice(service->price());
|
||||
serviceItem->setSalePossible(service->salePossible());
|
||||
serviceItem->setType(service->serviceType());
|
||||
|
||||
data->addServiceItem(serviceItem);
|
||||
}
|
||||
|
||||
void CampService::addService(CampDataPtr data, AccServicePtr service, QDecDouble price, QString description)
|
||||
{
|
||||
ServiceItemPtr item = addServiceInt(data, service);
|
||||
item->setPrice(price);
|
||||
item->setDescription(description);
|
||||
}
|
||||
|
||||
void CampService::setOwner(CampDataPtr data, AddressItemPtr person)
|
||||
{
|
||||
foreach (AddressItemPtr p, data->people()) {
|
||||
p->setOwner(false);
|
||||
}
|
||||
|
||||
person->setOwner(true);
|
||||
|
||||
data->setOwnerFirstame(person->firstName());
|
||||
data->setOwnerLastname(person->lastName());
|
||||
data->setOwnerAddress(person->address());
|
||||
}
|
||||
|
||||
CampDataPtr CampService::create()
|
||||
{
|
||||
CampDataPtr data(new CampData);
|
||||
data->setStart(QDate::currentDate());
|
||||
data->setEnd(QDate::currentDate());
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
void CampService::calculate(CampDataPtr data)
|
||||
{
|
||||
SettingsService srv("CAMP");
|
||||
m_settings = srv.loadSettings<CampSettings>();
|
||||
|
||||
calcServices(data);
|
||||
calcPeople(data);
|
||||
calcPrice(data);
|
||||
}
|
||||
|
||||
void CampService::saveCamp(CampDataPtr data)
|
||||
{
|
||||
if (!checkPermission(PERM_ADD))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
SeasonService seasonSrv;
|
||||
SeasonPtr season = seasonSrv.active();
|
||||
data->setSeason(season);
|
||||
|
||||
Transaction tr;
|
||||
try
|
||||
{
|
||||
odb::database *db = Context::instance().db();
|
||||
|
||||
NumberSeriesService numSrv;
|
||||
data->setNumSer(numSrv.nextStrForPlugin("CAMP"));
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
void CampService::updateCamp(CampDataPtr data)
|
||||
{
|
||||
if (!checkPermission(PERM_EDIT))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Transaction tr;
|
||||
|
||||
try
|
||||
{
|
||||
odb::database *db = Context::instance().db();
|
||||
|
||||
db->execute(QString("DELETE FROM ServiceItem WHERE campData = %1").arg(data->id()).toStdString());
|
||||
db->execute(QString("DELETE FROM AddressItem WHERE campData = %1").arg(data->id()).toStdString());
|
||||
|
||||
foreach (ServiceItemPtr item, data->services()) {
|
||||
item->setCampData(data.toWeakRef());
|
||||
db->persist(item);
|
||||
}
|
||||
|
||||
foreach (AddressItemPtr item, data->people()) {
|
||||
item->setCampData(data.toWeakRef());
|
||||
db->persist(item);
|
||||
}
|
||||
|
||||
addDateAndUser(data, false);
|
||||
|
||||
db->update(data);
|
||||
tr.commit();
|
||||
}
|
||||
catch (const odb::exception &ex)
|
||||
{
|
||||
emit dbError(ex.what());
|
||||
emit dbErrorUpdate(ex.what());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void CampService::eraseCamp(CampDataPtr data)
|
||||
{
|
||||
if (!checkPermission(PERM_DELETE))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Transaction tr;
|
||||
|
||||
try
|
||||
{
|
||||
odb::database *db = Context::instance().db();
|
||||
|
||||
db->execute(QString("DELETE FROM ServiceItem WHERE campData = %1").arg(data->id()).toStdString());
|
||||
db->execute(QString("DELETE FROM AddressItem WHERE campData = %1").arg(data->id()).toStdString());
|
||||
|
||||
db->erase(data);
|
||||
tr.commit();
|
||||
}
|
||||
catch (const odb::exception &ex)
|
||||
{
|
||||
emit dbError(ex.what());
|
||||
emit dbErrorDelete(ex.what());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
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()
|
||||
{
|
||||
SeasonService seasonSrv;
|
||||
SeasonPtr season = seasonSrv.active();
|
||||
|
||||
return all(QString("season = %1").arg(QString::number(season->id())));
|
||||
}
|
||||
|
||||
void CampService::calcPeople(CampDataPtr data)
|
||||
{
|
||||
foreach (ServiceItemPtr service, data->services()) {
|
||||
if (service->type() == AccService::ACCFEE)
|
||||
{
|
||||
data->removeServiceItem(service);
|
||||
}
|
||||
}
|
||||
|
||||
Service<PersonPrice> srvPrices;
|
||||
QList<PersonPricePtr> prices = srvPrices.all("active = 1");
|
||||
int days = data->start().daysTo(data->end());
|
||||
QDecDouble sale = data->sale();
|
||||
bool fixedSale = data->fixedSale();
|
||||
|
||||
foreach (AddressItemPtr item, data->people()) {
|
||||
QDate first(1,1,1);
|
||||
qint64 daysStart = item->adbItem()->birthDate().daysTo(data->start());
|
||||
first = first.addDays(daysStart);
|
||||
int startAge = first.year() - 1;
|
||||
|
||||
first = QDate(1,1,1);
|
||||
qint64 daysEnd = item->adbItem()->birthDate().daysTo(data->end());
|
||||
first = first.addDays(daysEnd);
|
||||
int endAge = first.year() - 1;
|
||||
|
||||
auto setTotal = [&](){
|
||||
if (sale != QDecDouble(0) && !fixedSale)
|
||||
{
|
||||
QDecDouble itemSale = (item->price() * sale) / 100;
|
||||
item->setSale(itemSale);
|
||||
item->setTotalPrice(item->price() - itemSale);
|
||||
}
|
||||
else
|
||||
{
|
||||
item->setSale(0);
|
||||
item->setTotalPrice(item->price());
|
||||
}
|
||||
|
||||
addAccFee(data, item, startAge, endAge, days);
|
||||
};
|
||||
|
||||
if (!item->personPrice().isNull())
|
||||
{
|
||||
item->setPrice(item->personPrice()->price() * days);
|
||||
setTotal();
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
item->setPrice(0);
|
||||
}
|
||||
|
||||
foreach (PersonPricePtr price, prices) {
|
||||
if (price->fromAge() <= endAge && price->toAge() >= endAge)
|
||||
{
|
||||
item->setPersonPrice(price);
|
||||
item->setPrice(price->price() * days);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
setTotal();
|
||||
}
|
||||
}
|
||||
|
||||
void CampService::calcServices(CampDataPtr data)
|
||||
{
|
||||
QDecDouble sale = data->sale();
|
||||
bool fixedSale = data->fixedSale();
|
||||
int days = data->start().daysTo(data->end());
|
||||
|
||||
foreach (ServiceItemPtr item, data->services()) {
|
||||
item->setFullPrice(item->price() * days);
|
||||
|
||||
if (sale != QDecDouble(0) && !fixedSale && item->salePossible())
|
||||
{
|
||||
QDecDouble itemSale = (item->fullPrice() * sale) / 100;
|
||||
item->setSale(itemSale);
|
||||
item->setTotalPrice(item->fullPrice() - itemSale);
|
||||
}
|
||||
else
|
||||
{
|
||||
item->setSale(0);
|
||||
item->setTotalPrice(item->fullPrice());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CampService::calcPrice(CampDataPtr data)
|
||||
{
|
||||
QDecDouble totalPrice(0);
|
||||
QDecDouble sale(0);
|
||||
|
||||
foreach (ServiceItemPtr service, data->services()) {
|
||||
totalPrice += service->totalPrice();
|
||||
sale += service->sale();
|
||||
}
|
||||
|
||||
foreach (AddressItemPtr addr, data->people()) {
|
||||
totalPrice += addr->totalPrice();
|
||||
sale += addr->sale();
|
||||
}
|
||||
|
||||
if (data->fixedSale())
|
||||
{
|
||||
totalPrice -= data->sale();
|
||||
sale = data->sale();
|
||||
}
|
||||
|
||||
switch (m_settings->rounding()) {
|
||||
case Enums::R_UP:
|
||||
totalPrice = QDecDouble(ceil(totalPrice.toDouble() * pow(10, m_settings->decimalPlaces())) / pow(10, m_settings->decimalPlaces()));
|
||||
break;
|
||||
case Enums::R_DOWN:
|
||||
totalPrice = QDecDouble(floor(totalPrice.toDouble() * pow(10, m_settings->decimalPlaces())) / pow(10, m_settings->decimalPlaces()));
|
||||
break;
|
||||
case Enums::R_MATH:
|
||||
totalPrice = QDecDouble(round(totalPrice.toDouble() * pow(10, m_settings->decimalPlaces())) / pow(10, m_settings->decimalPlaces()));
|
||||
break;
|
||||
case Enums::R_NONE:
|
||||
break;
|
||||
}
|
||||
|
||||
data->setTotalPrice(totalPrice);
|
||||
data->setTotalSale(sale);
|
||||
}
|
||||
|
||||
void CampService::addAccFee(CampDataPtr data, AddressItemPtr item, int startAge, int endAge, int days)
|
||||
{
|
||||
if (item->adbItem()->ztp())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
auto addAccService = [this, item, data](int count){
|
||||
ServiceItemPtr srvItem(new ServiceItem);
|
||||
|
||||
srvItem->setName(item->firstName() + " " + item->lastName());
|
||||
srvItem->setDescription(m_settings->accFeeText());
|
||||
srvItem->setPrice(m_settings->accFee());
|
||||
srvItem->setTotalPrice(m_settings->accFee() * count);
|
||||
srvItem->setFullPrice(srvItem->totalPrice());
|
||||
srvItem->setType(AccService::ACCFEE);
|
||||
srvItem->setSalePossible(false);
|
||||
srvItem->setCampData(data);
|
||||
data->addServiceItem(srvItem);
|
||||
};
|
||||
|
||||
if (startAge == endAge || (startAge >= m_settings->accFeeStartAge() && startAge <= m_settings->accFeeEndAge()))
|
||||
{
|
||||
if (endAge >= m_settings->accFeeStartAge() && endAge <= m_settings->accFeeEndAge())
|
||||
{
|
||||
addAccService(days);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (endAge >= m_settings->accFeeStartAge() && endAge <= m_settings->accFeeEndAge())
|
||||
{
|
||||
QDate tmp(data->end().year(), item->adbItem()->birthDate().month(), item->adbItem()->birthDate().day());
|
||||
int count = tmp.daysTo(data->end());
|
||||
|
||||
addAccService(count);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QList<ShopItemPtr> CampService::shopItems()
|
||||
{
|
||||
CampShopItemPtr item(new CampShopItem);
|
||||
|
||||
QList<ShopItemPtr> items;
|
||||
items.append(item);
|
||||
|
||||
return items;
|
||||
}
|
||||
|
||||
ShopItemPtr CampService::shopItem(int )
|
||||
{
|
||||
return CampShopItemPtr(new CampShopItem);
|
||||
}
|
||||
|
||||
void CampService::addedToVoucher(int itemId, int countAdded)
|
||||
{
|
||||
Transaction tx;
|
||||
CampDataPtr data = loadById(itemId);
|
||||
|
||||
if (countAdded > 0)
|
||||
{
|
||||
data->setOnVoucher(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
data->setOnVoucher(false);
|
||||
}
|
||||
|
||||
this->update(data);
|
||||
tx.commit();
|
||||
}
|
||||
|
||||
ISeller *CampService::seller()
|
||||
{
|
||||
return m_seller;
|
||||
}
|
||||
|
||||
ServiceItemPtr CampService::addServiceInt(CampDataPtr data, AccServicePtr service)
|
||||
{
|
||||
ServiceItemPtr serviceItem(new ServiceItem);
|
||||
|
||||
serviceItem->setName(service->accServiceName());
|
||||
serviceItem->setCode(service->accServiceCode());
|
||||
serviceItem->setPrice(service->price());
|
||||
serviceItem->setSalePossible(service->salePossible());
|
||||
serviceItem->setType(service->serviceType());
|
||||
serviceItem->setCampData(data);
|
||||
|
||||
data->addServiceItem(serviceItem);
|
||||
|
||||
return serviceItem;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
#ifndef CAMPSERVICE_H
|
||||
#define CAMPSERVICE_H
|
||||
|
||||
#include <core.h>
|
||||
#include <addressbookdata.h>
|
||||
#include <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);
|
||||
CampDataPtr create();
|
||||
void calculate(CampDataPtr data);
|
||||
void saveCamp(CampDataPtr data);
|
||||
void updateCamp(CampDataPtr data);
|
||||
void eraseCamp(CampDataPtr data);
|
||||
void loadItems(CampDataPtr data);
|
||||
QList<CampDataPtr> allForSeason();
|
||||
|
||||
private:
|
||||
ServiceItemPtr addServiceInt(CampDataPtr data, 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);
|
||||
CampSettingsPtr m_settings;
|
||||
ISeller *m_seller;
|
||||
|
||||
// ISellableService interface
|
||||
public:
|
||||
QList<ShopItemPtr> shopItems();
|
||||
ShopItemPtr shopItem(int itemId);
|
||||
void addedToVoucher(int itemId, int countAdded);
|
||||
ISeller *seller();
|
||||
};
|
||||
|
||||
#endif // CAMPSERVICE_H
|
||||
@@ -0,0 +1,58 @@
|
||||
#include "campshopitem.h"
|
||||
|
||||
CampShopItem::CampShopItem(QObject *parent)
|
||||
:ShopItem(parent)
|
||||
{
|
||||
m_unitPrice = QDecDouble(0);
|
||||
m_vatType = Enums::NONE;
|
||||
}
|
||||
|
||||
QString CampShopItem::name()
|
||||
{
|
||||
return "Camp";
|
||||
}
|
||||
|
||||
QString CampShopItem::shortName()
|
||||
{
|
||||
return "Camp";
|
||||
}
|
||||
|
||||
QDecDouble CampShopItem::unitPrice()
|
||||
{
|
||||
return m_unitPrice;
|
||||
}
|
||||
|
||||
Enums::VatType CampShopItem::vatType()
|
||||
{
|
||||
return m_vatType;
|
||||
}
|
||||
|
||||
QString CampShopItem::pluginId()
|
||||
{
|
||||
return "CAMP";
|
||||
}
|
||||
|
||||
QString CampShopItem::code()
|
||||
{
|
||||
return "Camp";
|
||||
}
|
||||
|
||||
void CampShopItem::setUnitPrice(const QDecDouble &unitPrice)
|
||||
{
|
||||
m_unitPrice = unitPrice;
|
||||
}
|
||||
|
||||
void CampShopItem::setVatType(const Enums::VatType &vatType)
|
||||
{
|
||||
m_vatType = vatType;
|
||||
}
|
||||
|
||||
int CampShopItem::id()
|
||||
{
|
||||
return m_id;
|
||||
}
|
||||
|
||||
void CampShopItem::setId(int id)
|
||||
{
|
||||
m_id = id;
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
#ifndef CAMPSHOPITEM_H
|
||||
#define CAMPSHOPITEM_H
|
||||
|
||||
#include <shopitem.h>
|
||||
|
||||
class CampShopItem : public ShopItem
|
||||
{
|
||||
public:
|
||||
CampShopItem(QObject *parent = 0);
|
||||
|
||||
// IShopItem interface
|
||||
public:
|
||||
int id();
|
||||
QString name();
|
||||
QString shortName();
|
||||
QDecDouble unitPrice();
|
||||
Enums::VatType vatType();
|
||||
QString pluginId();
|
||||
|
||||
// ShopItem interface
|
||||
public:
|
||||
QString code();
|
||||
|
||||
void setUnitPrice(const QDecDouble &unitPrice);
|
||||
void setVatType(const Enums::VatType &vatType);
|
||||
void setId(int id);
|
||||
|
||||
private:
|
||||
int m_id;
|
||||
QDecDouble m_unitPrice;
|
||||
Enums::VatType m_vatType;
|
||||
};
|
||||
|
||||
typedef QSharedPointer<CampShopItem> CampShopItemPtr;
|
||||
|
||||
#endif // CAMPSHOPITEM_H
|
||||
@@ -0,0 +1,497 @@
|
||||
#include "campwizard.h"
|
||||
#include "ui_campwizard.h"
|
||||
#include "campservice.h"
|
||||
#include "addservicedialog.h"
|
||||
|
||||
#include <core.h>
|
||||
#include <addressbookservice.h>
|
||||
#include <accservice.h>
|
||||
#include <reporting/reportviewer.h>
|
||||
|
||||
#include <QScroller>
|
||||
|
||||
////////////////////////////////////
|
||||
/// \brief AddressHelper::AddressHelper
|
||||
/// \param parent
|
||||
///
|
||||
AddressHelper::AddressHelper(QObject *parent)
|
||||
:QObject(parent)
|
||||
{
|
||||
m_address = AddressbookDataPtr(new AddressbookData);
|
||||
}
|
||||
|
||||
QSharedPointer<QObject> AddressHelper::address() const
|
||||
{
|
||||
return m_address;
|
||||
}
|
||||
|
||||
void AddressHelper::setAddress(const QSharedPointer<QObject> &address)
|
||||
{
|
||||
if (qobject_cast<AddressbookData*>(address.data()) != NULL)
|
||||
{
|
||||
m_address = qSharedPointerDynamicCast<AddressbookData, QObject>(address);
|
||||
}
|
||||
}
|
||||
|
||||
AddressbookDataPtr AddressHelper::addr() const
|
||||
{
|
||||
return m_address;
|
||||
}
|
||||
|
||||
void AddressHelper::setAddr(const AddressbookDataPtr &address)
|
||||
{
|
||||
m_address = address;
|
||||
}
|
||||
|
||||
AddressbookDataPtr AddressHelper::newAddress()
|
||||
{
|
||||
AddressBookService adbSrv;
|
||||
m_copyAddress = adbSrv.copyAddress(m_address);
|
||||
|
||||
return m_copyAddress;
|
||||
}
|
||||
|
||||
AddressbookDataPtr AddressHelper::copyAddress()
|
||||
{
|
||||
if (m_copyAddress.isNull())
|
||||
{
|
||||
m_copyAddress = AddressbookDataPtr(new AddressbookData);
|
||||
}
|
||||
|
||||
return m_copyAddress;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
/// \brief SaleHelper::SaleHelper
|
||||
/// \param parent
|
||||
///
|
||||
SaleHelper::SaleHelper(QObject *parent) :QObject(parent)
|
||||
{
|
||||
m_sale = SalePtr(new Sale);
|
||||
}
|
||||
|
||||
SalePtr SaleHelper::salePtr() const
|
||||
{
|
||||
return m_sale;
|
||||
}
|
||||
|
||||
void SaleHelper::setSalePtr(const SalePtr &sale)
|
||||
{
|
||||
m_sale = sale;
|
||||
}
|
||||
|
||||
QSharedPointer<QObject> SaleHelper::sale() const
|
||||
{
|
||||
return m_sale;
|
||||
}
|
||||
|
||||
void SaleHelper::setSale(const QSharedPointer<QObject> &sale)
|
||||
{
|
||||
if (qobject_cast<Sale*>(sale.data()) != NULL)
|
||||
{
|
||||
m_sale = qSharedPointerDynamicCast<Sale, QObject>(sale);
|
||||
emit saleChanged();
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
/// \brief CampWizard::CampWizard
|
||||
/// \param parent
|
||||
///
|
||||
CampWizard::CampWizard(QWidget *parent) :
|
||||
QWizard(parent),
|
||||
ui(new Ui::CampWizard)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
m_peopleModel = new AutoTableModel<AddressItem>(this);
|
||||
m_peopleModel->setTranslations(Context::instance().plugin("CAMP")->translations());
|
||||
ui->tablePeople->setModel(m_peopleModel);
|
||||
ui->tablePeople->hideColumn(2);
|
||||
ui->tablePeople->hideColumn(3);
|
||||
ui->tablePeople->hideColumn(4);
|
||||
ui->tablePeople->hideColumn(5);
|
||||
ui->tablePeople->horizontalHeader()->setSectionResizeMode(0, QHeaderView::Stretch);
|
||||
ui->tablePeople->horizontalHeader()->setSectionResizeMode(1, QHeaderView::Stretch);
|
||||
|
||||
connect(ui->tablePeople->selectionModel(), &QItemSelectionModel::currentRowChanged, [this](QModelIndex, QModelIndex){
|
||||
ui->btnRemove->setEnabled(!m_data->people().isEmpty());
|
||||
ui->btnOwner->setEnabled(!m_data->people().isEmpty());
|
||||
});
|
||||
|
||||
m_dataBinder = new ObjectBinder(this);
|
||||
m_dataBinder->registerBinding(ui->start);
|
||||
m_dataBinder->registerBinding(ui->end);
|
||||
m_dataBinder->registerBinding(ui->totalPrice);
|
||||
m_dataBinder->registerBinding(ui->totalSale);
|
||||
|
||||
m_addrHelper = new AddressHelper(this);
|
||||
|
||||
Service<AddressbookData> addrSrv;
|
||||
m_addrHelperBinder = new ObjectBinder(this);
|
||||
m_addrHelperBinder->registerBinding(ui->address, ComboData::createComboData(addrSrv.all("", "lastName, firstName")));
|
||||
m_addrHelperBinder->setData(m_addrHelper);
|
||||
|
||||
m_addressBinder = new ObjectBinder(this);
|
||||
m_addressBinder->registerBinding(ui->title);
|
||||
m_addressBinder->registerBinding(ui->firstName);
|
||||
m_addressBinder->registerBinding(ui->lastName);
|
||||
m_addressBinder->registerBinding(ui->birthDate);
|
||||
m_addressBinder->registerBinding(ui->idCardNumber);
|
||||
m_addressBinder->registerBinding(ui->ztp);
|
||||
m_addressBinder->registerBinding(ui->addressStreet);
|
||||
m_addressBinder->registerBinding(ui->addressHouseNumber);
|
||||
m_addressBinder->registerBinding(ui->addressZipCode);
|
||||
m_addressBinder->registerBinding(ui->addressCity);
|
||||
|
||||
Service<CountryData> coutrySrv;
|
||||
m_addressBinder->registerBinding(ui->country, ComboData::createComboData(coutrySrv.all()));
|
||||
|
||||
m_addressBinder->setData(m_addrHelper->copyAddress().data());
|
||||
m_addressBinder->bindToUi();
|
||||
|
||||
m_bindAddrCombo = true;
|
||||
|
||||
Service<AccService> serviceSrv;
|
||||
m_servicesModel = new AutoTableModel<AccService>(this);
|
||||
m_servicesModel->setTranslations(Context::instance().plugin("CAMP")->translations());
|
||||
m_servicesModel->setData(serviceSrv.all());
|
||||
ui->tableServices->setModel(m_servicesModel);
|
||||
|
||||
ui->tableServices->hideColumn(1);
|
||||
ui->tableServices->hideColumn(3);
|
||||
ui->tableServices->hideColumn(4);
|
||||
ui->tableServices->hideColumn(5);
|
||||
ui->tableServices->hideColumn(6);
|
||||
|
||||
ui->tableServices->horizontalHeader()->setSectionResizeMode(0, QHeaderView::Stretch);
|
||||
|
||||
m_itemsModel = new AutoTableModel<ServiceItem>();
|
||||
m_itemsModel->setTranslations(Context::instance().plugin("CAMP")->translations());
|
||||
ui->tableItems->setModel(m_itemsModel);
|
||||
|
||||
ui->tableItems->hideColumn(1);
|
||||
ui->tableItems->hideColumn(4);
|
||||
ui->tableItems->hideColumn(5);
|
||||
ui->tableItems->hideColumn(6);
|
||||
ui->tableItems->hideColumn(7);
|
||||
|
||||
ui->tableItems->horizontalHeader()->setSectionResizeMode(2, QHeaderView::Stretch);
|
||||
|
||||
connect(ui->tableServices->selectionModel(), &QItemSelectionModel::currentRowChanged, [this](QModelIndex current, QModelIndex){
|
||||
ui->btnAddService->setEnabled(current.isValid());
|
||||
});
|
||||
|
||||
connect(ui->tableItems->selectionModel(), &QItemSelectionModel::currentRowChanged, [this](QModelIndex, QModelIndex){
|
||||
ui->btnRemoveService->setEnabled(!m_data->services().isEmpty());
|
||||
});
|
||||
|
||||
m_saleHelper = new SaleHelper(this);
|
||||
m_saleBinder = new ObjectBinder(this);
|
||||
Service<Sale> saleSrv;
|
||||
m_saleBinder->registerBinding(ui->sale, ComboData::createComboData(saleSrv.all()));
|
||||
m_saleBinder->setData(m_saleHelper);
|
||||
m_saleBinder->bindToUi();
|
||||
|
||||
ui->tabPeople->setModel(m_peopleModel);
|
||||
ui->tabPeople->hideColumn(0);
|
||||
ui->tabPeople->hideColumn(1);
|
||||
ui->tabPeople->hideColumn(6);
|
||||
ui->tabPeople->horizontalHeader()->setSectionResizeMode(2, QHeaderView::Stretch);
|
||||
|
||||
ui->tabServices->setModel(m_itemsModel);
|
||||
ui->tabServices->hideColumn(1);
|
||||
ui->tabServices->hideColumn(3);
|
||||
ui->tabServices->hideColumn(7);
|
||||
ui->tabServices->horizontalHeader()->setSectionResizeMode(0, QHeaderView::Stretch);
|
||||
ui->tabServices->horizontalHeader()->setSectionResizeMode(2, QHeaderView::Stretch);
|
||||
|
||||
QScroller::grabGesture(ui->tabServices, QScroller::LeftMouseButtonGesture);
|
||||
QScroller::grabGesture(ui->tabPeople, QScroller::LeftMouseButtonGesture);
|
||||
|
||||
m_newRecord = false;
|
||||
}
|
||||
|
||||
CampWizard::~CampWizard()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void CampWizard::setData(const CampDataPtr &data)
|
||||
{
|
||||
m_data = data;
|
||||
|
||||
m_dataBinder->setData(data.data());
|
||||
m_dataBinder->bindToUi();
|
||||
m_addrHelperBinder->bindToUi();
|
||||
|
||||
m_peopleModel->setData(data->people());
|
||||
m_itemsModel->setData(data->services());
|
||||
|
||||
ui->sale_2->setValue(m_data->sale().toDouble());
|
||||
ui->lblSale->setText(m_data->fixedSale() ? tr("Fixed amound") : tr("%"));
|
||||
}
|
||||
|
||||
void CampWizard::on_btnAdd_clicked()
|
||||
{
|
||||
m_addressBinder->bindToData();
|
||||
|
||||
CampService srv;
|
||||
AddressBookService adbSrv;
|
||||
|
||||
if (ui->groupNew->isChecked())
|
||||
{
|
||||
AddressbookDataPtr newAddr = adbSrv.copyAddress(m_addrHelper->copyAddress());
|
||||
adbSrv.save(newAddr);
|
||||
srv.addPerson(m_data, newAddr);
|
||||
|
||||
m_bindAddrCombo = false;
|
||||
m_addrHelperBinder->registerBinding(ui->address, ComboData::createComboData(adbSrv.all()));
|
||||
m_addrHelperBinder->bindToUi();
|
||||
m_bindAddrCombo = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
srv.addPerson(m_data, m_addrHelper->addr());
|
||||
}
|
||||
|
||||
m_peopleModel->setData(m_data->people());
|
||||
}
|
||||
|
||||
|
||||
void CampWizard::on_address_currentIndexChanged(int)
|
||||
{
|
||||
if (m_bindAddrCombo)
|
||||
{
|
||||
AddressBookService adbSrv;
|
||||
m_addrHelperBinder->bindToData();
|
||||
m_addressBinder->setData(m_addrHelper->newAddress().data());
|
||||
m_addressBinder->bindToUi();
|
||||
}
|
||||
}
|
||||
|
||||
void CampWizard::on_btnRemove_clicked()
|
||||
{
|
||||
AddressItemPtr selAddr = m_peopleModel->itemFromIndex(ui->tablePeople->currentIndex());
|
||||
m_data->removePerson(selAddr);
|
||||
m_peopleModel->setData(m_data->people());
|
||||
|
||||
ui->btnOwner->setEnabled(false);
|
||||
ui->btnRemove->setEnabled(false);
|
||||
}
|
||||
|
||||
void CampWizard::on_btnOwner_clicked()
|
||||
{
|
||||
CampService srv;
|
||||
AddressItemPtr selAddr = m_peopleModel->itemFromIndex(ui->tablePeople->currentIndex());
|
||||
srv.setOwner(m_data, selAddr);
|
||||
|
||||
QModelIndex currIndex = ui->tablePeople->currentIndex();
|
||||
m_peopleModel->setData(m_data->people());
|
||||
ui->tablePeople->setCurrentIndex(currIndex);
|
||||
}
|
||||
|
||||
void CampWizard::on_groupNew_clicked(bool checked)
|
||||
{
|
||||
if (checked)
|
||||
{
|
||||
ui->address->setEnabled(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->address->setEnabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
void CampWizard::on_CampWizard_currentIdChanged(int id)
|
||||
{
|
||||
if (id == 2)
|
||||
{
|
||||
CampService srv;
|
||||
srv.calculate(m_data);
|
||||
|
||||
m_dataBinder->bindToUi();
|
||||
m_itemsModel->setData(m_data->services());
|
||||
|
||||
ui->lFrom->setText(m_data->start().toString("d. M. yyyy"));
|
||||
ui->lTo->setText(m_data->end().toString("d. M. yyyy"));
|
||||
ui->lDays->setText(QString::number(m_data->start().daysTo(m_data->end())));
|
||||
ui->lOwner->setText(m_data->ownerAddress());
|
||||
}
|
||||
}
|
||||
|
||||
void CampWizard::on_btnAddService_clicked()
|
||||
{
|
||||
AccServicePtr service = m_servicesModel->itemFromIndex(ui->tableServices->currentIndex());
|
||||
AddServiceDialog *dialog = new AddServiceDialog(service, this);
|
||||
|
||||
dialog->setAttribute(Qt::WA_DeleteOnClose);
|
||||
|
||||
connect(dialog, &QDialog::accepted, [=](){
|
||||
CampService srv;
|
||||
srv.addService(m_data, service, dialog->price(), dialog->description());
|
||||
m_itemsModel->setData(m_data->services());
|
||||
});
|
||||
|
||||
dialog->show();
|
||||
}
|
||||
|
||||
void CampWizard::on_btnRemoveService_clicked()
|
||||
{
|
||||
ServiceItemPtr item = m_itemsModel->itemFromIndex(ui->tableItems->currentIndex());
|
||||
m_data->removeServiceItem(item);
|
||||
m_itemsModel->setData(m_data->services());
|
||||
|
||||
ui->btnRemoveService->setEnabled(false);
|
||||
}
|
||||
|
||||
void CampWizard::on_checkSale_clicked()
|
||||
{
|
||||
ui->sale->setEnabled(ui->checkSale->isChecked());
|
||||
applySale();
|
||||
}
|
||||
|
||||
void CampWizard::applySale()
|
||||
{
|
||||
if (m_data.isNull())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (ui->checkSale->isChecked())
|
||||
{
|
||||
m_saleBinder->bindToData();
|
||||
m_data->setSale(m_saleHelper->salePtr()->sale());
|
||||
m_data->setFixedSale(m_saleHelper->salePtr()->fixed());
|
||||
}
|
||||
else
|
||||
{
|
||||
m_data->setSale(QDecDouble(0));
|
||||
}
|
||||
}
|
||||
|
||||
void CampWizard::on_sale_currentIndexChanged(int)
|
||||
{
|
||||
applySale();
|
||||
}
|
||||
|
||||
void CampWizard::setNewRecord(bool newRecord)
|
||||
{
|
||||
m_newRecord = newRecord;
|
||||
|
||||
if (newRecord)
|
||||
{
|
||||
ui->wSale->setVisible(false);
|
||||
ui->checkSale->setText(tr("Apply sale"));
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->wSale->setVisible(true);
|
||||
ui->checkSale->setText(tr("Change"));
|
||||
}
|
||||
}
|
||||
|
||||
bool CampWizard::validateCurrentPage()
|
||||
{
|
||||
m_dataBinder->bindToData();
|
||||
|
||||
if (currentPage() == ui->peoplePage && m_data->people().isEmpty())
|
||||
{
|
||||
QMessageBox::critical(this, tr("Error"), tr("Add people."));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (currentPage() == ui->peoplePage && m_data->start() >= m_data->end())
|
||||
{
|
||||
QMessageBox::critical(this, tr("Error"), tr("Start date is after or equals end date."));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (currentPage() == ui->servicePage && m_data->services().isEmpty())
|
||||
{
|
||||
QMessageBox::critical(this, tr("Error"), tr("Add service."));
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void CampWizard::accept()
|
||||
{
|
||||
CampService srv;
|
||||
bool success = true;
|
||||
|
||||
connect(&srv, &IService::dbError, [this, &success](QString msg){
|
||||
QMessageBox::critical(this, tr("Database error"), tr(msg.toStdString().c_str()));
|
||||
success = false;
|
||||
});
|
||||
|
||||
connect(&srv, &IService::permissionDenied, [this, &success](QString msg){
|
||||
QMessageBox::critical(this, tr("Permission denied"), msg.toStdString().c_str());
|
||||
success = false;
|
||||
});
|
||||
|
||||
if (m_newRecord && m_data->id() == 0)
|
||||
{
|
||||
srv.saveCamp(m_data);
|
||||
}
|
||||
else
|
||||
{
|
||||
srv.updateCamp(m_data);
|
||||
}
|
||||
|
||||
if (success)
|
||||
{
|
||||
QDialog::accept();
|
||||
}
|
||||
}
|
||||
|
||||
void CampWizard::on_btnPrint_clicked()
|
||||
{
|
||||
if (QMessageBox::question(this, tr("Save record?"), tr("Record must be saved before print. Do you want to save record?")) != QMessageBox::Yes)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
CampService srv;
|
||||
bool success = true;
|
||||
|
||||
connect(&srv, &IService::dbError, [this, &success](QString msg){
|
||||
QMessageBox::critical(this, tr("Database error"), tr(msg.toStdString().c_str()));
|
||||
success = false;
|
||||
});
|
||||
|
||||
connect(&srv, &IService::permissionDenied, [this, &success](QString msg){
|
||||
QMessageBox::critical(this, tr("Permission denied"), msg.toStdString().c_str());
|
||||
success = false;
|
||||
});
|
||||
|
||||
if (m_newRecord && m_data->id() == 0)
|
||||
{
|
||||
srv.saveCamp(m_data);
|
||||
}
|
||||
else
|
||||
{
|
||||
srv.updateCamp(m_data);
|
||||
}
|
||||
|
||||
if(!success)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ReportPtr report(new Report);
|
||||
report->setFile("camp_accommodation_document.lrxml");
|
||||
|
||||
VariableFiller filler;
|
||||
filler.fill(report, m_data->id());
|
||||
|
||||
ReportViewer *viewer = new ReportViewer(this);
|
||||
viewer->setAttribute(Qt::WA_DeleteOnClose);
|
||||
viewer->setReport(report);
|
||||
viewer->openPreview();
|
||||
|
||||
connect(viewer, &QDialog::finished, [this](int){
|
||||
this->accept();
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
#ifndef CAMPWIZARD_H
|
||||
#define CAMPWIZARD_H
|
||||
|
||||
#include <QWizard>
|
||||
#include "data/camp-data.h"
|
||||
#include <objectbinder.h>
|
||||
#include <data/addressbookdata.h>
|
||||
#include <data/accservice.h>
|
||||
#include <core.h>
|
||||
|
||||
class AddressHelper : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(QSharedPointer<QObject> address READ address WRITE setAddress)
|
||||
|
||||
public:
|
||||
AddressHelper(QObject *parent = NULL);
|
||||
|
||||
QSharedPointer<QObject> address() const;
|
||||
void setAddress(const QSharedPointer<QObject> &address);
|
||||
|
||||
AddressbookDataPtr addr() const;
|
||||
void setAddr(const AddressbookDataPtr &address);
|
||||
|
||||
AddressbookDataPtr newAddress();
|
||||
AddressbookDataPtr copyAddress();
|
||||
|
||||
private:
|
||||
AddressbookDataPtr m_address;
|
||||
AddressbookDataPtr m_copyAddress;
|
||||
};
|
||||
|
||||
class SaleHelper : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(QSharedPointer<QObject> sale READ sale WRITE setSale NOTIFY saleChanged)
|
||||
|
||||
public:
|
||||
SaleHelper(QObject *parent = NULL);
|
||||
|
||||
SalePtr salePtr() const;
|
||||
void setSalePtr(const SalePtr &sale);
|
||||
|
||||
QSharedPointer<QObject> sale() const;
|
||||
void setSale(const QSharedPointer<QObject> &sale);
|
||||
|
||||
signals:
|
||||
void saleChanged();
|
||||
|
||||
private:
|
||||
SalePtr m_sale;
|
||||
};
|
||||
|
||||
namespace Ui {
|
||||
class CampWizard;
|
||||
}
|
||||
|
||||
class CampWizard : public QWizard
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit CampWizard(QWidget *parent = 0);
|
||||
~CampWizard();
|
||||
|
||||
void setData(const CampDataPtr &data);
|
||||
void setNewRecord(bool newRecord);
|
||||
|
||||
private slots:
|
||||
void on_btnAdd_clicked();
|
||||
|
||||
void on_address_currentIndexChanged(int index);
|
||||
|
||||
void on_btnRemove_clicked();
|
||||
|
||||
void on_btnOwner_clicked();
|
||||
|
||||
void on_groupNew_clicked(bool checked);
|
||||
|
||||
void on_CampWizard_currentIdChanged(int id);
|
||||
|
||||
void on_btnAddService_clicked();
|
||||
|
||||
void on_btnRemoveService_clicked();
|
||||
|
||||
void on_checkSale_clicked();
|
||||
|
||||
void applySale();
|
||||
|
||||
void on_sale_currentIndexChanged(int index);
|
||||
|
||||
void on_btnPrint_clicked();
|
||||
|
||||
private:
|
||||
Ui::CampWizard *ui;
|
||||
CampDataPtr m_data;
|
||||
ObjectBinder *m_dataBinder;
|
||||
ObjectBinder *m_addrHelperBinder;
|
||||
ObjectBinder *m_addressBinder;
|
||||
AddressHelper *m_addrHelper;
|
||||
ObjectBinder *m_saleBinder;
|
||||
SaleHelper *m_saleHelper;
|
||||
|
||||
AutoTableModel<AddressItem> *m_peopleModel;
|
||||
AutoTableModel<AccService> *m_servicesModel;
|
||||
AutoTableModel<ServiceItem> *m_itemsModel;
|
||||
bool m_bindAddrCombo;
|
||||
bool m_newRecord;
|
||||
|
||||
// QWizard interface
|
||||
public:
|
||||
bool validateCurrentPage();
|
||||
|
||||
public slots:
|
||||
void accept();
|
||||
};
|
||||
|
||||
#endif // CAMPWIZARD_H
|
||||
@@ -0,0 +1,913 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>CampWizard</class>
|
||||
<widget class="QWizard" name="CampWizard">
|
||||
<property name="windowModality">
|
||||
<enum>Qt::ApplicationModal</enum>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>948</width>
|
||||
<height>684</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Camp record</string>
|
||||
</property>
|
||||
<property name="windowIcon">
|
||||
<iconset resource="camprc.qrc">
|
||||
<normaloff>:/icons/campPlugin.svg</normaloff>:/icons/campPlugin.svg</iconset>
|
||||
</property>
|
||||
<property name="wizardStyle">
|
||||
<enum>QWizard::ClassicStyle</enum>
|
||||
</property>
|
||||
<widget class="QWizardPage" name="peoplePage">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QWidget" name="widget" native="true">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>From</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDateEdit" name="start">
|
||||
<property name="displayFormat">
|
||||
<string>d. M. yyyy</string>
|
||||
</property>
|
||||
<property name="calendarPopup">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>To</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDateEdit" name="end">
|
||||
<property name="displayFormat">
|
||||
<string>d. M. yyyy</string>
|
||||
</property>
|
||||
<property name="calendarPopup">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_2">
|
||||
<property name="title">
|
||||
<string>People</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QWidget" name="widget_3" native="true">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>450</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Existing address</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="3">
|
||||
<widget class="QPushButton" name="btnAdd">
|
||||
<property name="text">
|
||||
<string>Add</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../core/rc.qrc">
|
||||
<normaloff>:/icons/new.svg</normaloff>:/icons/new.svg</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="4">
|
||||
<widget class="QGroupBox" name="groupNew">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>&New address</string>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout_2">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Title</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="title"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>First name</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="firstName"/>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string>Last name</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLineEdit" name="lastName"/>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="text">
|
||||
<string>Date of birth</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QDateEdit" name="birthDate">
|
||||
<property name="displayFormat">
|
||||
<string>d. MM. yyyy</string>
|
||||
</property>
|
||||
<property name="calendarPopup">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="text">
|
||||
<string>ID card</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QLineEdit" name="idCardNumber"/>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QCheckBox" name="ztp">
|
||||
<property name="text">
|
||||
<string>ZTP</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="label_9">
|
||||
<property name="text">
|
||||
<string>Street</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<widget class="QLineEdit" name="addressStreet"/>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<widget class="QLabel" name="label_10">
|
||||
<property name="text">
|
||||
<string>House number</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="1">
|
||||
<widget class="QLineEdit" name="addressHouseNumber"/>
|
||||
</item>
|
||||
<item row="8" column="0">
|
||||
<widget class="QLabel" name="label_11">
|
||||
<property name="text">
|
||||
<string>ZIP code</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="1">
|
||||
<widget class="QLineEdit" name="addressZipCode"/>
|
||||
</item>
|
||||
<item row="9" column="0">
|
||||
<widget class="QLabel" name="label_12">
|
||||
<property name="text">
|
||||
<string>City</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="1">
|
||||
<widget class="QLineEdit" name="addressCity"/>
|
||||
</item>
|
||||
<item row="10" column="0">
|
||||
<widget class="QLabel" name="label_13">
|
||||
<property name="text">
|
||||
<string>Country</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="1">
|
||||
<widget class="QComboBox" name="country">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>450</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="editable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1" colspan="3">
|
||||
<widget class="QComboBox" name="address">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>300</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="editable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="widget_8" native="true">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>150</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QWidget" name="widget_9" native="true">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_8">
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_6">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="btnRemove">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Remove</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../core/rc.qrc">
|
||||
<normaloff>:/icons/remove.svg</normaloff>:/icons/remove.svg</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="btnOwner">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Owner</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../core/rc.qrc">
|
||||
<normaloff>:/icons/ok.svg</normaloff>:/icons/ok.svg</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_5">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTableView" name="tablePeople">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>380</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="editTriggers">
|
||||
<set>QAbstractItemView::NoEditTriggers</set>
|
||||
</property>
|
||||
<property name="selectionBehavior">
|
||||
<enum>QAbstractItemView::SelectRows</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWizardPage" name="servicePage">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_3">
|
||||
<property name="title">
|
||||
<string>Services</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="QTableView" name="tableServices">
|
||||
<property name="selectionMode">
|
||||
<enum>QAbstractItemView::SingleSelection</enum>
|
||||
</property>
|
||||
<property name="selectionBehavior">
|
||||
<enum>QAbstractItemView::SelectRows</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="widget_2" native="true">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="btnAddService">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../core/rc.qrc">
|
||||
<normaloff>:/icons/new.svg</normaloff>:/icons/new.svg</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>32</width>
|
||||
<height>32</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="btnRemoveService">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../core/rc.qrc">
|
||||
<normaloff>:/icons/remove.svg</normaloff>:/icons/remove.svg</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>32</width>
|
||||
<height>32</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTableView" name="tableItems">
|
||||
<property name="selectionMode">
|
||||
<enum>QAbstractItemView::SingleSelection</enum>
|
||||
</property>
|
||||
<property name="selectionBehavior">
|
||||
<enum>QAbstractItemView::SelectRows</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_4">
|
||||
<property name="title">
|
||||
<string>Sale</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="1" column="0">
|
||||
<widget class="QCheckBox" name="checkSale">
|
||||
<property name="text">
|
||||
<string>Change</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QComboBox" name="sale">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QWidget" name="wSale" native="true">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_10">
|
||||
<item>
|
||||
<widget class="QDoubleSpinBox" name="sale_2">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>60</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="buttonSymbols">
|
||||
<enum>QAbstractSpinBox::NoButtons</enum>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>999.990000000000009</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="lblSale">
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_8">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWizardPage" name="finishPage">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_6">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_5">
|
||||
<property name="title">
|
||||
<string>Summary</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_5">
|
||||
<item>
|
||||
<widget class="QWidget" name="widget_4" native="true">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_16">
|
||||
<property name="text">
|
||||
<string>From:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="lFrom">
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_18">
|
||||
<property name="text">
|
||||
<string>To:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="lTo">
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_4">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="widget_5" native="true">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_20">
|
||||
<property name="text">
|
||||
<string>Days:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="lDays">
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="widget_10" native="true">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_9">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_23">
|
||||
<property name="text">
|
||||
<string>Owner:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="lOwner">
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_7">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_14">
|
||||
<property name="text">
|
||||
<string>People:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTableView" name="tabPeople"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_15">
|
||||
<property name="text">
|
||||
<string>Services:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTableView" name="tabServices"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="widget_6" native="true">
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_22">
|
||||
<property name="text">
|
||||
<string>Sale:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_24">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Total:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QDoubleSpinBox" name="totalSale">
|
||||
<property name="autoFillBackground">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="frame">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="buttonSymbols">
|
||||
<enum>QAbstractSpinBox::NoButtons</enum>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>999999999.990000009536743</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QDoubleSpinBox" name="totalPrice">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="autoFillBackground">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="frame">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="buttonSymbols">
|
||||
<enum>QAbstractSpinBox::NoButtons</enum>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>999999999.990000009536743</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="widget_7" native="true">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_7">
|
||||
<item>
|
||||
<widget class="QPushButton" name="btnPrint">
|
||||
<property name="text">
|
||||
<string>Print</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../core/rc.qrc">
|
||||
<normaloff>:/icons/print.svg</normaloff>:/icons/print.svg</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>start</tabstop>
|
||||
<tabstop>end</tabstop>
|
||||
<tabstop>address</tabstop>
|
||||
<tabstop>groupNew</tabstop>
|
||||
<tabstop>title</tabstop>
|
||||
<tabstop>firstName</tabstop>
|
||||
<tabstop>lastName</tabstop>
|
||||
<tabstop>birthDate</tabstop>
|
||||
<tabstop>idCardNumber</tabstop>
|
||||
<tabstop>ztp</tabstop>
|
||||
<tabstop>addressStreet</tabstop>
|
||||
<tabstop>addressHouseNumber</tabstop>
|
||||
<tabstop>addressZipCode</tabstop>
|
||||
<tabstop>addressCity</tabstop>
|
||||
<tabstop>country</tabstop>
|
||||
<tabstop>btnAdd</tabstop>
|
||||
<tabstop>btnRemove</tabstop>
|
||||
<tabstop>btnOwner</tabstop>
|
||||
<tabstop>tablePeople</tabstop>
|
||||
<tabstop>btnAddService</tabstop>
|
||||
<tabstop>btnRemoveService</tabstop>
|
||||
<tabstop>tableItems</tabstop>
|
||||
<tabstop>tabPeople</tabstop>
|
||||
<tabstop>tabServices</tabstop>
|
||||
<tabstop>btnPrint</tabstop>
|
||||
<tabstop>checkSale</tabstop>
|
||||
<tabstop>sale</tabstop>
|
||||
<tabstop>tableServices</tabstop>
|
||||
</tabstops>
|
||||
<resources>
|
||||
<include location="../core/rc.qrc"/>
|
||||
<include location="camprc.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
||||
@@ -0,0 +1,121 @@
|
||||
#include "addressitem.h"
|
||||
#include <define.h>
|
||||
|
||||
AddressItem::AddressItem(QObject *parent) : QObject(parent)
|
||||
{
|
||||
m_id = 0;
|
||||
m_price = 0;
|
||||
m_owner = false;
|
||||
m_sale = 0;
|
||||
m_totalPrice = 0;
|
||||
}
|
||||
|
||||
int AddressItem::id() const
|
||||
{
|
||||
return m_id;
|
||||
}
|
||||
|
||||
void AddressItem::setId(int id)
|
||||
{
|
||||
m_id = id;
|
||||
}
|
||||
|
||||
QString AddressItem::firstName() const
|
||||
{
|
||||
return m_firstName;
|
||||
}
|
||||
|
||||
void AddressItem::setFirstName(const QString &firstName)
|
||||
{
|
||||
m_firstName = firstName;
|
||||
}
|
||||
|
||||
QString AddressItem::lastName() const
|
||||
{
|
||||
return m_lastName;
|
||||
}
|
||||
|
||||
void AddressItem::setLastName(const QString &lastName)
|
||||
{
|
||||
m_lastName = lastName;
|
||||
}
|
||||
|
||||
QString AddressItem::address() const
|
||||
{
|
||||
return m_address;
|
||||
}
|
||||
|
||||
void AddressItem::setAddress(const QString &address)
|
||||
{
|
||||
m_address = address;
|
||||
}
|
||||
|
||||
QDecDouble AddressItem::price() const
|
||||
{
|
||||
return TO_DEC(m_price);
|
||||
}
|
||||
|
||||
void AddressItem::setPrice(QDecDouble price)
|
||||
{
|
||||
m_price = FROM_DEC(price);
|
||||
}
|
||||
|
||||
QWeakPointer<CampData> AddressItem::campData() const
|
||||
{
|
||||
return m_campData;
|
||||
}
|
||||
|
||||
void AddressItem::setCampData(const QWeakPointer<CampData> &campData)
|
||||
{
|
||||
m_campData = campData;
|
||||
}
|
||||
|
||||
PersonPricePtr AddressItem::personPrice() const
|
||||
{
|
||||
return m_personPrice;
|
||||
}
|
||||
|
||||
void AddressItem::setPersonPrice(const PersonPricePtr &personPrice)
|
||||
{
|
||||
m_personPrice = personPrice;
|
||||
}
|
||||
|
||||
AddressbookDataPtr AddressItem::adbItem() const
|
||||
{
|
||||
return m_adbItem;
|
||||
}
|
||||
|
||||
void AddressItem::setAdbItem(const AddressbookDataPtr &adbItem)
|
||||
{
|
||||
m_adbItem = adbItem;
|
||||
}
|
||||
|
||||
bool AddressItem::owner() const
|
||||
{
|
||||
return m_owner;
|
||||
}
|
||||
|
||||
void AddressItem::setOwner(bool owner)
|
||||
{
|
||||
m_owner = owner;
|
||||
}
|
||||
|
||||
QDecDouble AddressItem::totalPrice() const
|
||||
{
|
||||
return TO_DEC(m_totalPrice);
|
||||
}
|
||||
|
||||
void AddressItem::setTotalPrice(QDecDouble totalPrice)
|
||||
{
|
||||
m_totalPrice = FROM_DEC(totalPrice);
|
||||
}
|
||||
|
||||
QDecDouble AddressItem::sale() const
|
||||
{
|
||||
return TO_DEC(m_sale);
|
||||
}
|
||||
|
||||
void AddressItem::setSale(QDecDouble sale)
|
||||
{
|
||||
m_sale = FROM_DEC(sale);
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
#ifndef ADDRESSITEM_H
|
||||
#define ADDRESSITEM_H
|
||||
|
||||
#include "camp-data.h"
|
||||
#include <QObject>
|
||||
#include <QSharedPointer>
|
||||
#include <QWeakPointer>
|
||||
#include <QDecDouble.hh>
|
||||
#include <odb/core.hxx>
|
||||
|
||||
#include <addressbookdata.h>
|
||||
|
||||
class CampData;
|
||||
|
||||
#pragma db object
|
||||
class AddressItem : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(QString firstName READ firstName WRITE setFirstName)
|
||||
Q_PROPERTY(QString lastName READ lastName WRITE setLastName)
|
||||
Q_PROPERTY(QString address READ address WRITE setAddress)
|
||||
Q_PROPERTY(QDecDouble price READ price WRITE setPrice)
|
||||
Q_PROPERTY(QDecDouble sale READ sale WRITE setSale)
|
||||
Q_PROPERTY(QDecDouble totalPrice READ totalPrice WRITE setTotalPrice)
|
||||
Q_PROPERTY(bool owner READ owner WRITE setOwner)
|
||||
|
||||
public:
|
||||
explicit AddressItem(QObject *parent = 0);
|
||||
|
||||
int id() const;
|
||||
void setId(int id);
|
||||
|
||||
QString firstName() const;
|
||||
void setFirstName(const QString &firstName);
|
||||
|
||||
QString lastName() const;
|
||||
void setLastName(const QString &lastName);
|
||||
|
||||
QString address() const;
|
||||
void setAddress(const QString &address);
|
||||
|
||||
QDecDouble price() const;
|
||||
void setPrice(QDecDouble price);
|
||||
|
||||
QWeakPointer<CampData> campData() const;
|
||||
void setCampData(const QWeakPointer<CampData> &campData);
|
||||
|
||||
PersonPricePtr personPrice() const;
|
||||
void setPersonPrice(const PersonPricePtr &personPrice);
|
||||
|
||||
AddressbookDataPtr adbItem() const;
|
||||
void setAdbItem(const AddressbookDataPtr &adbItem);
|
||||
|
||||
bool owner() const;
|
||||
void setOwner(bool owner);
|
||||
|
||||
QDecDouble totalPrice() const;
|
||||
void setTotalPrice(QDecDouble totalPrice);
|
||||
|
||||
QDecDouble sale() const;
|
||||
void setSale(QDecDouble sale);
|
||||
|
||||
private:
|
||||
friend class odb::access;
|
||||
#pragma db id auto
|
||||
int m_id;
|
||||
QString m_firstName;
|
||||
QString m_lastName;
|
||||
QString m_address;
|
||||
AddressbookDataPtr m_adbItem;
|
||||
int m_price;
|
||||
int m_totalPrice;
|
||||
int m_sale;
|
||||
#pragma db not_null
|
||||
QWeakPointer<CampData> m_campData;
|
||||
PersonPricePtr m_personPrice;
|
||||
bool m_owner;
|
||||
};
|
||||
|
||||
#endif // ADDRESSITEM_H
|
||||
@@ -0,0 +1,24 @@
|
||||
#ifndef CAMP_DATA_H
|
||||
#define CAMP_DATA_H
|
||||
|
||||
#include <QSharedPointer>
|
||||
|
||||
class CampData;
|
||||
class AddressItem;
|
||||
class ServiceItem;
|
||||
class Sale;
|
||||
class PersonPrice;
|
||||
|
||||
typedef QSharedPointer<CampData> CampDataPtr;
|
||||
typedef QSharedPointer<ServiceItem> ServiceItemPtr;
|
||||
typedef QSharedPointer<AddressItem> AddressItemPtr;
|
||||
typedef QSharedPointer<Sale> SalePtr;
|
||||
typedef QSharedPointer<PersonPrice> PersonPricePtr;
|
||||
|
||||
#include "campdata.h"
|
||||
#include "addressitem.h"
|
||||
#include "serviceitem.h"
|
||||
#include "sale.h"
|
||||
#include "personprice.h"
|
||||
|
||||
#endif // CAMP_DATA_H
|
||||
@@ -0,0 +1,233 @@
|
||||
#include "campdata.h"
|
||||
#include <define.h>
|
||||
|
||||
CampData::CampData(QObject *parent) : QObject(parent)
|
||||
{
|
||||
m_id = 0;
|
||||
m_totalPrice = 0;
|
||||
m_sale = 0;
|
||||
m_totalSale = 0;
|
||||
m_fixedSale = false;
|
||||
m_fullPrice = 0;
|
||||
m_onVoucher = false;
|
||||
}
|
||||
|
||||
int CampData::id() const
|
||||
{
|
||||
return m_id;
|
||||
}
|
||||
|
||||
void CampData::setId(int id)
|
||||
{
|
||||
m_id = id;
|
||||
}
|
||||
|
||||
QDate CampData::start() const
|
||||
{
|
||||
return m_start;
|
||||
}
|
||||
|
||||
void CampData::setStart(const QDate &start)
|
||||
{
|
||||
m_start = start;
|
||||
}
|
||||
|
||||
QDate CampData::end() const
|
||||
{
|
||||
return m_end;
|
||||
}
|
||||
|
||||
void CampData::setEnd(const QDate &end)
|
||||
{
|
||||
m_end = end;
|
||||
}
|
||||
|
||||
QString CampData::ownerFirstame() const
|
||||
{
|
||||
return m_ownerFirstame;
|
||||
}
|
||||
|
||||
void CampData::setOwnerFirstame(const QString &ownerFirstame)
|
||||
{
|
||||
m_ownerFirstame = ownerFirstame;
|
||||
}
|
||||
|
||||
QString CampData::ownerLastname() const
|
||||
{
|
||||
return m_ownerLastname;
|
||||
}
|
||||
|
||||
void CampData::setOwnerLastname(const QString &ownerLastname)
|
||||
{
|
||||
m_ownerLastname = ownerLastname;
|
||||
}
|
||||
|
||||
QString CampData::ownerAddress() const
|
||||
{
|
||||
return m_ownerAddress;
|
||||
}
|
||||
|
||||
void CampData::setOwnerAddress(const QString &ownerAddress)
|
||||
{
|
||||
m_ownerAddress = ownerAddress;
|
||||
}
|
||||
|
||||
QOdbList<ServiceItemPtr> CampData::services() const
|
||||
{
|
||||
return m_services;
|
||||
}
|
||||
|
||||
void CampData::setServices(const QOdbList<QSharedPointer<ServiceItem> > &services)
|
||||
{
|
||||
m_services = services;
|
||||
}
|
||||
|
||||
void CampData::addServiceItem(ServiceItemPtr serviceItem)
|
||||
{
|
||||
m_services.append(serviceItem);
|
||||
}
|
||||
|
||||
void CampData::removeServiceItem(ServiceItemPtr serviceItem)
|
||||
{
|
||||
m_services.removeOne(serviceItem);
|
||||
}
|
||||
|
||||
QOdbList<AddressItemPtr> CampData::people() const
|
||||
{
|
||||
return m_people;
|
||||
}
|
||||
|
||||
void CampData::setPeople(const QOdbList<AddressItemPtr> &people)
|
||||
{
|
||||
m_people = people;
|
||||
}
|
||||
|
||||
void CampData::addPerson(AddressItemPtr person)
|
||||
{
|
||||
m_people.append(person);
|
||||
}
|
||||
|
||||
void CampData::removePerson(AddressItemPtr person)
|
||||
{
|
||||
m_people.removeOne(person);
|
||||
}
|
||||
|
||||
QDecDouble CampData::totalPrice() const
|
||||
{
|
||||
return TO_DEC(m_totalPrice);
|
||||
}
|
||||
|
||||
void CampData::setTotalPrice(QDecDouble totalPrice)
|
||||
{
|
||||
m_totalPrice = FROM_DEC(totalPrice);
|
||||
}
|
||||
|
||||
SeasonPtr CampData::season() const
|
||||
{
|
||||
return m_season;
|
||||
}
|
||||
|
||||
void CampData::setSeason(const SeasonPtr &season)
|
||||
{
|
||||
m_season = season;
|
||||
}
|
||||
|
||||
QDecDouble CampData::sale() const
|
||||
{
|
||||
return TO_DEC(m_sale);
|
||||
}
|
||||
|
||||
void CampData::setSale(QDecDouble sale)
|
||||
{
|
||||
m_sale = FROM_DEC(sale);
|
||||
}
|
||||
|
||||
bool CampData::fixedSale() const
|
||||
{
|
||||
return m_fixedSale;
|
||||
}
|
||||
|
||||
void CampData::setFixedSale(bool fixedSale)
|
||||
{
|
||||
m_fixedSale = fixedSale;
|
||||
}
|
||||
|
||||
QString CampData::numSer() const
|
||||
{
|
||||
return m_numSer;
|
||||
}
|
||||
|
||||
void CampData::setNumSer(const QString &numSer)
|
||||
{
|
||||
m_numSer = numSer;
|
||||
}
|
||||
|
||||
QDecDouble CampData::totalSale() const
|
||||
{
|
||||
return TO_DEC(m_totalSale);
|
||||
}
|
||||
|
||||
void CampData::setTotalSale(QDecDouble totalSale)
|
||||
{
|
||||
m_totalSale = FROM_DEC(totalSale);
|
||||
}
|
||||
|
||||
QDecDouble CampData::fullPrice() const
|
||||
{
|
||||
return TO_DEC(m_fullPrice);
|
||||
}
|
||||
|
||||
void CampData::setFullPrice(QDecDouble fullPrice)
|
||||
{
|
||||
m_fullPrice = FROM_DEC(fullPrice);
|
||||
}
|
||||
|
||||
bool CampData::onVoucher() const
|
||||
{
|
||||
return m_onVoucher;
|
||||
}
|
||||
|
||||
void CampData::setOnVoucher(bool onVoucher)
|
||||
{
|
||||
m_onVoucher = onVoucher;
|
||||
}
|
||||
|
||||
QString CampData::createdBy() const
|
||||
{
|
||||
return m_createdBy;
|
||||
}
|
||||
|
||||
void CampData::setCreatedBy(const QString &createdBy)
|
||||
{
|
||||
m_createdBy = createdBy;
|
||||
}
|
||||
|
||||
QString CampData::updatedBy() const
|
||||
{
|
||||
return m_updatedBy;
|
||||
}
|
||||
|
||||
void CampData::setUpdatedBy(const QString &updatedBy)
|
||||
{
|
||||
m_updatedBy = updatedBy;
|
||||
}
|
||||
|
||||
QDateTime CampData::created() const
|
||||
{
|
||||
return m_created;
|
||||
}
|
||||
|
||||
void CampData::setCreated(const QDateTime &created)
|
||||
{
|
||||
m_created = created;
|
||||
}
|
||||
|
||||
QDateTime CampData::updated() const
|
||||
{
|
||||
return m_updated;
|
||||
}
|
||||
|
||||
void CampData::setUpdated(const QDateTime &updated)
|
||||
{
|
||||
m_updated = updated;
|
||||
}
|
||||
@@ -0,0 +1,127 @@
|
||||
#ifndef CAMPDATA_H
|
||||
#define CAMPDATA_H
|
||||
|
||||
#include "camp-data.h"
|
||||
#include <QObject>
|
||||
#include <QDate>
|
||||
#include <QDecDouble.hh>
|
||||
#include <odb/core.hxx>
|
||||
#include <odb/qt/list.hxx>
|
||||
|
||||
#include <data/season.h>
|
||||
|
||||
#pragma db object
|
||||
class CampData : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(QString numSer READ numSer WRITE setNumSer)
|
||||
Q_PROPERTY(QDate start READ start WRITE setStart)
|
||||
Q_PROPERTY(QDate end READ end WRITE setEnd)
|
||||
Q_PROPERTY(QString ownerFirstame READ ownerFirstame WRITE setOwnerFirstame)
|
||||
Q_PROPERTY(QString ownerLastname READ ownerLastname WRITE setOwnerLastname)
|
||||
Q_PROPERTY(QString ownerAddress READ ownerAddress WRITE setOwnerAddress)
|
||||
Q_PROPERTY(QDecDouble totalPrice READ totalPrice WRITE setTotalPrice)
|
||||
Q_PROPERTY(QDecDouble sale READ sale WRITE setSale)
|
||||
Q_PROPERTY(bool fixedSale READ fixedSale WRITE setFixedSale)
|
||||
Q_PROPERTY(QDecDouble totalSale READ totalSale WRITE setTotalSale)
|
||||
Q_PROPERTY(bool onVoucher READ onVoucher WRITE setOnVoucher)
|
||||
Q_PROPERTY(QString createdBy READ createdBy WRITE setCreatedBy)
|
||||
Q_PROPERTY(QString updatedBy READ updatedBy WRITE setUpdatedBy)
|
||||
Q_PROPERTY(QDateTime created READ created WRITE setCreated)
|
||||
Q_PROPERTY(QDateTime updated READ updated WRITE setUpdated)
|
||||
|
||||
public:
|
||||
explicit CampData(QObject *parent = 0);
|
||||
|
||||
int id() const;
|
||||
void setId(int id);
|
||||
|
||||
QDate start() const;
|
||||
void setStart(const QDate &start);
|
||||
|
||||
QDate end() const;
|
||||
void setEnd(const QDate &end);
|
||||
|
||||
QString ownerFirstame() const;
|
||||
void setOwnerFirstame(const QString &ownerFirstame);
|
||||
|
||||
QString ownerLastname() const;
|
||||
void setOwnerLastname(const QString &ownerLastname);
|
||||
|
||||
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);
|
||||
|
||||
QOdbList<AddressItemPtr> people() const;
|
||||
void setPeople(const QOdbList<AddressItemPtr> &people);
|
||||
void addPerson(AddressItemPtr person);
|
||||
void removePerson(AddressItemPtr person);
|
||||
|
||||
QDecDouble totalPrice() const;
|
||||
void setTotalPrice(QDecDouble totalPrice);
|
||||
|
||||
SeasonPtr season() const;
|
||||
void setSeason(const SeasonPtr &season);
|
||||
|
||||
QDecDouble sale() const;
|
||||
void setSale(QDecDouble sale);
|
||||
|
||||
bool fixedSale() const;
|
||||
void setFixedSale(bool fixedSale);
|
||||
|
||||
QString numSer() const;
|
||||
void setNumSer(const QString &numSer);
|
||||
|
||||
QDecDouble totalSale() const;
|
||||
void setTotalSale(QDecDouble totalSale);
|
||||
|
||||
QDecDouble fullPrice() const;
|
||||
void setFullPrice(QDecDouble fullPrice);
|
||||
|
||||
bool onVoucher() const;
|
||||
void setOnVoucher(bool onVoucher);
|
||||
|
||||
QString createdBy() const;
|
||||
void setCreatedBy(const QString &createdBy);
|
||||
|
||||
QString updatedBy() const;
|
||||
void setUpdatedBy(const QString &updatedBy);
|
||||
|
||||
QDateTime created() const;
|
||||
void setCreated(const QDateTime &created);
|
||||
|
||||
QDateTime updated() const;
|
||||
void setUpdated(const QDateTime &updated);
|
||||
|
||||
private:
|
||||
friend class odb::access;
|
||||
#pragma db id auto
|
||||
int 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;
|
||||
int m_fullPrice;
|
||||
int m_totalPrice;
|
||||
int m_sale;
|
||||
int m_totalSale;
|
||||
bool m_fixedSale;
|
||||
SeasonPtr m_season;
|
||||
bool m_onVoucher;
|
||||
QString m_createdBy;
|
||||
QString m_updatedBy;
|
||||
QDateTime m_created;
|
||||
QDateTime m_updated;
|
||||
};
|
||||
|
||||
#endif // CAMPDATA_H
|
||||
@@ -0,0 +1,71 @@
|
||||
#include "personprice.h"
|
||||
#include <define.h>
|
||||
|
||||
PersonPrice::PersonPrice(QObject *parent) : QObject(parent)
|
||||
{
|
||||
m_id = 0;
|
||||
m_fromAge = 0;
|
||||
m_toAge = 0;
|
||||
m_price = 0;
|
||||
m_active = true;
|
||||
}
|
||||
|
||||
int PersonPrice::id() const
|
||||
{
|
||||
return m_id;
|
||||
}
|
||||
|
||||
void PersonPrice::setId(int id)
|
||||
{
|
||||
m_id = id;
|
||||
}
|
||||
|
||||
QString PersonPrice::description() const
|
||||
{
|
||||
return m_description;
|
||||
}
|
||||
|
||||
void PersonPrice::setDescription(const QString &description)
|
||||
{
|
||||
m_description = description;
|
||||
}
|
||||
|
||||
int PersonPrice::fromAge() const
|
||||
{
|
||||
return m_fromAge;
|
||||
}
|
||||
|
||||
void PersonPrice::setFromAge(int fromAge)
|
||||
{
|
||||
m_fromAge = fromAge;
|
||||
}
|
||||
|
||||
int PersonPrice::toAge() const
|
||||
{
|
||||
return m_toAge;
|
||||
}
|
||||
|
||||
void PersonPrice::setToAge(int toAge)
|
||||
{
|
||||
m_toAge = toAge;
|
||||
}
|
||||
|
||||
QDecDouble PersonPrice::price() const
|
||||
{
|
||||
return TO_DEC(m_price);
|
||||
}
|
||||
|
||||
void PersonPrice::setPrice(QDecDouble price)
|
||||
{
|
||||
m_price = FROM_DEC(price);
|
||||
}
|
||||
|
||||
bool PersonPrice::active() const
|
||||
{
|
||||
return m_active;
|
||||
}
|
||||
|
||||
void PersonPrice::setActive(bool active)
|
||||
{
|
||||
m_active = active;
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
#ifndef PERSONPRICE_H
|
||||
#define PERSONPRICE_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QDecDouble.hh>
|
||||
#include <odb/core.hxx>
|
||||
|
||||
#pragma db object
|
||||
class PersonPrice : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(QString description READ description WRITE setDescription)
|
||||
Q_PROPERTY(int fromAge READ fromAge WRITE setFromAge)
|
||||
Q_PROPERTY(int toAge READ toAge WRITE setToAge)
|
||||
Q_PROPERTY(QDecDouble price READ price WRITE setPrice)
|
||||
Q_PROPERTY(bool active READ active WRITE setActive)
|
||||
|
||||
public:
|
||||
explicit PersonPrice(QObject *parent = 0);
|
||||
|
||||
int id() const;
|
||||
void setId(int id);
|
||||
|
||||
QString description() const;
|
||||
void setDescription(const QString &description);
|
||||
|
||||
int fromAge() const;
|
||||
void setFromAge(int fromAge);
|
||||
|
||||
int toAge() const;
|
||||
void setToAge(int toAge);
|
||||
|
||||
QDecDouble price() const;
|
||||
void setPrice(QDecDouble price);
|
||||
|
||||
bool active() const;
|
||||
void setActive(bool active);
|
||||
|
||||
private:
|
||||
friend class odb::access;
|
||||
#pragma db id auto
|
||||
int m_id;
|
||||
QString m_description;
|
||||
int m_fromAge;
|
||||
int m_toAge;
|
||||
int m_price;
|
||||
bool m_active;
|
||||
};
|
||||
|
||||
#endif // PERSONPRICE_H
|
||||
@@ -0,0 +1,66 @@
|
||||
#include "sale.h"
|
||||
#include <define.h>
|
||||
|
||||
Sale::Sale(QObject *parent) : ComboItem(parent)
|
||||
{
|
||||
m_id = 0;
|
||||
m_sale = 0;
|
||||
m_fixed = false;
|
||||
}
|
||||
|
||||
int Sale::id() const
|
||||
{
|
||||
return m_id;
|
||||
}
|
||||
|
||||
void Sale::setId(int id)
|
||||
{
|
||||
m_id = id;
|
||||
}
|
||||
|
||||
QDecDouble Sale::sale() const
|
||||
{
|
||||
return TO_DEC(m_sale);
|
||||
}
|
||||
|
||||
void Sale::setSale(QDecDouble sale)
|
||||
{
|
||||
m_sale = FROM_DEC(sale);
|
||||
}
|
||||
|
||||
bool Sale::fixed() const
|
||||
{
|
||||
return m_fixed;
|
||||
}
|
||||
|
||||
void Sale::setFixed(bool fixed)
|
||||
{
|
||||
m_fixed = fixed;
|
||||
}
|
||||
|
||||
QString Sale::description() const
|
||||
{
|
||||
return m_description;
|
||||
}
|
||||
|
||||
void Sale::setDescription(const QString &description)
|
||||
{
|
||||
m_description = description;
|
||||
}
|
||||
|
||||
bool Sale::eq(ComboItem *other)
|
||||
{
|
||||
Sale *sale = qobject_cast<Sale*>(other);
|
||||
|
||||
if (sale == NULL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return this->m_id == sale->m_id && this->m_sale == sale->m_sale && this->m_fixed == sale->m_fixed;
|
||||
}
|
||||
|
||||
QString Sale::toString()
|
||||
{
|
||||
return m_description;
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
#ifndef SALE_H
|
||||
#define SALE_H
|
||||
|
||||
#include <QObject>
|
||||
#include <odb/core.hxx>
|
||||
#include <QDecDouble.hh>
|
||||
#include <combodata.h>
|
||||
|
||||
#pragma db object
|
||||
class Sale : public ComboItem
|
||||
{
|
||||
Q_OBJECT
|
||||
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);
|
||||
|
||||
int id() const;
|
||||
void setId(int id);
|
||||
|
||||
QDecDouble sale() const;
|
||||
void setSale(QDecDouble sale);
|
||||
|
||||
bool fixed() const;
|
||||
void setFixed(bool fixed);
|
||||
|
||||
QString description() const;
|
||||
void setDescription(const QString &description);
|
||||
|
||||
private:
|
||||
friend class odb::access;
|
||||
#pragma db id auto
|
||||
int m_id;
|
||||
QString m_description;
|
||||
int m_sale;
|
||||
bool m_fixed;
|
||||
|
||||
// ComboItem interface
|
||||
public:
|
||||
bool eq(ComboItem *other);
|
||||
QString toString();
|
||||
};
|
||||
|
||||
#endif // SALE_H
|
||||
@@ -0,0 +1,122 @@
|
||||
#include "serviceitem.h"
|
||||
#include <define.h>
|
||||
|
||||
ServiceItem::ServiceItem(QObject *parent) : QObject(parent)
|
||||
{
|
||||
m_id = 0;
|
||||
m_salePossible = false;
|
||||
m_sale = 0;
|
||||
m_price = 0;
|
||||
m_totalPrice = 0;
|
||||
m_type = AccService::OTHER;
|
||||
}
|
||||
|
||||
int ServiceItem::id() const
|
||||
{
|
||||
return m_id;
|
||||
}
|
||||
|
||||
void ServiceItem::setId(int id)
|
||||
{
|
||||
m_id = id;
|
||||
}
|
||||
|
||||
QString ServiceItem::name() const
|
||||
{
|
||||
return m_name;
|
||||
}
|
||||
|
||||
void ServiceItem::setName(const QString &name)
|
||||
{
|
||||
m_name = name;
|
||||
}
|
||||
|
||||
QString ServiceItem::code() const
|
||||
{
|
||||
return m_code;
|
||||
}
|
||||
|
||||
void ServiceItem::setCode(const QString &code)
|
||||
{
|
||||
m_code = code;
|
||||
}
|
||||
|
||||
QDecDouble ServiceItem::price() const
|
||||
{
|
||||
return TO_DEC(m_price);
|
||||
}
|
||||
|
||||
void ServiceItem::setPrice(QDecDouble price)
|
||||
{
|
||||
m_price = FROM_DEC(price);
|
||||
}
|
||||
|
||||
bool ServiceItem::salePossible() const
|
||||
{
|
||||
return m_salePossible;
|
||||
}
|
||||
|
||||
void ServiceItem::setSalePossible(bool salePossible)
|
||||
{
|
||||
m_salePossible = salePossible;
|
||||
}
|
||||
|
||||
AccService::ServiceType ServiceItem::type() const
|
||||
{
|
||||
return m_type;
|
||||
}
|
||||
|
||||
void ServiceItem::setType(const AccService::ServiceType &type)
|
||||
{
|
||||
m_type = type;
|
||||
}
|
||||
|
||||
QWeakPointer<CampData> ServiceItem::campData() const
|
||||
{
|
||||
return m_campData;
|
||||
}
|
||||
|
||||
void ServiceItem::setCampData(const QWeakPointer<CampData> &campData)
|
||||
{
|
||||
m_campData = campData;
|
||||
}
|
||||
|
||||
QString ServiceItem::description() const
|
||||
{
|
||||
return m_description;
|
||||
}
|
||||
|
||||
void ServiceItem::setDescription(const QString &description)
|
||||
{
|
||||
m_description = description;
|
||||
}
|
||||
|
||||
QDecDouble ServiceItem::sale() const
|
||||
{
|
||||
return TO_DEC(m_sale);
|
||||
}
|
||||
|
||||
void ServiceItem::setSale(QDecDouble sale)
|
||||
{
|
||||
m_sale = FROM_DEC(sale);
|
||||
}
|
||||
|
||||
QDecDouble ServiceItem::totalPrice() const
|
||||
{
|
||||
return TO_DEC(m_totalPrice);
|
||||
}
|
||||
|
||||
void ServiceItem::setTotalPrice(QDecDouble totalPrice)
|
||||
{
|
||||
m_totalPrice = FROM_DEC(totalPrice);
|
||||
}
|
||||
|
||||
QDecDouble ServiceItem::fullPrice() const
|
||||
{
|
||||
return TO_DEC(m_fullPrice);
|
||||
}
|
||||
|
||||
void ServiceItem::setFullPrice(QDecDouble fullPrice)
|
||||
{
|
||||
m_fullPrice = FROM_DEC(fullPrice);
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
#ifndef SREVICEITEM_H
|
||||
#define SREVICEITEM_H
|
||||
|
||||
#include "camp-data.h"
|
||||
#include <QObject>
|
||||
#include <QSharedPointer>
|
||||
#include <QWeakPointer>
|
||||
#include <QDecDouble.hh>
|
||||
|
||||
#include <odb/core.hxx>
|
||||
#include <accservice.h>
|
||||
|
||||
class CampData;
|
||||
|
||||
#pragma db object
|
||||
class ServiceItem : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(QString name READ name WRITE setName)
|
||||
Q_PROPERTY(QString code READ code WRITE setCode)
|
||||
Q_PROPERTY(QString description READ description WRITE setDescription)
|
||||
Q_PROPERTY(QDecDouble price READ price WRITE setPrice)
|
||||
Q_PROPERTY(QDecDouble fullPrice READ fullPrice WRITE setFullPrice)
|
||||
Q_PROPERTY(QDecDouble sale READ sale WRITE setSale)
|
||||
Q_PROPERTY(QDecDouble totalPrice READ totalPrice WRITE setTotalPrice)
|
||||
Q_PROPERTY(AccService::ServiceType type READ type WRITE setType)
|
||||
Q_ENUMS(AccService::ServiceType)
|
||||
|
||||
public:
|
||||
explicit ServiceItem(QObject *parent = 0);
|
||||
|
||||
int id() const;
|
||||
void setId(int id);
|
||||
|
||||
QString name() const;
|
||||
void setName(const QString &name);
|
||||
|
||||
QString code() const;
|
||||
void setCode(const QString &code);
|
||||
|
||||
QDecDouble price() const;
|
||||
void setPrice(QDecDouble price);
|
||||
|
||||
bool salePossible() const;
|
||||
void setSalePossible(bool salePossible);
|
||||
|
||||
AccService::ServiceType type() const;
|
||||
void setType(const AccService::ServiceType &type);
|
||||
|
||||
QWeakPointer<CampData> campData() const;
|
||||
void setCampData(const QWeakPointer<CampData> &campData);
|
||||
|
||||
QString description() const;
|
||||
void setDescription(const QString &description);
|
||||
|
||||
QDecDouble sale() const;
|
||||
void setSale(QDecDouble sale);
|
||||
|
||||
QDecDouble totalPrice() const;
|
||||
void setTotalPrice(QDecDouble totalPrice);
|
||||
|
||||
QDecDouble fullPrice() const;
|
||||
void setFullPrice(QDecDouble fullPrice);
|
||||
|
||||
private:
|
||||
friend class odb::access;
|
||||
#pragma db id auto
|
||||
int m_id;
|
||||
QString m_name;
|
||||
QString m_code;
|
||||
QString m_description;
|
||||
int m_price;
|
||||
int m_fullPrice;
|
||||
int m_totalPrice;
|
||||
int m_sale;
|
||||
bool m_salePossible;
|
||||
AccService::ServiceType m_type;
|
||||
#pragma db not_null
|
||||
QWeakPointer<CampData> m_campData;
|
||||
};
|
||||
|
||||
#endif // SREVICEITEM_H
|
||||
@@ -0,0 +1,50 @@
|
||||
#include "detailwidget.h"
|
||||
#include "ui_detailwidget.h"
|
||||
|
||||
#include <QScroller>
|
||||
|
||||
#include "campservice.h"
|
||||
|
||||
DetailWidget::DetailWidget(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::DetailWidget)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
m_peopleModel = new AutoTableModel<AddressItem>(this);
|
||||
m_servicesModel = new AutoTableModel<ServiceItem>(this);
|
||||
|
||||
m_peopleModel->setTranslations(Context::instance().plugin("CAMP")->translations());
|
||||
m_servicesModel->setTranslations(Context::instance().plugin("CAMP")->translations());
|
||||
|
||||
ui->tabPeople->setModel(m_peopleModel);
|
||||
ui->tabServices->setModel(m_servicesModel);
|
||||
|
||||
ui->tabPeople->hideColumn(0);
|
||||
ui->tabPeople->hideColumn(1);
|
||||
ui->tabPeople->hideColumn(6);
|
||||
ui->tabPeople->horizontalHeader()->setSectionResizeMode(2, QHeaderView::Stretch);
|
||||
|
||||
ui->tabServices->hideColumn(1);
|
||||
ui->tabServices->hideColumn(3);
|
||||
ui->tabServices->hideColumn(7);
|
||||
ui->tabServices->horizontalHeader()->setSectionResizeMode(0, QHeaderView::Stretch);
|
||||
ui->tabServices->horizontalHeader()->setSectionResizeMode(2, QHeaderView::Stretch);
|
||||
|
||||
QScroller::grabGesture(ui->tabServices, QScroller::LeftMouseButtonGesture);
|
||||
QScroller::grabGesture(ui->tabPeople, QScroller::LeftMouseButtonGesture);
|
||||
}
|
||||
|
||||
DetailWidget::~DetailWidget()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void DetailWidget::setData(const CampDataPtr &data)
|
||||
{
|
||||
CampService srv;
|
||||
srv.loadItems(data);
|
||||
|
||||
m_peopleModel->setData(data->people());
|
||||
m_servicesModel->setData(data->services());
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
#ifndef DETAILWIDGET_H
|
||||
#define DETAILWIDGET_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <autotablemodel.h>
|
||||
#include "data/camp-data.h"
|
||||
|
||||
namespace Ui {
|
||||
class DetailWidget;
|
||||
}
|
||||
|
||||
class DetailWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit DetailWidget(QWidget *parent = 0);
|
||||
~DetailWidget();
|
||||
|
||||
void setData(const CampDataPtr &data);
|
||||
|
||||
private:
|
||||
Ui::DetailWidget *ui;
|
||||
AutoTableModel<AddressItem> *m_peopleModel;
|
||||
AutoTableModel<ServiceItem> *m_servicesModel;
|
||||
};
|
||||
|
||||
#endif // DETAILWIDGET_H
|
||||
@@ -0,0 +1,59 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>DetailWidget</class>
|
||||
<widget class="QWidget" name="DetailWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>806</width>
|
||||
<height>445</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>People</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QTableView" name="tabPeople">
|
||||
<property name="selectionMode">
|
||||
<enum>QAbstractItemView::NoSelection</enum>
|
||||
</property>
|
||||
<property name="selectionBehavior">
|
||||
<enum>QAbstractItemView::SelectRows</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_2">
|
||||
<property name="title">
|
||||
<string>Services</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="QTableView" name="tabServices">
|
||||
<property name="selectionMode">
|
||||
<enum>QAbstractItemView::NoSelection</enum>
|
||||
</property>
|
||||
<property name="selectionBehavior">
|
||||
<enum>QAbstractItemView::SelectRows</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" ?><svg clip-rule="evenodd" fill-rule="evenodd" image-rendering="optimizeQuality" shape-rendering="geometricPrecision" text-rendering="geometricPrecision" viewBox="0 0 5000 5000" xmlns="http://www.w3.org/2000/svg"><defs><style type="text/css"><![CDATA[
|
||||
.str1 {stroke:#434242;stroke-width:100}
|
||||
.str0 {stroke:#434242;stroke-width:300;stroke-linecap:round}
|
||||
.fil0 {fill:none}
|
||||
.fil1 {fill:#434242}
|
||||
.fil2 {fill:url(#id0)}
|
||||
]]></style><linearGradient gradientUnits="userSpaceOnUse" id="id0" x1="2500.01" x2="2500.01" y1="4260.19" y2="1474.81"><stop offset="0" stop-color="#008BFF"/><stop offset="1" stop-color="#0af"/></linearGradient></defs><g id="Layer_x0020_1"><path class="fil0 str0" d="M300 2000l2050-1600c100-50 200-50 300 0l2050 1500"/><path class="fil1" d="M3500 1022l600 439v-861c0-55-45-100-100-100h-400c-55 0-100 45-100 100v422z"/><path class="fil2 str1" d="M899 4700h901v-1500c0-110 90-200 200-200h900c110 0 200 90 200 200v1500h1001c165 0 300-135 300-300l-1-2000-1776-1328c-33-26-79-37-124-36s-92 14-127 40l-1773 1324-1 2000c0 165 135 300 300 300z"/></g></svg>
|
||||
|
After Width: | Height: | Size: 1.1 KiB |
@@ -0,0 +1,81 @@
|
||||
#include "campsettings.h"
|
||||
#include <define.h>
|
||||
#include <QDebug>
|
||||
|
||||
CampSettings::CampSettings(QObject *parent) : QObject(parent)
|
||||
{
|
||||
m_accFee = 0;
|
||||
m_rounding = Enums::R_MATH;
|
||||
m_decimalPlaces = 0;
|
||||
m_vatType = Enums::NONE;
|
||||
}
|
||||
|
||||
QDecDouble CampSettings::accFee() const
|
||||
{
|
||||
return TO_DEC(m_accFee);
|
||||
}
|
||||
|
||||
void CampSettings::setAccFee(QDecDouble accFee)
|
||||
{
|
||||
m_accFee = FROM_DEC(accFee);
|
||||
}
|
||||
|
||||
Enums::Rounding CampSettings::rounding() const
|
||||
{
|
||||
return m_rounding;
|
||||
}
|
||||
|
||||
void CampSettings::setRounding(const Enums::Rounding &rounding)
|
||||
{
|
||||
m_rounding = rounding;
|
||||
}
|
||||
|
||||
int CampSettings::decimalPlaces() const
|
||||
{
|
||||
return m_decimalPlaces;
|
||||
}
|
||||
|
||||
void CampSettings::setDecimalPlaces(int decimalPlaces)
|
||||
{
|
||||
m_decimalPlaces = decimalPlaces;
|
||||
}
|
||||
|
||||
int CampSettings::accFeeStartAge() const
|
||||
{
|
||||
return m_accFeeStartAge;
|
||||
}
|
||||
|
||||
void CampSettings::setAccFeeStartAge(int accFeeStartAge)
|
||||
{
|
||||
m_accFeeStartAge = accFeeStartAge;
|
||||
}
|
||||
|
||||
int CampSettings::accFeeEndAge() const
|
||||
{
|
||||
return m_accFeeEndAge;
|
||||
}
|
||||
|
||||
void CampSettings::setAccFeeEndAge(int accFeeEndAge)
|
||||
{
|
||||
m_accFeeEndAge = accFeeEndAge;
|
||||
}
|
||||
|
||||
QString CampSettings::accFeeText() const
|
||||
{
|
||||
return m_accFeeText;
|
||||
}
|
||||
|
||||
void CampSettings::setAccFeeText(const QString &accFeeText)
|
||||
{
|
||||
m_accFeeText = accFeeText;
|
||||
}
|
||||
|
||||
Enums::VatType CampSettings::vatType() const
|
||||
{
|
||||
return m_vatType;
|
||||
}
|
||||
|
||||
void CampSettings::setVatType(const Enums::VatType &vatType)
|
||||
{
|
||||
m_vatType = vatType;
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
#ifndef CAMPSETTINGS_H
|
||||
#define CAMPSETTINGS_H
|
||||
|
||||
#include <QObject>
|
||||
#include <enums.h>
|
||||
#include <QDecDouble.hh>
|
||||
#include <QSharedPointer>
|
||||
|
||||
class CampSettings : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(QDecDouble accFee READ accFee WRITE setAccFee)
|
||||
Q_PROPERTY(int accFeeStartAge READ accFeeStartAge WRITE setAccFeeStartAge)
|
||||
Q_PROPERTY(int accFeeEndAge READ accFeeEndAge WRITE setAccFeeEndAge)
|
||||
Q_PROPERTY(Enums::Rounding rounding READ rounding WRITE setRounding)
|
||||
Q_PROPERTY(Enums::VatType vatType READ vatType WRITE setVatType)
|
||||
Q_PROPERTY(int decimalPlaces READ decimalPlaces WRITE setDecimalPlaces)
|
||||
Q_PROPERTY(QString accFeeText READ accFeeText WRITE setAccFeeText)
|
||||
|
||||
public:
|
||||
explicit CampSettings(QObject *parent = 0);
|
||||
|
||||
QDecDouble accFee() const;
|
||||
void setAccFee(QDecDouble accFee);
|
||||
|
||||
Enums::Rounding rounding() const;
|
||||
void setRounding(const Enums::Rounding &rounding);
|
||||
|
||||
int decimalPlaces() const;
|
||||
void setDecimalPlaces(int decimalPlaces);
|
||||
|
||||
int accFeeStartAge() const;
|
||||
void setAccFeeStartAge(int accFeeStartAge);
|
||||
|
||||
int accFeeEndAge() const;
|
||||
void setAccFeeEndAge(int accFeeEndAge);
|
||||
|
||||
QString accFeeText() const;
|
||||
void setAccFeeText(const QString &accFeeText);
|
||||
|
||||
Enums::VatType vatType() const;
|
||||
void setVatType(const Enums::VatType &vatType);
|
||||
|
||||
private:
|
||||
int m_accFee;
|
||||
int m_accFeeStartAge;
|
||||
int m_accFeeEndAge;
|
||||
QString m_accFeeText;
|
||||
Enums::Rounding m_rounding;
|
||||
Enums::VatType m_vatType;
|
||||
int m_decimalPlaces;
|
||||
};
|
||||
|
||||
typedef QSharedPointer<CampSettings> CampSettingsPtr;
|
||||
|
||||
#endif // CAMPSETTINGS_H
|
||||
@@ -0,0 +1,181 @@
|
||||
#include "camp-odb.hxx"
|
||||
#include "campsettingsform.h"
|
||||
#include "ui_campsettingsform.h"
|
||||
|
||||
#include <settingsservice.h>
|
||||
#include <QScroller>
|
||||
#include <QMessageBox>
|
||||
|
||||
CampSettingsForm::CampSettingsForm(QWidget *parent) :
|
||||
FormBinder<CampSettings>(parent),
|
||||
ui(new Ui::CampSettingsForm)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
m_personPriceModel = new AutoTableModel<PersonPrice>();
|
||||
m_personPriceModel->setEditableCols(QList<int>() << 0 << 1 << 2 << 3);
|
||||
m_saleModel = new AutoTableModel<Sale>();
|
||||
m_saleModel->setEditableCols(QList<int>() << 0 << 1 << 2);
|
||||
|
||||
ui->tablePersonPrices->setModel(m_personPriceModel);
|
||||
ui->tableSales->setModel(m_saleModel);
|
||||
|
||||
ui->tablePersonPrices->horizontalHeader()->setSectionResizeMode(0, QHeaderView::Stretch);
|
||||
ui->tableSales->horizontalHeader()->setSectionResizeMode(0, QHeaderView::Stretch);
|
||||
|
||||
QScroller::grabGesture(ui->tablePersonPrices, QScroller::LeftMouseButtonGesture);
|
||||
QScroller::grabGesture(ui->tableSales, QScroller::LeftMouseButtonGesture);
|
||||
|
||||
connect(ui->tablePersonPrices->selectionModel(), &QItemSelectionModel::currentRowChanged, [this](){
|
||||
ui->btnPriceDisable->setEnabled(ui->tablePersonPrices->currentIndex().isValid());
|
||||
ui->btnPriceRemove->setEnabled(ui->tablePersonPrices->currentIndex().isValid());
|
||||
ui->btnPriceDisable->setChecked(m_personPriceModel->itemFromIndex(ui->tablePersonPrices->currentIndex())->active());
|
||||
});
|
||||
|
||||
connect(ui->tableSales->selectionModel(), &QItemSelectionModel::currentRowChanged, [this](){
|
||||
ui->btnSaleRemove->setEnabled(ui->tableSales->currentIndex().isValid());
|
||||
});
|
||||
|
||||
registerBinding(ui->accFee);
|
||||
registerBinding(ui->accFeeStartAge);
|
||||
registerBinding(ui->accFeeEndAge);
|
||||
registerBinding(ui->decimalPlaces);
|
||||
registerBinding(ui->accFeeText);
|
||||
QList<ComboData> roundings ;
|
||||
roundings << ComboData(Enums::R_NONE, tr("None"))
|
||||
<< ComboData(Enums::R_UP, tr("Up"))
|
||||
<< ComboData(Enums::R_DOWN, tr("Down"))
|
||||
<< ComboData(Enums::R_MATH, tr("Mathematic"));
|
||||
registerBinding(ui->rounding, roundings);
|
||||
QList<ComboData> vatTypes;
|
||||
vatTypes << ComboData(Enums::NONE, tr("None"))
|
||||
<< ComboData(Enums::HIGH, tr("High"))
|
||||
<< ComboData(Enums::FIRST_LOWER, tr("First lower"))
|
||||
<< ComboData(Enums::SECOND_LOWER, tr("Second lower"));
|
||||
registerBinding(ui->vatType, vatTypes);
|
||||
}
|
||||
|
||||
CampSettingsForm::~CampSettingsForm()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
bool CampSettingsForm::saveRecord()
|
||||
{
|
||||
bindToData();
|
||||
SettingsService srv("CAMP");
|
||||
srv.saveSettings(entity());
|
||||
|
||||
Service<PersonPrice> personSrv;
|
||||
Service<Sale> saleSrv;
|
||||
bool ret = true;
|
||||
|
||||
connect(&personSrv, &IService::dbErrorDelete, [&ret, this](QString){
|
||||
QMessageBox::critical(this, tr("Cannot delete"), tr("Price already used"));
|
||||
ret = false;
|
||||
});
|
||||
|
||||
foreach (PersonPricePtr p, personSrv.all()) {
|
||||
bool found = false;
|
||||
foreach (PersonPricePtr price, m_personPriceModel->list()) {
|
||||
if (price->id() == p->id())
|
||||
{
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!found)
|
||||
{
|
||||
personSrv.erase(p);
|
||||
}
|
||||
}
|
||||
|
||||
foreach (PersonPricePtr p, m_personPriceModel->list()) {
|
||||
bool found = false;
|
||||
foreach (PersonPricePtr price, personSrv.all()) {
|
||||
if (price->id() == p->id())
|
||||
{
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!found)
|
||||
{
|
||||
personSrv.save(p);
|
||||
}
|
||||
else
|
||||
{
|
||||
personSrv.update(p);
|
||||
}
|
||||
}
|
||||
|
||||
foreach (SalePtr s, saleSrv.all()) {
|
||||
saleSrv.erase(s);
|
||||
}
|
||||
|
||||
foreach (SalePtr s, m_saleModel->list()) {
|
||||
saleSrv.save(s);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void CampSettingsForm::loadEntity()
|
||||
{
|
||||
SettingsService srv("CAMP");
|
||||
CampSettingsPtr settings = srv.loadSettings<CampSettings>();
|
||||
setEntity(settings);
|
||||
|
||||
Service<PersonPrice> personSrv;
|
||||
Service<Sale> saleSrv;
|
||||
|
||||
m_personPriceModel->setData(personSrv.all());
|
||||
m_saleModel->setData(saleSrv.all());
|
||||
|
||||
ui->btnPriceDisable->setEnabled(false);
|
||||
ui->btnPriceRemove->setEnabled(false);
|
||||
ui->btnSaleRemove->setEnabled(false);
|
||||
}
|
||||
|
||||
void CampSettingsForm::on_btnPriceAdd_clicked()
|
||||
{
|
||||
PersonPricePtr price(new PersonPrice());
|
||||
m_personPriceModel->addRow(price);
|
||||
}
|
||||
|
||||
void CampSettingsForm::on_btnSaleAdd_clicked()
|
||||
{
|
||||
SalePtr sale(new Sale());
|
||||
m_saleModel->addRow(sale);
|
||||
}
|
||||
|
||||
void CampSettingsForm::on_btnPriceRemove_clicked()
|
||||
{
|
||||
m_personPriceModel->removeRowAt(ui->tablePersonPrices->currentIndex());
|
||||
}
|
||||
|
||||
void CampSettingsForm::on_btnPriceDisable_clicked()
|
||||
{
|
||||
PersonPricePtr price = m_personPriceModel->itemFromIndex(ui->tablePersonPrices->currentIndex());
|
||||
price->setActive(!price->active());
|
||||
}
|
||||
|
||||
void CampSettingsForm::on_btnPriceFilter_clicked()
|
||||
{
|
||||
Service<PersonPrice> srv;
|
||||
if (ui->btnPriceFilter->isChecked())
|
||||
{
|
||||
m_personPriceModel->setData(srv.all("active = 1"));
|
||||
}
|
||||
else
|
||||
{
|
||||
m_personPriceModel->setData(srv.all());
|
||||
}
|
||||
}
|
||||
|
||||
void CampSettingsForm::on_btnSaleRemove_clicked()
|
||||
{
|
||||
m_saleModel->removeRowAt(ui->tableSales->currentIndex());
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
#ifndef CAMPSETTINGSFORM_H
|
||||
#define CAMPSETTINGSFORM_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <QList>
|
||||
|
||||
#include "campsettings.h"
|
||||
#include "data/camp-data.h"
|
||||
#include <formbinder.h>
|
||||
#include <autotablemodel.h>
|
||||
|
||||
namespace Ui {
|
||||
class CampSettingsForm;
|
||||
}
|
||||
|
||||
class CampSettingsForm : public FormBinder<CampSettings>
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit CampSettingsForm(QWidget *parent = 0);
|
||||
~CampSettingsForm();
|
||||
|
||||
// IForm interface
|
||||
public slots:
|
||||
bool saveRecord();
|
||||
|
||||
// IForm interface
|
||||
public:
|
||||
void loadEntity();
|
||||
|
||||
private slots:
|
||||
void on_btnPriceAdd_clicked();
|
||||
|
||||
void on_btnSaleAdd_clicked();
|
||||
|
||||
void on_btnPriceRemove_clicked();
|
||||
|
||||
void on_btnPriceDisable_clicked();
|
||||
|
||||
void on_btnPriceFilter_clicked();
|
||||
|
||||
void on_btnSaleRemove_clicked();
|
||||
|
||||
private:
|
||||
Ui::CampSettingsForm *ui;
|
||||
AutoTableModel<PersonPrice> *m_personPriceModel;
|
||||
AutoTableModel<Sale> *m_saleModel;
|
||||
};
|
||||
|
||||
#endif // CAMPSETTINGSFORM_H
|
||||
@@ -0,0 +1,343 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>CampSettingsForm</class>
|
||||
<widget class="QWidget" name="CampSettingsForm">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>995</width>
|
||||
<height>641</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="QWidget" name="widget_3" native="true">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>Person prices</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QWidget" name="widget" native="true">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QToolButton" name="btnPriceAdd">
|
||||
<property name="toolTip">
|
||||
<string>Add</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../core/rc.qrc">
|
||||
<normaloff>:/icons/new_24x24.png</normaloff>:/icons/new_24x24.png</iconset>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="btnPriceRemove">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Remove</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../core/rc.qrc">
|
||||
<normaloff>:/icons/remove_24x24.png</normaloff>:/icons/remove_24x24.png</iconset>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="btnPriceDisable">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Deactivate</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../core/rc.qrc">
|
||||
<normaloff>:/icons/ok_24x24.png</normaloff>:/icons/ok_24x24.png</iconset>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="btnPriceFilter">
|
||||
<property name="toolTip">
|
||||
<string>Filter active</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../core/rc.qrc">
|
||||
<normaloff>:/icons/filter_24x24.png</normaloff>:/icons/filter_24x24.png</iconset>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTableView" name="tablePersonPrices">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>550</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_2">
|
||||
<property name="title">
|
||||
<string>Sales</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<widget class="QWidget" name="widget_2" native="true">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QToolButton" name="btnSaleAdd">
|
||||
<property name="toolTip">
|
||||
<string>Add</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../core/rc.qrc">
|
||||
<normaloff>:/icons/new_24x24.png</normaloff>:/icons/new_24x24.png</iconset>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="btnSaleRemove">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Remove</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../core/rc.qrc">
|
||||
<normaloff>:/icons/remove_24x24.png</normaloff>:/icons/remove_24x24.png</iconset>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTableView" name="tableSales"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_3">
|
||||
<property name="title">
|
||||
<string>Other settings</string>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Accommodation fee</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Rounding</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<widget class="QComboBox" name="rounding"/>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<widget class="QLabel" name="decimalPlaceslab">
|
||||
<property name="text">
|
||||
<string>Decimal places</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="1">
|
||||
<widget class="QDoubleSpinBox" name="decimalPlaces">
|
||||
<property name="buttonSymbols">
|
||||
<enum>QAbstractSpinBox::NoButtons</enum>
|
||||
</property>
|
||||
<property name="decimals">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>100000.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Fee start age</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QSpinBox" name="accFeeStartAge">
|
||||
<property name="buttonSymbols">
|
||||
<enum>QAbstractSpinBox::NoButtons</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QDoubleSpinBox" name="accFee">
|
||||
<property name="buttonSymbols">
|
||||
<enum>QAbstractSpinBox::NoButtons</enum>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>99999.990000000005239</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Fee end age</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QSpinBox" name="accFeeEndAge">
|
||||
<property name="buttonSymbols">
|
||||
<enum>QAbstractSpinBox::NoButtons</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>Fee description</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QLineEdit" name="accFeeText"/>
|
||||
</item>
|
||||
<item row="8" column="0">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string>Vat type</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="1">
|
||||
<widget class="QComboBox" name="vatType"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="../../core/rc.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
||||
Binary file not shown.
@@ -0,0 +1,466 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE TS>
|
||||
<TS version="2.1" language="cs_CZ">
|
||||
<context>
|
||||
<name>AddServiceDialog</name>
|
||||
<message>
|
||||
<location filename="../addservicedialog.ui" line="14"/>
|
||||
<source>Dialog</source>
|
||||
<translation>Služba</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../addservicedialog.ui" line="20"/>
|
||||
<source>Service name</source>
|
||||
<translation>Jméno služby</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../addservicedialog.ui" line="47"/>
|
||||
<source>Description</source>
|
||||
<translation>Popis</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../addservicedialog.ui" line="64"/>
|
||||
<source>Price</source>
|
||||
<translation>Cena</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>CampForm</name>
|
||||
<message>
|
||||
<location filename="../campform.ui" line="14"/>
|
||||
<source>Form</source>
|
||||
<translation>Ubytování</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>CampGrid</name>
|
||||
<message>
|
||||
<location filename="../campgrid.cpp" line="22"/>
|
||||
<source>Pay</source>
|
||||
<translation>Zaplatit</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../campgrid.cpp" line="75"/>
|
||||
<source>Can not edit</source>
|
||||
<translation>Nemohu upravit</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../campgrid.cpp" line="75"/>
|
||||
<source>This record is asociated with voucher. Can not edit paid items</source>
|
||||
<translation>Tento záznam je na účtence. Nemohu změnit položky</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../campgrid.cpp" line="97"/>
|
||||
<source>Can not delete</source>
|
||||
<translation>Nemohu smazat</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../campgrid.cpp" line="97"/>
|
||||
<source>This record is asociated with voucher. Can not delete paid items</source>
|
||||
<translation>Tento záznam je na účtence. Nemohu smazat položky</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../campgrid.cpp" line="109"/>
|
||||
<source>Can not pay</source>
|
||||
<translation>Nemohu zaplatit</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../campgrid.cpp" line="109"/>
|
||||
<source>This record is already paid</source>
|
||||
<translation>Tato položka je již zaplacena</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>CampSettingsForm</name>
|
||||
<message>
|
||||
<location filename="../settings/campsettingsform.ui" line="14"/>
|
||||
<source>Form</source>
|
||||
<translation>Nastavení ubytování</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/campsettingsform.ui" line="23"/>
|
||||
<source>Person prices</source>
|
||||
<translation>Ubytování lidí</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/campsettingsform.ui" line="44"/>
|
||||
<location filename="../settings/campsettingsform.ui" line="174"/>
|
||||
<source>Add</source>
|
||||
<translation>Nový</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/campsettingsform.ui" line="47"/>
|
||||
<location filename="../settings/campsettingsform.ui" line="67"/>
|
||||
<location filename="../settings/campsettingsform.ui" line="87"/>
|
||||
<location filename="../settings/campsettingsform.ui" line="107"/>
|
||||
<location filename="../settings/campsettingsform.ui" line="177"/>
|
||||
<location filename="../settings/campsettingsform.ui" line="197"/>
|
||||
<source>...</source>
|
||||
<translation>...</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/campsettingsform.ui" line="64"/>
|
||||
<location filename="../settings/campsettingsform.ui" line="194"/>
|
||||
<source>Remove</source>
|
||||
<translation>Odebrat</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/campsettingsform.ui" line="84"/>
|
||||
<source>Deactivate</source>
|
||||
<translation>Odstranit</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/campsettingsform.ui" line="104"/>
|
||||
<source>Filter active</source>
|
||||
<translation>Filtr</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/campsettingsform.ui" line="153"/>
|
||||
<source>Sales</source>
|
||||
<translation>Slevy</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/campsettingsform.ui" line="236"/>
|
||||
<source>Other settings</source>
|
||||
<translation>Ostatní nastavení</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/campsettingsform.ui" line="242"/>
|
||||
<source>Accommodation fee</source>
|
||||
<translation>Rekreační poplatek</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/campsettingsform.ui" line="249"/>
|
||||
<source>Rounding</source>
|
||||
<translation>Zaokrouhlování</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/campsettingsform.ui" line="259"/>
|
||||
<source>Decimal places</source>
|
||||
<translation>Desetinných míst</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/campsettingsform.ui" line="279"/>
|
||||
<source>Fee start age</source>
|
||||
<translation>Poplatek od věku</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/campsettingsform.ui" line="303"/>
|
||||
<source>Fee end age</source>
|
||||
<translation>Poplatek do věku</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/campsettingsform.ui" line="317"/>
|
||||
<source>Fee description</source>
|
||||
<translation>Název na dokladu</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/campsettingsform.cpp" line="45"/>
|
||||
<source>None</source>
|
||||
<translation>Žádné</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/campsettingsform.cpp" line="46"/>
|
||||
<source>Up</source>
|
||||
<translation>Nahoru</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/campsettingsform.cpp" line="47"/>
|
||||
<source>Down</source>
|
||||
<translation>Dolu</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/campsettingsform.cpp" line="48"/>
|
||||
<source>Mathematic</source>
|
||||
<translation>Matematické</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/campsettingsform.cpp" line="68"/>
|
||||
<source>Cannot delete</source>
|
||||
<translation>Nelze smazat</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/campsettingsform.cpp" line="68"/>
|
||||
<source>Price already used</source>
|
||||
<translation>Cena je používána</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>CampWizard</name>
|
||||
<message>
|
||||
<location filename="../campwizard.ui" line="17"/>
|
||||
<source>Camp record</source>
|
||||
<translation>Nové ubytování</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../campwizard.ui" line="37"/>
|
||||
<source>From</source>
|
||||
<translation>Od</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../campwizard.ui" line="44"/>
|
||||
<location filename="../campwizard.ui" line="61"/>
|
||||
<source>d. M. yyyy</source>
|
||||
<translation></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../campwizard.ui" line="54"/>
|
||||
<source>To</source>
|
||||
<translation>Do</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../campwizard.ui" line="87"/>
|
||||
<source>People</source>
|
||||
<translation>Ubytovaný</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../campwizard.ui" line="102"/>
|
||||
<source>Existing address</source>
|
||||
<translation>Existující adresa</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../campwizard.ui" line="109"/>
|
||||
<source>Add</source>
|
||||
<translation>Přidat</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>New address</source>
|
||||
<translation type="vanished">Nová adresa</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../campwizard.ui" line="132"/>
|
||||
<source>&New address</source>
|
||||
<translation>&Nová adresa</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../campwizard.ui" line="144"/>
|
||||
<source>Title</source>
|
||||
<translation>Titul</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../campwizard.ui" line="154"/>
|
||||
<source>First name</source>
|
||||
<translation>Křestní jméno</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../campwizard.ui" line="164"/>
|
||||
<source>Last name</source>
|
||||
<translation>Příjmení</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../campwizard.ui" line="174"/>
|
||||
<source>Date of birth</source>
|
||||
<translation>Datum narození</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../campwizard.ui" line="181"/>
|
||||
<source>d. MM. yyyy</source>
|
||||
<translation></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../campwizard.ui" line="191"/>
|
||||
<source>ID card</source>
|
||||
<translation>Číslo dokladu</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../campwizard.ui" line="201"/>
|
||||
<source>ZTP</source>
|
||||
<translation>ZTP</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../campwizard.ui" line="208"/>
|
||||
<source>Street</source>
|
||||
<translation>Ulice</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../campwizard.ui" line="218"/>
|
||||
<source>House number</source>
|
||||
<translation>Číslo popisné</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../campwizard.ui" line="228"/>
|
||||
<source>ZIP code</source>
|
||||
<translation>PSČ</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../campwizard.ui" line="238"/>
|
||||
<source>City</source>
|
||||
<translation>Město</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../campwizard.ui" line="248"/>
|
||||
<source>Country</source>
|
||||
<translation>Stát</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../campwizard.ui" line="333"/>
|
||||
<source>Remove</source>
|
||||
<translation>Odebrat</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../campwizard.ui" line="336"/>
|
||||
<location filename="../campwizard.ui" line="362"/>
|
||||
<location filename="../campwizard.ui" line="462"/>
|
||||
<location filename="../campwizard.ui" line="485"/>
|
||||
<source>...</source>
|
||||
<translation>...</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../campwizard.ui" line="359"/>
|
||||
<source>Owner</source>
|
||||
<translation>Vlastník</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../campwizard.ui" line="427"/>
|
||||
<source>Services</source>
|
||||
<translation>Služby</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../campwizard.ui" line="534"/>
|
||||
<source>Sale</source>
|
||||
<translation>Sleva</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../campwizard.cpp" line="385"/>
|
||||
<source>Apply sale</source>
|
||||
<translation>Uplatnit slevu</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../campwizard.ui" line="609"/>
|
||||
<source>Summary</source>
|
||||
<translation>Shrnutí</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../campwizard.ui" line="627"/>
|
||||
<source>From:</source>
|
||||
<translation>Od:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../campwizard.ui" line="579"/>
|
||||
<location filename="../campwizard.ui" line="634"/>
|
||||
<location filename="../campwizard.ui" line="648"/>
|
||||
<location filename="../campwizard.ui" line="690"/>
|
||||
<location filename="../campwizard.ui" line="732"/>
|
||||
<source>TextLabel</source>
|
||||
<translation></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../campwizard.ui" line="540"/>
|
||||
<location filename="../campwizard.cpp" line="390"/>
|
||||
<source>Change</source>
|
||||
<translation>Změnit</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../campwizard.ui" line="641"/>
|
||||
<source>To:</source>
|
||||
<translation>Do:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../campwizard.ui" line="683"/>
|
||||
<source>Days:</source>
|
||||
<translation>Počet dní:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../campwizard.ui" line="725"/>
|
||||
<source>Owner:</source>
|
||||
<translation>Vlastník:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../campwizard.ui" line="755"/>
|
||||
<source>People:</source>
|
||||
<translation>Ubytovaní:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../campwizard.ui" line="765"/>
|
||||
<source>Services:</source>
|
||||
<translation>Služby:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../campwizard.ui" line="778"/>
|
||||
<source>Sale:</source>
|
||||
<translation>Sleva:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../campwizard.ui" line="791"/>
|
||||
<source>Total:</source>
|
||||
<translation>Celkem:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../campwizard.ui" line="848"/>
|
||||
<source>Print</source>
|
||||
<translation>Tisk</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../campwizard.cpp" line="232"/>
|
||||
<source>Fixed amound</source>
|
||||
<translation>Pevná částka</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../campwizard.cpp" line="232"/>
|
||||
<source>%</source>
|
||||
<translation>%</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../campwizard.cpp" line="400"/>
|
||||
<location filename="../campwizard.cpp" line="406"/>
|
||||
<location filename="../campwizard.cpp" line="412"/>
|
||||
<source>Error</source>
|
||||
<translation>Chyba</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../campwizard.cpp" line="400"/>
|
||||
<source>Add people.</source>
|
||||
<translation>Přidání lidí.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../campwizard.cpp" line="406"/>
|
||||
<source>Start date is after or equals end date.</source>
|
||||
<translation>Datum začátku je stejné nebo menší než datum konce.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../campwizard.cpp" line="412"/>
|
||||
<source>Add service.</source>
|
||||
<translation>Přidat službu.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../campwizard.cpp" line="425"/>
|
||||
<location filename="../campwizard.cpp" line="460"/>
|
||||
<source>Database error</source>
|
||||
<translation>Chyba databáze</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../campwizard.cpp" line="430"/>
|
||||
<location filename="../campwizard.cpp" line="465"/>
|
||||
<source>Permission denied</source>
|
||||
<translation>Nedostatečná oprávnění</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../campwizard.cpp" line="451"/>
|
||||
<source>Save record?</source>
|
||||
<translation>Uložit záznam?</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../campwizard.cpp" line="451"/>
|
||||
<source>Record must be saved before print. Do you want to save record?</source>
|
||||
<translation>Záznam musí být před tiskem uložen. Chcete jej uložit?</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>DetailWidget</name>
|
||||
<message>
|
||||
<location filename="../detailwidget.ui" line="14"/>
|
||||
<source>Form</source>
|
||||
<translation>Detail ubytování</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../detailwidget.ui" line="20"/>
|
||||
<source>People</source>
|
||||
<translation>Ubytovaný</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../detailwidget.ui" line="39"/>
|
||||
<source>Services</source>
|
||||
<translation>Služby</translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
||||
@@ -43,7 +43,7 @@ CREATE TABLE \"CommodityData\" (
|
||||
},
|
||||
|
||||
"reports" : [
|
||||
{ "name" : "Ceník", "description" : "Všechny položky v ceníku", "listReport" : true, "file" : "pokus.lrxml" },
|
||||
{ "name" : "Nezpalcené účtenky", "description" : "Všechny nezaplacené účtenky", "listReport" : true, "file" : "pokus.lrxml" }
|
||||
{ "name" : "Ceník", "description" : "Všechny položky v ceníku", "listReport" : true, "file" : "commodity_pricelist.lrxml" },
|
||||
{ "name" : "Všechny položky", "description" : "Všechny položky zboží", "listReport" : true, "file" : "commodity_all_commodities.lrxml" }
|
||||
]
|
||||
}
|
||||
|
||||
@@ -20,7 +20,8 @@ SOURCES += commodity.cpp \
|
||||
commodityform.cpp \
|
||||
commoditygrid.cpp \
|
||||
commoditysettingsform.cpp \
|
||||
commodityservice.cpp
|
||||
commodityservice.cpp \
|
||||
settings/commoditysettings.cpp
|
||||
|
||||
HEADERS += commodity.h\
|
||||
commodity_global.h \
|
||||
@@ -31,7 +32,8 @@ HEADERS += commodity.h\
|
||||
commodityform.h \
|
||||
commoditygrid.h \
|
||||
commoditysettingsform.h \
|
||||
commodityservice.h
|
||||
commodityservice.h \
|
||||
settings/commoditysettings.h
|
||||
|
||||
include(../config_plugin.pri)
|
||||
|
||||
|
||||
@@ -1,8 +1,12 @@
|
||||
#include "commodityform.h"
|
||||
#include "ui_commodityform.h"
|
||||
#include <combodata.h>
|
||||
#include <settingsservice.h>
|
||||
#include <settings/commoditysettings.h>
|
||||
#include <helper.h>
|
||||
|
||||
#include <QSharedPointer>
|
||||
#include <qlist.h>
|
||||
#include <QList>
|
||||
#include "data/commoditytypedata.h"
|
||||
|
||||
CommodityForm::CommodityForm(QWidget *parent) :
|
||||
@@ -21,6 +25,8 @@ CommodityForm::CommodityForm(QWidget *parent) :
|
||||
<< ComboData(Enums::SECOND_LOWER,tr("Second Lower"));
|
||||
registerBinding(ui->vat, vt);
|
||||
registerBinding(ui->count);
|
||||
|
||||
m_codeAsNumber = false;
|
||||
}
|
||||
|
||||
CommodityForm::~CommodityForm()
|
||||
@@ -33,3 +39,19 @@ void CommodityForm::registerCombos()
|
||||
Service<CommodityTypeData> srvComTypes;
|
||||
registerBinding(ui->type, ComboData::createComboData(srvComTypes.all()));
|
||||
}
|
||||
|
||||
void CommodityForm::onShow()
|
||||
{
|
||||
SettingsService srv("COMMODITY");
|
||||
CommoditySettingsPtr settings = srv.loadSettings<CommoditySettings>();
|
||||
|
||||
m_codeAsNumber = settings->codeAsNumber();
|
||||
}
|
||||
|
||||
void CommodityForm::on_code_textChanged(const QString &text)
|
||||
{
|
||||
if (m_codeAsNumber)
|
||||
{
|
||||
ui->code->setText(Helper::replaceByNumbers(text));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,9 +21,14 @@ public:
|
||||
private:
|
||||
Ui::CommodityForm *ui;
|
||||
|
||||
bool m_codeAsNumber;
|
||||
|
||||
// FormBinder interface
|
||||
protected:
|
||||
void registerCombos();
|
||||
void onShow();
|
||||
private slots:
|
||||
void on_code_textChanged(const QString &text);
|
||||
};
|
||||
|
||||
#endif // COMMODITYFORM_H
|
||||
|
||||
@@ -29,3 +29,19 @@ void CommodityService::addedToVoucher(int itemId, int countAdded)
|
||||
|
||||
update(commodity);
|
||||
}
|
||||
|
||||
ShopItemPtr CommodityService::shopItem(int itemId)
|
||||
{
|
||||
CommodityDataPtr item = this->loadById(itemId);
|
||||
return qSharedPointerDynamicCast<ShopItem, CommodityData>(item);
|
||||
}
|
||||
|
||||
ISeller *CommodityService::seller()
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
QString CommodityService::defaultSort()
|
||||
{
|
||||
return "name";
|
||||
}
|
||||
|
||||
@@ -12,8 +12,11 @@ public:
|
||||
|
||||
// ISellableService interface
|
||||
public:
|
||||
QList<QSharedPointer<ShopItem> > shopItems() override;
|
||||
QList<ShopItemPtr> shopItems() override;
|
||||
void addedToVoucher(int itemId, int countAdded) override;
|
||||
virtual ShopItemPtr shopItem(int itemId) override;
|
||||
ISeller *seller() override;
|
||||
QString defaultSort() override;
|
||||
};
|
||||
|
||||
#endif // COMMODITYSERVICE_H
|
||||
|
||||
@@ -1,16 +1,21 @@
|
||||
#include "commoditysettingsform.h"
|
||||
#include "ui_commoditysettingsform.h"
|
||||
#include <service.h>
|
||||
#include <settingsservice.h>
|
||||
#include "commodity-odb.hxx"
|
||||
|
||||
CommoditySettingsForm::CommoditySettingsForm(QWidget *parent) :
|
||||
IForm(parent),
|
||||
FormBinder<CommoditySettings>(parent),
|
||||
ui(new Ui::CommoditySettingsForm)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
registerBinding(ui->codeAsNumber);
|
||||
|
||||
m_table = new AutoTableModel<CommodityTypeData>();
|
||||
m_table->setEditableCols(QList<int>() << 0);
|
||||
ui->commodityTypesTable->setModel(m_table);
|
||||
ui->commodityTypesTable->horizontalHeader()->setSectionResizeMode(0, QHeaderView::Stretch);
|
||||
}
|
||||
|
||||
CommoditySettingsForm::~CommoditySettingsForm()
|
||||
@@ -20,12 +25,20 @@ CommoditySettingsForm::~CommoditySettingsForm()
|
||||
|
||||
void CommoditySettingsForm::loadEntity()
|
||||
{
|
||||
SettingsService srv("COMMODITY");
|
||||
CommoditySettingsPtr settings = srv.loadSettings<CommoditySettings>();
|
||||
setEntity(settings);
|
||||
|
||||
Service<CommodityTypeData> commodityService;
|
||||
m_table->setData(commodityService.all());
|
||||
}
|
||||
|
||||
bool CommoditySettingsForm::saveRecord()
|
||||
{
|
||||
bindToData();
|
||||
SettingsService srv("COMMODITY");
|
||||
srv.saveSettings(entity());
|
||||
|
||||
Service<CommodityTypeData> commodityService;
|
||||
foreach (QSharedPointer<CommodityTypeData> item, m_table->list())
|
||||
{
|
||||
|
||||
@@ -2,15 +2,16 @@
|
||||
#define COMMODITYSETTINGSFORM_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <iform.h>
|
||||
#include <formbinder.h>
|
||||
#include "data/commoditytypedata.h"
|
||||
#include "settings/commoditysettings.h"
|
||||
#include <autotablemodel.h>
|
||||
|
||||
namespace Ui {
|
||||
class CommoditySettingsForm;
|
||||
}
|
||||
|
||||
class CommoditySettingsForm : public IForm
|
||||
class CommoditySettingsForm : public FormBinder<CommoditySettings>
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
<width>550</width>
|
||||
<height>358</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@@ -17,39 +17,92 @@
|
||||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
|
||||
</property>
|
||||
<item row="0" column="1">
|
||||
<item row="1" column="1">
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>Commodity types</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QWidget" name="widget" native="true">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QToolButton" name="addCommodityType">
|
||||
<property name="toolTip">
|
||||
<string>Add type</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>+</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../core/rc.qrc">
|
||||
<normaloff>:/icons/new.svg</normaloff>:/icons/new.svg</iconset>
|
||||
<normaloff>:/icons/new_24x24.png</normaloff>:/icons/new_24x24.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="delCommodityType">
|
||||
<property name="toolTip">
|
||||
<string>Remove type</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>-</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../core/rc.qrc">
|
||||
<normaloff>:/icons/remove.svg</normaloff>:/icons/remove.svg</iconset>
|
||||
<normaloff>:/icons/remove_24x24.png</normaloff>:/icons/remove_24x24.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<item>
|
||||
<widget class="QTableView" name="commodityTypesTable"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QCheckBox" name="codeAsNumber">
|
||||
<property name="text">
|
||||
<string>Code is number allways</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="../core/rc.qrc"/>
|
||||
</resources>
|
||||
|
||||
@@ -26,7 +26,7 @@ void CommodityData::setName(const QString &name)
|
||||
{
|
||||
m_name = name;
|
||||
}
|
||||
QString CommodityData::shortName() const
|
||||
QString CommodityData::shortName()
|
||||
{
|
||||
return m_shortName;
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ public:
|
||||
QString name() override;
|
||||
void setName(const QString &name);
|
||||
|
||||
QString shortName() const;
|
||||
QString shortName() override;
|
||||
void setShortName(const QString &shortName);
|
||||
|
||||
QString code() const;
|
||||
@@ -68,4 +68,6 @@ public:
|
||||
QString pluginId() override;
|
||||
};
|
||||
|
||||
typedef QSharedPointer<CommodityData> CommodityDataPtr;
|
||||
|
||||
#endif // COMMODITYDATA_H
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
#include "commoditysettings.h"
|
||||
|
||||
CommoditySettings::CommoditySettings(QObject *parent) : QObject(parent)
|
||||
{
|
||||
m_codeAsNumber = false;
|
||||
}
|
||||
|
||||
bool CommoditySettings::codeAsNumber() const
|
||||
{
|
||||
return m_codeAsNumber;
|
||||
}
|
||||
|
||||
void CommoditySettings::setCodeAsNumber(bool codeAsNumber)
|
||||
{
|
||||
m_codeAsNumber = codeAsNumber;
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
#ifndef COMMODITYSETTINGS_H
|
||||
#define COMMODITYSETTINGS_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QSharedPointer>
|
||||
|
||||
class CommoditySettings : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(bool codeAsNumber READ codeAsNumber WRITE setCodeAsNumber)
|
||||
|
||||
public:
|
||||
explicit CommoditySettings(QObject *parent = 0);
|
||||
|
||||
bool codeAsNumber() const;
|
||||
void setCodeAsNumber(bool codeAsNumber);
|
||||
|
||||
private:
|
||||
bool m_codeAsNumber;
|
||||
};
|
||||
|
||||
typedef QSharedPointer<CommoditySettings> CommoditySettingsPtr;
|
||||
|
||||
#endif // COMMODITYSETTINGS_H
|
||||
Binary file not shown.
@@ -44,22 +44,22 @@
|
||||
<translation>Počet</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../commodityform.cpp" line="18"/>
|
||||
<location filename="../commodityform.cpp" line="22"/>
|
||||
<source>None</source>
|
||||
<translation>Žádná</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../commodityform.cpp" line="19"/>
|
||||
<location filename="../commodityform.cpp" line="23"/>
|
||||
<source>High</source>
|
||||
<translation>Vysoká</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../commodityform.cpp" line="20"/>
|
||||
<location filename="../commodityform.cpp" line="24"/>
|
||||
<source>First Lower</source>
|
||||
<translation>První snížená</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../commodityform.cpp" line="21"/>
|
||||
<location filename="../commodityform.cpp" line="25"/>
|
||||
<source>Second Lower</source>
|
||||
<translation>Druhá snížená</translation>
|
||||
</message>
|
||||
@@ -72,14 +72,34 @@
|
||||
<translation></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../commoditysettingsform.ui" line="26"/>
|
||||
<location filename="../commoditysettingsform.ui" line="23"/>
|
||||
<source>Commodity types</source>
|
||||
<translation>Druhy zboží</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../commoditysettingsform.ui" line="32"/>
|
||||
<source>Add type</source>
|
||||
<translation>Přidat druh zboží</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../commoditysettingsform.ui" line="35"/>
|
||||
<source>+</source>
|
||||
<translation>+</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../commoditysettingsform.ui" line="37"/>
|
||||
<location filename="../commoditysettingsform.ui" line="55"/>
|
||||
<source>Remove type</source>
|
||||
<translation>Odebrat druh zboží</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../commoditysettingsform.ui" line="58"/>
|
||||
<source>-</source>
|
||||
<translation>-</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../commoditysettingsform.ui" line="100"/>
|
||||
<source>Code is number allways</source>
|
||||
<translation>Kód zboží je vždy číslo</translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
||||
|
||||
@@ -17,6 +17,7 @@ else:win32:CONFIG(debug, debug|release): LIBS += -L$$OUT_PWD/../core/debug/ -lco
|
||||
else:unix: LIBS += -L$$OUT_PWD/../core/ -lcore
|
||||
|
||||
INCLUDEPATH += $$PWD/core
|
||||
INCLUDEPATH += $$PWD/core/data
|
||||
DEPENDPATH += $$PWD/core
|
||||
|
||||
win32:CONFIG(release, debug|release): LIBS += -L$$OUT_PWD/../qdecimal/lib/ -lqdecimal -ldecnumber
|
||||
|
||||
+28
-2
@@ -6,6 +6,7 @@
|
||||
#include <QMetaProperty>
|
||||
#include <QModelIndex>
|
||||
#include <QDebug>
|
||||
#include <QDecDouble.hh>
|
||||
|
||||
#include "../qdecimal/src/QDecDouble.hh"
|
||||
|
||||
@@ -151,7 +152,7 @@ public:
|
||||
const char *prop = rawEntity->metaObject()->property(column + 1).name();
|
||||
|
||||
std::sort(ALL(m_list), [prop, order](QSharedPointer<T> entA, QSharedPointer<T> entB) -> bool {
|
||||
if (order == Qt::AscendingOrder) {
|
||||
if (order == Qt::DescendingOrder) {
|
||||
return ((QObject*)entA.data())->property(prop) < ((QObject*)entB.data())->property(prop);
|
||||
} else {
|
||||
return ((QObject*)entB.data())->property(prop) < ((QObject*)entA.data())->property(prop);
|
||||
@@ -220,6 +221,24 @@ public:
|
||||
return ret;
|
||||
}
|
||||
|
||||
void setSelectAll(bool select) {
|
||||
if (!m_checkboxSelect) {
|
||||
return;
|
||||
}
|
||||
|
||||
beginResetModel();
|
||||
m_selectedRows.clear();
|
||||
|
||||
if (select)
|
||||
{
|
||||
for (int i = 0; i < rowCount(); i++)
|
||||
{
|
||||
m_selectedRows << i;
|
||||
}
|
||||
}
|
||||
endResetModel();
|
||||
}
|
||||
|
||||
protected:
|
||||
void handleFilter(const QString &filter) override
|
||||
{
|
||||
@@ -264,7 +283,14 @@ public:
|
||||
QSharedPointer<T> entity = m_list.at(index.row());
|
||||
QObject *rawEntity = (QObject*)entity.data();
|
||||
|
||||
rawEntity->setProperty(rawEntity->metaObject()->property(index.column() + 1).name(), value);
|
||||
QVariant val = value;
|
||||
if (rawEntity->property(rawEntity->metaObject()->property(index.column() + 1).name()).canConvert<QDecDouble>())
|
||||
{
|
||||
QDecDouble dec(val.toDouble());
|
||||
val = QVariant::fromValue(dec);
|
||||
}
|
||||
|
||||
rawEntity->setProperty(rawEntity->metaObject()->property(index.column() + 1).name(), val);
|
||||
}
|
||||
|
||||
if (role == Qt::CheckStateRole)
|
||||
|
||||
+1
-1
@@ -61,8 +61,8 @@ void Context::loadPlugins()
|
||||
if (p != NULL) {
|
||||
IPlugin *plugin = qobject_cast<IPlugin*>(p);
|
||||
if (plugin != NULL) {
|
||||
plugin->init(pluginLoader.metaData());
|
||||
m_plugins.append(plugin);
|
||||
plugin->init(pluginLoader.metaData());
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -13,5 +13,7 @@
|
||||
#include "settingsform.h"
|
||||
#include "enums.h"
|
||||
#include "objectbinder.h"
|
||||
#include "helper.h"
|
||||
#include "idashboardwidget.h"
|
||||
|
||||
#endif // CORE_H
|
||||
|
||||
+18
-3
@@ -62,7 +62,12 @@ SOURCES += \
|
||||
settings/seasonnamedialog.cpp \
|
||||
reporting/report.cpp \
|
||||
reporting/reportviewer.cpp \
|
||||
reporting/reportdialog.cpp
|
||||
reporting/reportdialog.cpp \
|
||||
csvimporter.cpp \
|
||||
importdialog.cpp \
|
||||
importprogress.cpp \
|
||||
reporting/variablefiller.cpp \
|
||||
helper.cpp
|
||||
|
||||
HEADERS += core.h\
|
||||
core_global.h \
|
||||
@@ -122,7 +127,15 @@ HEADERS += core.h\
|
||||
settings/seasonnamedialog.h \
|
||||
reporting/report.h \
|
||||
reporting/reportviewer.h \
|
||||
reporting/reportdialog.h
|
||||
reporting/reportdialog.h \
|
||||
iimporter.h \
|
||||
csvimporter.h \
|
||||
iimportprogress.h \
|
||||
importdialog.h \
|
||||
importprogress.h \
|
||||
reporting/variablefiller.h \
|
||||
helper.h \
|
||||
idashboardwidget.h
|
||||
|
||||
unix {
|
||||
target.path = /usr/lib
|
||||
@@ -157,7 +170,9 @@ FORMS += \
|
||||
settings/globalsettingsform.ui \
|
||||
settings/seasonnamedialog.ui \
|
||||
reporting/reportviewer.ui \
|
||||
reporting/reportdialog.ui
|
||||
reporting/reportdialog.ui \
|
||||
importdialog.ui \
|
||||
importprogress.ui
|
||||
|
||||
OTHER_FILES += \
|
||||
users/metaData.json \
|
||||
|
||||
@@ -0,0 +1,93 @@
|
||||
#include "csvimporter.h"
|
||||
#include <QFile>
|
||||
#include <QVariant>
|
||||
|
||||
CsvImporter::CsvImporter(const QMetaObject *metaObject, QObject *parent)
|
||||
:QObject(parent),
|
||||
IImporter(metaObject)
|
||||
{
|
||||
m_parsed = false;
|
||||
m_currentRec = 1;
|
||||
m_error = false;
|
||||
}
|
||||
|
||||
void CsvImporter::setImportFile(const QString &fileName)
|
||||
{
|
||||
m_fileName = fileName;
|
||||
}
|
||||
|
||||
int CsvImporter::recordCount()
|
||||
{
|
||||
if (!m_parsed)
|
||||
{
|
||||
parseFile();
|
||||
}
|
||||
|
||||
return m_lines.count() - 1;
|
||||
}
|
||||
|
||||
QSharedPointer<QObject> CsvImporter::nextRecord()
|
||||
{
|
||||
if (!m_parsed)
|
||||
{
|
||||
parseFile();
|
||||
}
|
||||
|
||||
QObject *entity = m_metaObject->newInstance();
|
||||
|
||||
if (entity == NULL || m_currentRec > recordCount())
|
||||
{
|
||||
++m_currentRec;
|
||||
return QSharedPointer<QObject>();
|
||||
}
|
||||
|
||||
QStringList props = m_header.split(m_separator);
|
||||
QString line = m_lines[m_currentRec];
|
||||
QStringList values = line.split(m_separator);
|
||||
|
||||
for (int i = 0; i < props.size(); i++) {
|
||||
QString property = props[i];
|
||||
QString value = values[i];
|
||||
if (!entity->setProperty(property.toStdString().c_str(), QVariant(value)))
|
||||
{
|
||||
m_error = true;
|
||||
emit noSuchProperty(property);
|
||||
|
||||
++m_currentRec;
|
||||
return QSharedPointer<QObject>();
|
||||
}
|
||||
}
|
||||
|
||||
++m_currentRec;
|
||||
|
||||
return QSharedPointer<QObject>(entity);
|
||||
}
|
||||
|
||||
bool CsvImporter::isError()
|
||||
{
|
||||
return m_error;
|
||||
}
|
||||
|
||||
void CsvImporter::parseFile()
|
||||
{
|
||||
QFile file(m_fileName);
|
||||
|
||||
if (!file.open(QFile::ReadOnly | QFile::Text))
|
||||
{
|
||||
m_error = true;
|
||||
emit parseError();
|
||||
return;
|
||||
}
|
||||
|
||||
QByteArray data = file.readAll();
|
||||
QString strData(data);
|
||||
|
||||
m_lines = strData.split("\n");
|
||||
m_header = m_lines[0];
|
||||
m_parsed = true;
|
||||
}
|
||||
|
||||
void CsvImporter::setSeparator(const QString &separator)
|
||||
{
|
||||
m_separator = separator;
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
#ifndef CSVIMPORTER_H
|
||||
#define CSVIMPORTER_H
|
||||
|
||||
#include "iimporter.h"
|
||||
#include <QStringList>
|
||||
#include <QObject>
|
||||
|
||||
class CORESHARED_EXPORT CsvImporter : public QObject, public IImporter
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit CsvImporter(const QMetaObject *metaObject, QObject *parent = NULL);
|
||||
|
||||
// IImporter interface
|
||||
public:
|
||||
void setImportFile(const QString &fileName);
|
||||
int recordCount();
|
||||
QSharedPointer<QObject> nextRecord();
|
||||
bool isError();
|
||||
|
||||
void setSeparator(const QString &separator);
|
||||
|
||||
signals:
|
||||
void parseError();
|
||||
void noSuchProperty(QString propName);
|
||||
|
||||
private:
|
||||
void parseFile();
|
||||
|
||||
QString m_header;
|
||||
QString m_separator;
|
||||
QString m_fileName;
|
||||
QStringList m_lines;
|
||||
bool m_parsed;
|
||||
bool m_error;
|
||||
int m_currentRec;
|
||||
};
|
||||
|
||||
#endif // CSVIMPORTER_H
|
||||
@@ -5,6 +5,11 @@ System::System()
|
||||
|
||||
}
|
||||
|
||||
System::~System()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
int System::id() const
|
||||
{
|
||||
return m_id;
|
||||
|
||||
@@ -11,6 +11,7 @@ class CORESHARED_EXPORT System
|
||||
{
|
||||
public:
|
||||
System();
|
||||
virtual ~System();
|
||||
|
||||
int id() const;
|
||||
void setId(int id);
|
||||
|
||||
@@ -16,6 +16,7 @@ DefaultFormHandler::~DefaultFormHandler()
|
||||
|
||||
void DefaultFormHandler::showForm(IForm *formWidget)
|
||||
{
|
||||
formWidget->onShow();
|
||||
m_dialog->setForm(formWidget);
|
||||
m_dialog->setModal(true);
|
||||
m_dialog->move(QApplication::desktop()->screen()->rect().center() - m_dialog->rect().center());
|
||||
|
||||
+2
-2
@@ -10,8 +10,8 @@
|
||||
#define PERM_DELETE "DELETE"
|
||||
|
||||
#define DEC_MULTIPLE 100
|
||||
#define TO_DEC(num) QDecDouble((double)num / DEC_MULTIPLE)
|
||||
#define FROM_DEC(num) num.toDouble() * DEC_MULTIPLE
|
||||
#define TO_DEC(num) (QDecDouble(num) / QDecDouble(DEC_MULTIPLE))
|
||||
#define FROM_DEC(num) (num * QDecDouble(DEC_MULTIPLE)).toInt32()
|
||||
|
||||
#ifndef PLUGIN_ROOT
|
||||
#ifdef _WIN32
|
||||
|
||||
@@ -9,6 +9,7 @@ class CORESHARED_EXPORT Enums : public QObject
|
||||
Q_OBJECT
|
||||
|
||||
Q_ENUMS(VatType)
|
||||
Q_ENUMS(Rounding)
|
||||
public:
|
||||
|
||||
enum VatType
|
||||
@@ -19,6 +20,14 @@ public:
|
||||
SECOND_LOWER
|
||||
};
|
||||
|
||||
enum Rounding
|
||||
{
|
||||
R_NONE,
|
||||
R_UP,
|
||||
R_DOWN,
|
||||
R_MATH
|
||||
};
|
||||
|
||||
Enums()
|
||||
{
|
||||
}
|
||||
|
||||
@@ -63,8 +63,14 @@ bool ExprEvaluator::evaluate(QObject *object, const QString &exp)
|
||||
QString oper;
|
||||
QVariant cond;
|
||||
parseExpr(exp, value, oper, cond, object);
|
||||
|
||||
if (cond.isValid())
|
||||
{
|
||||
return m_operations[oper](value, cond);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
void ExprEvaluator::setCaseSensitive(bool caseSensitive)
|
||||
@@ -87,6 +93,10 @@ void ExprEvaluator::parseExpr(const QString &exp, QVariant &value, QString &oper
|
||||
QStringList expCat = exp.trimmed().split(" ");
|
||||
value = object->property(expCat[0].toStdString().c_str());
|
||||
oper = expCat[1];
|
||||
|
||||
if (expCat.size() > 2)
|
||||
{
|
||||
condition = expCat[2].replace("%20", " ");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+141
-6
@@ -5,6 +5,8 @@
|
||||
#include <QMessageBox>
|
||||
#include <QHeaderView>
|
||||
#include <QLayout>
|
||||
#include <QToolButton>
|
||||
#include <QDesktopWidget>
|
||||
|
||||
#include "autoform.h"
|
||||
#include "autotablemodel.h"
|
||||
@@ -12,6 +14,9 @@
|
||||
#include "iplugin.h"
|
||||
#include "igridform.h"
|
||||
#include "iservice.h"
|
||||
#include "importdialog.h"
|
||||
#include "csvimporter.h"
|
||||
#include "importprogress.h"
|
||||
|
||||
template<class T>
|
||||
class GridForm : public IGridForm
|
||||
@@ -52,8 +57,7 @@ public:
|
||||
|
||||
connect(m_form, &IForm::recordAdded, [this](){
|
||||
//service()->save(form()->entity());
|
||||
m_tableModel->addRow(form()->entity());
|
||||
emit dataChanged();
|
||||
addRow(form()->entity());
|
||||
});
|
||||
connect(m_form, &IForm::recordUpdated, [this](){
|
||||
//service()->update(form()->entity());
|
||||
@@ -81,6 +85,7 @@ public:
|
||||
}
|
||||
|
||||
virtual void setTranslations(const QMap<QString, QString> &translations) {
|
||||
Q_ASSERT(m_tableModel != NULL);
|
||||
m_tableModel->setTranslations(translations);
|
||||
}
|
||||
|
||||
@@ -94,7 +99,7 @@ public slots:
|
||||
m_permissionDenied = false;
|
||||
connectService();
|
||||
|
||||
m_tableModel->setData(service()->all());
|
||||
m_tableModel->setData(listForGrid());
|
||||
tableView()->setModel(m_tableModel);
|
||||
|
||||
QList<QVariant> varList = Context::instance().settings()->value("grids/" + pluginId() + "/hide").toList();
|
||||
@@ -111,6 +116,11 @@ public slots:
|
||||
|
||||
connect(tableView()->horizontalHeader(), SIGNAL(sectionResized(int,int,int)), this, SLOT(widthChanged(int,int,int)));
|
||||
hideColumns(hide);
|
||||
enableButtons();
|
||||
|
||||
connect(tableView()->selectionModel(), &QItemSelectionModel::currentRowChanged, [this](const QModelIndex ¤t, const QModelIndex &){
|
||||
currentIndexChanged(current);
|
||||
});
|
||||
|
||||
return !m_permissionDenied;
|
||||
}
|
||||
@@ -162,10 +172,17 @@ private:
|
||||
bool m_serviceConnected;
|
||||
bool m_permissionDenied;
|
||||
|
||||
private slots:
|
||||
|
||||
// IGridForm interface
|
||||
protected:
|
||||
void handleNewRecord() override
|
||||
virtual void handleNewRecord() override
|
||||
{
|
||||
if (!checkPermAdd())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_form == NULL)
|
||||
{
|
||||
Q_ASSERT(false);
|
||||
@@ -177,8 +194,13 @@ protected:
|
||||
m_formHandler->showForm(m_form);
|
||||
}
|
||||
|
||||
void handleEditRecord() override
|
||||
virtual void handleEditRecord() override
|
||||
{
|
||||
if (!checkPermEdit())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_form == NULL || m_tableModel == NULL || tableView()->currentIndex().row() < 0)
|
||||
{
|
||||
Q_ASSERT(false);
|
||||
@@ -192,6 +214,11 @@ protected:
|
||||
|
||||
void handleDeleteRecord() override
|
||||
{
|
||||
if (!checkPermDelete())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
m_permissionDenied = false;
|
||||
connectService();
|
||||
if (m_form == NULL || m_tableModel == NULL || tableView()->currentIndex().row() < 0)
|
||||
@@ -205,7 +232,7 @@ protected:
|
||||
if (reply == QMessageBox::Yes)
|
||||
{
|
||||
QSharedPointer<T> entity = m_tableModel->itemFromIndex(tableView()->currentIndex());
|
||||
service()->erase(entity);
|
||||
doDelete(entity);
|
||||
|
||||
if (!m_permissionDenied)
|
||||
{
|
||||
@@ -214,6 +241,114 @@ protected:
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool checkPermAdd()
|
||||
{
|
||||
PermissionEvaluator permEv;
|
||||
if (!permEv.hasPermission(pluginId(), PERM_ADD))
|
||||
{
|
||||
QMessageBox::critical(this, tr("Permission denied"), tr("You don't have permission to add new record."));
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool checkPermEdit()
|
||||
{
|
||||
PermissionEvaluator permEv;
|
||||
if (!permEv.hasPermission(pluginId(), PERM_EDIT))
|
||||
{
|
||||
QMessageBox::critical(this, tr("Permission denied"), tr("You don't have permission to edit record."));
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool checkPermDelete()
|
||||
{
|
||||
PermissionEvaluator permEv;
|
||||
if (!permEv.hasPermission(pluginId(), PERM_DELETE))
|
||||
{
|
||||
QMessageBox::critical(this, tr("Permission denied"), tr("You don't have permission to delete record."));
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual int currentRecordId()
|
||||
{
|
||||
if (tableView()->currentIndex().isValid())
|
||||
{
|
||||
return m_tableModel->itemFromIndex(tableView()->currentIndex())->id();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
QSharedPointer<T> currentEntity()
|
||||
{
|
||||
if (tableView()->currentIndex().isValid())
|
||||
{
|
||||
return m_tableModel->itemFromIndex(tableView()->currentIndex());
|
||||
}
|
||||
|
||||
return QSharedPointer<T>();
|
||||
}
|
||||
|
||||
virtual void doDelete(QSharedPointer<T> entity)
|
||||
{
|
||||
service()->erase(entity);
|
||||
}
|
||||
|
||||
virtual QList<QSharedPointer<T> > listForGrid()
|
||||
{
|
||||
return service()->all();
|
||||
}
|
||||
|
||||
void addRow(QSharedPointer<T> entity)
|
||||
{
|
||||
m_tableModel->addRow(entity);
|
||||
emit dataChanged();
|
||||
}
|
||||
|
||||
void showImportButton()
|
||||
{
|
||||
QHBoxLayout *tbLayout = qobject_cast<QHBoxLayout*>(this->toolbar()->layout());
|
||||
|
||||
if (tbLayout != NULL)
|
||||
{
|
||||
QToolButton *btnImport = new QToolButton(this->toolbar());
|
||||
btnImport->setIcon(QIcon(":/icons/import.svg"));
|
||||
btnImport->setAutoRaise(true);
|
||||
btnImport->setIconSize(QSize(24, 24));
|
||||
btnImport->setToolTip(tr("Import"));
|
||||
tbLayout->insertWidget(tbLayout->count() - 1, btnImport);
|
||||
|
||||
connect(btnImport, &QToolButton::clicked, [this](){
|
||||
ImportDialog *dlg = new ImportDialog(this);
|
||||
dlg->setAttribute(Qt::WA_DeleteOnClose);
|
||||
dlg->show();
|
||||
|
||||
connect(dlg, &QDialog::accepted, [this, dlg](){
|
||||
T dataObj;
|
||||
CsvImporter importer(dataObj.metaObject());
|
||||
|
||||
importer.setImportFile(dlg->fileName());
|
||||
importer.setSeparator(dlg->separator());
|
||||
|
||||
ImportProgress *progress = new ImportProgress();
|
||||
progress->move(QApplication::desktop()->screen()->rect().center() - progress->rect().center());
|
||||
progress->setWindowModality(Qt::ApplicationModal);
|
||||
progress->show();
|
||||
|
||||
service()->importData(&importer, progress);
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
#endif // GRIDFORM_H
|
||||
|
||||
+5
-5
@@ -30,7 +30,7 @@
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="rc.qrc">
|
||||
<normaloff>:/icons/new.svg</normaloff>:/icons/new.svg</iconset>
|
||||
<normaloff>:/icons/new_24x24.png</normaloff>:/icons/new_24x24.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
@@ -59,7 +59,7 @@
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="rc.qrc">
|
||||
<normaloff>:/icons/edit.svg</normaloff>:/icons/edit.svg</iconset>
|
||||
<normaloff>:/icons/edit_24x24.png</normaloff>:/icons/edit_24x24.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
@@ -85,7 +85,7 @@
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="rc.qrc">
|
||||
<normaloff>:/icons/remove.svg</normaloff>:/icons/remove.svg</iconset>
|
||||
<normaloff>:/icons/remove_24x24.png</normaloff>:/icons/remove_24x24.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
@@ -108,7 +108,7 @@
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="rc.qrc">
|
||||
<normaloff>:/icons/filter.svg</normaloff>:/icons/filter.svg</iconset>
|
||||
<normaloff>:/icons/filter_24x24.png</normaloff>:/icons/filter_24x24.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
@@ -134,7 +134,7 @@
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="rc.qrc">
|
||||
<normaloff>:/icons/print.svg</normaloff>:/icons/print.svg</iconset>
|
||||
<normaloff>:/icons/print_24x24.png</normaloff>:/icons/print_24x24.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
#include "helper.h"
|
||||
#include "define.h"
|
||||
|
||||
#ifndef _WIN32
|
||||
const QMap<QString, QString> Helper::m_numMap{
|
||||
{"+", "1"},
|
||||
{"ě", "2"},
|
||||
{"š", "3"},
|
||||
{"č", "4"},
|
||||
{"ř", "5"},
|
||||
{"ž", "6"},
|
||||
{"ý", "7"},
|
||||
{"á", "8"},
|
||||
{"í", "9"},
|
||||
{"é", "0"}
|
||||
};
|
||||
#endif
|
||||
|
||||
Helper::Helper()
|
||||
{
|
||||
}
|
||||
|
||||
QString Helper::replaceByNumbers(const QString &str)
|
||||
{
|
||||
QString ret;
|
||||
|
||||
#ifdef _WIN32
|
||||
QMap<QString, QString> m_numMap;
|
||||
m_numMap["+"] = "1";
|
||||
m_numMap["ě"] = "2";
|
||||
m_numMap["š"] = "3";
|
||||
m_numMap["č"] = "4";
|
||||
m_numMap["ř"] = "5";
|
||||
m_numMap["ž"] = "6";
|
||||
m_numMap["ý"] = "7";
|
||||
m_numMap["á"] = "8";
|
||||
m_numMap["í"] = "9";
|
||||
m_numMap["é"] = "0";
|
||||
#endif
|
||||
|
||||
std::for_each(ALL(str), [&](QChar c){
|
||||
QString replaced = m_numMap[c];
|
||||
|
||||
if (replaced.isEmpty())
|
||||
{
|
||||
ret.append(c);
|
||||
}
|
||||
else
|
||||
{
|
||||
ret.append(replaced);
|
||||
}
|
||||
});
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
#ifndef HELPER_H
|
||||
#define HELPER_H
|
||||
|
||||
#include <QString>
|
||||
#include <QMap>
|
||||
|
||||
#include "core_global.h"
|
||||
|
||||
class CORESHARED_EXPORT Helper
|
||||
{
|
||||
public:
|
||||
Helper();
|
||||
|
||||
static QString replaceByNumbers(const QString &str);
|
||||
|
||||
private:
|
||||
#ifndef _WIN32
|
||||
static const QMap<QString, QString> m_numMap;
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif // HELPER_H
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user