fix report

This commit is contained in:
Martin Brodbeck 2018-08-10 16:45:16 +02:00
parent 3d8f05ec1d
commit 0f96861584

View file

@ -64,7 +64,7 @@ void ReportDialog::onPrintReportButtonClicked()
QPainter painter;
int height = printer.height();
int width = printer.width();
const double ENTRIES_PER_PAGE = 50.0;
const double ENTRIES_PER_PAGE = 51;
const auto& sellers = market_->getSellers();
unsigned int numPages = std::ceil(sellers.size() / ENTRIES_PER_PAGE);
@ -90,18 +90,19 @@ void ReportDialog::onPrintReportButtonClicked()
.arg("Auszahlung\n", -11);
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") {
for (unsigned int j = 0; j < ENTRIES_PER_PAGE && (i - 1) * ENTRIES_PER_PAGE + j < sellers.size(); ++j) {
int idx = (i - 1) * ENTRIES_PER_PAGE + j;
if (sellers.at(idx)->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)
.arg(sellers.at(i * j)->getFirstName().substr(0, 14).c_str(), -14)
.arg(sellers.at(i * j)->numArticlesOffered(), 9)
.arg(sellers.at(i * j)->numArticlesSold(), 8)
.arg(sellers.at(i * j)->sumAsString().c_str(), 10)
.arg(paymentAsString(sellers.at(i * j)->sumInCents(), feeInPercent,
.arg(sellers.at(idx)->getSellerNo(), 3)
.arg(sellers.at(idx)->getLastName().substr(0, 14).c_str(), -14)
.arg(sellers.at(idx)->getFirstName().substr(0, 14).c_str(), -14)
.arg(sellers.at(idx)->numArticlesOffered(), 9)
.arg(sellers.at(idx)->numArticlesSold(), 8)
.arg(sellers.at(idx)->sumAsString().c_str(), 10)
.arg(paymentAsString(sellers.at(idx)->sumInCents(), feeInPercent,
maxFeeInEuro * 100)
.c_str(),
11);
@ -147,7 +148,7 @@ void ReportDialog::onPrintReportButtonClicked()
"Auswertung Kindersachenmarkt");
painter.setFont(fixedFont);
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() - 1, 6);
content += QString("Verkaufte Artikel: %1\n\n").arg(market_->getNumArticlesSold(), 6);
content +=
QString(" Gesamtumsatz: %1\n").arg(market_->getOverallSumAsString().c_str(), 10);