Compare commits
No commits in common. "cdc737a823284decafb03cd222f0db0375c79665" and "d1c5d3a6f8e492e0f1cb2a4808694928a6707aab" have entirely different histories.
cdc737a823
...
d1c5d3a6f8
6 changed files with 7 additions and 43 deletions
|
@ -81,13 +81,12 @@ QVariant BasketModel::headerData(int section, Qt::Orientation orientation, int r
|
|||
return "";
|
||||
}
|
||||
|
||||
void BasketModel::addArticle(Seller* seller, int price, const std::string& desc)
|
||||
void BasketModel::addArticle(Seller* seller, int price)
|
||||
{
|
||||
emit beginInsertRows(QModelIndex(), marketplace_->getBasket().size(),
|
||||
marketplace_->getBasket().size());
|
||||
auto article = std::make_unique<Article>(price);
|
||||
article->createUuid();
|
||||
article->setDescription(desc);
|
||||
article->setArticleNo(marketplace_->getNextArticleNo());
|
||||
article->setSourceNo(QSettings().value("global/cashPointNo").toInt());
|
||||
article->setSeller(seller);
|
||||
|
|
|
@ -18,7 +18,7 @@ class BasketModel : public QAbstractTableModel
|
|||
//virtual Qt::ItemFlags flags(const QModelIndex& index) const override;
|
||||
//virtual bool setData(const QModelIndex& index, const QVariant& value, int role = Qt::EditRole) override;
|
||||
//virtual bool insertRows(int row, int count, const QModelIndex& parent = QModelIndex()) override;
|
||||
void addArticle(Seller* seller, int price, const std::string& desc);
|
||||
void addArticle(Seller* seller, int price);
|
||||
void finishSale();
|
||||
void cancelSale();
|
||||
virtual bool removeRows(int row, int count, const QModelIndex& parent = QModelIndex()) override;
|
||||
|
|
|
@ -149,8 +149,7 @@ void MainWindow::onSellerNoEditCheckSellerNo()
|
|||
auto dialogResult = priceDialog.exec();
|
||||
if (dialogResult == QDialog::Accepted) {
|
||||
int price = priceDialog.getPrice();
|
||||
std::string desc = priceDialog.getDescription();
|
||||
dynamic_cast<BasketModel*>(ui_.basketView->model())->addArticle(seller, price, desc);
|
||||
dynamic_cast<BasketModel*>(ui_.basketView->model())->addArticle(seller, price);
|
||||
ui_.basketSumLabel->setText(marketplace_->getBasketSumAsString().c_str());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,8 +12,6 @@ PriceDialog::PriceDialog(QWidget* parent, Qt::WindowFlags f) : QDialog(parent, f
|
|||
|
||||
int PriceDialog::getPrice() const { return static_cast<int>(ui_.priceSpinBox->value() * 100); }
|
||||
|
||||
std::string PriceDialog::getDescription() const { return ui_.descEdit->text().toStdString(); }
|
||||
|
||||
void PriceDialog::accept()
|
||||
{
|
||||
if (static_cast<int>(std::round(ui_.priceSpinBox->value() * 100.0L)) % 50 != 0) {
|
||||
|
|
|
@ -13,7 +13,6 @@ class PriceDialog : public QDialog
|
|||
PriceDialog(QWidget* parent = nullptr,
|
||||
Qt::WindowFlags f = Qt::WindowTitleHint | Qt::WindowSystemMenuHint);
|
||||
int getPrice() const;
|
||||
std::string getDescription() const;
|
||||
|
||||
private:
|
||||
void on_model_duplicateSellerNo(const QString& message);
|
||||
|
|
|
@ -89,8 +89,8 @@ void ReportDialog::onPrintReportButtonClicked()
|
|||
for (unsigned int j = 0; j < ENTRIES_PER_PAGE && (i * j) < sellers.size(); ++j) {
|
||||
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)->getLastName().c_str(), -14)
|
||||
.arg(sellers.at(i * j)->getFirstName().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)
|
||||
|
@ -102,44 +102,13 @@ void ReportDialog::onPrintReportButtonClicked()
|
|||
painter.drawText(QRect(0, 50, width, height), Qt::AlignLeft, content);
|
||||
}
|
||||
|
||||
// pieces booked on the special account "Sonderkonto"
|
||||
const auto specialSeller = market_->findSellerWithUuid("11111111-1111-1111-1111-111111111111");
|
||||
if (specialSeller && specialSeller->numArticlesSold() > 0) {
|
||||
// now print the overall statistics
|
||||
printer.newPage();
|
||||
painter.setFont(QFont("Arial", 16, QFont::Bold));
|
||||
painter.drawText(QRect(0, 0, width, height), Qt::AlignTop | Qt::AlignHCenter,
|
||||
"Auswertung Kindersachenmarkt");
|
||||
painter.setFont(QFont("monospace", 12));
|
||||
QString content("Einzelteile ohne Nummer\n=======================\n\n");
|
||||
unsigned int lines{0};
|
||||
unsigned int pages{1};
|
||||
for (const auto& article : specialSeller->getArticles(true)) {
|
||||
content += QString("- %1:").arg(article->getDescription().substr(0, 45).c_str(), -45);
|
||||
content += QString("%1\n").arg(article->getPriceAsString().c_str(), 11);
|
||||
++lines;
|
||||
if (lines % static_cast<int>(ENTRIES_PER_PAGE) == 0 &&
|
||||
(pages * lines) < specialSeller->getArticles(true).size()) {
|
||||
painter.drawText(QRect(0, 50, width, height), Qt::AlignLeft, content);
|
||||
lines = 0;
|
||||
++pages;
|
||||
printer.newPage();
|
||||
painter.setFont(QFont("Arial", 16, QFont::Bold));
|
||||
painter.drawText(QRect(0, 0, width, height), Qt::AlignTop | Qt::AlignHCenter,
|
||||
"Auswertung Kindersachenmarkt");
|
||||
painter.setFont(QFont("monospace", 12));
|
||||
content = "Einzelteile ohne Nummer\n=======================\n\n";
|
||||
}
|
||||
}
|
||||
painter.drawText(QRect(0, 50, width, height), Qt::AlignLeft, content);
|
||||
}
|
||||
|
||||
// overall statistics
|
||||
printer.newPage();
|
||||
painter.setFont(QFont("Arial", 16, QFont::Bold));
|
||||
painter.drawText(QRect(0, 0, width, height), Qt::AlignTop | Qt::AlignHCenter,
|
||||
"Auswertung Kindersachenmarkt");
|
||||
painter.setFont(QFont("monospace", 12));
|
||||
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("Verkaufte Artikel: %1\n\n").arg(6, 6);
|
||||
content += QString("Gesamtumsatz: %1\n").arg(market_->getOverallSumAsString().c_str(), 10);
|
||||
|
|
Loading…
Reference in a new issue