2016-04-13 21:34:49 +02:00
|
|
|
#ifndef SHOPSERVICE_H
|
|
|
|
|
#define SHOPSERVICE_H
|
|
|
|
|
|
2016-04-13 22:37:41 +02:00
|
|
|
#include <QSharedPointer>
|
2016-04-13 21:34:49 +02:00
|
|
|
|
2016-04-13 22:37:41 +02:00
|
|
|
#include <core.h>
|
2016-05-27 16:47:40 +02:00
|
|
|
#include <settings/globalsettings.h>
|
2016-04-13 22:37:41 +02:00
|
|
|
|
|
|
|
|
#include "data/shop-data.h"
|
2016-07-13 15:15:18 +02:00
|
|
|
#include "shopitem.h"
|
2016-04-13 22:37:41 +02:00
|
|
|
|
2017-06-08 22:11:25 +02:00
|
|
|
#include "shop_global.h"
|
|
|
|
|
|
2017-10-13 12:58:26 +02:00
|
|
|
#define ROUNDING_ITEM -9999
|
|
|
|
|
|
2017-06-07 15:54:13 +02:00
|
|
|
class PayDialog;
|
|
|
|
|
class ShopForm;
|
|
|
|
|
|
2023-04-28 22:25:29 +02:00
|
|
|
void SHOPSHARED_EXPORT payVoucherFromUI(const VoucherPtr& voucher, PayDialog *dialog, ShopForm *form = nullptr);
|
2017-06-07 15:54:13 +02:00
|
|
|
|
2017-06-08 22:11:25 +02:00
|
|
|
class SHOPSHARED_EXPORT ShopService : public Service<Voucher>
|
2016-04-13 21:34:49 +02:00
|
|
|
{
|
|
|
|
|
public:
|
2023-04-28 22:25:29 +02:00
|
|
|
ShopService() = default;
|
2016-07-22 13:22:51 +02:00
|
|
|
VoucherPtr createVoucher();
|
|
|
|
|
void addShopItem(VoucherPtr voucher, QSharedPointer<IShopItem> item, int count);
|
|
|
|
|
void calculate(VoucherPtr voucher);
|
|
|
|
|
void calculateItem(VoucherItemPtr item);
|
|
|
|
|
void pay(VoucherPtr voucher);
|
2023-05-17 21:31:32 +02:00
|
|
|
void save(VoucherPtr entity, qx::QxSession* pSession = nullptr) override;
|
|
|
|
|
void update(VoucherPtr entity, qx::QxSession* pSession = nullptr) override;
|
2016-08-03 18:24:15 +02:00
|
|
|
void moveItems(QList<VoucherItemPtr> items, VoucherPtr source, VoucherPtr target);
|
2016-07-21 16:24:07 +02:00
|
|
|
void updateRelatedItem(VoucherItem* item, int countAdded);
|
2017-02-21 22:15:43 +01:00
|
|
|
bool processEet(VoucherPtr voucher, QString &message);
|
2017-02-21 20:37:38 +01:00
|
|
|
void setEetOnline(bool online);
|
2017-02-21 22:15:43 +01:00
|
|
|
bool isEetOnline();
|
2017-02-23 22:50:01 +01:00
|
|
|
bool isEetEnabled();
|
2017-10-13 12:58:26 +02:00
|
|
|
void roundVoucher(VoucherPtr voucher);
|
|
|
|
|
VoucherItemPtr roundingItem(VoucherPtr voucher);
|
2016-07-22 13:22:51 +02:00
|
|
|
QList<VoucherPtr> savedVouchers();
|
|
|
|
|
QList<VoucherPtr> tempVouchers();
|
|
|
|
|
QList<VoucherPtr> paiedVouchers();
|
2017-02-23 22:50:01 +01:00
|
|
|
QList<VoucherPtr> vouchersForEet();
|
2023-05-17 21:31:32 +02:00
|
|
|
QList<IShopItemPtr> allSellableItems(const QString& category = "");
|
|
|
|
|
QMap<QString, QString> allCategories();
|
2018-05-23 14:11:56 +02:00
|
|
|
VoucherSum unpaidSummary();
|
2023-06-02 15:04:53 +02:00
|
|
|
VoucherSum salesSummary(QDate date);
|
2018-05-23 14:11:56 +02:00
|
|
|
VoucherSum unsendEET();
|
2016-05-27 16:47:40 +02:00
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
QDecDouble includeVat(QDecDouble price, Enums::VatType vatType);
|
2017-10-13 12:58:26 +02:00
|
|
|
QDecDouble excludeVat(QDecDouble price, Enums::VatType vatType);
|
2016-05-27 16:47:40 +02:00
|
|
|
void loadSettings();
|
2023-06-02 15:04:53 +02:00
|
|
|
VoucherSum summary(const QString& where);
|
2016-05-27 16:47:40 +02:00
|
|
|
|
|
|
|
|
QSharedPointer<GlobalSettings> m_gs;
|
|
|
|
|
QDecDouble vatRate(Enums::VatType vatType);
|
2016-04-13 21:34:49 +02:00
|
|
|
};
|
|
|
|
|
|
2016-04-13 22:37:41 +02:00
|
|
|
#endif // SHOPSERVICE_H
|