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;
|
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();
|
||||||
|
|
|
@ -18,6 +18,7 @@ ReportDialog::ReportDialog(QWidget* parent, Qt::WindowFlags f) : QDialog(parent,
|
||||||
model_ = std::make_unique<ReportModel>(market_, ui_.reportView);
|
model_ = std::make_unique<ReportModel>(market_, ui_.reportView);
|
||||||
ui_.reportView->setModel(model_.get());
|
ui_.reportView->setModel(model_.get());
|
||||||
ui_.reportView->hideColumn(0);
|
ui_.reportView->hideColumn(0);
|
||||||
|
ui_.reportView->setRowHidden(0, true); // hide the special "Sonderkonto" user
|
||||||
|
|
||||||
connect(ui_.exportCsvButton, &QPushButton::clicked, this,
|
connect(ui_.exportCsvButton, &QPushButton::clicked, this,
|
||||||
&ReportDialog::onExportCsvButtonClicked);
|
&ReportDialog::onExportCsvButtonClicked);
|
||||||
|
@ -90,6 +91,9 @@ void ReportDialog::onPrintReportButtonClicked()
|
||||||
content.append(
|
content.append(
|
||||||
"---------------------------------------------------------------------------\n");
|
"---------------------------------------------------------------------------\n");
|
||||||
for (unsigned int j = 0; j < ENTRIES_PER_PAGE && (i * j) < sellers.size(); ++j) {
|
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")
|
content += QString("%1 %2 %3 %4 %5 %6 %7\n")
|
||||||
.arg(sellers.at(i * j)->getSellerNo(), 3)
|
.arg(sellers.at(i * j)->getSellerNo(), 3)
|
||||||
.arg(sellers.at(i * j)->getLastName().substr(0, 14).c_str(), -14)
|
.arg(sellers.at(i * j)->getLastName().substr(0, 14).c_str(), -14)
|
||||||
|
@ -144,8 +148,9 @@ 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")
|
||||||
.arg(market_->getOverallPaymentAsString(feeInPercent, maxFeeInEuro * 100).c_str(), 10);
|
.arg(market_->getOverallPaymentAsString(feeInPercent, maxFeeInEuro * 100).c_str(), 10);
|
||||||
|
|
Loading…
Reference in a new issue