print articles of special seller

This commit is contained in:
Martin Brodbeck 2018-08-07 08:53:31 +02:00
parent d1c5d3a6f8
commit a3b832b087

View file

@ -102,13 +102,29 @@ void ReportDialog::onPrintReportButtonClicked()
painter.drawText(QRect(0, 50, width, height), Qt::AlignLeft, content); painter.drawText(QRect(0, 50, width, height), Qt::AlignLeft, content);
} }
// now print the overall statistics // pieces booked on the special account "Sonderkonto"
const auto specialSeller = market_->findSellerWithUuid("11111111-1111-1111-1111-111111111111");
if (specialSeller && specialSeller->numArticlesSold() > 0) {
printer.newPage(); printer.newPage();
painter.setFont(QFont("Arial", 16, QFont::Bold)); painter.setFont(QFont("Arial", 16, QFont::Bold));
painter.drawText(QRect(0, 0, width, height), Qt::AlignTop | Qt::AlignHCenter, painter.drawText(QRect(0, 0, width, height), Qt::AlignTop | Qt::AlignHCenter,
"Auswertung Kindersachenmarkt"); "Auswertung Kindersachenmarkt");
painter.setFont(QFont("monospace", 12)); painter.setFont(QFont("monospace", 12));
QString content("Gesamtstatistik\n---------------\n\n"); QString content("Einzelteile ohne Nummer\n=======================\n\n");
for (const auto& article : specialSeller->getArticles(true)) {
content += QString("- %1:\t").arg(article->getDescription().c_str(), -45);
content += QString("%1\n").arg(article->getPriceAsString().c_str(), 11);
}
painter.drawText(QRect(0, 50, width, height), Qt::AlignLeft, content);
}
// overall statistics
printer.newPage();
painter.setFont(QFont("Arial", 16, QFont::Bold));
painter.drawText(QRect(0, 0, width, height), Qt::AlignTop | Qt::AlignHCenter,
"Auswertung Kindersachenmarkt");
painter.setFont(QFont("monospace", 12));
QString content("Gesamtstatistik\n===============\n\n");
content += QString("Registrierte Verkäufer: %1\n").arg(sellers.size(), 6); content += QString("Registrierte Verkäufer: %1\n").arg(sellers.size(), 6);
content += QString("Verkaufte Artikel: %1\n\n").arg(6, 6); content += QString("Verkaufte Artikel: %1\n\n").arg(6, 6);
content += QString("Gesamtumsatz: %1\n").arg(market_->getOverallSumAsString().c_str(), 10); content += QString("Gesamtumsatz: %1\n").arg(market_->getOverallSumAsString().c_str(), 10);