|
|
|
#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();
|
|
|
|
QSharedPointer<Voucher> createVoucher();
|
|
|
|
void addShopItem(QSharedPointer<Voucher> voucher, QSharedPointer<IShopItem> item, int count);
|
|
|
|
void calculate(QSharedPointer<Voucher> voucher);
|
|
|
|
void calculateItem(QSharedPointer<VoucherItem> item);
|
|
|
|
void loadItems(QSharedPointer<Voucher> voucher);
|
|
|
|
void pay(QSharedPointer<Voucher> voucher);
|
|
|
|
void updateRelatedItem(VoucherItem* item, int countAdded);
|
|
|
|
QList<QSharedPointer<Voucher> > savedVouchers();
|
|
|
|
QList<QSharedPointer<Voucher> > tempVouchers();
|
|
|
|
QList<QSharedPointer<Voucher> > paiedVouchers();
|
|
|
|
QList<QSharedPointer<ShopItem> > allSellableItems();
|
|
|
|
|
|
|
|
private:
|
|
|
|
QDecDouble includeVat(QDecDouble price, Enums::VatType vatType);
|
|
|
|
void loadSettings();
|
|
|
|
|
|
|
|
QSharedPointer<GlobalSettings> m_gs;
|
|
|
|
QDecDouble vatRate(Enums::VatType vatType);
|
|
|
|
|
|
|
|
public:
|
|
|
|
void saveVoucher(QSharedPointer<Voucher> entity);
|
|
|
|
void updateVoucher(QSharedPointer<Voucher> entity);
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // SHOPSERVICE_H
|