|
|
@ -25,6 +25,7 @@ ShopForm::ShopForm(QWidget *parent) :
|
|
|
|
ui->setupUi(this);
|
|
|
|
ui->setupUi(this);
|
|
|
|
m_itemsModel = NULL;
|
|
|
|
m_itemsModel = NULL;
|
|
|
|
m_commodityModel = NULL;
|
|
|
|
m_commodityModel = NULL;
|
|
|
|
|
|
|
|
m_itemFound = false;
|
|
|
|
|
|
|
|
|
|
|
|
ui->temporarySaveButton->setEnabled(false);
|
|
|
|
ui->temporarySaveButton->setEnabled(false);
|
|
|
|
ui->saveButton->setEnabled(false);
|
|
|
|
ui->saveButton->setEnabled(false);
|
|
|
@ -38,8 +39,6 @@ ShopForm::~ShopForm()
|
|
|
|
|
|
|
|
|
|
|
|
void ShopForm::loadLast()
|
|
|
|
void ShopForm::loadLast()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
loadButtons();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (m_itemsModel == NULL)
|
|
|
|
if (m_itemsModel == NULL)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
m_itemsModel = new AutoTableModel<VoucherItem>(this);
|
|
|
|
m_itemsModel = new AutoTableModel<VoucherItem>(this);
|
|
|
@ -82,7 +81,7 @@ void ShopForm::loadLast()
|
|
|
|
|
|
|
|
|
|
|
|
m_commodityModel->setData(srv.allSellableItems());
|
|
|
|
m_commodityModel->setData(srv.allSellableItems());
|
|
|
|
ui->commodityTable->horizontalHeader()->setSectionResizeMode(1, QHeaderView::Stretch);
|
|
|
|
ui->commodityTable->horizontalHeader()->setSectionResizeMode(1, QHeaderView::Stretch);
|
|
|
|
ui->commodityTable->setColumnHidden(3, true);
|
|
|
|
ui->commodityTable->setColumnHidden(4, true);
|
|
|
|
ui->commodityTable->setColumnHidden(2, true);
|
|
|
|
ui->commodityTable->setColumnHidden(2, true);
|
|
|
|
|
|
|
|
|
|
|
|
if (srv.isEetEnabled())
|
|
|
|
if (srv.isEetEnabled())
|
|
|
@ -141,6 +140,8 @@ void ShopForm::loadButtons()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ui->commoditySearch->setFocus();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void ShopForm::fillRaceiptCombo()
|
|
|
|
void ShopForm::fillRaceiptCombo()
|
|
|
@ -365,6 +366,8 @@ void ShopForm::addItem(QSharedPointer<IShopItem> item, int count)
|
|
|
|
onCountChanged();
|
|
|
|
onCountChanged();
|
|
|
|
|
|
|
|
|
|
|
|
ui->actualReceipt->scrollToBottom();
|
|
|
|
ui->actualReceipt->scrollToBottom();
|
|
|
|
|
|
|
|
ui->commoditySearch->setFocus();
|
|
|
|
|
|
|
|
ui->commoditySearch->setText("");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void ShopForm::on_receiptCombo_currentIndexChanged(int)
|
|
|
|
void ShopForm::on_receiptCombo_currentIndexChanged(int)
|
|
|
@ -464,6 +467,7 @@ void ShopForm::on_commoditySearch_textChanged(const QString &text)
|
|
|
|
QModelIndex matchingIndex = proxy.mapToSource(proxy.index(0,0));
|
|
|
|
QModelIndex matchingIndex = proxy.mapToSource(proxy.index(0,0));
|
|
|
|
if(matchingIndex.isValid()) {
|
|
|
|
if(matchingIndex.isValid()) {
|
|
|
|
moveToIndex(matchingIndex);
|
|
|
|
moveToIndex(matchingIndex);
|
|
|
|
|
|
|
|
m_itemFound = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -473,6 +477,11 @@ void ShopForm::on_commoditySearch_textChanged(const QString &text)
|
|
|
|
if (matchingIndex.isValid())
|
|
|
|
if (matchingIndex.isValid())
|
|
|
|
{
|
|
|
|
{
|
|
|
|
moveToIndex(matchingIndex);
|
|
|
|
moveToIndex(matchingIndex);
|
|
|
|
|
|
|
|
m_itemFound = true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
m_itemFound = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -484,3 +493,12 @@ void ShopForm::on_lblEetState_linkActivated(const QString &)
|
|
|
|
|
|
|
|
|
|
|
|
ui->lblEetState->setText(srv.isEetOnline() ? tr("<a href=\"#eet\">Online</a>") : tr("<a href=\"#eet\">Offline</a>"));
|
|
|
|
ui->lblEetState->setText(srv.isEetOnline() ? tr("<a href=\"#eet\">Online</a>") : tr("<a href=\"#eet\">Offline</a>"));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void ShopForm::on_commoditySearch_returnPressed()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (m_itemFound)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
ShopItemPtr item = m_commodityModel->itemFromIndex(ui->commodityTable->currentIndex());
|
|
|
|
|
|
|
|
addItem(item, ui->spnCount->value());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|