| 
						
						
							
								
							
						
						
					 | 
				
			
			 | 
			 | 
			
				@ -7,14 +7,14 @@ ShopService::ShopService()
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				{
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				QSharedPointer<Voucher> ShopService::createVoucher()
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				VoucherPtr ShopService::createVoucher()
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				{
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    QSharedPointer<Voucher> voucher(new Voucher);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    voucher->setStatus(Voucher::NEW);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    return voucher;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				void ShopService::addShopItem(QSharedPointer<Voucher> voucher, QSharedPointer<IShopItem> item, int count)
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				void ShopService::addShopItem(VoucherPtr voucher, QSharedPointer<IShopItem> item, int count)
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				{
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    QSharedPointer<VoucherItem> vItem(new VoucherItem);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    vItem->setName(item->name());
 | 
			
		
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
			
			 | 
			 | 
			
				@ -27,7 +27,7 @@ void ShopService::addShopItem(QSharedPointer<Voucher> voucher, QSharedPointer<IS
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    voucher->addItem(vItem);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				void ShopService::calculate(QSharedPointer<Voucher> voucher)
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				void ShopService::calculate(VoucherPtr voucher)
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				{
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    QDecDouble total;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
			
			 | 
			 | 
			
				@ -66,7 +66,7 @@ void ShopService::calculate(QSharedPointer<Voucher> voucher)
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    voucher->setTotalPrice(total);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				void ShopService::calculateItem(QSharedPointer<VoucherItem> item)
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				void ShopService::calculateItem(VoucherItemPtr item)
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				{
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    loadSettings();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    if (m_gs->vatPayer())
 | 
			
		
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
			
			 | 
			 | 
			
				@ -82,13 +82,13 @@ void ShopService::calculateItem(QSharedPointer<VoucherItem> item)
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				void ShopService::loadItems(QSharedPointer<Voucher> voucher)
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				void ShopService::loadItems(VoucherPtr voucher)
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				{
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    Service<VoucherItem> srv;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    voucher->setItems(srv.all(QString("voucher = %1").arg(voucher->id())));
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				void ShopService::pay(QSharedPointer<Voucher> voucher)
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				void ShopService::pay(VoucherPtr voucher)
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				{
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    Transaction tx;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    NumberSeriesService srvNs;
 | 
			
		
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
			
			 | 
			 | 
			
				@ -106,22 +106,22 @@ void ShopService::pay(QSharedPointer<Voucher> voucher)
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    tx.commit();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				QList<QSharedPointer<Voucher> > ShopService::savedVouchers()
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				QList<VoucherPtr> ShopService::savedVouchers()
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				{
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    return all(QString("status = %1").arg(QString::number(Voucher::NOT_PAID)));
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				QList<QSharedPointer<Voucher> > ShopService::tempVouchers()
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				QList<VoucherPtr> ShopService::tempVouchers()
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				{
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    return all(QString("status = %1").arg(QString::number(Voucher::TEMPORARY)));
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				QList<QSharedPointer<Voucher> > ShopService::paiedVouchers()
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				QList<VoucherPtr> ShopService::paiedVouchers()
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				{
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    return all(QString("status = %1").arg(QString::number(Voucher::PAID)));
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				QList<QSharedPointer<ShopItem> > ShopService::allSellableItems()
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				QList<ShopItemPtr> ShopService::allSellableItems()
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				{
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    QList<QSharedPointer<ShopItem> > items;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    foreach (IPlugin *plugin, Context::instance().plugins()) {
 | 
			
		
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
			
			 | 
			 | 
			
				@ -176,7 +176,7 @@ QDecDouble ShopService::vatRate(Enums::VatType vatType)
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    return vatRate;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				void ShopService::saveVoucher(QSharedPointer<Voucher> entity)
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				void ShopService::saveVoucher(VoucherPtr entity)
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				{
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    Transaction tr;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    odb::database *db = Context::instance().db();
 | 
			
		
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
			
			 | 
			 | 
			
				@ -191,7 +191,7 @@ void ShopService::saveVoucher(QSharedPointer<Voucher> entity)
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    tr.commit();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				void ShopService::updateVoucher(QSharedPointer<Voucher> entity)
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				void ShopService::updateVoucher(VoucherPtr entity)
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				{
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    Transaction tr;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    odb::database *db = Context::instance().db();
 | 
			
		
		
	
	
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
				
			
			 | 
			 | 
			
				
 
 |