show real number of articles sold in report
This commit is contained in:
parent
dda7b95e78
commit
2c584519b9
3 changed files with 13 additions and 4 deletions
|
@ -73,6 +73,14 @@ int Marketplace::getNumSellersDelete()
|
|||
return count;
|
||||
}
|
||||
|
||||
int Marketplace::getNumArticlesSold()
|
||||
{
|
||||
int sum = std::accumulate(sellers_.begin(), sellers_.end(), 0, [](int a, const auto& seller) {
|
||||
return a + seller->numArticlesSold();
|
||||
});
|
||||
return sum;
|
||||
}
|
||||
|
||||
void Marketplace::sortSellers() { std::sort(sellers_.begin(), sellers_.end()); }
|
||||
|
||||
Seller* Marketplace::findSellerWithSellerNo(int sellerNo)
|
||||
|
|
|
@ -29,6 +29,7 @@ class Marketplace
|
|||
int getNextSellerNo();
|
||||
int getNextArticleNo();
|
||||
int getNumSellersDelete();
|
||||
int getNumArticlesSold();
|
||||
BasketVec& getBasket();
|
||||
int getBasketSumInCent();
|
||||
std::string getBasketSumAsString();
|
||||
|
|
|
@ -144,13 +144,13 @@ void ReportDialog::onPrintReportButtonClicked()
|
|||
painter.setFont(fixedFont);
|
||||
QString content("Gesamtstatistik\n===============\n\n");
|
||||
content += QString("Registrierte Verkäufer: %1\n").arg(sellers.size(), 6);
|
||||
content += QString("Verkaufte Artikel: %1\n\n").arg(6, 6);
|
||||
content += QString("Gesamtumsatz: %1\n").arg(market_->getOverallSumAsString().c_str(), 10);
|
||||
content += QString("Verkaufte Artikel: %1\n\n").arg(market_->getNumArticlesSold(), 6);
|
||||
content += 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")
|
||||
.arg(market_->getOverallRevenueAsString(feeInPercent, maxFeeInEuro * 100).c_str(), 10);
|
||||
painter.drawText(QRect(0, 50, width, height), Qt::AlignLeft, content);
|
||||
|
||||
|
|
Loading…
Reference in a new issue