You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
55 lines
1.2 KiB
C++
55 lines
1.2 KiB
C++
#include "shopform.h"
|
|
#include "ui_shopform.h"
|
|
#include "directsaleform.h"
|
|
#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()
|
|
{
|
|
delete ui;
|
|
}
|
|
|
|
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();
|
|
}
|
|
|
|
void ShopForm::on_temporarySaveButton_clicked()
|
|
{
|
|
TemporaryReceiptSaveForm *form = new TemporaryReceiptSaveForm(this);
|
|
form->show();
|
|
}
|
|
|
|
void ShopForm::on_saveButton_clicked()
|
|
{
|
|
ReceiptSaveForm *form = new ReceiptSaveForm;
|
|
form->show();
|
|
}
|
|
|
|
void ShopForm::on_loadButton_clicked()
|
|
{
|
|
ReceiptLoadForm *form = new ReceiptLoadForm;
|
|
form->show();
|
|
}
|