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;
|
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()); }
|
void Marketplace::sortSellers() { std::sort(sellers_.begin(), sellers_.end()); }
|
||||||
|
|
||||||
Seller* Marketplace::findSellerWithSellerNo(int sellerNo)
|
Seller* Marketplace::findSellerWithSellerNo(int sellerNo)
|
||||||
|
|
|
@ -29,6 +29,7 @@ class Marketplace
|
||||||
int getNextSellerNo();
|
int getNextSellerNo();
|
||||||
int getNextArticleNo();
|
int getNextArticleNo();
|
||||||
int getNumSellersDelete();
|
int getNumSellersDelete();
|
||||||
|
int getNumArticlesSold();
|
||||||
BasketVec& getBasket();
|
BasketVec& getBasket();
|
||||||
int getBasketSumInCent();
|
int getBasketSumInCent();
|
||||||
std::string getBasketSumAsString();
|
std::string getBasketSumAsString();
|
||||||
|
|
|
@ -144,7 +144,7 @@ void ReportDialog::onPrintReportButtonClicked()
|
||||||
painter.setFont(fixedFont);
|
painter.setFont(fixedFont);
|
||||||
QString content("Gesamtstatistik\n===============\n\n");
|
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(market_->getNumArticlesSold(), 6);
|
||||||
content += QString(" Gesamtumsatz: %1\n").arg(market_->getOverallSumAsString().c_str(), 10);
|
content += QString(" Gesamtumsatz: %1\n").arg(market_->getOverallSumAsString().c_str(), 10);
|
||||||
content +=
|
content +=
|
||||||
QString(" Ausgezahlt: %1\n")
|
QString(" Ausgezahlt: %1\n")
|
||||||
|
|
Loading…
Reference in a new issue