Allow to print multiple seller recipes.

This commit is contained in:
Martin Brodbeck 2025-03-14 12:17:24 +01:00
parent 8a5038e462
commit 98a9fe0069
3 changed files with 10 additions and 7 deletions

View file

@ -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<PosPrinter>();
}
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,

View file

@ -19,7 +19,7 @@
<item>
<widget class="QTableView" name="reportView">
<property name="selectionMode">
<enum>QAbstractItemView::SingleSelection</enum>
<enum>QAbstractItemView::MultiSelection</enum>
</property>
<property name="selectionBehavior">
<enum>QAbstractItemView::SelectRows</enum>

View file

@ -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());
}