import / export sellers completed

This commit is contained in:
Martin Brodbeck 2018-08-02 12:34:56 +02:00
parent 045bc8dd20
commit 61da9adce5
5 changed files with 66 additions and 10 deletions

View file

@ -62,8 +62,10 @@ MainWindow::MainWindow()
this->setWindowTitle("KIMA2 - Kasse Nr. " +
QSettings().value("global/cashPointNo").toString());
});
connect(ui_.importExcelAction, &QAction::triggered, this,
connect(ui_.importSellerExcelAction, &QAction::triggered, this,
&MainWindow::onImportSellerExcelActionTriggered);
connect(ui_.importSellerJsonAction, &QAction::triggered, this,
&MainWindow::onImportSellerJsonActionTriggered);
connect(ui_.exportSellerJsonAction, &QAction::triggered, this,
&MainWindow::onExportSellerJsonActionTriggered);
}
@ -258,6 +260,23 @@ void MainWindow::onImportSellerExcelActionTriggered()
ExcelReader::readSellersFromFile(filename.toStdString(), marketplace_.get());
}
void MainWindow::onImportSellerJsonActionTriggered()
{
if (!marketplace_->getSales().empty()) {
QMessageBox(QMessageBox::Icon::Information, "Import nicht möglich",
"Der Import ist nicht möglich, da schon Verkäufe getätigt wurden.",
QMessageBox::StandardButton::Ok, this)
.exec();
return;
}
auto filename = QFileDialog::getOpenFileName(this, "Verkäufer importieren", QString(),
"JSON Dateien (*.json)");
JsonUtil::importSellers(filename.toStdString(), marketplace_.get());
}
void MainWindow::onExportSellerJsonActionTriggered()
{
auto filename = QFileDialog::getSaveFileName(this, "Verkäufer exportieren", QString(),

View file

@ -33,6 +33,7 @@ class MainWindow : public QMainWindow
void onSellerNoEditCheckSellerNo();
void onPaidButtonTriggered();
void onImportSellerExcelActionTriggered();
void onImportSellerJsonActionTriggered();
void onExportSellerJsonActionTriggered();
void setSaleModel();

View file

@ -403,8 +403,15 @@ drucken</string>
<property name="title">
<string>&amp;Verkäufer</string>
</property>
<widget class="QMenu" name="importSellerMenu">
<property name="title">
<string>Importieren</string>
</property>
<addaction name="importSellerExcelAction"/>
<addaction name="importSellerJsonAction"/>
</widget>
<addaction name="actionEditSeller"/>
<addaction name="importExcelAction"/>
<addaction name="importSellerMenu"/>
<addaction name="exportSellerJsonAction"/>
</widget>
<widget class="QMenu" name="menuHilfe">
@ -460,16 +467,21 @@ drucken</string>
<string>Auswertung</string>
</property>
</action>
<action name="importExcelAction">
<property name="text">
<string>Importieren (Excel)</string>
</property>
</action>
<action name="exportSellerJsonAction">
<property name="text">
<string>Exportieren (JSON)</string>
</property>
</action>
<action name="importSellerExcelAction">
<property name="text">
<string>Aus Excel-Datei</string>
</property>
</action>
<action name="importSellerJsonAction">
<property name="text">
<string>Aus JSON-Datei</string>
</property>
</action>
</widget>
<resources/>
<connections/>