lots of smaller improvements

This commit is contained in:
Martin Brodbeck 2018-07-30 14:43:02 +02:00
parent c3b17fbb8b
commit 84f71ea056
13 changed files with 49 additions and 24 deletions

View file

@ -24,7 +24,8 @@ QVariant BasketModel::data(const QModelIndex& index, int role) const
case 0:
[[fallthrough]];
case 1:
[[fallthrough]];
myFont.setFamily("monospace");
return myFont;
case 2:
return myFont;
case 3:
@ -45,7 +46,7 @@ QVariant BasketModel::data(const QModelIndex& index, int role) const
case 0:
return article->getUuidAsString().c_str();
case 1:
return article->getArticleNo();
return article->getCompleteArticleNo().c_str();
case 2:
return article->getSeller()->getSellerNo();
case 3:
@ -96,7 +97,10 @@ void BasketModel::addArticle(Seller* seller, int price)
void BasketModel::finishSale()
{
emit beginRemoveRows(QModelIndex(), 0, marketplace_->getBasket().size() - 1);
marketplace_->finishCurrentSale();
auto sale = std::make_unique<Sale>();
sale->createUuid();
sale->setSourceNo(QSettings().value("global/cashPointNo").toInt());
marketplace_->finishCurrentSale(std::move(sale));
emit endRemoveRows();
emit basketDataChanged();
}

View file

@ -96,6 +96,7 @@ void MainWindow::onPaidButtonTriggered()
dynamic_cast<BasketModel*>(ui_.basketView->model())->finishSale();
ui_.lastPriceLabel1->setText(lastPrice);
ui_.lastPriceLabel2->setText(lastPrice);
ui_.basketSumLabel->setText(" 0,00 €");
statusBar()->showMessage("Verkaufsvorgang erfolgreich durchgeführt.", STATUSBAR_TIMEOUT);
}
}
@ -128,8 +129,7 @@ void MainWindow::onSellerNoEditCheckSellerNo()
if (dialogResult == QDialog::Accepted) {
int price = priceDialog.getPrice();
dynamic_cast<BasketModel*>(ui_.basketView->model())->addArticle(seller, price);
std::string sumStr = "Gesamt: " + marketplace_->getBasketSumAsString();
ui_.basketSumLabel->setText(sumStr.c_str());
ui_.basketSumLabel->setText(marketplace_->getBasketSumAsString().c_str());
}
}

View file

@ -33,6 +33,7 @@
<widget class="QLabel" name="basketSumLabel">
<property name="font">
<font>
<family>Monospace</family>
<pointsize>18</pointsize>
<weight>75</weight>
<bold>true</bold>
@ -42,7 +43,7 @@
<enum>QFrame::Box</enum>
</property>
<property name="text">
<string>Gesamt: ---</string>
<string> 0,00 €</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
@ -298,6 +299,7 @@ drucken</string>
<widget class="QLabel" name="lastPriceLabel1">
<property name="font">
<font>
<family>Monospace</family>
<pointsize>20</pointsize>
<weight>75</weight>
<bold>true</bold>
@ -351,6 +353,7 @@ drucken</string>
<widget class="QLabel" name="lastPriceLabel2">
<property name="font">
<font>
<family>Monospace</family>
<pointsize>20</pointsize>
<weight>75</weight>
<bold>true</bold>

View file

@ -17,7 +17,14 @@
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QTableView" name="reportView"/>
<widget class="QTableView" name="reportView">
<property name="selectionMode">
<enum>QAbstractItemView::SingleSelection</enum>
</property>
<property name="selectionBehavior">
<enum>QAbstractItemView::SelectRows</enum>
</property>
</widget>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout">

View file

@ -35,6 +35,10 @@ QVariant ReportModel::data(const QModelIndex& index, int role) const
if (role == Qt::TextAlignmentRole) {
switch (index.column()) {
case 4:
[[fallthrough]];
case 5:
[[fallthrough]];
case 6:
return Qt::AlignRight;
default:
return Qt::AlignLeft;

View file

@ -108,7 +108,7 @@ QVariant SaleModel::data(const QModelIndex& index, int role) const
Article* article = static_cast<Article*>(index.internalPointer());
switch (index.column()) {
case 0:
return article->getArticleNo();
return article->getCompleteArticleNo().c_str();
case 1:
return article->getPriceAsString().c_str();
case 2: