Implemented base functionality for commodity grid on shop form.

This commit is contained in:
2016-07-13 15:15:18 +02:00
parent f9d7df9ab5
commit fb6b4fe027
15 changed files with 138 additions and 10 deletions
+17
View File
@@ -1,5 +1,6 @@
#include "shopservice.h"
#include "numberseriesservice.h"
#include "isellableservice.h"
#include "shop-odb.hxx"
ShopService::ShopService()
@@ -120,6 +121,22 @@ QList<QSharedPointer<Voucher> > ShopService::paiedVouchers()
return all(QString("status = %1").arg(QString::number(Voucher::PAID)));
}
QList<QSharedPointer<ShopItem> > ShopService::allSellableItems()
{
QList<QSharedPointer<ShopItem> > items;
foreach (IPlugin *plugin, Context::instance().plugins()) {
IService *srv = plugin->service<IService>();
ISellableService *selSrv = dynamic_cast<ISellableService*>(srv);
if (selSrv != NULL)
{
items.append(selSrv->shopItems());
}
}
return items;
}
QDecDouble ShopService::includeVat(QDecDouble price, Enums::VatType vatType)
{
return price * ((vatRate(vatType) / 100) + QDecDouble(1));