printing sale receipt
This commit is contained in:
parent
23659078b4
commit
6e6510ebcf
8 changed files with 53 additions and 10 deletions
|
@ -10,6 +10,7 @@
|
|||
#include "settingsdialog.h"
|
||||
|
||||
#include <excelreader.h>
|
||||
#include <posprinter.h>
|
||||
|
||||
#include <exception>
|
||||
#include <regex>
|
||||
|
@ -48,6 +49,8 @@ MainWindow::MainWindow()
|
|||
&MainWindow::onCancelArticleButtonClicked);
|
||||
connect(ui_.cancelSaleButton, &QPushButton::clicked, this,
|
||||
&MainWindow::onCancelSaleButtonClicked);
|
||||
connect(ui_.printSaleReceiptButton, &QPushButton::clicked, this,
|
||||
&MainWindow::onPrintSaleReceiptButtonClicked);
|
||||
connect(ui_.cancelAllArticlesButton, &QPushButton::clicked, this,
|
||||
&MainWindow::onCancelAllArticlesButtonClicked);
|
||||
connect(ui_.aboutQtAction, &QAction::triggered, this, &MainWindow::onAboutQt);
|
||||
|
@ -169,8 +172,14 @@ void MainWindow::onSalesViewSelectionChanged(const QItemSelection& selected,
|
|||
{
|
||||
if (selected.size() > 0) {
|
||||
ui_.cancelSaleButton->setEnabled(true);
|
||||
if (!selected.indexes()[0].parent().isValid())
|
||||
ui_.printSaleReceiptButton->setEnabled(true);
|
||||
else
|
||||
ui_.printSaleReceiptButton->setEnabled(false);
|
||||
|
||||
} else {
|
||||
ui_.cancelSaleButton->setEnabled(false);
|
||||
ui_.printSaleReceiptButton->setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -220,6 +229,18 @@ void MainWindow::onCancelSaleButtonClicked([[maybe_unused]] bool checked)
|
|||
}
|
||||
}
|
||||
|
||||
void MainWindow::onPrintSaleReceiptButtonClicked([[maybe_unused]] bool checked)
|
||||
{
|
||||
auto selModel = ui_.salesView->selectionModel();
|
||||
if (selModel->hasSelection() == false)
|
||||
return;
|
||||
|
||||
auto indexes = selModel->selectedRows();
|
||||
auto& sale = marketplace_->getSales().at(indexes[0].row());
|
||||
PosPrinter printer;
|
||||
printer.printReceipt(sale.get());
|
||||
}
|
||||
|
||||
void MainWindow::onCancelAllArticlesButtonClicked([[maybe_unused]] bool checked)
|
||||
{
|
||||
if (ui_.basketView->model()->rowCount() == 0)
|
||||
|
|
|
@ -24,6 +24,7 @@ class MainWindow : public QMainWindow
|
|||
const QItemSelection& deselected);
|
||||
void onCancelArticleButtonClicked(bool checked);
|
||||
void onCancelSaleButtonClicked(bool checked);
|
||||
void onPrintSaleReceiptButtonClicked(bool checked);
|
||||
void onCancelAllArticlesButtonClicked(bool checked);
|
||||
void onAboutQt();
|
||||
void onAbout();
|
||||
|
|
|
@ -246,7 +246,7 @@ stornieren</string>
|
|||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_2">
|
||||
<widget class="QPushButton" name="printSaleReceiptButton">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue