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
|
|
|
|
|
|
|
|
class ShopService : public Service<Voucher>
|
2016-04-13 21:34:49 +02:00
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
ShopService();
|
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 loadItems(VoucherPtr voucher);
|
|
|
|
|
void pay(VoucherPtr voucher);
|
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-17 23:13:59 +01:00
|
|
|
void processEet(VoucherPtr voucher);
|
2016-07-22 13:22:51 +02:00
|
|
|
QList<VoucherPtr> savedVouchers();
|
|
|
|
|
QList<VoucherPtr> tempVouchers();
|
|
|
|
|
QList<VoucherPtr> paiedVouchers();
|
|
|
|
|
QList<ShopItemPtr> allSellableItems();
|
2016-05-27 16:47:40 +02:00
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
QDecDouble includeVat(QDecDouble price, Enums::VatType vatType);
|
|
|
|
|
void loadSettings();
|
|
|
|
|
|
|
|
|
|
QSharedPointer<GlobalSettings> m_gs;
|
|
|
|
|
QDecDouble vatRate(Enums::VatType vatType);
|
2016-05-29 18:31:46 +02:00
|
|
|
|
|
|
|
|
public:
|
2016-07-22 13:22:51 +02:00
|
|
|
void saveVoucher(VoucherPtr entity);
|
|
|
|
|
void updateVoucher(VoucherPtr entity);
|
2016-04-13 21:34:49 +02:00
|
|
|
};
|
|
|
|
|
|
2016-04-13 22:37:41 +02:00
|
|
|
#endif // SHOPSERVICE_H
|