Compare commits

..

No commits in common. "432aed665a2f4f3c29298ae9c86beeef4c8b8acb" and "84f71ea056cea23a10faa5a4302eea4abf51371d" have entirely different histories.

6 changed files with 8 additions and 15 deletions

View file

@ -150,10 +150,10 @@ std::string marketFeeAsString(int sum, int percent, int maxFee)
return feeStream.str(); return feeStream.str();
} }
std::string paymentAsString(int sumInCent, int percent, int maxFeeInCent) std::string paymentAsString(int sum, int percent)
{ {
std::stringstream feeStream; std::stringstream feeStream;
feeStream << std::right << std::setw(10) << std::showbase feeStream << std::right << std::setw(10) << std::showbase
<< std::put_money(sumInCent - marketFee(sumInCent, percent, maxFeeInCent), false); << std::put_money(sum - marketFee(sum, percent), false);
return feeStream.str(); return feeStream.str();
} }

View file

@ -47,8 +47,8 @@ class Marketplace
BasketVec basket_; BasketVec basket_;
}; };
double marketFee(int sumInCent, int percent, int maxFeeInCent); double marketFee(int sum, int percent, int maxFee = 5000);
std::string marketFeeAsString(int sumInCent, int percent, int maxFeeInCent); std::string marketFeeAsString(int sum, int percent, int maxFee = 5000);
std::string paymentAsString(int sumInCent, int percent, int maxFeeInCent); std::string paymentAsString(int sum, int percent);
#endif #endif

View file

@ -96,7 +96,7 @@ void MainWindow::onPaidButtonTriggered()
dynamic_cast<BasketModel*>(ui_.basketView->model())->finishSale(); dynamic_cast<BasketModel*>(ui_.basketView->model())->finishSale();
ui_.lastPriceLabel1->setText(lastPrice); ui_.lastPriceLabel1->setText(lastPrice);
ui_.lastPriceLabel2->setText(lastPrice); ui_.lastPriceLabel2->setText(lastPrice);
ui_.basketSumLabel->setText(" 0,00 €"); ui_.basketSumLabel->setText(" 0,00 €");
statusBar()->showMessage("Verkaufsvorgang erfolgreich durchgeführt.", STATUSBAR_TIMEOUT); statusBar()->showMessage("Verkaufsvorgang erfolgreich durchgeführt.", STATUSBAR_TIMEOUT);
} }
} }

View file

@ -43,7 +43,7 @@
<enum>QFrame::Box</enum> <enum>QFrame::Box</enum>
</property> </property>
<property name="text"> <property name="text">
<string> 0,00 €</string> <string> 0,00 €</string>
</property> </property>
<property name="alignment"> <property name="alignment">
<set>Qt::AlignCenter</set> <set>Qt::AlignCenter</set>

View file

@ -1,15 +1,10 @@
#include "reportmodel.h" #include "reportmodel.h"
#include <QFont> #include <QFont>
#include <QSettings>
ReportModel::ReportModel(Marketplace* market, QObject* parent) ReportModel::ReportModel(Marketplace* market, QObject* parent)
: QAbstractTableModel(parent), market_(market) : QAbstractTableModel(parent), market_(market)
{ {
QSettings settings;
feeInPercent_ = settings.value("global/feeInPercent").toInt();
maxFeeInCent_ = settings.value("global/maxFeeInEuro").toInt() * 100;
} }
int ReportModel::rowCount([[maybe_unused]] const QModelIndex& parent) const int ReportModel::rowCount([[maybe_unused]] const QModelIndex& parent) const
@ -72,7 +67,7 @@ QVariant ReportModel::data(const QModelIndex& index, int role) const
case 5: case 5:
return seller->sumAsString().c_str(); return seller->sumAsString().c_str();
case 6: case 6:
return paymentAsString(seller->sumInCents(), feeInPercent_, maxFeeInCent_).c_str(); return paymentAsString(seller->sumInCents(), 20).c_str();
default: default:
return "???"; return "???";
} }

View file

@ -16,8 +16,6 @@ class ReportModel : public QAbstractTableModel
private: private:
Marketplace* market_; Marketplace* market_;
int feeInPercent_{};
int maxFeeInCent_{};
}; };
#endif #endif