Excel stuff removed.

This commit is contained in:
Martin Brodbeck 2023-01-18 16:35:28 +01:00
parent 42bf036f85
commit 19ea7f27de
9 changed files with 18 additions and 133 deletions

View file

@ -9,7 +9,6 @@
#include <config.h>
#include <core/csvreader.h>
#include <core/excelreader.h>
#include <core/jsonutil.h>
#include <core/utils.h>
#include <printer/posprinter.h>
@ -137,8 +136,8 @@ MainWindow::MainWindow()
this->setWindowTitle("KIMA2 - Kasse Nr. " +
QSettings().value("global/cashPointNo").toString());
});
connect(m_ui.importSellerExcelAction, &QAction::triggered, this,
&MainWindow::onImportSellerExcelActionTriggered);
connect(m_ui.importSellerAction, &QAction::triggered, this,
&MainWindow::onImportSellerActionTriggered);
connect(m_ui.importSellerJsonAction, &QAction::triggered, this,
&MainWindow::onImportSellerJsonActionTriggered);
connect(m_ui.exportSellerJsonAction, &QAction::triggered, this,
@ -345,7 +344,8 @@ void MainWindow::onCancelArticleButtonClicked([[maybe_unused]] bool checked)
m_ui.basketView->model()->removeRow(iter->row());
}
m_ui.basketSumLabel->setText(m_marketplace->getBasketSumAsString().c_str()); // Update basket sum
m_ui.basketSumLabel->setText(
m_marketplace->getBasketSumAsString().c_str()); // Update basket sum
m_ui.sellerNoEdit->setFocus();
}
@ -428,7 +428,8 @@ void MainWindow::onCancelAllArticlesButtonClicked([[maybe_unused]] bool checked)
dynamic_cast<BasketModel *>(m_ui.basketView->model())->cancelSale();
m_ui.basketSumLabel->setText(m_marketplace->getBasketSumAsString().c_str()); // Update basket sum
m_ui.basketSumLabel->setText(
m_marketplace->getBasketSumAsString().c_str()); // Update basket sum
m_ui.sellerNoEdit->setFocus();
}
@ -445,7 +446,7 @@ void MainWindow::onAbout()
">info@rustysoft.de</a>&gt;</p>");
}
void MainWindow::onImportSellerExcelActionTriggered()
void MainWindow::onImportSellerActionTriggered()
{
if (!m_marketplace->getSales().empty()) {
QMessageBox(QMessageBox::Icon::Information, "Import nicht möglich",
@ -455,9 +456,9 @@ void MainWindow::onImportSellerExcelActionTriggered()
return;
}
auto filename = QFileDialog::getOpenFileName(
this, "Verkäufer importieren", QString(),
"Alle unterstützte Dateien (*.xlsx *.csv);;Excel Dateien (*.xlsx);;CSV Dateien (*.csv)");
auto filename =
QFileDialog::getOpenFileName(this, "Verkäufer importieren", QString(),
"Alle unterstützte Dateien (*.csv);;CSV Dateien (*.csv)");
if (filename.isEmpty())
return;
@ -469,27 +470,13 @@ void MainWindow::onImportSellerExcelActionTriggered()
#endif
std::size_t numImported{};
if (case_insensitive_match(filePath.extension().string(), std::string(".xlsx"))) {
try {
numImported = ExcelReader::readSellersFromFile(filePath, m_marketplace.get());
} catch (const std::exception &e) {
QMessageBox(QMessageBox::Icon::Critical, "Fehler beim Importieren",
"Beim Import aus der Excel-Datei ist ein Fehler aufgetreten. "
"Sie könnten ggf. versuchen, die Daten aus einer .csv Datei zu imporieren.",
QMessageBox::StandardButton::Ok, this)
.exec();
std::cerr << e.what() << std::endl;
return;
}
} else {
numImported = CsvReader::readSellersFromFile(filePath, m_marketplace.get());
}
numImported = CsvReader::readSellersFromFile(filePath, m_marketplace.get());
updateStatLabel();
using namespace std::string_literals;
std::ostringstream msg;
msg << "Aus der Excel/CSV-Datei wurden <b>"s << std::to_string(numImported)
msg << "Aus der CSV-Datei wurden <b>"s << std::to_string(numImported)
<< "</b> Verkäufer importiert.";
QMessageBox(QMessageBox::Icon::Information, "Verkäufer erfolgreich importiert",
msg.str().c_str(), QMessageBox::StandardButton::Ok, this)

View file

@ -39,7 +39,7 @@ class MainWindow : public QMainWindow
void checkSellerNo(bool ctrlPressed = false);
void onPaidButtonTriggered();
void onGivenSpinBoxValueChanged(double value);
void onImportSellerExcelActionTriggered();
void onImportSellerActionTriggered();
void onImportSellerJsonActionTriggered();
void onExportSellerJsonActionTriggered();
void onExportSalesJsonActionTriggered();

View file

@ -423,7 +423,7 @@ drucken</string>
<x>0</x>
<y>0</y>
<width>817</width>
<height>30</height>
<height>24</height>
</rect>
</property>
<widget class="QMenu" name="menu_Datei">
@ -444,7 +444,7 @@ drucken</string>
<property name="title">
<string>Importieren</string>
</property>
<addaction name="importSellerExcelAction"/>
<addaction name="importSellerAction"/>
<addaction name="importSellerJsonAction"/>
</widget>
<addaction name="actionEditSeller"/>
@ -513,9 +513,9 @@ drucken</string>
<string>Exportieren für andere Kasse (JSON)</string>
</property>
</action>
<action name="importSellerExcelAction">
<action name="importSellerAction">
<property name="text">
<string>Aus Excel/CSV-Datei (initial)</string>
<string>Aus CSV-Datei (initial)</string>
</property>
</action>
<action name="importSellerJsonAction">