Compare commits

..

2 commits

Author SHA1 Message Date
d1c5d3a6f8 handle "Sonderkonto" in imports 2018-08-07 08:31:43 +02:00
410eb775aa hide "Sonderkonto" 2018-08-07 08:14:26 +02:00
5 changed files with 48 additions and 6 deletions

View file

@ -37,5 +37,19 @@ void ExcelReader::readSellersFromFile(const std::string& filename, Marketplace*
market->getSellers().push_back(std::move(seller));
rowCount++;
}
// If there was no special seller "Sonderkonto" in import data, then create one
auto specialSeller = market->findSellerWithUuid("11111111-1111-1111-1111-111111111111");
if (!specialSeller) {
auto seller = std::make_unique<Seller>();
seller->setUuidFromString("11111111-1111-1111-1111-111111111111");
seller->setSellerNo(0);
seller->setLastName("Sonderkonto");
seller->setFirstName("Sonderkonto");
seller->setNumArticlesOffered(0);
market->getSellers().push_back(std::move(seller));
}
market->sortSellers();
market->storeToDb();
}

View file

@ -49,6 +49,21 @@ void JsonUtil::importSellers(const std::string& filename, Marketplace* market)
seller->setNumArticlesOffered(val["num_offered_articles"].asInt());
market->getSellers().push_back(std::move(seller));
}
// If there was no special seller "Sonderkonto" in import data, then create one
auto specialSeller = market->findSellerWithUuid("11111111-1111-1111-1111-111111111111");
if (!specialSeller) {
auto seller = std::make_unique<Seller>();
seller->setUuidFromString("11111111-1111-1111-1111-111111111111");
seller->setSellerNo(0);
seller->setLastName("Sonderkonto");
seller->setFirstName("Sonderkonto");
seller->setNumArticlesOffered(0);
market->getSellers().push_back(std::move(seller));
}
market->sortSellers();
market->storeToDb();
}

View file

@ -13,6 +13,7 @@ SellerDialog::SellerDialog(QWidget* parent, Qt::WindowFlags f) : QDialog(parent,
model_ = std::make_unique<SellerModel>(market_, ui_.tableView);
ui_.tableView->setModel(model_.get());
ui_.tableView->setColumnHidden(0, true); // hide the uuid
ui_.tableView->setRowHidden(0, true); // hide the special "Sonderkonto" user
connect(ui_.newButton, &QPushButton::clicked, this, &SellerDialog::on_newButton_clicked);
connect(ui_.deleteButton, &QPushButton::clicked, this, &SellerDialog::on_deleteButton_clicked);
connect(model_.get(), &SellerModel::duplicateSellerNo, this,

View file

@ -1,5 +1,7 @@
#include "settingsdialog.h"
#include "mainwindow.h"
#include <database.h>
#include <posprinter.h>
@ -18,6 +20,8 @@ SettingsDialog::SettingsDialog(QWidget* parent, Qt::WindowFlags f) : QDialog(par
int feeInPercent = settings.value("global/feeInPercent").toInt();
int maxFeeInEuro = settings.value("global/maxFeeInEuro").toInt();
market_ = dynamic_cast<MainWindow*>(parent)->getMarketplace();
ui_.cashPointNoSpinBox->setValue(cashPointNo);
// ui_.posPrinterDeviceEdit->setText(posPrinterDevice);
ui_.feePercentSpinBox->setValue(feeInPercent);
@ -56,12 +60,17 @@ void SettingsDialog::accept()
settings.setValue("global/maxFeeInEuro", ui_.maxFeeSpinBox->value());
if (oldCashPointNo != newCashPointNo) {
int result =
QMessageBox(QMessageBox::Icon::Question, "Sind Sie sicher?",
int result{0};
if (market_->getSales().size() > 0) {
result = QMessageBox(QMessageBox::Icon::Question, "Sind Sie sicher?",
"Möchten Sie die Kassen-Nr wirklich ändern? Diese muss über alle "
"Installationen hinweg eindeutig sein.",
QMessageBox::StandardButton::Yes | QMessageBox::StandardButton::No, this)
QMessageBox::StandardButton::Yes | QMessageBox::StandardButton::No,
this)
.exec();
} else {
result = QMessageBox::Yes;
}
if (result == QMessageBox::Yes) {
try {
Database().updateCashPointNo(oldCashPointNo, newCashPointNo);

View file

@ -3,6 +3,8 @@
#include "ui_settingsdialog.h"
#include <marketplace.h>
#include <QDialog>
class SettingsDialog : public QDialog
@ -16,6 +18,7 @@ class SettingsDialog : public QDialog
private:
Ui::SettingsDialog ui_;
Marketplace* market_{};
};
#endif