Implemented base functionality of DirectSaleForm.

This commit is contained in:
2016-04-13 22:37:41 +02:00
parent 049314a245
commit 2ed7d7077b
15 changed files with 206 additions and 14 deletions
+12
View File
@@ -4,12 +4,17 @@
#include "temporaryreceiptsaveform.h"
#include "receiptsaveform.h"
#include "receiptloadform.h"
#include "shopservice.h"
ShopForm::ShopForm(QWidget *parent) :
QWidget(parent),
ui(new Ui::ShopForm)
{
ui->setupUi(this);
ShopService srv;
m_voucher = srv.createVoucher();
m_itemsModel = new AutoTableModel<VoucherItem>(this);
ui->actualReceipt->setModel(m_itemsModel);
}
ShopForm::~ShopForm()
@@ -20,6 +25,13 @@ ShopForm::~ShopForm()
void ShopForm::on_directSale_clicked()
{
DirectSaleForm *form = new DirectSaleForm(this);
connect(form, &QDialog::accepted, [this, form](){
ShopService srv;
srv.addShopItem(m_voucher, form->shopItem(), ((DirectSaleItem*)form->shopItem().data())->count());
this->m_itemsModel->addRow(m_voucher->items()[m_voucher->items().count() - 1]);
});
form->show();
}