Allow import of multiple sales at once.

This commit is contained in:
Martin Brodbeck 2024-01-23 10:39:43 +01:00
parent 54e5c70447
commit 32d0ec7749
2 changed files with 19 additions and 14 deletions

View file

@ -102,8 +102,10 @@ void JsonUtil::importSales(const std::filesystem::path &filePath, Marketplace *m
int source_no = jsonValues["source_no"];
if (source_no == cashPointNo) {
throw std::runtime_error("Die Kassen-Nr. der zu imporierenden Daten wird von dieser Kasse "
"hier bereits verwendet.");
std::string ret = "Die Kassen-Nr. ";
ret += std::to_string(source_no);
ret += " der zu imporierenden Daten wird von dieser Kasse hier bereits verwendet.";
throw std::runtime_error(ret);
}
market->setSalesToDelete(jsonValues["source_no"]);

View file

@ -504,12 +504,13 @@ void MainWindow::onImportSalesJsonActionTriggered()
{
QSettings settings;
auto filename = QFileDialog::getOpenFileName(this, "Umsätze/Transaktionen importieren",
auto filenames = QFileDialog::getOpenFileNames(this, "Umsätze/Transaktionen importieren",
QString(), "JSON Dateien (*.json)");
if (filename.isEmpty())
if (filenames.isEmpty())
return;
for(auto filename: filenames) {
#if defined(_WIN64) || defined(_WIN32)
fs::path filePath(filename.toStdWString());
#else
@ -525,6 +526,8 @@ void MainWindow::onImportSalesJsonActionTriggered()
this)
.exec();
}
}
setSaleModel();
updateStatLabel();
}