show real number of articles sold in report

This commit is contained in:
Martin Brodbeck 2018-08-10 08:11:35 +02:00
parent dda7b95e78
commit 2c584519b9
3 changed files with 13 additions and 4 deletions

View file

@ -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)

View file

@ -29,6 +29,7 @@ class Marketplace
int getNextSellerNo();
int getNextArticleNo();
int getNumSellersDelete();
int getNumArticlesSold();
BasketVec& getBasket();
int getBasketSumInCent();
std::string getBasketSumAsString();

View file

@ -144,7 +144,7 @@ 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("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")