Compare commits
11
Commits
e02595ba0e
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3a4c517a75 | ||
|
|
a0a745df0c | ||
|
|
e3a5e44c33 | ||
|
|
12dd6ddba0 | ||
|
|
de2bab90de | ||
|
|
285fc8e80f | ||
|
|
93eb98c10a | ||
|
|
e958c86eb7 | ||
|
|
8b132c6c51 | ||
|
|
46b2098ffc | ||
|
|
7082648122 |
@@ -1,2 +1,3 @@
|
||||
cmake*
|
||||
!CMakePresets.json
|
||||
build
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
url = https://github.com/semihc/qdecimal.git
|
||||
[submodule "3rdparty/QxOrm"]
|
||||
path = 3rdparty/QxOrm
|
||||
url = https://github.com/PepaRokos/QxOrm.git
|
||||
url = https://github.com/QxOrm/QxOrm.git
|
||||
[submodule "3rdparty/LimeReport"]
|
||||
path = 3rdparty/LimeReport
|
||||
url = https://github.com/PepaRokos/LimeReport.git
|
||||
|
||||
Vendored
+1
-1
Submodule 3rdparty/QxOrm updated: 975c3b5ad3...44fd7f1617
@@ -1,6 +1,13 @@
|
||||
cmake_minimum_required(VERSION 3.24)
|
||||
project(prodejna-root)
|
||||
|
||||
include(CTest)
|
||||
option(ENABLE_ZINT "Enable LimeReport barcode support" ON)
|
||||
|
||||
find_package(Qt6 6.11.2 REQUIRED COMPONENTS Core Core5Compat Test Gui Widgets PrintSupport Sql Qml Network Xml Svg)
|
||||
|
||||
set(CMAKE_POLICY_VERSION_MINIMUM 3.10)
|
||||
|
||||
add_subdirectory(3rdparty/qdecimal)
|
||||
add_subdirectory(3rdparty/QxOrm)
|
||||
add_subdirectory(3rdparty/LimeReport)
|
||||
@@ -15,3 +22,7 @@ add_subdirectory(shop)
|
||||
add_subdirectory(commodity)
|
||||
add_subdirectory(camp)
|
||||
|
||||
if(BUILD_TESTING)
|
||||
add_subdirectory(tests)
|
||||
endif()
|
||||
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
{
|
||||
"version": 5,
|
||||
"cmakeMinimumRequired": {
|
||||
"major": 3,
|
||||
"minor": 24,
|
||||
"patch": 0
|
||||
},
|
||||
"configurePresets": [
|
||||
{
|
||||
"name": "qt6-debug",
|
||||
"displayName": "Qt 6.11.2+ Debug",
|
||||
"generator": "Ninja",
|
||||
"binaryDir": "${sourceDir}/build/presets/${presetName}",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Debug"
|
||||
}
|
||||
}
|
||||
],
|
||||
"buildPresets": [
|
||||
{
|
||||
"name": "qt6-debug",
|
||||
"configurePreset": "qt6-debug"
|
||||
}
|
||||
],
|
||||
"testPresets": [
|
||||
{
|
||||
"name": "qt6-debug",
|
||||
"configurePreset": "qt6-debug",
|
||||
"output": {
|
||||
"outputOnFailure": true
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -14,6 +14,7 @@ find_package(Qt6 COMPONENTS
|
||||
Core
|
||||
Gui
|
||||
Widgets
|
||||
Qml
|
||||
REQUIRED)
|
||||
|
||||
add_library(addressbook SHARED
|
||||
@@ -42,6 +43,7 @@ target_link_libraries(addressbook
|
||||
Qt::Core
|
||||
Qt::Gui
|
||||
Qt::Widgets
|
||||
Qt::Qml
|
||||
qdecimal
|
||||
decnumber
|
||||
QxOrm
|
||||
|
||||
@@ -13,6 +13,7 @@ find_package(Qt6 COMPONENTS
|
||||
Gui
|
||||
Widgets
|
||||
Sql
|
||||
Qml
|
||||
REQUIRED)
|
||||
|
||||
include_directories(../core)
|
||||
@@ -27,12 +28,20 @@ add_executable(prodejna
|
||||
logindialog.ui
|
||||
mainwindow.cpp
|
||||
mainwindow.h
|
||||
mainwindow.ui)
|
||||
mainwindow.ui
|
||||
shop.rc
|
||||
)
|
||||
|
||||
target_link_libraries(prodejna
|
||||
Qt::Core
|
||||
Qt::Gui
|
||||
Qt::Widgets
|
||||
Qt::Sql
|
||||
Qt::Qml
|
||||
core
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
if(CMAKE_BUILD_TYPE STREQUAL "Release")
|
||||
set_property(TARGET prodejna PROPERTY WIN32_EXECUTABLE true)
|
||||
endif()
|
||||
|
||||
@@ -256,5 +256,5 @@ void MainWindow::on_actionAbout_Qt_triggered()
|
||||
|
||||
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"));
|
||||
QMessageBox::about(this, tr("About prodejna"), tr("Modular cash register software under GPL license.\n(C) 2015 - 2023 Josef Rokos, Zdenek Jonák"));
|
||||
}
|
||||
|
||||
@@ -117,9 +117,9 @@
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<widget class="QLabel" name="labelVersion">
|
||||
<property name="text">
|
||||
<string>Prodejna 2.0</string>
|
||||
<string>Prodejna 3.0</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
@@ -137,7 +137,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1000</width>
|
||||
<height>42</height>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QMenu" name="menuFile">
|
||||
|
||||
@@ -14,6 +14,7 @@ find_package(Qt6 COMPONENTS
|
||||
Core
|
||||
Gui
|
||||
Widgets
|
||||
Qml
|
||||
REQUIRED)
|
||||
|
||||
add_library(camp SHARED
|
||||
@@ -70,6 +71,7 @@ target_link_libraries(camp
|
||||
Qt::Core
|
||||
Qt::Gui
|
||||
Qt::Widgets
|
||||
Qt::Qml
|
||||
qdecimal
|
||||
decnumber
|
||||
QxOrm
|
||||
|
||||
@@ -6,10 +6,6 @@
|
||||
#include "campseller.h"
|
||||
#include <cmath>
|
||||
|
||||
#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";
|
||||
|
||||
@@ -14,6 +14,7 @@ find_package(Qt6 COMPONENTS
|
||||
Core
|
||||
Gui
|
||||
Widgets
|
||||
Qml
|
||||
REQUIRED)
|
||||
|
||||
add_library(commodity SHARED
|
||||
@@ -51,6 +52,7 @@ target_link_libraries(commodity
|
||||
Qt::Core
|
||||
Qt::Gui
|
||||
Qt::Widgets
|
||||
Qt::Qml
|
||||
qdecimal
|
||||
decnumber
|
||||
QxOrm
|
||||
|
||||
@@ -84,7 +84,7 @@ QDecDouble CommodityData::price() const
|
||||
|
||||
void CommodityData::setPrice(const QDecDouble &price)
|
||||
{
|
||||
m_price = price.toDouble() * DEC_MULTIPLE;
|
||||
m_price = qRound(price.toDouble() * DEC_MULTIPLE);
|
||||
}
|
||||
Enums::VatType CommodityData::vat() const
|
||||
{
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
|
||||
#include "../commodity_global.h"
|
||||
|
||||
#pragma db object
|
||||
class CommodityData : public IShopItem
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -95,6 +95,10 @@ void Role::clearPermissions()
|
||||
m_listPermissions.clear();
|
||||
}
|
||||
|
||||
QStringList Role::eagerLoad() {
|
||||
return {"object_id_fk", "value_fk"};
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -46,6 +46,8 @@ public:
|
||||
void addPermission(QSharedPointer<Permission> perm);
|
||||
void clearPermissions();
|
||||
|
||||
Q_INVOKABLE QStringList eagerLoad();
|
||||
|
||||
private:
|
||||
long m_id;
|
||||
QString m_name;
|
||||
|
||||
@@ -112,6 +112,10 @@ void User::setIsAdmin(bool isAdmin)
|
||||
m_isAdmin = isAdmin;
|
||||
}
|
||||
|
||||
QStringList User::eagerLoad() {
|
||||
return {"object_id_fk"};
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -57,6 +57,7 @@ public:
|
||||
|
||||
void clearRoles();
|
||||
|
||||
Q_INVOKABLE QStringList eagerLoad();
|
||||
|
||||
private:
|
||||
long m_id;
|
||||
|
||||
+13
-3
@@ -1,6 +1,8 @@
|
||||
#ifndef DEFINE_H
|
||||
#define DEFINE_H
|
||||
|
||||
#include <QtGlobal>
|
||||
|
||||
#define ALL(arr) arr.begin(), arr.end()
|
||||
|
||||
// default rights
|
||||
@@ -11,11 +13,15 @@
|
||||
|
||||
#define DEC_MULTIPLE 100
|
||||
#define TO_DEC(num) (QDecDouble(num) / QDecDouble(DEC_MULTIPLE))
|
||||
#define FROM_DEC(num) (num * QDecDouble(DEC_MULTIPLE)).toDouble()
|
||||
#define FROM_DEC(num) qRound((num * QDecDouble(DEC_MULTIPLE)).toDouble())
|
||||
|
||||
#ifndef PLUGIN_ROOT
|
||||
#ifdef _WIN32
|
||||
#define PLUGIN_ROOT "/../../plugins"
|
||||
#ifdef QT_NO_DEBUG
|
||||
#define PLUGIN_ROOT "/plugins"
|
||||
#else
|
||||
#define PLUGIN_ROOT "/../../plugins"
|
||||
#endif
|
||||
#else
|
||||
#define PLUGIN_ROOT "/../plugins"
|
||||
#endif
|
||||
@@ -23,7 +29,11 @@
|
||||
|
||||
#ifndef REPORT_ROOT
|
||||
#ifdef _WIN32
|
||||
#define REPORT_ROOT "/../../reports"
|
||||
#ifdef QT_NO_DEBUG
|
||||
#define REPORT_ROOT "/reports"
|
||||
#else
|
||||
#define REPORT_ROOT "/../../reports"
|
||||
#endif
|
||||
#else
|
||||
#define REPORT_ROOT "/../reports"
|
||||
#endif
|
||||
|
||||
@@ -1,21 +1,5 @@
|
||||
#include "exprevaluator.h"
|
||||
|
||||
#ifdef _MSC_VER
|
||||
ExprEvaluator::ExprEvaluator()
|
||||
{
|
||||
m_operations["=="] = [](QVariant left, QVariant right) { return left == right; };
|
||||
m_operations["!="] = [](QVariant left, QVariant right) { return left != right; };
|
||||
m_operations["<"] = [](QVariant left, QVariant right) { return left < right; };
|
||||
m_operations["<="] = [](QVariant left, QVariant right) { return left <= right; };
|
||||
m_operations[">"] = [](QVariant left, QVariant right) { return left > right; };
|
||||
m_operations[">="] = [](QVariant left, QVariant right) { return left >= right; };
|
||||
m_operations["%"] = [](QVariant left, QVariant right) { return left.toString().contains(right.toString()); };
|
||||
|
||||
m_operations["||"] = [](QVariant left, QVariant right) { return left.toBool() || right.toBool(); };
|
||||
m_operations["&&"] = [](QVariant left, QVariant right) { return left.toBool() && right.toBool(); };
|
||||
m_caseSensitive = false;
|
||||
}
|
||||
#else
|
||||
const QMap<QString, std::function<bool(QVariant, QVariant)> > ExprEvaluator::m_operations = {
|
||||
{ "==", [](QVariant left, QVariant right) { return left == right; }},
|
||||
{ "!=", [](QVariant left, QVariant right) { return left != right; }},
|
||||
@@ -35,13 +19,6 @@ const QMap<QString, std::function<bool(QVariant, QVariant)> > ExprEvaluator::m_o
|
||||
{ "&&", [](QVariant left, QVariant right) { return left.toBool() && right.toBool(); }}
|
||||
};
|
||||
|
||||
ExprEvaluator::ExprEvaluator()
|
||||
{
|
||||
m_caseSensitive = false;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
bool ExprEvaluator::evaluate(QObject *object, const QString &exp)
|
||||
{
|
||||
if (exp.contains("&&") && exp.contains("||"))
|
||||
|
||||
@@ -11,19 +11,15 @@
|
||||
class CORESHARED_EXPORT ExprEvaluator
|
||||
{
|
||||
public:
|
||||
ExprEvaluator();
|
||||
ExprEvaluator() = default;
|
||||
|
||||
bool evaluate(QObject *object, const QString &exp);
|
||||
void setCaseSensitive(bool caseSensitive);
|
||||
|
||||
private:
|
||||
#ifdef _MSC_VER
|
||||
QMap<QString, std::function<bool(QVariant, QVariant)> > m_operations;
|
||||
#else
|
||||
static const QMap<QString, std::function<bool(QVariant, QVariant)> > m_operations;
|
||||
#endif
|
||||
|
||||
bool m_caseSensitive;
|
||||
bool m_caseSensitive{false};
|
||||
|
||||
bool subEval(const QString &oper, const QString &expresion, QObject *object);
|
||||
void parseExpr(const QString &exp, QVariant &value, QString &oper, QVariant &condition, QObject *object);
|
||||
|
||||
+1
-1
@@ -95,7 +95,7 @@ protected:
|
||||
m_translator = new QTranslator();
|
||||
|
||||
if (!m_translator->load(fileName + QLocale::system().name())) {
|
||||
qDebug() << "Cannot load translation";
|
||||
qDebug() << "Cannot load translation " << QLocale::system().name();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,14 @@
|
||||
#include "iservice.h"
|
||||
|
||||
#ifdef _MSC_VER
|
||||
QX_REGISTER_CPP_CORE(IService)
|
||||
|
||||
namespace qx {
|
||||
template<> void register_class(QxClass<IService>&) {
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
IService::IService(QObject *parent) : QObject(parent)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -33,4 +33,8 @@ protected:
|
||||
QString m_pluginId;
|
||||
};
|
||||
|
||||
#ifdef _MSC_VER
|
||||
QX_REGISTER_HPP_CORE(IService, QObject, 0)
|
||||
#endif
|
||||
|
||||
#endif // ISERVICE_H
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include "permissionservice.h"
|
||||
#include "service.h"
|
||||
#include <QCryptographicHash>
|
||||
|
||||
QList<QSharedPointer<Permission> > PermissionService::forPlugin(const QString &pluginId)
|
||||
@@ -54,6 +55,10 @@ QSharedPointer<User> PermissionService::loadUser(const QString &login)
|
||||
auto admin = srvUser.all("login = '" + login + "'");
|
||||
|
||||
if (admin.count() == 1) {
|
||||
Service<Role> srvRole;
|
||||
for (auto& role : admin[0]->listRoles()) {
|
||||
srvRole.load(role);
|
||||
}
|
||||
return admin[0];
|
||||
}
|
||||
|
||||
|
||||
@@ -3,12 +3,13 @@
|
||||
|
||||
#include <QDialog>
|
||||
#include "report.h"
|
||||
#include "../core_global.h"
|
||||
|
||||
namespace Ui {
|
||||
class ReportDialog;
|
||||
}
|
||||
|
||||
class ReportDialog : public QDialog
|
||||
class CORESHARED_EXPORT ReportDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
||||
+5
-2
@@ -156,7 +156,7 @@ public:
|
||||
pSession = ptrSession.data();
|
||||
}
|
||||
|
||||
*pSession += qx::dao::delete_by_id(entity);
|
||||
*pSession += qx::dao::delete_by_id(entity, pSession->database());
|
||||
|
||||
if (!pSession->isValid()) {
|
||||
qDebug() << pSession->firstError().text();
|
||||
@@ -237,7 +237,10 @@ protected:
|
||||
}
|
||||
else
|
||||
{
|
||||
obj->setProperty("updatedBy", Context::instance().currentUser()->login());
|
||||
if (!Context::instance().currentUser().isNull()) {
|
||||
obj->setProperty("updatedBy", Context::instance().currentUser()->login());
|
||||
}
|
||||
|
||||
obj->setProperty("updated", QDateTime::currentDateTime());
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
@@ -129,83 +129,83 @@
|
||||
<translation>Hlavní nastavení</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/globalsettingsform.ui" line="104"/>
|
||||
<location filename="../settings/globalsettingsform.ui" line="107"/>
|
||||
<source>Web</source>
|
||||
<translation>Web</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/globalsettingsform.ui" line="111"/>
|
||||
<location filename="../settings/globalsettingsform.ui" line="114"/>
|
||||
<source>E-mail</source>
|
||||
<translation>E-mail</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/globalsettingsform.ui" line="118"/>
|
||||
<location filename="../settings/globalsettingsform.ui" line="121"/>
|
||||
<source>Phone</source>
|
||||
<translation>Telefon</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/globalsettingsform.ui" line="166"/>
|
||||
<location filename="../settings/globalsettingsform.ui" line="169"/>
|
||||
<source>Company info</source>
|
||||
<translation>Informace o společnosti</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/globalsettingsform.ui" line="175"/>
|
||||
<location filename="../settings/globalsettingsform.ui" line="178"/>
|
||||
<source>IC</source>
|
||||
<translation>IČO</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/globalsettingsform.ui" line="185"/>
|
||||
<location filename="../settings/globalsettingsform.ui" line="188"/>
|
||||
<source>VAT number</source>
|
||||
<translation>DIČ</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/globalsettingsform.ui" line="195"/>
|
||||
<location filename="../settings/globalsettingsform.ui" line="198"/>
|
||||
<source>VAT payer</source>
|
||||
<translation>Plátce DPH</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/globalsettingsform.ui" line="208"/>
|
||||
<location filename="../settings/globalsettingsform.ui" line="211"/>
|
||||
<source>VAT rates</source>
|
||||
<translation>Sazby DPH</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/globalsettingsform.ui" line="214"/>
|
||||
<location filename="../settings/globalsettingsform.ui" line="217"/>
|
||||
<source>High</source>
|
||||
<translation>Vysoká</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/globalsettingsform.ui" line="228"/>
|
||||
<location filename="../settings/globalsettingsform.ui" line="231"/>
|
||||
<source>First lower</source>
|
||||
<translation>První snížená</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/globalsettingsform.ui" line="242"/>
|
||||
<location filename="../settings/globalsettingsform.ui" line="245"/>
|
||||
<source>Second lower</source>
|
||||
<translation>Druhá snížená</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/globalsettingsform.ui" line="259"/>
|
||||
<location filename="../settings/globalsettingsform.ui" line="262"/>
|
||||
<source>Prices with VAT</source>
|
||||
<translation>Ceny s DPH</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/globalsettingsform.ui" line="270"/>
|
||||
<location filename="../settings/globalsettingsform.ui" line="331"/>
|
||||
<location filename="../settings/globalsettingsform.ui" line="273"/>
|
||||
<location filename="../settings/globalsettingsform.ui" line="334"/>
|
||||
<source>Number series</source>
|
||||
<translation>Číselné řady</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/globalsettingsform.ui" line="299"/>
|
||||
<location filename="../settings/globalsettingsform.ui" line="302"/>
|
||||
<source>Edit name</source>
|
||||
<translation>Upravit název</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/globalsettingsform.ui" line="310"/>
|
||||
<location filename="../settings/globalsettingsform.ui" line="313"/>
|
||||
<source>Season</source>
|
||||
<translation>Sezóna</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/globalsettingsform.ui" line="317"/>
|
||||
<location filename="../settings/globalsettingsform.ui" line="320"/>
|
||||
<source>Create new</source>
|
||||
<translation>Vytvořit novou</translation>
|
||||
</message>
|
||||
@@ -215,67 +215,75 @@
|
||||
<translation>Kontaktní údaje</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/globalsettingsform.ui" line="45"/>
|
||||
<location filename="../settings/globalsettingsform.ui" line="48"/>
|
||||
<source>Firm Name</source>
|
||||
<translation>Název společnosti</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/globalsettingsform.ui" line="55"/>
|
||||
<location filename="../settings/globalsettingsform.ui" line="58"/>
|
||||
<source>Street</source>
|
||||
<translation>Ulice</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/globalsettingsform.ui" line="65"/>
|
||||
<location filename="../settings/globalsettingsform.ui" line="68"/>
|
||||
<source>House Number</source>
|
||||
<translation>Číslo popisné</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/globalsettingsform.ui" line="75"/>
|
||||
<location filename="../settings/globalsettingsform.ui" line="78"/>
|
||||
<source>City</source>
|
||||
<translation>Město</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/globalsettingsform.ui" line="85"/>
|
||||
<location filename="../settings/globalsettingsform.ui" line="88"/>
|
||||
<source>ZIP code</source>
|
||||
<translation>PSČ</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/globalsettingsform.ui" line="128"/>
|
||||
<location filename="../settings/globalsettingsform.ui" line="131"/>
|
||||
<source>Logo</source>
|
||||
<translation>Logo</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/globalsettingsform.ui" line="156"/>
|
||||
<location filename="../settings/globalsettingsform.ui" line="159"/>
|
||||
<source>Select file</source>
|
||||
<translation>Vyber soubor</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/globalsettingsform.cpp" line="82"/>
|
||||
<location filename="../settings/globalsettingsform.cpp" line="95"/>
|
||||
<source>Switch season</source>
|
||||
<translation>Změna sezóny</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/globalsettingsform.cpp" line="82"/>
|
||||
<source>Realy switch active season?</source>
|
||||
<translation>Opravdu si přejete změnit aktivní sezónu?</translation>
|
||||
<translation type="vanished">Opravdu si přejete změnit aktivní sezónu?</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/globalsettingsform.cpp" line="150"/>
|
||||
<location filename="../settings/globalsettingsform.cpp" line="155"/>
|
||||
<source>New season</source>
|
||||
<translation>Nová sezóna</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/globalsettingsform.cpp" line="150"/>
|
||||
<source>Realy create new season and switch to it?</source>
|
||||
<translation type="vanished">Opravdu si přejete vytvořit novou sezónu a přepnout na ni?</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/globalsettingsform.cpp" line="95"/>
|
||||
<source>Really switch active season?</source>
|
||||
<translation>Opravdu si přejete změnit aktivní sezónu?</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/globalsettingsform.cpp" line="155"/>
|
||||
<source>Really create new season and switch to it?</source>
|
||||
<translation>Opravdu si přejete vytvořit novou sezónu a přepnout na ni?</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/globalsettingsform.cpp" line="173"/>
|
||||
<location filename="../settings/globalsettingsform.cpp" line="178"/>
|
||||
<source>Select logo</source>
|
||||
<translation>Vybrat logo</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/globalsettingsform.cpp" line="173"/>
|
||||
<location filename="../settings/globalsettingsform.cpp" line="178"/>
|
||||
<source>Images (*.png *.xpm *.jpg)</source>
|
||||
<translation>Obrázky (*.png *.xpm *.jpg)</translation>
|
||||
</message>
|
||||
@@ -359,17 +367,17 @@
|
||||
<translation>Import dat</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../importdialog.ui" line="20"/>
|
||||
<location filename="../importdialog.ui" line="23"/>
|
||||
<source>File</source>
|
||||
<translation>Soubor</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../importdialog.ui" line="27"/>
|
||||
<location filename="../importdialog.ui" line="30"/>
|
||||
<source>Separator</source>
|
||||
<translation>Oddělovač</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../importdialog.ui" line="65"/>
|
||||
<location filename="../importdialog.ui" line="68"/>
|
||||
<source>...</source>
|
||||
<translation>...</translation>
|
||||
</message>
|
||||
@@ -400,12 +408,12 @@
|
||||
<context>
|
||||
<name>QObject</name>
|
||||
<message>
|
||||
<location filename="../iplugin.h" line="58"/>
|
||||
<location filename="../iplugin.h" line="52"/>
|
||||
<source>Permission denied</source>
|
||||
<translation>Nedostatečná oprávnění</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../iplugin.h" line="58"/>
|
||||
<location filename="../iplugin.h" line="52"/>
|
||||
<source>You don't have permission to open this plugin.</source>
|
||||
<translation>Nemáte oprávnění otevřít tento modul.</translation>
|
||||
</message>
|
||||
@@ -590,39 +598,39 @@
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../autoform.h" line="46"/>
|
||||
<location filename="../gridform.h" line="250"/>
|
||||
<location filename="../gridform.h" line="262"/>
|
||||
<location filename="../gridform.h" line="274"/>
|
||||
<location filename="../gridform.h" line="252"/>
|
||||
<location filename="../gridform.h" line="264"/>
|
||||
<location filename="../gridform.h" line="276"/>
|
||||
<source>Permission denied</source>
|
||||
<translation>Nedostatečná oprávnění</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gridform.h" line="250"/>
|
||||
<location filename="../gridform.h" line="252"/>
|
||||
<source>You don't have permission to add new record.</source>
|
||||
<translation>Nemáte oprávnění přidat nový záznam.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gridform.h" line="262"/>
|
||||
<location filename="../gridform.h" line="264"/>
|
||||
<source>You don't have permission to edit record.</source>
|
||||
<translation>Nemáte oprávnění upravit záznam.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gridform.h" line="274"/>
|
||||
<location filename="../gridform.h" line="276"/>
|
||||
<source>You don't have permission to delete record.</source>
|
||||
<translation>Nemáte oprávnění smazat záznam.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gridform.h" line="231"/>
|
||||
<location filename="../gridform.h" line="233"/>
|
||||
<source>Delete record</source>
|
||||
<translation>Smazat záznam</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gridform.h" line="231"/>
|
||||
<location filename="../gridform.h" line="233"/>
|
||||
<source>Realy delete this record?</source>
|
||||
<translation>Opravdu si přejete smazat tento záznam?</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gridform.h" line="327"/>
|
||||
<location filename="../gridform.h" line="329"/>
|
||||
<source>Import</source>
|
||||
<translation>Import</translation>
|
||||
</message>
|
||||
@@ -635,37 +643,37 @@
|
||||
<translation></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../users/userform.ui" line="20"/>
|
||||
<location filename="../users/userform.ui" line="23"/>
|
||||
<source>Login</source>
|
||||
<translation>Uživatelské jméno</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../users/userform.ui" line="30"/>
|
||||
<location filename="../users/userform.ui" line="33"/>
|
||||
<source>Password</source>
|
||||
<translation>Heslo</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../users/userform.ui" line="44"/>
|
||||
<location filename="../users/userform.ui" line="47"/>
|
||||
<source>Name</source>
|
||||
<translation>Jméno</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../users/userform.ui" line="57"/>
|
||||
<location filename="../users/userform.ui" line="60"/>
|
||||
<source>Is Admin</source>
|
||||
<translation>Admin</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../users/userform.ui" line="67"/>
|
||||
<location filename="../users/userform.ui" line="70"/>
|
||||
<source>Active</source>
|
||||
<translation>Aktivní</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../users/userform.ui" line="77"/>
|
||||
<location filename="../users/userform.ui" line="80"/>
|
||||
<source>Roles</source>
|
||||
<translation>Role</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../users/userform.ui" line="91"/>
|
||||
<location filename="../users/userform.ui" line="94"/>
|
||||
<source>Retype Password</source>
|
||||
<translation>Zopakujte heslo</translation>
|
||||
</message>
|
||||
|
||||
@@ -14,6 +14,7 @@ find_package(Qt6 COMPONENTS
|
||||
Core
|
||||
Gui
|
||||
Widgets
|
||||
Qml
|
||||
REQUIRED)
|
||||
|
||||
add_library(countryregister SHARED
|
||||
@@ -33,6 +34,7 @@ target_link_libraries(countryregister
|
||||
Qt::Core
|
||||
Qt::Gui
|
||||
Qt::Widgets
|
||||
Qt::Qml
|
||||
qdecimal
|
||||
decnumber
|
||||
QxOrm
|
||||
|
||||
@@ -14,6 +14,7 @@ find_package(Qt6 COMPONENTS
|
||||
Core
|
||||
Gui
|
||||
Widgets
|
||||
Qml
|
||||
REQUIRED)
|
||||
|
||||
add_library(postregister SHARED
|
||||
@@ -33,6 +34,7 @@ target_link_libraries(postregister
|
||||
Qt::Core
|
||||
Qt::Gui
|
||||
Qt::Widgets
|
||||
Qt::Qml
|
||||
qdecimal
|
||||
decnumber
|
||||
QxOrm
|
||||
|
||||
@@ -14,6 +14,7 @@ find_package(Qt6 COMPONENTS
|
||||
Core
|
||||
Gui
|
||||
Widgets
|
||||
Qml
|
||||
REQUIRED)
|
||||
|
||||
add_library(services SHARED
|
||||
@@ -39,6 +40,7 @@ target_link_libraries(services
|
||||
Qt::Core
|
||||
Qt::Gui
|
||||
Qt::Widgets
|
||||
Qt::Qml
|
||||
qdecimal
|
||||
decnumber
|
||||
QxOrm
|
||||
|
||||
@@ -39,7 +39,7 @@ QDecDouble AccService::price() const
|
||||
|
||||
void AccService::setPrice(QDecDouble price)
|
||||
{
|
||||
m_price = price.toDouble() * DEC_MULTIPLE;
|
||||
m_price = qRound(price.toDouble() * DEC_MULTIPLE);
|
||||
}
|
||||
bool AccService::active() const
|
||||
{
|
||||
|
||||
@@ -14,6 +14,7 @@ find_package(Qt6 COMPONENTS
|
||||
Core
|
||||
Gui
|
||||
Widgets
|
||||
Qml
|
||||
REQUIRED)
|
||||
|
||||
add_library(shop SHARED
|
||||
@@ -85,6 +86,7 @@ target_link_libraries(shop
|
||||
Qt::Core
|
||||
Qt::Gui
|
||||
Qt::Widgets
|
||||
Qt::Qml
|
||||
qdecimal
|
||||
decnumber
|
||||
QxOrm
|
||||
|
||||
+17
-1
@@ -131,7 +131,13 @@ void Voucher::addItem(QSharedPointer<VoucherItem> item)
|
||||
|
||||
void Voucher::removeItem(QSharedPointer<VoucherItem> item)
|
||||
{
|
||||
m_items.removeOne(item);
|
||||
if (item->id() != 0) {
|
||||
m_items.removeIf([&item](const auto& it){
|
||||
return item->id() == it->id();
|
||||
});
|
||||
} else {
|
||||
m_items.removeOne(item);
|
||||
}
|
||||
}
|
||||
|
||||
void Voucher::clearItems()
|
||||
@@ -415,3 +421,13 @@ QDecDouble VoucherSum::totalPrice() const
|
||||
int VoucherSum::count() const {
|
||||
return m_count;
|
||||
}
|
||||
|
||||
VoucherSum::VoucherSum(int count, int totalPrice) : m_count(count), m_totalPrice(totalPrice) {}
|
||||
|
||||
void VoucherSum::addPrice(QDecDouble price) {
|
||||
m_totalPrice += FROM_DEC(price);
|
||||
}
|
||||
|
||||
void VoucherSum::addCount(int count) {
|
||||
m_count += count;
|
||||
}
|
||||
|
||||
@@ -210,9 +210,13 @@ class VoucherSum
|
||||
QX_REGISTER_FRIEND_CLASS(VoucherSum)
|
||||
public:
|
||||
VoucherSum() = default;
|
||||
VoucherSum(int count, int totalPrice);
|
||||
|
||||
QDecDouble totalPrice() const;
|
||||
int count() const;
|
||||
|
||||
void addPrice(QDecDouble price);
|
||||
void addCount(int count);
|
||||
|
||||
private:
|
||||
int m_count{0};
|
||||
|
||||
@@ -47,12 +47,20 @@ PaydVouchersDialog::PaydVouchersDialog(QWidget *parent) :
|
||||
ui->tableItems->setColumnHidden(0, true);
|
||||
ui->tableItems->verticalScrollBar()->setStyleSheet("QScrollBar:vertical { width: 30px; }");
|
||||
|
||||
#ifndef EET
|
||||
ui->btnEetNotSen->setVisible(false);
|
||||
ui->btnSendEet->setVisible(false);
|
||||
ui->label_2->setVisible(false);
|
||||
ui->lblEetStatus->setVisible(false);
|
||||
#endif
|
||||
|
||||
ShopService srv;
|
||||
m_voucherModel->setData(srv.paiedVouchers());
|
||||
ui->tableVouchers->sortByColumn(0,Qt::AscendingOrder);
|
||||
ui->tableVouchers->verticalScrollBar()->setStyleSheet("QScrollBar:vertical { width: 30px; }");
|
||||
|
||||
connect(ui->tableVouchers->selectionModel(), &QItemSelectionModel::currentRowChanged, [this, &srv](const QModelIndex ¤t, const QModelIndex &) {
|
||||
connect(ui->tableVouchers->selectionModel(), &QItemSelectionModel::currentRowChanged, [this](const QModelIndex ¤t, const QModelIndex &) {
|
||||
ShopService srv;
|
||||
QSharedPointer<Voucher> voucher = m_voucherModel->itemFromIndex(current);
|
||||
if (voucher->items().isEmpty()) {
|
||||
srv.load(voucher);
|
||||
|
||||
@@ -59,11 +59,11 @@ void ReceiptGenerator::print()
|
||||
DWORD dwBytes;
|
||||
BOOL bStatus = FALSE;
|
||||
|
||||
if (OpenPrinter((LPWSTR)printer.toStdWString().c_str(), &hPrinter, NULL))
|
||||
if (OpenPrinter((LPWSTR)printer.toStdWString().c_str(), &hPrinter, nullptr))
|
||||
{
|
||||
docInfo.pDocName = L"Uctenka";
|
||||
docInfo.pOutputFile = NULL;
|
||||
docInfo.pDatatype = L"RAW";
|
||||
docInfo.pDocName = (LPWSTR)(L"Uctenka");
|
||||
docInfo.pOutputFile = nullptr;
|
||||
docInfo.pDatatype = (LPWSTR)(L"RAW");
|
||||
|
||||
dwJob = StartDocPrinter(hPrinter, 1, (LPBYTE)&docInfo);
|
||||
if (dwJob > 0)
|
||||
|
||||
@@ -16,6 +16,7 @@ ShopSettingsForm::ShopSettingsForm(QWidget *parent) :
|
||||
registerBinding(ui->lettersPerLine);
|
||||
registerBinding(ui->byMessage);
|
||||
|
||||
#ifdef EET
|
||||
registerBinding(ui->eetActive);
|
||||
registerBinding(ui->eetShopId);
|
||||
registerBinding(ui->eetRegisterId);
|
||||
@@ -26,6 +27,9 @@ ShopSettingsForm::ShopSettingsForm(QWidget *parent) :
|
||||
registerBinding(ui->eetKeyPassword);
|
||||
registerBinding(ui->eetTest);
|
||||
registerBinding(ui->eetPlayground);
|
||||
#else
|
||||
ui->tabWidget->removeTab(2);
|
||||
#endif
|
||||
|
||||
registerBinding(ui->favBtnCols);
|
||||
registerBinding(ui->favBtnRows);
|
||||
|
||||
+6
-2
@@ -515,7 +515,6 @@ void ShopForm::recalculate()
|
||||
{
|
||||
ShopService srv;
|
||||
srv.calculate(m_voucher);
|
||||
this->m_itemsModel->setData(m_voucher->items());
|
||||
|
||||
setTotalText();
|
||||
ui->temporarySaveButton->setEnabled(!m_voucher->items().isEmpty());
|
||||
@@ -530,6 +529,9 @@ void ShopForm::recalculate()
|
||||
{
|
||||
srv.update(m_voucher);
|
||||
}
|
||||
|
||||
this->m_itemsModel->setData(m_voucher->items());
|
||||
connectItemSignals();
|
||||
}
|
||||
|
||||
void ShopForm::on_receiptCombo_currentIndexChanged(int)
|
||||
@@ -654,7 +656,9 @@ void ShopForm::on_actionDelete_items_triggered()
|
||||
QList<VoucherItemPtr> forDelete;
|
||||
|
||||
for (const auto& row : ui->actualReceipt->selectionModel()->selectedIndexes()) {
|
||||
forDelete << m_itemsModel->itemFromIndex(row);
|
||||
if (!forDelete.contains(m_itemsModel->itemFromIndex(row))) {
|
||||
forDelete << m_itemsModel->itemFromIndex(row);
|
||||
}
|
||||
}
|
||||
|
||||
for (auto& item : forDelete) {
|
||||
|
||||
+13
-1
@@ -7,6 +7,11 @@ ShopOverview::ShopOverview(QWidget *parent) :
|
||||
ui(new Ui::ShopOverview)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
#ifndef EET
|
||||
ui->labelUnsendEET->setVisible(false);
|
||||
ui->label_6->setVisible(false);
|
||||
#endif
|
||||
}
|
||||
|
||||
ShopOverview::~ShopOverview()
|
||||
@@ -19,9 +24,16 @@ void ShopOverview::refresh()
|
||||
ShopService srv;
|
||||
|
||||
VoucherSum unpaid = srv.unpaidSummary();
|
||||
VoucherSum unsend = srv.unsendEET();
|
||||
|
||||
ui->labelUnapiedCount->setText(QString::number(unpaid.count()));
|
||||
ui->labelUnpaiedAmount->setText(QString::number(unpaid.totalPrice().toDouble()));
|
||||
|
||||
VoucherSum today = srv.salesSummary(QDate::currentDate());
|
||||
ui->labelSales->setText(QString::number(today.totalPrice().toDouble()));
|
||||
ui->labelNumSales->setText(QString::number(today.count()));
|
||||
|
||||
#ifdef EET
|
||||
VoucherSum unsend = srv.unsendEET();
|
||||
ui->labelUnsendEET->setText(QString::number(unsend.count()));
|
||||
#endif
|
||||
}
|
||||
|
||||
+47
-3
@@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>908</width>
|
||||
<height>95</height>
|
||||
<height>162</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@@ -83,7 +83,6 @@
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
@@ -102,7 +101,6 @@
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
@@ -114,6 +112,52 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Today sales:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QLabel" name="labelSales">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>90</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>Number of sales today:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QLabel" name="labelNumSales">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>90</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
+27
-10
@@ -60,10 +60,6 @@ void ShopService::calculate(VoucherPtr voucher)
|
||||
|
||||
loadSettings();
|
||||
|
||||
if (voucher->items().isEmpty()) {
|
||||
load(voucher);
|
||||
}
|
||||
|
||||
foreach (QSharedPointer<VoucherItem> item, voucher->items()) {
|
||||
|
||||
if (item->refId() == ROUNDING_ITEM)
|
||||
@@ -173,6 +169,10 @@ void ShopService::pay(VoucherPtr voucher)
|
||||
voucher->setPayDateTime(QDateTime::currentDateTime());
|
||||
|
||||
this->update(voucher, &session);
|
||||
|
||||
if (!session.isValid()) {
|
||||
qDebug() << session.firstError().text();
|
||||
}
|
||||
}
|
||||
|
||||
void ShopService::updateRelatedItem(VoucherItem* item, int countAdded)
|
||||
@@ -380,6 +380,9 @@ void ShopService::moveItems(QList<VoucherItemPtr> items, VoucherPtr source, Vouc
|
||||
it->setVoucher(target);
|
||||
}
|
||||
|
||||
calculate(target);
|
||||
update(target, &session);
|
||||
|
||||
if (source->items().isEmpty())
|
||||
{
|
||||
erase(source, &session);
|
||||
@@ -433,9 +436,7 @@ QList<IShopItemPtr> ShopService::allSellableItems(const QString& category/* = ""
|
||||
|
||||
VoucherSum ShopService::unpaidSummary()
|
||||
{
|
||||
VoucherSum sum; //= db->query_value<VoucherSum>("status = " + query::_ref((int)Voucher::NOT_PAID));
|
||||
|
||||
return sum;
|
||||
return summary("status = " + QString::number(Voucher::NOT_PAID));
|
||||
}
|
||||
|
||||
VoucherSum ShopService::unsendEET()
|
||||
@@ -526,10 +527,11 @@ void ShopService::update(VoucherPtr entity, qx::QxSession* pSession) {
|
||||
|
||||
Service::update(entity, pSession);
|
||||
auto oldItems = entity->items();
|
||||
entity->clearItems();
|
||||
load(entity);
|
||||
|
||||
for (auto item : entity->items()) {
|
||||
Service<VoucherItem> srvItem;
|
||||
auto items = srvItem.all("voucher = " + QString::number(entity->id()));
|
||||
|
||||
for (auto item : items) {
|
||||
auto newItem = std::find_if(oldItems.begin(), oldItems.end(), [item](auto it){
|
||||
return item->id() == it->id();
|
||||
});
|
||||
@@ -546,3 +548,18 @@ void ShopService::update(VoucherPtr entity, qx::QxSession* pSession) {
|
||||
}
|
||||
}
|
||||
|
||||
VoucherSum ShopService::salesSummary(QDate date) {
|
||||
return summary("payDateTime >= '" + date.toString("yyyy-MM-dd") + "'");
|
||||
}
|
||||
|
||||
VoucherSum ShopService::summary(const QString& where) {
|
||||
auto sums = all(where);
|
||||
VoucherSum sum(sums.count(), 0);
|
||||
|
||||
for (const auto& item : sums) {
|
||||
sum.addPrice(item->totalPrice());
|
||||
}
|
||||
|
||||
return sum;
|
||||
}
|
||||
|
||||
|
||||
@@ -44,12 +44,14 @@ public:
|
||||
QList<IShopItemPtr> allSellableItems(const QString& category = "");
|
||||
QMap<QString, QString> allCategories();
|
||||
VoucherSum unpaidSummary();
|
||||
VoucherSum salesSummary(QDate date);
|
||||
VoucherSum unsendEET();
|
||||
|
||||
private:
|
||||
QDecDouble includeVat(QDecDouble price, Enums::VatType vatType);
|
||||
QDecDouble excludeVat(QDecDouble price, Enums::VatType vatType);
|
||||
void loadSettings();
|
||||
VoucherSum summary(const QString& where);
|
||||
|
||||
QSharedPointer<GlobalSettings> m_gs;
|
||||
QDecDouble vatRate(Enums::VatType vatType);
|
||||
|
||||
Binary file not shown.
+179
-95
@@ -29,22 +29,22 @@
|
||||
<translation>Sazba DPH</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../directsaleform.cpp" line="17"/>
|
||||
<location filename="../directsaleform.cpp" line="18"/>
|
||||
<source>None</source>
|
||||
<translation>Žádná</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../directsaleform.cpp" line="18"/>
|
||||
<location filename="../directsaleform.cpp" line="19"/>
|
||||
<source>High</source>
|
||||
<translation>Vysoká</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../directsaleform.cpp" line="19"/>
|
||||
<location filename="../directsaleform.cpp" line="20"/>
|
||||
<source>First Lower</source>
|
||||
<translation>První snížená</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../directsaleform.cpp" line="20"/>
|
||||
<location filename="../directsaleform.cpp" line="21"/>
|
||||
<source>Second Lower</source>
|
||||
<translation>Druhá snížená</translation>
|
||||
</message>
|
||||
@@ -60,36 +60,41 @@
|
||||
<context>
|
||||
<name>PayDialog</name>
|
||||
<message>
|
||||
<location filename="../paydialog.ui" line="14"/>
|
||||
<location filename="../paydialog.ui" line="20"/>
|
||||
<source>Recieve money</source>
|
||||
<translation>Platba</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../paydialog.ui" line="30"/>
|
||||
<location filename="../paydialog.ui" line="36"/>
|
||||
<source>Total:</source>
|
||||
<translation>Celkem:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../paydialog.ui" line="44"/>
|
||||
<location filename="../paydialog.ui" line="101"/>
|
||||
<location filename="../paydialog.ui" line="50"/>
|
||||
<location filename="../paydialog.ui" line="107"/>
|
||||
<source>0</source>
|
||||
<translation></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../paydialog.ui" line="59"/>
|
||||
<location filename="../paydialog.ui" line="65"/>
|
||||
<source>Recieved</source>
|
||||
<translation>Obdrženo</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../paydialog.ui" line="89"/>
|
||||
<location filename="../paydialog.ui" line="95"/>
|
||||
<source>Return</source>
|
||||
<translation>Vrátit</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../paydialog.ui" line="124"/>
|
||||
<location filename="../paydialog.ui" line="117"/>
|
||||
<source>Send to EET portal</source>
|
||||
<translation>Odeslat na EET</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../paydialog.ui" line="142"/>
|
||||
<source>OK</source>
|
||||
<translation>OK</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>PaydVouchersDialog</name>
|
||||
@@ -104,65 +109,66 @@
|
||||
<translation>Vytisknout účtenku</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../paydvouchersdialog.ui" line="55"/>
|
||||
<location filename="../paydvouchersdialog.cpp" line="99"/>
|
||||
<location filename="../paydvouchersdialog.ui" line="75"/>
|
||||
<location filename="../paydvouchersdialog.cpp" line="110"/>
|
||||
<source>Save receipt</source>
|
||||
<translation>Uložit účtenku</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../paydvouchersdialog.ui" line="58"/>
|
||||
<location filename="../paydvouchersdialog.ui" line="52"/>
|
||||
<location filename="../paydvouchersdialog.ui" line="78"/>
|
||||
<location filename="../paydvouchersdialog.ui" line="101"/>
|
||||
<location filename="../paydvouchersdialog.ui" line="98"/>
|
||||
<location filename="../paydvouchersdialog.ui" line="121"/>
|
||||
<source>...</source>
|
||||
<translation></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../paydvouchersdialog.ui" line="153"/>
|
||||
<location filename="../paydvouchersdialog.ui" line="173"/>
|
||||
<source>Items</source>
|
||||
<translation>Položky</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../paydvouchersdialog.ui" line="168"/>
|
||||
<location filename="../paydvouchersdialog.ui" line="188"/>
|
||||
<source>EET:</source>
|
||||
<translation></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../paydvouchersdialog.ui" line="219"/>
|
||||
<location filename="../paydvouchersdialog.ui" line="239"/>
|
||||
<source>Total:</source>
|
||||
<translation>Celkem:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../paydvouchersdialog.ui" line="239"/>
|
||||
<location filename="../paydvouchersdialog.ui" line="259"/>
|
||||
<source>0</source>
|
||||
<translation></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../paydvouchersdialog.cpp" line="63"/>
|
||||
<location filename="../paydvouchersdialog.cpp" line="74"/>
|
||||
<source>not entering</source>
|
||||
<translation>Nevstupuje</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../paydvouchersdialog.cpp" line="66"/>
|
||||
<location filename="../paydvouchersdialog.cpp" line="77"/>
|
||||
<source>for send</source>
|
||||
<translation>K odeslání</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../paydvouchersdialog.cpp" line="69"/>
|
||||
<location filename="../paydvouchersdialog.cpp" line="80"/>
|
||||
<source>error</source>
|
||||
<translation>Chyba</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../paydvouchersdialog.cpp" line="72"/>
|
||||
<location filename="../paydvouchersdialog.cpp" line="83"/>
|
||||
<source>sent</source>
|
||||
<translation>Odesláno</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../paydvouchersdialog.cpp" line="99"/>
|
||||
<location filename="../paydvouchersdialog.cpp" line="110"/>
|
||||
<source>Text files (*.txt)</source>
|
||||
<translation>Textové soubory (*.txt)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../paydvouchersdialog.cpp" line="139"/>
|
||||
<location filename="../paydvouchersdialog.cpp" line="150"/>
|
||||
<source>Error</source>
|
||||
<translation>Chyba</translation>
|
||||
</message>
|
||||
@@ -170,33 +176,33 @@
|
||||
<context>
|
||||
<name>QObject</name>
|
||||
<message>
|
||||
<location filename="../shopform.cpp" line="36"/>
|
||||
<location filename="../shopform.cpp" line="35"/>
|
||||
<source>EET communication error.
|
||||
</source>
|
||||
<translation>Chyba komunikace s EET</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../shopform.cpp" line="40"/>
|
||||
<location filename="../shopform.cpp" line="39"/>
|
||||
<source>Message from portal: </source>
|
||||
<translation>Zpráva z EET portálu:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../shopform.cpp" line="43"/>
|
||||
<location filename="../shopform.cpp" line="42"/>
|
||||
<source>Switch to offline?</source>
|
||||
<translation>Přepnout do offline?</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../shopform.cpp" line="45"/>
|
||||
<location filename="../shopform.cpp" line="44"/>
|
||||
<source>EET error</source>
|
||||
<translation>Chyba EET</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../shopform.cpp" line="51"/>
|
||||
<location filename="../shopform.cpp" line="50"/>
|
||||
<source><a href="#eet">Online</a></source>
|
||||
<translation></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../shopform.cpp" line="51"/>
|
||||
<location filename="../shopform.cpp" line="50"/>
|
||||
<source><a href="#eet">Offline</a></source>
|
||||
<translation></translation>
|
||||
</message>
|
||||
@@ -223,6 +229,11 @@
|
||||
<source>Items</source>
|
||||
<translation>Položky</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../receiptloadform.ui" line="55"/>
|
||||
<source>Select &all</source>
|
||||
<translation>Vybrat &vše</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>ReceiptSaveForm</name>
|
||||
@@ -284,142 +295,167 @@
|
||||
<translation></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../shopform.ui" line="44"/>
|
||||
<location filename="../shopform.ui" line="111"/>
|
||||
<source>Commodity</source>
|
||||
<translation>Zboží</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../shopform.ui" line="73"/>
|
||||
<location filename="../shopform.ui" line="140"/>
|
||||
<source>Count</source>
|
||||
<translation>Počet</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../shopform.ui" line="99"/>
|
||||
<location filename="../shopform.ui" line="166"/>
|
||||
<source>Add Item</source>
|
||||
<translation>Přidat položku</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../shopform.ui" line="127"/>
|
||||
<source>Direct Sale</source>
|
||||
<translation>Přímý prodej</translation>
|
||||
<translation type="vanished">Přímý prodej</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../shopform.ui" line="140"/>
|
||||
<location filename="../shopform.ui" line="62"/>
|
||||
<source>Ctrl+D</source>
|
||||
<translation></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../shopform.ui" line="162"/>
|
||||
<location filename="../shopform.ui" line="84"/>
|
||||
<source>Favorities</source>
|
||||
<translation>Oblíbené</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../shopform.ui" line="186"/>
|
||||
<source>Receipt</source>
|
||||
<translation>Účtenka</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../shopform.ui" line="201"/>
|
||||
<location filename="../shopform.ui" line="231"/>
|
||||
<source>10%</source>
|
||||
<translation></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../shopform.ui" line="260"/>
|
||||
<location filename="../shopform.ui" line="289"/>
|
||||
<source>0%</source>
|
||||
<translation></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../shopform.ui" line="273"/>
|
||||
<location filename="../shopform.ui" line="302"/>
|
||||
<source>21%</source>
|
||||
<translation></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../shopform.ui" line="312"/>
|
||||
<location filename="../shopform.ui" line="340"/>
|
||||
<source>15%</source>
|
||||
<translation></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../shopform.ui" line="361"/>
|
||||
<location filename="../shopform.ui" line="387"/>
|
||||
<source>Witouth VAT</source>
|
||||
<translation>Bez DPH</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../shopform.ui" line="371"/>
|
||||
<location filename="../shopform.ui" line="397"/>
|
||||
<source>VAT</source>
|
||||
<translation>DPH</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../shopform.ui" line="381"/>
|
||||
<location filename="../shopform.ui" line="407"/>
|
||||
<source>Total</source>
|
||||
<translation>Celkem</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../shopform.ui" line="409"/>
|
||||
<location filename="../shopform.ui" line="435"/>
|
||||
<source>EET status:</source>
|
||||
<translation>EET status:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../shopform.ui" line="425"/>
|
||||
<location filename="../shopform.ui" line="450"/>
|
||||
<source><a href="#eet">dfghdfg</a></source>
|
||||
<translation></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../shopform.ui" line="455"/>
|
||||
<location filename="../shopform.ui" line="479"/>
|
||||
<source>Total:</source>
|
||||
<translation>Celkem:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../shopform.ui" line="185"/>
|
||||
<location filename="../shopform.ui" line="208"/>
|
||||
<location filename="../shopform.ui" line="218"/>
|
||||
<location filename="../shopform.ui" line="228"/>
|
||||
<location filename="../shopform.ui" line="244"/>
|
||||
<location filename="../shopform.ui" line="280"/>
|
||||
<location filename="../shopform.ui" line="296"/>
|
||||
<location filename="../shopform.ui" line="325"/>
|
||||
<location filename="../shopform.ui" line="335"/>
|
||||
<location filename="../shopform.ui" line="351"/>
|
||||
<location filename="../shopform.ui" line="472"/>
|
||||
<location filename="../shopform.ui" line="627"/>
|
||||
<location filename="../shopform.cpp" line="655"/>
|
||||
<source>Delete items</source>
|
||||
<translation>Smazat položky</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../shopform.ui" line="630"/>
|
||||
<source>Ctrl+Del</source>
|
||||
<translation>Ctrl+Del</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../shopform.ui" line="215"/>
|
||||
<location filename="../shopform.ui" line="238"/>
|
||||
<location filename="../shopform.ui" line="248"/>
|
||||
<location filename="../shopform.ui" line="258"/>
|
||||
<location filename="../shopform.ui" line="273"/>
|
||||
<location filename="../shopform.ui" line="309"/>
|
||||
<location filename="../shopform.ui" line="324"/>
|
||||
<location filename="../shopform.ui" line="352"/>
|
||||
<location filename="../shopform.ui" line="362"/>
|
||||
<location filename="../shopform.ui" line="377"/>
|
||||
<location filename="../shopform.ui" line="495"/>
|
||||
<source>0</source>
|
||||
<translation></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../shopform.ui" line="493"/>
|
||||
<location filename="../shopform.ui" line="49"/>
|
||||
<source>Direct Sell</source>
|
||||
<translation>Přímý prodej</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../shopform.ui" line="516"/>
|
||||
<source>Temporary Save</source>
|
||||
<translation>Dočasné uložení</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../shopform.ui" line="515"/>
|
||||
<location filename="../shopform.ui" line="538"/>
|
||||
<source>Save</source>
|
||||
<translation>Uložení</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../shopform.ui" line="537"/>
|
||||
<location filename="../shopform.ui" line="560"/>
|
||||
<source>Load</source>
|
||||
<translation>Načíst</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../shopform.ui" line="559"/>
|
||||
<location filename="../shopform.ui" line="582"/>
|
||||
<source>Show paid</source>
|
||||
<translation>Zobrazit zaplacené</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../shopform.ui" line="581"/>
|
||||
<location filename="../shopform.ui" line="604"/>
|
||||
<source>Pay</source>
|
||||
<translation>Zaplatit</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../shopform.cpp" line="149"/>
|
||||
<location filename="../shopform.cpp" line="595"/>
|
||||
<location filename="../shopform.cpp" line="157"/>
|
||||
<location filename="../shopform.cpp" line="640"/>
|
||||
<source><a href="#eet">Online</a></source>
|
||||
<translation></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../shopform.cpp" line="149"/>
|
||||
<location filename="../shopform.cpp" line="595"/>
|
||||
<location filename="../shopform.cpp" line="157"/>
|
||||
<location filename="../shopform.cpp" line="640"/>
|
||||
<source><a href="#eet">Offline</a></source>
|
||||
<translation></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../shopform.cpp" line="223"/>
|
||||
<location filename="../shopform.cpp" line="236"/>
|
||||
<source><< empty >></source>
|
||||
<translation><< nevybráno >></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../shopform.cpp" line="655"/>
|
||||
<source>Really delete selected voucher items?</source>
|
||||
<translation>Opravdu chcete smazat vybrané položky?</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>EET communication error.
|
||||
</source>
|
||||
@@ -453,7 +489,9 @@
|
||||
<message>
|
||||
<location filename="../shopoverview.ui" line="52"/>
|
||||
<location filename="../shopoverview.ui" line="75"/>
|
||||
<location filename="../shopoverview.ui" line="110"/>
|
||||
<location filename="../shopoverview.ui" line="108"/>
|
||||
<location filename="../shopoverview.ui" line="131"/>
|
||||
<location filename="../shopoverview.ui" line="154"/>
|
||||
<source>TextLabel</source>
|
||||
<translation></translation>
|
||||
</message>
|
||||
@@ -463,10 +501,20 @@
|
||||
<translation>Nezaplaceno v Kč:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../shopoverview.ui" line="91"/>
|
||||
<location filename="../shopoverview.ui" line="90"/>
|
||||
<source>Unsend to EET:</source>
|
||||
<translation>Neodesláno na EET:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../shopoverview.ui" line="118"/>
|
||||
<source>Today sales:</source>
|
||||
<translation>Dnešní tržba:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../shopoverview.ui" line="141"/>
|
||||
<source>Number of sales today:</source>
|
||||
<translation>Dnešní počet prodejů:</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>ShopSettingsForm</name>
|
||||
@@ -481,127 +529,148 @@
|
||||
<translation>Nastavení rychlé volby</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/shopsettingsform.ui" line="236"/>
|
||||
<location filename="../settings/shopsettingsform.ui" line="245"/>
|
||||
<source>...</source>
|
||||
<translation></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/shopsettingsform.ui" line="126"/>
|
||||
<location filename="../settings/shopsettingsform.ui" line="129"/>
|
||||
<source>Printer</source>
|
||||
<translation>Tiskárna</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/shopsettingsform.ui" line="89"/>
|
||||
<location filename="../settings/shopsettingsform.ui" line="92"/>
|
||||
<source>Columns</source>
|
||||
<translation>Sloupců</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/shopsettingsform.ui" line="99"/>
|
||||
<location filename="../settings/shopsettingsform.ui" line="102"/>
|
||||
<source>Rows</source>
|
||||
<translation>Řádků</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/shopsettingsform.ui" line="109"/>
|
||||
<location filename="../settings/shopsettingsform.ui" line="112"/>
|
||||
<source>Size</source>
|
||||
<translation>Velikost</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/shopsettingsform.ui" line="132"/>
|
||||
<location filename="../settings/shopsettingsform.ui" line="138"/>
|
||||
<source>Output device</source>
|
||||
<translation>Jméno tiskárny</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/shopsettingsform.ui" line="142"/>
|
||||
<location filename="../settings/shopsettingsform.ui" line="148"/>
|
||||
<source>Letters per line</source>
|
||||
<translation>Znaků na řádek</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/shopsettingsform.ui" line="152"/>
|
||||
<location filename="../settings/shopsettingsform.ui" line="158"/>
|
||||
<source>Footer text</source>
|
||||
<translation>Patička</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/shopsettingsform.ui" line="163"/>
|
||||
<location filename="../settings/shopsettingsform.ui" line="169"/>
|
||||
<source>EET</source>
|
||||
<translation>EET</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/shopsettingsform.ui" line="169"/>
|
||||
<location filename="../settings/shopsettingsform.ui" line="175"/>
|
||||
<source>Activate EET</source>
|
||||
<translation>Zapnout podporu EET</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/shopsettingsform.ui" line="181"/>
|
||||
<location filename="../settings/shopsettingsform.ui" line="190"/>
|
||||
<source>Shop ID</source>
|
||||
<translation>ID provozovny</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/shopsettingsform.ui" line="191"/>
|
||||
<location filename="../settings/shopsettingsform.ui" line="200"/>
|
||||
<source>Cash register ID</source>
|
||||
<translation>ID zařízení</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/shopsettingsform.ui" line="201"/>
|
||||
<location filename="../settings/shopsettingsform.ui" line="210"/>
|
||||
<source>EET mode</source>
|
||||
<translation>EET režim</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/shopsettingsform.ui" line="211"/>
|
||||
<location filename="../settings/shopsettingsform.ui" line="220"/>
|
||||
<source>Certificate file</source>
|
||||
<translation>Certifikát</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/shopsettingsform.ui" line="246"/>
|
||||
<location filename="../settings/shopsettingsform.ui" line="255"/>
|
||||
<source>Private key password</source>
|
||||
<translation>Heslo k certifikátu</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/shopsettingsform.ui" line="260"/>
|
||||
<location filename="../settings/shopsettingsform.ui" line="269"/>
|
||||
<source>Test mode</source>
|
||||
<translation>Testovací režim</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/shopsettingsform.ui" line="267"/>
|
||||
<location filename="../settings/shopsettingsform.ui" line="276"/>
|
||||
<source>Communication with playground </source>
|
||||
<translation>Testovací EET server </translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/shopsettingsform.ui" line="278"/>
|
||||
<location filename="../settings/shopsettingsform.ui" line="287"/>
|
||||
<source>Other</source>
|
||||
<translation>Jiné</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/shopsettingsform.ui" line="284"/>
|
||||
<location filename="../settings/shopsettingsform.ui" line="293"/>
|
||||
<source>Rounding</source>
|
||||
<translation>Zaokrouhlování</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/shopsettingsform.ui" line="290"/>
|
||||
<location filename="../settings/shopsettingsform.ui" line="302"/>
|
||||
<source>Direction</source>
|
||||
<translation>Typ</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/shopsettingsform.ui" line="300"/>
|
||||
<location filename="../settings/shopsettingsform.ui" line="312"/>
|
||||
<source>Decimal places</source>
|
||||
<translation>Desetiných míst</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/shopsettingsform.ui" line="313"/>
|
||||
<location filename="../settings/shopsettingsform.ui" line="325"/>
|
||||
<source>Rounding item text</source>
|
||||
<translation>Název položky</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/shopsettingsform.cpp" line="27"/>
|
||||
<location filename="../settings/shopsettingsform.ui" line="335"/>
|
||||
<source>Default VAT type</source>
|
||||
<translation>Výchozí sazba daně</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/shopsettingsform.ui" line="348"/>
|
||||
<source>Doub&le print bill</source>
|
||||
<translation>Z&dvojená účtenka</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/shopsettingsform.ui" line="363"/>
|
||||
<source>Item name</source>
|
||||
<translation>Jméno položky</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/shopsettingsform.ui" line="376"/>
|
||||
<source>Show field for item count</source>
|
||||
<translation>Zobrazit pole pro počet položek</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/shopsettingsform.cpp" line="24"/>
|
||||
<source>Simplifyed</source>
|
||||
<translation>Zjednodušený</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/shopsettingsform.cpp" line="27"/>
|
||||
<location filename="../settings/shopsettingsform.cpp" line="24"/>
|
||||
<source>Standard</source>
|
||||
<translation>Standartní</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/shopsettingsform.cpp" line="40"/>
|
||||
<location filename="../settings/shopsettingsform.cpp" line="55"/>
|
||||
<source>None</source>
|
||||
<translation>Žádný</translation>
|
||||
</message>
|
||||
@@ -620,6 +689,21 @@
|
||||
<source>Mathematic</source>
|
||||
<translation>Matematické</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/shopsettingsform.cpp" line="56"/>
|
||||
<source>High</source>
|
||||
<translation>Vysoká</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/shopsettingsform.cpp" line="57"/>
|
||||
<source>First lower</source>
|
||||
<translation>První snížená</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/shopsettingsform.cpp" line="58"/>
|
||||
<source>Second lower</source>
|
||||
<translation>Druhá snížená</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>TemporaryReceiptSaveForm</name>
|
||||
|
||||
@@ -0,0 +1,103 @@
|
||||
#include <QCoreApplication>
|
||||
#include <QtTest>
|
||||
|
||||
#include "data/campdata.h"
|
||||
#include "data/serviceitem.h"
|
||||
#include "data/addressitem.h"
|
||||
#include "data/personprice.h"
|
||||
|
||||
class CampTests : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
private slots:
|
||||
void campDataDefaultsAreZeroed()
|
||||
{
|
||||
CampData camp;
|
||||
|
||||
QCOMPARE(camp.totalPrice().toDouble(), 0.0);
|
||||
QCOMPARE(camp.sale().toDouble(), 0.0);
|
||||
QCOMPARE(camp.totalSale().toDouble(), 0.0);
|
||||
QCOMPARE(camp.fullPrice().toDouble(), 0.0);
|
||||
QVERIFY(!camp.fixedSale());
|
||||
QVERIFY(!camp.onVoucher());
|
||||
}
|
||||
|
||||
void campPricesRoundTripWithoutLoss()
|
||||
{
|
||||
CampData camp;
|
||||
|
||||
camp.setTotalPrice(QDecDouble(19.9));
|
||||
camp.setSale(QDecDouble(4.9));
|
||||
camp.setFullPrice(QDecDouble(24.8));
|
||||
|
||||
QVERIFY(qAbs(camp.totalPrice().toDouble() - 19.9) < 0.0001);
|
||||
QVERIFY(qAbs(camp.sale().toDouble() - 4.9) < 0.0001);
|
||||
QVERIFY(qAbs(camp.fullPrice().toDouble() - 24.8) < 0.0001);
|
||||
}
|
||||
|
||||
void campCollectsPeopleAndServices()
|
||||
{
|
||||
CampData camp;
|
||||
auto person = QSharedPointer<AddressItem>::create();
|
||||
auto service = QSharedPointer<ServiceItem>::create();
|
||||
|
||||
camp.addPerson(person);
|
||||
camp.addServiceItem(service);
|
||||
QCOMPARE(camp.people().size(), 1);
|
||||
QCOMPARE(camp.services().size(), 1);
|
||||
|
||||
camp.removePerson(person);
|
||||
camp.removeServiceItem(service);
|
||||
QVERIFY(camp.people().isEmpty());
|
||||
QVERIFY(camp.services().isEmpty());
|
||||
}
|
||||
|
||||
void serviceItemPricesRoundTrip()
|
||||
{
|
||||
ServiceItem item;
|
||||
|
||||
item.setPrice(QDecDouble(33.3));
|
||||
item.setTotalPrice(QDecDouble(66.6));
|
||||
item.setSale(QDecDouble(3.3));
|
||||
|
||||
QVERIFY(qAbs(item.price().toDouble() - 33.3) < 0.0001);
|
||||
QVERIFY(qAbs(item.totalPrice().toDouble() - 66.6) < 0.0001);
|
||||
QVERIFY(qAbs(item.sale().toDouble() - 3.3) < 0.0001);
|
||||
}
|
||||
|
||||
void addressItemOwnerFlagAndPrice()
|
||||
{
|
||||
AddressItem person;
|
||||
|
||||
person.setOwner(true);
|
||||
person.setPrice(QDecDouble(12.5));
|
||||
|
||||
QVERIFY(person.owner());
|
||||
QVERIFY(qAbs(person.price().toDouble() - 12.5) < 0.0001);
|
||||
}
|
||||
|
||||
void personPriceAgeRangeAndPrice()
|
||||
{
|
||||
PersonPrice price;
|
||||
|
||||
price.setFromAge(3);
|
||||
price.setToAge(12);
|
||||
price.setPrice(QDecDouble(7.5));
|
||||
price.setActive(true);
|
||||
|
||||
QCOMPARE(price.fromAge(), 3);
|
||||
QCOMPARE(price.toAge(), 12);
|
||||
QVERIFY(qAbs(price.price().toDouble() - 7.5) < 0.0001);
|
||||
QVERIFY(price.active());
|
||||
}
|
||||
};
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QCoreApplication app(argc, argv);
|
||||
CampTests tests;
|
||||
return QTest::qExec(&tests, argc, argv);
|
||||
}
|
||||
|
||||
#include "camp_tests.moc"
|
||||
@@ -0,0 +1,82 @@
|
||||
#include <QCoreApplication>
|
||||
#include <QtTest>
|
||||
|
||||
#include "data/commoditydata.h"
|
||||
|
||||
class CommodityTests : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
private slots:
|
||||
void defaultsAreZero()
|
||||
{
|
||||
CommodityData commodity;
|
||||
|
||||
QCOMPARE(commodity.price().toDouble(), 0.0);
|
||||
QCOMPARE(commodity.count(), 0);
|
||||
QCOMPARE(commodity.vat(), Enums::NONE);
|
||||
QVERIFY(!commodity.favorite());
|
||||
}
|
||||
|
||||
void priceRoundTripUsesFixedPointStorage()
|
||||
{
|
||||
CommodityData commodity;
|
||||
|
||||
commodity.setPrice(QDecDouble(19.9));
|
||||
|
||||
QVERIFY(qAbs(commodity.price().toDouble() - 19.9) < 0.0001);
|
||||
QCOMPARE(commodity.price(), commodity.unitPrice());
|
||||
}
|
||||
|
||||
void priceRoundTripHandlesWholeAmounts()
|
||||
{
|
||||
CommodityData commodity;
|
||||
|
||||
commodity.setPrice(QDecDouble(125));
|
||||
|
||||
QCOMPARE(commodity.price().toDouble(), 125.0);
|
||||
}
|
||||
|
||||
void vatMirrorsShopItemInterface()
|
||||
{
|
||||
CommodityData commodity;
|
||||
|
||||
commodity.setVat(Enums::HIGH);
|
||||
|
||||
QCOMPARE(commodity.vat(), Enums::HIGH);
|
||||
QCOMPARE(commodity.vatType(), Enums::HIGH);
|
||||
}
|
||||
|
||||
void pluginIdMatchesEmbeddedMetadata()
|
||||
{
|
||||
CommodityData commodity;
|
||||
|
||||
QCOMPARE(commodity.pluginId(), QStringLiteral("COMMODITY"));
|
||||
}
|
||||
|
||||
void basicPropertiesRoundTrip()
|
||||
{
|
||||
CommodityData commodity;
|
||||
|
||||
commodity.setName(QStringLiteral("Položka"));
|
||||
commodity.setShortName(QStringLiteral("Pol."));
|
||||
commodity.setCode(QStringLiteral("A-01"));
|
||||
commodity.setCount(7);
|
||||
commodity.setFavorite(true);
|
||||
|
||||
QCOMPARE(commodity.name(), QStringLiteral("Položka"));
|
||||
QCOMPARE(commodity.shortName(), QStringLiteral("Pol."));
|
||||
QCOMPARE(commodity.code(), QStringLiteral("A-01"));
|
||||
QCOMPARE(commodity.count(), 7);
|
||||
QVERIFY(commodity.favorite());
|
||||
}
|
||||
};
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QCoreApplication app(argc, argv);
|
||||
CommodityTests tests;
|
||||
return QTest::qExec(&tests, argc, argv);
|
||||
}
|
||||
|
||||
#include "commodity_tests.moc"
|
||||
@@ -0,0 +1,157 @@
|
||||
#include <QCoreApplication>
|
||||
#include <QJsonArray>
|
||||
#include <QJsonObject>
|
||||
#include <QLocale>
|
||||
#include <QSettings>
|
||||
#include <QSignalSpy>
|
||||
#include <QTemporaryDir>
|
||||
#include <QtTest>
|
||||
|
||||
#include "context.h"
|
||||
#include "data/permission.h"
|
||||
#include "data/role.h"
|
||||
#include "data/user.h"
|
||||
#include "imetadataplugin.h"
|
||||
#include "permissionevaluator.h"
|
||||
|
||||
class CoreTests : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
private slots:
|
||||
void init()
|
||||
{
|
||||
Context::instance().setCurrentUser({});
|
||||
}
|
||||
|
||||
void cleanup()
|
||||
{
|
||||
Context::instance().setCurrentUser({});
|
||||
}
|
||||
|
||||
void metadataRejectsMissingObject()
|
||||
{
|
||||
QVERIFY(!IMetaDataPlugin::loadBaseMetaData({}));
|
||||
QVERIFY(!IMetaDataPlugin::loadBaseMetaData(QJsonObject{{"MetaData", QStringLiteral("invalid")}}));
|
||||
}
|
||||
|
||||
void metadataUsesDefaultLocaleAndExtractsSchema()
|
||||
{
|
||||
const QJsonObject metadata{
|
||||
{"id", QStringLiteral("EXAMPLE")},
|
||||
{"schemaVersion", 2},
|
||||
{"name", QJsonObject{{"default", QStringLiteral("Example plugin")}}},
|
||||
{"description", QJsonObject{{"default", QStringLiteral("Example description")}}},
|
||||
{"sql", QJsonArray{QStringLiteral("CREATE TABLE example (id INTEGER)")}},
|
||||
{"dependencies", QJsonArray{QStringLiteral("CORE")}}
|
||||
};
|
||||
|
||||
const MetaDataPtr result = IMetaDataPlugin::loadBaseMetaData(QJsonObject{{"MetaData", metadata}});
|
||||
|
||||
QVERIFY(result);
|
||||
QCOMPARE(result->getId(), QStringLiteral("EXAMPLE"));
|
||||
QCOMPARE(result->getName(), QStringLiteral("Example plugin"));
|
||||
QCOMPARE(result->getDescription(), QStringLiteral("Example description"));
|
||||
QCOMPARE(result->getSchemaVersion(), 2);
|
||||
QCOMPARE(result->getSchemas(), QStringList{QStringLiteral("CREATE TABLE example (id INTEGER)")});
|
||||
QCOMPARE(result->getDependsOn(), QStringList{QStringLiteral("CORE")});
|
||||
}
|
||||
|
||||
void metadataPrefersSystemLocale()
|
||||
{
|
||||
const QString locale = QLocale::system().name();
|
||||
const QJsonObject metadata{
|
||||
{"id", QStringLiteral("LOCALIZED")},
|
||||
{"name", QJsonObject{{"default", QStringLiteral("Fallback")}, {locale, QStringLiteral("Localized")}}},
|
||||
{"description", QJsonObject{{"default", QStringLiteral("Fallback description")}}}
|
||||
};
|
||||
|
||||
const MetaDataPtr result = IMetaDataPlugin::loadBaseMetaData(QJsonObject{{"MetaData", metadata}});
|
||||
|
||||
QVERIFY(result);
|
||||
QCOMPARE(result->getName(), QStringLiteral("Localized"));
|
||||
QCOMPARE(result->getDescription(), QStringLiteral("Fallback description"));
|
||||
}
|
||||
|
||||
void permissionDeniedWithoutUser()
|
||||
{
|
||||
PermissionEvaluator evaluator;
|
||||
QSignalSpy denied(&evaluator, &PermissionEvaluator::permissionDenied);
|
||||
|
||||
QVERIFY(!evaluator.hasPermission(QStringLiteral("SHOP"), QStringLiteral("READ")));
|
||||
QCOMPARE(denied.count(), 0);
|
||||
}
|
||||
|
||||
void administratorBypassesPermissionLookup()
|
||||
{
|
||||
auto user = QSharedPointer<User>::create();
|
||||
user->setIsAdmin(true);
|
||||
Context::instance().setCurrentUser(user);
|
||||
|
||||
PermissionEvaluator evaluator;
|
||||
QSignalSpy denied(&evaluator, &PermissionEvaluator::permissionDenied);
|
||||
|
||||
QVERIFY(evaluator.hasPermission(QStringLiteral("SHOP"), QStringLiteral("DELETE")));
|
||||
QCOMPARE(denied.count(), 0);
|
||||
}
|
||||
|
||||
void matchingRolePermissionIsGranted()
|
||||
{
|
||||
auto permission = QSharedPointer<Permission>::create();
|
||||
permission->setPluginId(QStringLiteral("SHOP"));
|
||||
permission->setPermissionName(QStringLiteral("READ"));
|
||||
|
||||
auto role = QSharedPointer<Role>::create();
|
||||
role->addPermission(permission);
|
||||
|
||||
auto user = QSharedPointer<User>::create();
|
||||
user->setIsAdmin(false);
|
||||
user->addRole(role);
|
||||
Context::instance().setCurrentUser(user);
|
||||
|
||||
PermissionEvaluator evaluator;
|
||||
QSignalSpy denied(&evaluator, &PermissionEvaluator::permissionDenied);
|
||||
|
||||
QVERIFY(evaluator.hasPermission(QStringLiteral("SHOP"), QStringLiteral("READ")));
|
||||
QCOMPARE(denied.count(), 0);
|
||||
}
|
||||
|
||||
void mismatchedPermissionIsDeniedAndEmitsSignal()
|
||||
{
|
||||
auto permission = QSharedPointer<Permission>::create();
|
||||
permission->setPluginId(QStringLiteral("SHOP"));
|
||||
permission->setPermissionName(QStringLiteral("READ"));
|
||||
|
||||
auto role = QSharedPointer<Role>::create();
|
||||
role->addPermission(permission);
|
||||
|
||||
auto user = QSharedPointer<User>::create();
|
||||
user->setIsAdmin(false);
|
||||
user->addRole(role);
|
||||
Context::instance().setCurrentUser(user);
|
||||
|
||||
PermissionEvaluator evaluator;
|
||||
QSignalSpy denied(&evaluator, &PermissionEvaluator::permissionDenied);
|
||||
|
||||
QVERIFY(!evaluator.hasPermission(QStringLiteral("SHOP"), QStringLiteral("DELETE")));
|
||||
QCOMPARE(denied.count(), 1);
|
||||
QCOMPARE(denied.takeFirst().at(0).toString(), QStringLiteral("DELETE"));
|
||||
}
|
||||
};
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QCoreApplication app(argc, argv);
|
||||
QTemporaryDir settingsDirectory;
|
||||
if (!settingsDirectory.isValid()) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
QSettings::setDefaultFormat(QSettings::IniFormat);
|
||||
QSettings::setPath(QSettings::IniFormat, QSettings::UserScope, settingsDirectory.path());
|
||||
|
||||
CoreTests tests;
|
||||
return QTest::qExec(&tests, argc, argv);
|
||||
}
|
||||
|
||||
#include "core_tests.moc"
|
||||
@@ -0,0 +1,81 @@
|
||||
#include <QCoreApplication>
|
||||
#include <QFileInfo>
|
||||
#include <QSettings>
|
||||
#include <QTemporaryDir>
|
||||
#include <QtTest>
|
||||
|
||||
#include <QxOrm.h>
|
||||
|
||||
#include "context.h"
|
||||
#include "service.h"
|
||||
#include "../countryregister/data/countrydata.h"
|
||||
|
||||
class PersistenceTests : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
private slots:
|
||||
void crudCycleOnTemporaryDatabase()
|
||||
{
|
||||
QTemporaryDir dir;
|
||||
QVERIFY(dir.isValid());
|
||||
const QString dbPath = dir.filePath(QStringLiteral("countries.db"));
|
||||
|
||||
qx::QxSqlDatabase::getSingleton()->setDriverName(QStringLiteral("QSQLITE"));
|
||||
qx::QxSqlDatabase::getSingleton()->setDatabaseName(dbPath);
|
||||
|
||||
const QSqlError createError = qx::dao::create_table<CountryData>();
|
||||
QVERIFY2(!createError.isValid(), qPrintable(createError.text()));
|
||||
QVERIFY(QFileInfo::exists(dbPath));
|
||||
|
||||
Service<CountryData> service;
|
||||
|
||||
auto country = QSharedPointer<CountryData>::create();
|
||||
country->setCode2(QStringLiteral("CZ"));
|
||||
country->setCode3(QStringLiteral("CZE"));
|
||||
country->setCzechName(QStringLiteral("Česko"));
|
||||
country->setEnglishName(QStringLiteral("Czechia"));
|
||||
|
||||
QSignalSpy errorSpy(&service, &Service<CountryData>::dbError);
|
||||
service.save(country);
|
||||
QCOMPARE(errorSpy.count(), 0);
|
||||
QVERIFY(country->id() > 0);
|
||||
|
||||
const QList<QSharedPointer<CountryData>> all = service.all();
|
||||
QCOMPARE(all.size(), 1);
|
||||
QCOMPARE(all.first()->code2(), QStringLiteral("CZ"));
|
||||
QCOMPARE(all.first()->czechName(), QStringLiteral("Česko"));
|
||||
|
||||
auto loaded = service.loadById(country->id());
|
||||
QVERIFY(!loaded.isNull());
|
||||
QCOMPARE(loaded->code3(), QStringLiteral("CZE"));
|
||||
|
||||
loaded->setCzechName(QStringLiteral("Česká republika"));
|
||||
service.update(loaded);
|
||||
QCOMPARE(errorSpy.count(), 0);
|
||||
|
||||
auto reloaded = service.loadById(country->id());
|
||||
QCOMPARE(reloaded->czechName(), QStringLiteral("Česká republika"));
|
||||
|
||||
service.erase(reloaded);
|
||||
QCOMPARE(errorSpy.count(), 0);
|
||||
QVERIFY(service.all().isEmpty());
|
||||
}
|
||||
};
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QCoreApplication app(argc, argv);
|
||||
QTemporaryDir settingsDirectory;
|
||||
if (!settingsDirectory.isValid()) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
QSettings::setDefaultFormat(QSettings::IniFormat);
|
||||
QSettings::setPath(QSettings::IniFormat, QSettings::UserScope, settingsDirectory.path());
|
||||
|
||||
PersistenceTests tests;
|
||||
return QTest::qExec(&tests, argc, argv);
|
||||
}
|
||||
|
||||
#include "persistence_tests.moc"
|
||||
@@ -0,0 +1,73 @@
|
||||
#include <QCoreApplication>
|
||||
#include <QFileInfo>
|
||||
#include <QJsonArray>
|
||||
#include <QJsonObject>
|
||||
#include <QPluginLoader>
|
||||
#include <QtTest>
|
||||
|
||||
#include "imetadataplugin.h"
|
||||
#include "iplugin.h"
|
||||
|
||||
struct PluginExpectation
|
||||
{
|
||||
QString path;
|
||||
QString id;
|
||||
};
|
||||
|
||||
class PluginMetadataTests : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit PluginMetadataTests(QList<PluginExpectation> plugins)
|
||||
: m_plugins(std::move(plugins))
|
||||
{
|
||||
}
|
||||
|
||||
private slots:
|
||||
void embeddedMetadataMatchesPluginContract()
|
||||
{
|
||||
for (const PluginExpectation &plugin : m_plugins) {
|
||||
QVERIFY2(QFileInfo::exists(plugin.path), qPrintable(plugin.path));
|
||||
|
||||
QPluginLoader loader(plugin.path);
|
||||
const QJsonObject metadata = loader.metaData();
|
||||
QVERIFY2(!metadata.isEmpty(), qPrintable(loader.errorString()));
|
||||
QCOMPARE(metadata.value(QStringLiteral("IID")).toString(), QString::fromLatin1(PluginInterface_iid));
|
||||
|
||||
const QJsonObject data = metadata.value(QStringLiteral("MetaData")).toObject();
|
||||
QVERIFY2(!data.isEmpty(), qPrintable(plugin.path));
|
||||
QCOMPARE(data.value(QStringLiteral("id")).toString(), plugin.id);
|
||||
QVERIFY(data.value(QStringLiteral("schemaVersion")).toInt() > 0);
|
||||
QVERIFY(data.value(QStringLiteral("sql")).isArray());
|
||||
QVERIFY(data.value(QStringLiteral("dependencies")).isArray());
|
||||
|
||||
const MetaDataPtr parsed = IMetaDataPlugin::loadBaseMetaData(metadata);
|
||||
QVERIFY(parsed);
|
||||
QCOMPARE(parsed->getId(), plugin.id);
|
||||
QCOMPARE(parsed->getSchemaVersion(), data.value(QStringLiteral("schemaVersion")).toInt());
|
||||
QCOMPARE(parsed->getSchemas().size(), data.value(QStringLiteral("sql")).toArray().size());
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
QList<PluginExpectation> m_plugins;
|
||||
};
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QCoreApplication app(argc, argv);
|
||||
if (argc < 3 || (argc - 1) % 2 != 0) {
|
||||
return 2;
|
||||
}
|
||||
|
||||
QList<PluginExpectation> plugins;
|
||||
for (int index = 1; index < argc; index += 2) {
|
||||
plugins.append({QString::fromLocal8Bit(argv[index]), QString::fromLocal8Bit(argv[index + 1])});
|
||||
}
|
||||
|
||||
PluginMetadataTests tests(std::move(plugins));
|
||||
return QTest::qExec(&tests, 1, argv);
|
||||
}
|
||||
|
||||
#include "plugin_metadata_tests.moc"
|
||||
@@ -0,0 +1,67 @@
|
||||
#include <QCoreApplication>
|
||||
#include <QtTest>
|
||||
|
||||
#include "data/accservice.h"
|
||||
|
||||
class ServicesTests : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
private slots:
|
||||
void defaultsMatchExpectedInitialState()
|
||||
{
|
||||
AccService service;
|
||||
|
||||
QCOMPARE(service.price().toDouble(), 0.0);
|
||||
QVERIFY(service.active());
|
||||
QVERIFY(!service.salePossible());
|
||||
QCOMPARE(service.serviceType(), AccService::OTHER);
|
||||
QCOMPARE(service.vatType(), Enums::NONE);
|
||||
}
|
||||
|
||||
void priceRoundTripUsesFixedPointStorage()
|
||||
{
|
||||
AccService service;
|
||||
|
||||
service.setPrice(QDecDouble(19.9));
|
||||
|
||||
QVERIFY(qAbs(service.price().toDouble() - 19.9) < 0.0001);
|
||||
}
|
||||
|
||||
void priceRoundTripHandlesWholeAmounts()
|
||||
{
|
||||
AccService service;
|
||||
|
||||
service.setPrice(QDecDouble(250));
|
||||
|
||||
QCOMPARE(service.price().toDouble(), 250.0);
|
||||
}
|
||||
|
||||
void basicPropertiesRoundTrip()
|
||||
{
|
||||
AccService service;
|
||||
|
||||
service.setAccServiceName(QStringLiteral("Ubytování"));
|
||||
service.setAccServiceCode(QStringLiteral("UB-1"));
|
||||
service.setActive(false);
|
||||
service.setSalePossible(true);
|
||||
service.setServiceType(AccService::TENT);
|
||||
service.setVatType(Enums::FIRST_LOWER);
|
||||
|
||||
QCOMPARE(service.accServiceName(), QStringLiteral("Ubytování"));
|
||||
QCOMPARE(service.accServiceCode(), QStringLiteral("UB-1"));
|
||||
QVERIFY(!service.active());
|
||||
QVERIFY(service.salePossible());
|
||||
QCOMPARE(service.serviceType(), AccService::TENT);
|
||||
QCOMPARE(service.vatType(), Enums::FIRST_LOWER);
|
||||
}
|
||||
};
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QCoreApplication app(argc, argv);
|
||||
ServicesTests tests;
|
||||
return QTest::qExec(&tests, argc, argv);
|
||||
}
|
||||
|
||||
#include "services_tests.moc"
|
||||
@@ -0,0 +1,57 @@
|
||||
#include <QCoreApplication>
|
||||
#include <QtTest>
|
||||
|
||||
#include "data/voucher.h"
|
||||
|
||||
class ShopTests : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
private slots:
|
||||
void defaultsMatchNewVoucherState()
|
||||
{
|
||||
Voucher voucher;
|
||||
|
||||
QCOMPARE(voucher.totalPrice().toDouble(), 0.0);
|
||||
QCOMPARE(voucher.status(), Voucher::NEW);
|
||||
QCOMPARE(voucher.eetStatus(), Voucher::EET_FOR_SEND);
|
||||
}
|
||||
|
||||
void totalPriceRoundTripUsesFixedPointStorage()
|
||||
{
|
||||
Voucher voucher;
|
||||
|
||||
voucher.setTotalPrice(QDecDouble(19.9));
|
||||
|
||||
QVERIFY(qAbs(voucher.totalPrice().toDouble() - 19.9) < 0.0001);
|
||||
}
|
||||
|
||||
void vatAmountIsDifferenceBetweenTotalAndBase()
|
||||
{
|
||||
Voucher voucher;
|
||||
|
||||
voucher.setTotalPriceVatHigh(QDecDouble(121));
|
||||
voucher.setPriceVatHigh(QDecDouble(100));
|
||||
|
||||
QVERIFY(qAbs(voucher.vatAmountHigh().toDouble() - 21.0) < 0.0001);
|
||||
}
|
||||
|
||||
void voucherSumAccumulatesPricesWithoutTruncation()
|
||||
{
|
||||
VoucherSum sum(0, 0);
|
||||
|
||||
sum.addPrice(QDecDouble(19.9));
|
||||
sum.addPrice(QDecDouble(0.1));
|
||||
|
||||
QVERIFY(qAbs(sum.totalPrice().toDouble() - 20.0) < 0.0001);
|
||||
}
|
||||
};
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QCoreApplication app(argc, argv);
|
||||
ShopTests tests;
|
||||
return QTest::qExec(&tests, argc, argv);
|
||||
}
|
||||
|
||||
#include "shop_tests.moc"
|
||||
Reference in New Issue
Block a user