Browse Source

extended print report

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

8
src/core/marketplace.cpp

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

1
src/core/marketplace.h

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

18
src/gui/reportdialog.cpp

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