extended print report
This commit is contained in:
parent
f0078647d4
commit
0966483b05
3 changed files with 23 additions and 4 deletions
|
@ -81,6 +81,14 @@ int Marketplace::getNumArticlesSold()
|
|||
return sum;
|
||||
}
|
||||
|
||||
int Marketplace::getNumArticlesOffered()
|
||||
{
|
||||
int sum = std::accumulate(sellers_.begin(), sellers_.end(), 0, [](int a, const auto& seller) {
|
||||
return a + seller->numArticlesOffered();
|
||||
});
|
||||
return sum;
|
||||
}
|
||||
|
||||
void Marketplace::sortSellers() { std::sort(sellers_.begin(), sellers_.end()); }
|
||||
|
||||
Seller* Marketplace::findSellerWithSellerNo(int sellerNo)
|
||||
|
|
|
@ -30,6 +30,7 @@ class Marketplace
|
|||
int getNextArticleNo();
|
||||
int getNumSellersDelete();
|
||||
int getNumArticlesSold();
|
||||
int getNumArticlesOffered();
|
||||
BasketVec& getBasket();
|
||||
int getBasketSumInCent();
|
||||
std::string getBasketSumAsString();
|
||||
|
|
|
@ -150,16 +150,26 @@ void ReportDialog::onPrintReportButtonClicked()
|
|||
"Auswertung Kindersachenmarkt");
|
||||
painter.setFont(fixedFont);
|
||||
QString content("Gesamtstatistik\n===============\n\n");
|
||||
int numArticlesOffered = market_->getNumArticlesOffered();
|
||||
int numArticlesSold = market_->getNumArticlesSold();
|
||||
double percentArticlesSold =
|
||||
(static_cast<double>(numArticlesSold) / static_cast<double>(numArticlesOffered)) * 100;
|
||||
content += QString("Registrierte Verkäufer: %1\n").arg(sellers.size() - 1, 6);
|
||||
content += QString("Verkaufte Artikel: %1\n\n").arg(market_->getNumArticlesSold(), 6);
|
||||
content += QString("Angelieferte Artikel: %1\n").arg(numArticlesOffered, 6);
|
||||
content += QString("Verkaufte Artikel: %1 (%L2 %)\n\n")
|
||||
.arg(numArticlesSold, 6)
|
||||
.arg(percentArticlesSold, 0, 'f', 2);
|
||||
content +=
|
||||
QString(" Gesamtumsatz: %1\n").arg(market_->getOverallSumAsString().c_str(), 10);
|
||||
QString("Gesamtumsatz: %1\n").arg(market_->getOverallSumAsString().c_str(), 10);
|
||||
content +=
|
||||
QString(" Ausgezahlt: %1\n")
|
||||
QString("Ausgezahlt: %1\n")
|
||||
.arg(market_->getOverallPaymentAsString(feeInPercent, maxFeeInEuro * 100).c_str(), 10);
|
||||
content +=
|
||||
QString(" Verbleibend: %1\n")
|
||||
QString("Verbleibend: %1\n\n")
|
||||
.arg(market_->getOverallRevenueAsString(feeInPercent, maxFeeInEuro * 100).c_str(), 10);
|
||||
content += QString("(Einbehaltener Prozentsatz: %1 %)\n").arg(feeInPercent, 3);
|
||||
content += QString("(Maximal einbehaltener Betrag: %1 €)\n").arg(maxFeeInEuro, 3);
|
||||
|
||||
painter.drawText(QRect(0, 50, width, height), Qt::AlignLeft, content);
|
||||
|
||||
painter.end();
|
||||
|
|
Loading…
Reference in a new issue