import export nearly finished

This commit is contained in:
Martin Brodbeck 2018-08-05 14:52:34 +02:00
parent de91a804a0
commit 3ba230d9b9
5 changed files with 72 additions and 5 deletions

View file

@ -11,8 +11,8 @@
#include <excelreader.h>
#include <regex>
#include <exception>
#include <regex>
#include <QFileDialog>
#include <QMessageBox>
@ -278,6 +278,9 @@ void MainWindow::onImportSellerJsonActionTriggered()
auto filename = QFileDialog::getOpenFileName(this, "Verkäufer importieren", QString(),
"JSON Dateien (*.json)");
if (filename.isEmpty())
return;
JsonUtil::importSellers(filename.toStdString(), marketplace_.get());
}
@ -286,6 +289,9 @@ void MainWindow::onExportSellerJsonActionTriggered()
auto filename = QFileDialog::getSaveFileName(this, "Verkäufer exportieren", QString(),
"JSON Dateien (*.json)");
if (filename.isEmpty())
return;
JsonUtil::exportSellers(filename.toStdString(), marketplace_.get());
}
@ -295,6 +301,10 @@ void MainWindow::onExportSalesJsonActionTriggered()
auto filename = QFileDialog::getSaveFileName(this, "Umsätze/Transaktionen exportieren",
QString(), "JSON Dateien (*.json)");
if (filename.isEmpty())
return;
JsonUtil::exportSales(filename.toStdString(), marketplace_.get(),
settings.value("global/cashPointNo").toInt());
}
@ -314,12 +324,17 @@ void MainWindow::onImportSalesJsonActionTriggered()
auto filename = QFileDialog::getOpenFileName(this, "Umsätze/Transaktionen importieren",
QString(), "JSON Dateien (*.json)");
if (filename.isEmpty())
return;
delete ui_.salesView->model();
try {
JsonUtil::importSales(filename.toStdString(), marketplace_.get(),
settings.value("global/cashPointNo").toInt());
settings.value("global/cashPointNo").toInt());
} catch (std::runtime_error& err) {
QMessageBox(QMessageBox::Icon::Warning, "Import nicht möglich", err.what(), QMessageBox::Ok,
this)
.exec();
}
setSaleModel();
}