From 98a9fe0069856277f322e0ef62ed8bde85d0c200 Mon Sep 17 00:00:00 2001 From: Martin Brodbeck Date: Fri, 14 Mar 2025 12:17:24 +0100 Subject: [PATCH] Allow to print multiple seller recipes. --- src/gui/reportdialog.cpp | 13 ++++++++----- src/gui/reportdialog.ui | 2 +- src/printer/posprinter.cpp | 2 +- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/gui/reportdialog.cpp b/src/gui/reportdialog.cpp index 682c737..6edc590 100644 --- a/src/gui/reportdialog.cpp +++ b/src/gui/reportdialog.cpp @@ -201,7 +201,6 @@ void ReportDialog::onPrintSellerReceiptButtonClicked() return; auto indexes = selModel->selectedRows(); - auto &seller = m_market->getSellers().at(indexes[0].row()); auto printerDevice = convertToPosPrinterDevice(posPrinterDevice.toStdString(), posPrinterEndpoint.toStdString()); @@ -214,10 +213,14 @@ void ReportDialog::onPrintSellerReceiptButtonClicked() printer = std::make_unique(); } - if (printer->isValid()) - printer->printSellerReceipt( - seller.get(), feeInPercent, maxFeeInEuro * 100, - settings.value("global/commune", "Dettingen").toString().toStdString()); + if (printer->isValid()) { + for (const auto &index : indexes) { + auto &seller = m_market->getSellers().at(index.row()); + printer->printSellerReceipt( + seller.get(), feeInPercent, maxFeeInEuro * 100, + settings.value("global/commune", "Dettingen").toString().toStdString()); + } + } } void ReportDialog::onReportViewSelectionChanged(const QItemSelection &selected, diff --git a/src/gui/reportdialog.ui b/src/gui/reportdialog.ui index d5d27b6..f70be52 100644 --- a/src/gui/reportdialog.ui +++ b/src/gui/reportdialog.ui @@ -19,7 +19,7 @@ - QAbstractItemView::SingleSelection + QAbstractItemView::MultiSelection QAbstractItemView::SelectRows diff --git a/src/printer/posprinter.cpp b/src/printer/posprinter.cpp index 368d483..8a06f63 100644 --- a/src/printer/posprinter.cpp +++ b/src/printer/posprinter.cpp @@ -202,7 +202,7 @@ void PosPrinter::printSellerReceipt(Seller* seller, const int percent, const int << marketFeeAsString(seller->sumInCents(), percent, maxFeeInCent) << "\n"; commandStream << "\nAuszahlung............. " << paymentAsString(seller->sumInCents(), percent, maxFeeInCent) << "\n"; - commandStream << Command::FEED; + commandStream << Command::FEED << Command::FEED; write(commandStream.str()); }