Improved work with number series. Added season to voucher record.

This commit is contained in:
2017-05-29 14:08:06 +02:00
parent 87290d4be4
commit b941acf9a0
8 changed files with 38 additions and 6 deletions
+6 -5
View File
@@ -7,6 +7,7 @@
#include <eetcpp.h>
#include <QEventLoop>
#include <seasonservice.h>
ShopService::ShopService()
{
@@ -101,11 +102,7 @@ void ShopService::pay(VoucherPtr voucher)
Transaction tx;
NumberSeriesService srvNs;
NumberSeriesPtr numSer = srvNs.nextForPlugin("SHOP");
QString numSerStr;
numSerStr.sprintf("%s%05d", numSer->prefix().toStdString().c_str(), numSer->lastNumber());
voucher->setNumSer(numSerStr);
voucher->setNumSer(srvNs.nextStrForPlugin("SHOP"));
voucher->setStatus(Voucher::PAID);
voucher->setEetStatus(Voucher::EET_FOR_SEND);
voucher->setPayDateTime(QDateTime::currentDateTime());
@@ -345,6 +342,10 @@ QDecDouble ShopService::vatRate(Enums::VatType vatType)
void ShopService::saveVoucher(VoucherPtr entity)
{
SeasonService seasonSrv;
SeasonPtr season = seasonSrv.active();
entity->setSeason(season);
Transaction tr;
odb::database *db = Context::instance().db();