| 
						
						
							
								
							
						
						
					 | 
				
			
			 | 
			 | 
			
				@ -54,9 +54,13 @@ void ShopForm::loadLast()
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        connectItemSignals();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        ui->total->setText(QString::number(m_voucher->totalPrice().toDouble(), 'f', 2));
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        ui->temporarySaveButton->setEnabled(true);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        ui->saveButton->setEnabled(true);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        ui->payButton->setEnabled(true);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        if (!m_voucher->items().isEmpty())
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            ui->temporarySaveButton->setEnabled(true);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            ui->saveButton->setEnabled(true);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            ui->payButton->setEnabled(true);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    if (m_commodityModel == NULL)
 | 
			
		
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
			
			 | 
			 | 
			
				@ -119,13 +123,25 @@ void ShopForm::on_saveButton_clicked()
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    ReceiptSaveForm *form = new ReceiptSaveForm(m_voucher, this);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    form->setAttribute(Qt::WA_DeleteOnClose);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    connect(form, &QDialog::accepted, [this]() {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    connect(form, &QDialog::accepted, [this, form]() {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        ShopService srv;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        m_voucher->setStatus(Voucher::NOT_PAID);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        srv.saveVoucher(m_voucher);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        m_voucher = srv.createVoucher();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        if (form->saveAsNew())
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            m_voucher->setStatus(Voucher::NOT_PAID);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            srv.saveVoucher(m_voucher);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            createEmptyVoucher();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        else
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            VoucherPtr selVoucher = form->selectedVoucher();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            srv.moveItems(m_voucher->items(), m_voucher, selVoucher);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            srv.calculate(selVoucher);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            srv.updateVoucher(selVoucher);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            createEmptyVoucher();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        m_itemsModel->setData(m_voucher->items());
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        ui->total->setText("0");
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    });
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    form->show();
 | 
			
		
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
			
			 | 
			 | 
			
				@ -306,7 +322,13 @@ void ShopForm::on_payButton_clicked()
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    connect(dialog, &QDialog::accepted, [this](){
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        ShopService srv;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        srv.pay(m_voucher);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        srv.processEet(m_voucher);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        QString eetMsg;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        bool eetRet = srv.processEet(m_voucher, eetMsg);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        if (!eetRet)
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        ReceiptGenerator generator;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        generator.setVoucher(m_voucher);
 | 
			
		
		
	
	
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
				
			
			 | 
			 | 
			
				
 
 |