export sellers as json file

This commit is contained in:
Martin Brodbeck 2018-08-02 11:15:15 +02:00
parent b2d696ccb5
commit 045bc8dd20
8 changed files with 80 additions and 11 deletions

View file

@ -14,8 +14,8 @@ int main(int argc, char* argv[])
// Set the locale to german, so that currency is correct
// std::locale german("de_DE.utf-8");
std::locale myLocale("");
std::locale::global(myLocale);
//std::locale myLocale("");
//std::locale::global(myLocale);
QApplication kimaApp{argc, argv};

View file

@ -2,6 +2,7 @@
#include "basketmodel.h"
#include "config.h"
#include "jsonutil.h"
#include "pricedialog.h"
#include "reportdialog.h"
#include "salemodel.h"
@ -62,7 +63,9 @@ MainWindow::MainWindow()
QSettings().value("global/cashPointNo").toString());
});
connect(ui_.importExcelAction, &QAction::triggered, this,
&MainWindow::onImportExcelActionTriggered);
&MainWindow::onImportSellerExcelActionTriggered);
connect(ui_.exportSellerJsonAction, &QAction::triggered, this,
&MainWindow::onExportSellerJsonActionTriggered);
}
void MainWindow::onActionEditSellerTriggered()
@ -239,7 +242,7 @@ void MainWindow::onAbout()
">info@rustysoft.de</a>&gt;</p>");
}
void MainWindow::onImportExcelActionTriggered()
void MainWindow::onImportSellerExcelActionTriggered()
{
if (!marketplace_->getSales().empty()) {
QMessageBox(QMessageBox::Icon::Information, "Import nicht möglich",
@ -253,4 +256,12 @@ void MainWindow::onImportExcelActionTriggered()
"Excel Dateien (*.xlsx *.xls)");
ExcelReader::readSellersFromFile(filename.toStdString(), marketplace_.get());
}
void MainWindow::onExportSellerJsonActionTriggered()
{
auto filename = QFileDialog::getSaveFileName(this, "Verkäufer exportieren", QString(),
"JSON Dateien (*.json)");
JsonUtil::exportSellers(filename.toStdString(), marketplace_.get());
}

View file

@ -32,7 +32,8 @@ class MainWindow : public QMainWindow
void onActionEditSellerTriggered();
void onSellerNoEditCheckSellerNo();
void onPaidButtonTriggered();
void onImportExcelActionTriggered();
void onImportSellerExcelActionTriggered();
void onExportSellerJsonActionTriggered();
void setSaleModel();
Ui::MainWindow ui_;

View file

@ -405,6 +405,7 @@ drucken</string>
</property>
<addaction name="actionEditSeller"/>
<addaction name="importExcelAction"/>
<addaction name="exportSellerJsonAction"/>
</widget>
<widget class="QMenu" name="menuHilfe">
<property name="title">
@ -464,6 +465,11 @@ drucken</string>
<string>Importieren (Excel)</string>
</property>
</action>
<action name="exportSellerJsonAction">
<property name="text">
<string>Exportieren (JSON)</string>
</property>
</action>
</widget>
<resources/>
<connections/>