Browse Source

show real number of articles sold in report

allow_new_sellers
Martin Brodbeck 4 years ago
parent
commit
2c584519b9
  1. 8
      src/core/marketplace.cpp
  2. 1
      src/core/marketplace.h
  3. 8
      src/gui/reportdialog.cpp

8
src/core/marketplace.cpp

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

1
src/core/marketplace.h

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

8
src/gui/reportdialog.cpp

@ -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…
Cancel
Save