diff --git a/src/core/excelreader.cpp b/src/core/excelreader.cpp index 57c17aa..4bc712f 100644 --- a/src/core/excelreader.cpp +++ b/src/core/excelreader.cpp @@ -6,7 +6,7 @@ namespace fs = std::filesystem; -void ExcelReader::readSellersFromFile(const fs::path& filePath, Marketplace* market) +std::size_t ExcelReader::readSellersFromFile(const fs::path& filePath, Marketplace* market) { xlnt::workbook wb; std::ifstream mystream(filePath, std::ios::binary); @@ -63,4 +63,6 @@ void ExcelReader::readSellersFromFile(const fs::path& filePath, Marketplace* mar market->sortSellers(); market->storeToDb(); + + return market->getSellers().size() - 1; // minus 1 because we don't count the "special" seller } diff --git a/src/core/excelreader.h b/src/core/excelreader.h index 8071e04..b9d0e1c 100644 --- a/src/core/excelreader.h +++ b/src/core/excelreader.h @@ -12,7 +12,7 @@ class ExcelReader { public: - static void readSellersFromFile(const std::filesystem::path& filePath, Marketplace* market); + static std::size_t readSellersFromFile(const std::filesystem::path& filePath, Marketplace* market); }; #endif \ No newline at end of file diff --git a/src/gui/mainwindow.cpp b/src/gui/mainwindow.cpp index b0ec70b..8cd1c24 100644 --- a/src/gui/mainwindow.cpp +++ b/src/gui/mainwindow.cpp @@ -17,6 +17,7 @@ #include #include #include +#include #include #include @@ -388,7 +389,8 @@ void MainWindow::onPrintSaleReceiptButtonClicked([[maybe_unused]] bool checked) } if (printer->isValid()) - printer->printSaleReceipt(sale.get(), settings.value("global/commune", "Dettingen").toString().toStdString()); + printer->printSaleReceipt( + sale.get(), settings.value("global/commune", "Dettingen").toString().toStdString()); } void MainWindow::onCancelAllArticlesButtonClicked([[maybe_unused]] bool checked) @@ -449,8 +451,16 @@ void MainWindow::onImportSellerExcelActionTriggered() fs::path filePath(filename.toStdWString()); - ExcelReader::readSellersFromFile(filePath, marketplace_.get()); + std::size_t numImported = ExcelReader::readSellersFromFile(filePath, marketplace_.get()); updateStatLabel(); + + using namespace std::string_literals; + std::ostringstream msg; + msg << "Aus der Excel-Datei wurden "s << std::to_string(numImported) + << " Verkäufer importiert."; + QMessageBox(QMessageBox::Icon::Information, "Verkäufer erfolgreich importiert", + msg.str().c_str(), QMessageBox::StandardButton::Ok, this) + .exec(); } void MainWindow::onImportSellerJsonActionTriggered()