Compare commits

..

2 commits

Author SHA1 Message Date
0e889aefe9 hide special account 2018-08-10 08:32:53 +02:00
2c584519b9 show real number of articles sold in report 2018-08-10 08:11:35 +02:00
3 changed files with 18 additions and 4 deletions

View file

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

View file

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

View file

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