Compare commits
2 commits
dda7b95e78
...
0e889aefe9
Author | SHA1 | Date | |
---|---|---|---|
0e889aefe9 | |||
2c584519b9 |
3 changed files with 18 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();
|
||||
|
|
|
@ -18,6 +18,7 @@ ReportDialog::ReportDialog(QWidget* parent, Qt::WindowFlags f) : QDialog(parent,
|
|||
model_ = std::make_unique<ReportModel>(market_, ui_.reportView);
|
||||
ui_.reportView->setModel(model_.get());
|
||||
ui_.reportView->hideColumn(0);
|
||||
ui_.reportView->setRowHidden(0, true); // hide the special "Sonderkonto" user
|
||||
|
||||
connect(ui_.exportCsvButton, &QPushButton::clicked, this,
|
||||
&ReportDialog::onExportCsvButtonClicked);
|
||||
|
@ -90,6 +91,9 @@ void ReportDialog::onPrintReportButtonClicked()
|
|||
content.append(
|
||||
"---------------------------------------------------------------------------\n");
|
||||
for (unsigned int j = 0; j < ENTRIES_PER_PAGE && (i * j) < sellers.size(); ++j) {
|
||||
if (sellers.at(i * j)->getUuidAsString() == "11111111-1111-1111-1111-111111111111") {
|
||||
continue;
|
||||
}
|
||||
content += QString("%1 %2 %3 %4 %5 %6 %7\n")
|
||||
.arg(sellers.at(i * j)->getSellerNo(), 3)
|
||||
.arg(sellers.at(i * j)->getLastName().substr(0, 14).c_str(), -14)
|
||||
|
@ -144,13 +148,14 @@ 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("Ausgezahlt: %1\n")
|
||||
QString(" Gesamtumsatz: %1\n").arg(market_->getOverallSumAsString().c_str(), 10);
|
||||
content +=
|
||||
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