|
|
|
#ifndef SHOPSERVICE_H
|
|
|
|
#define SHOPSERVICE_H
|
|
|
|
|
|
|
|
#include <QSharedPointer>
|
|
|
|
|
|
|
|
#include <core.h>
|
|
|
|
#include <settings/globalsettings.h>
|
|
|
|
|
|
|
|
#include "data/shop-data.h"
|
|
|
|
#include "shopitem.h"
|
|
|
|
|
|
|
|
class ShopService : public Service<Voucher>
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
ShopService();
|
|
|
|
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);
|
|
|
|
QList<VoucherPtr> savedVouchers();
|
|
|
|
QList<VoucherPtr> tempVouchers();
|
|
|
|
QList<VoucherPtr> paiedVouchers();
|
|
|
|
QList<ShopItemPtr> allSellableItems();
|
|
|
|
|
|
|
|
private:
|
|
|
|
QDecDouble includeVat(QDecDouble price, Enums::VatType vatType);
|
|
|
|
void loadSettings();
|
|
|
|
|
|
|
|
QSharedPointer<GlobalSettings> m_gs;
|
|
|
|
QDecDouble vatRate(Enums::VatType vatType);
|
|
|
|
|
|
|
|
public:
|
|
|
|
void saveVoucher(VoucherPtr entity);
|
|
|
|
void updateVoucher(VoucherPtr entity);
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // SHOPSERVICE_H
|