Compare commits
37 commits
86a9ed38b6
...
eb23243637
Author | SHA1 | Date | |
---|---|---|---|
eb23243637 | |||
e92b080f7a | |||
bd23e2417c | |||
fe7ddc5cf2 | |||
43faf05006 | |||
04de363af5 | |||
1aa56f24a3 | |||
d546b61f00 | |||
373e143aa4 | |||
6c0441992f | |||
4fb6d2f98b | |||
e9fde76a60 | |||
f6528bdf45 | |||
127fbc1398 | |||
ef88604ad4 | |||
ad68fb8bf7 | |||
0b4041c13a | |||
9ef1ada6d9 | |||
723dee825b | |||
d15deb42c8 | |||
4f0ce62ce5 | |||
7571ef6a13 | |||
6b9ac3d284 | |||
9f114660e1 | |||
d5d309ac10 | |||
cdec552f04 | |||
cdeea37f8c | |||
639c8ec576 | |||
8e5080b888 | |||
cfc632a986 | |||
271aac0914 | |||
725bc8f04b | |||
42a1a3151f | |||
337462f010 | |||
634b256da7 | |||
b76d1e129a | |||
a870736d72 |
18 changed files with 169 additions and 39 deletions
|
@ -1,4 +1,3 @@
|
|||
---
|
||||
Language: Cpp
|
||||
# BasedOnStyle: LLVM
|
||||
AccessModifierOffset: -2
|
||||
|
@ -90,10 +89,6 @@ PenaltyBreakString: 1000
|
|||
PenaltyExcessCharacter: 1000000
|
||||
PenaltyReturnTypeOnItsOwnLine: 60
|
||||
PointerAlignment: Left
|
||||
RawStringFormats:
|
||||
- Delimiter: pb
|
||||
Language: TextProto
|
||||
BasedOnStyle: google
|
||||
ReflowComments: true
|
||||
SortIncludes: true
|
||||
SortUsingDeclarations: true
|
||||
|
@ -108,8 +103,7 @@ SpacesInContainerLiterals: true
|
|||
SpacesInCStyleCastParentheses: false
|
||||
SpacesInParentheses: false
|
||||
SpacesInSquareBrackets: false
|
||||
Standard: Cpp11
|
||||
Standard: Auto
|
||||
TabWidth: 8
|
||||
UseTab: Never
|
||||
...
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
cmake_minimum_required(VERSION 3.8)
|
||||
|
||||
project(kima2 VERSION 0.10.3)
|
||||
project(kima2 VERSION 0.12.0)
|
||||
|
||||
set(CMAKE_MODULE_PATH "${CMAKE_HOME_DIRECTORY}/cmake" ${CMAKE_MODULE_PATH})
|
||||
|
||||
|
@ -87,9 +87,9 @@ if( MINGW )
|
|||
${MINGW_PATH}/libsqlite3-0.dll
|
||||
${MINGW_PATH}/libusb-1.0.dll
|
||||
${MINGW_PATH}/libxlnt.dll
|
||||
${MINGW_PATH}/libicuuc61.dll
|
||||
${MINGW_PATH}/libicuin61.dll
|
||||
${MINGW_PATH}/libicudt61.dll
|
||||
${MINGW_PATH}/libicuuc62.dll
|
||||
${MINGW_PATH}/libicuin62.dll
|
||||
${MINGW_PATH}/libicudt62.dll
|
||||
${MINGW_PATH}/libjsoncpp-20.dll
|
||||
${MINGW_PATH}/libpcre2-16-0.dll
|
||||
${MINGW_PATH}/zlib1.dll
|
||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -5,6 +5,8 @@
|
|||
#include <stdexcept>
|
||||
#include <vector>
|
||||
|
||||
#include "boost/date_time/posix_time/posix_time.hpp"
|
||||
|
||||
Database::Database(const std::string& dbname)
|
||||
{
|
||||
dbname_ = dbname;
|
||||
|
@ -30,11 +32,29 @@ Database::Database()
|
|||
throw err;
|
||||
}
|
||||
}
|
||||
dbpath /= "kima2-cpp.db";
|
||||
dbpath /= "kima2.db";
|
||||
dbname_ = dbpath.string();
|
||||
init();
|
||||
}
|
||||
|
||||
void Database::newDb()
|
||||
{
|
||||
namespace fs = std::filesystem;
|
||||
|
||||
sqlite3_close(db_);
|
||||
|
||||
fs::path sourcePath = dbname_;
|
||||
fs::path destPath = sourcePath.parent_path() / sourcePath.stem();
|
||||
destPath += std::string("_") +=
|
||||
boost::posix_time::to_iso_string(boost::posix_time::second_clock::local_time()) += ".db";
|
||||
|
||||
fs::copy_file(sourcePath, destPath, fs::copy_options::overwrite_existing);
|
||||
|
||||
fs::remove(sourcePath);
|
||||
|
||||
init();
|
||||
}
|
||||
|
||||
Database::~Database() { sqlite3_close(db_); }
|
||||
|
||||
void Database::exec(const std::string& sql)
|
||||
|
@ -55,7 +75,7 @@ void Database::createNew()
|
|||
|
||||
std::string sqlCreateKima2{"CREATE TABLE IF NOT EXISTS kima2 ("
|
||||
"version INTEGER NOT NULL);"
|
||||
"INSERT INTO kima2 (version) VALUES (1);"};
|
||||
"INSERT INTO kima2 (version) VALUES (2);"};
|
||||
sqlStrings.push_back(sqlCreateKima2);
|
||||
std::string sqlCreateSellers{"CREATE TABLE IF NOT EXISTS sellers ("
|
||||
"id TEXT PRIMARY KEY NOT NULL, "
|
||||
|
@ -94,6 +114,12 @@ void Database::createNew()
|
|||
");"};
|
||||
sqlStrings.push_back(sqlCreateSalesItems);
|
||||
|
||||
std::string sqlInitialEntries{
|
||||
"INSERT OR IGNORE INTO sellers (id, seller_no, first_name, last_name, "
|
||||
"num_offered_articles) VALUES "
|
||||
"('11111111-1111-1111-1111-111111111111', 0, 'Sonderkonto', 'Sonderkonto', 0)"};
|
||||
sqlStrings.push_back(sqlInitialEntries);
|
||||
|
||||
beginTransaction();
|
||||
for (const auto& sql : sqlStrings) {
|
||||
exec(sql);
|
||||
|
|
|
@ -24,6 +24,7 @@ class Database
|
|||
unsigned int loadSales(std::vector<std::unique_ptr<Sale>>& sales,
|
||||
std::vector<std::unique_ptr<Seller>>& sellers);
|
||||
void updateCashPointNo(int oldCashPointNo, int newCashPointNo);
|
||||
void newDb();
|
||||
|
||||
private:
|
||||
sqlite3* db_{nullptr};
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#include <iomanip>
|
||||
#include <numeric>
|
||||
#include <sstream>
|
||||
#include <filesystem>
|
||||
|
||||
namespace fs = std::filesystem;
|
||||
|
||||
|
@ -113,7 +114,7 @@ Seller* Marketplace::findSellerWithUuid(const std::string& uuid)
|
|||
|
||||
void Marketplace::addArticleToBasket(std::unique_ptr<Article> article)
|
||||
{
|
||||
basket_.push_back(std::move(article));
|
||||
basket_.insert(basket_.begin(), std::move(article)); // article to the beginning of the basket vector
|
||||
}
|
||||
|
||||
size_t Marketplace::basketSize() { return basket_.size(); }
|
||||
|
@ -272,7 +273,7 @@ std::string escapeCsvValue(const std::string& value, const char delimiter)
|
|||
|
||||
void Marketplace::clear()
|
||||
{
|
||||
std::for_each(sellers_.begin(), sellers_.end(), [](auto& seller) {
|
||||
/* std::for_each(sellers_.begin(), sellers_.end(), [](auto& seller) {
|
||||
if (seller->getUuidAsString() == "11111111-1111-1111-1111-111111111111") {
|
||||
for (auto& article : seller->getArticles()) {
|
||||
article->setState(Article::State::DELETE);
|
||||
|
@ -283,5 +284,9 @@ void Marketplace::clear()
|
|||
});
|
||||
std::for_each(sales_.begin(), sales_.end(),
|
||||
[](auto& sale) { sale->setState(Sale::State::DELETE); });
|
||||
storeToDb();
|
||||
storeToDb(); */
|
||||
|
||||
Database db;
|
||||
db.newDb();
|
||||
loadFromDb();
|
||||
}
|
|
@ -35,6 +35,16 @@ std::string Seller::getLastName() const { return lastName_; }
|
|||
|
||||
int Seller::getSellerNo() const { return sellerNo_; }
|
||||
|
||||
std::string Seller::getSellerNoAsString() const
|
||||
{
|
||||
std::stringstream selNoStr;
|
||||
|
||||
selNoStr << std::setfill('0') << std::setw(3) << sellerNo_;
|
||||
|
||||
return selNoStr.str();
|
||||
;
|
||||
}
|
||||
|
||||
std::vector<Article*> Seller::getArticles(bool onlySold) const
|
||||
{
|
||||
std::vector<Article*> articles;
|
||||
|
@ -94,7 +104,6 @@ int Seller::sumInCents()
|
|||
|
||||
std::string Seller::sumAsString() { return formatCentAsEuroString(sumInCents()); }
|
||||
|
||||
|
||||
bool operator<(const Seller& li, const Seller& re) { return li.sellerNo_ < re.sellerNo_; }
|
||||
bool operator<(const std::unique_ptr<Seller>& li, const std::unique_ptr<Seller>& re)
|
||||
{
|
||||
|
|
|
@ -8,13 +8,13 @@
|
|||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
//class Article;
|
||||
// class Article;
|
||||
|
||||
class Seller : public Entity
|
||||
{
|
||||
public:
|
||||
Seller() = default;
|
||||
//virtual ~Seller() = default;
|
||||
// virtual ~Seller() = default;
|
||||
Seller(const std::string& firstName, const std::string& lastName, int sellerNo = 0,
|
||||
int numArticlesOffered = 0);
|
||||
|
||||
|
@ -28,6 +28,7 @@ class Seller : public Entity
|
|||
std::string getFirstName() const;
|
||||
std::string getLastName() const;
|
||||
int getSellerNo() const;
|
||||
std::string getSellerNoAsString() const;
|
||||
int numArticlesOffered() const;
|
||||
int numArticlesSold() const;
|
||||
// int numArticlesTotal() const;
|
||||
|
|
|
@ -21,15 +21,19 @@ QVariant BasketModel::data(const QModelIndex& index, int role) const
|
|||
if (role == Qt::FontRole) {
|
||||
QFont myFont;
|
||||
|
||||
QFont myFixedFont = QFontDatabase::systemFont(QFontDatabase::FixedFont);
|
||||
|
||||
switch (index.column()) {
|
||||
case 0:
|
||||
[[fallthrough]];
|
||||
case 1:
|
||||
return QFontDatabase::systemFont(QFontDatabase::FixedFont);
|
||||
return myFixedFont;
|
||||
case 2:
|
||||
return myFont;
|
||||
myFixedFont.setPointSize(myFixedFont.pointSize() + 3);
|
||||
return myFixedFont;
|
||||
case 3:
|
||||
return QFontDatabase::systemFont(QFontDatabase::FixedFont);
|
||||
myFixedFont.setPointSize(myFixedFont.pointSize() + 3);
|
||||
return myFixedFont;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -62,6 +62,7 @@ MainWindow::MainWindow()
|
|||
dynamic_cast<BasketModel*>(ui_.basketView->model())->cancelSale();
|
||||
marketplace_->clear();
|
||||
setSaleModel();
|
||||
updateStatLabel();
|
||||
});
|
||||
|
||||
ui_.sellerNoEdit->installEventFilter(this);
|
||||
|
@ -139,6 +140,8 @@ MainWindow::MainWindow()
|
|||
|
||||
readGeometry();
|
||||
setWindowIcon(QIcon(":/misc/kima2.ico"));
|
||||
|
||||
updateStatLabel();
|
||||
}
|
||||
|
||||
void MainWindow::onActionEditSellerTriggered()
|
||||
|
@ -159,6 +162,7 @@ void MainWindow::onActionEditSellerTriggered()
|
|||
}
|
||||
|
||||
setSaleModel();
|
||||
updateStatLabel();
|
||||
}
|
||||
|
||||
void MainWindow::setSaleModel()
|
||||
|
@ -189,6 +193,7 @@ void MainWindow::onPaidButtonTriggered()
|
|||
ui_.drawbackContainerWidget->setEnabled(false);
|
||||
ui_.sellerNoEdit->setFocus();
|
||||
statusBar()->showMessage("Verkaufsvorgang erfolgreich durchgeführt.", STATUSBAR_TIMEOUT);
|
||||
updateStatLabel();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -255,11 +260,15 @@ void MainWindow::checkSellerNo(bool ctrlPressed)
|
|||
auto seller = marketplace_->findSellerWithSellerNo(sellerNo);
|
||||
if (seller) {
|
||||
PriceDialog priceDialog(this);
|
||||
if(sellerNo == 0) {
|
||||
priceDialog.setForceDesc(true);
|
||||
}
|
||||
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);
|
||||
ui_.basketView->resizeColumnToContents(1);
|
||||
ui_.basketSumLabel->setText(marketplace_->getBasketSumAsString().c_str());
|
||||
}
|
||||
}
|
||||
|
@ -322,6 +331,9 @@ void MainWindow::onCancelArticleButtonClicked([[maybe_unused]] bool checked)
|
|||
for (auto iter = indexes.constEnd() - 1; iter >= indexes.constBegin(); --iter) {
|
||||
ui_.basketView->model()->removeRow(iter->row());
|
||||
}
|
||||
|
||||
ui_.basketSumLabel->setText(marketplace_->getBasketSumAsString().c_str()); // Update basket sum
|
||||
ui_.sellerNoEdit->setFocus();
|
||||
}
|
||||
|
||||
void MainWindow::onCancelSaleButtonClicked([[maybe_unused]] bool checked)
|
||||
|
@ -345,6 +357,9 @@ void MainWindow::onCancelSaleButtonClicked([[maybe_unused]] bool checked)
|
|||
for (auto iter = indexes.constEnd() - 1; iter >= indexes.constBegin(); --iter) {
|
||||
ui_.salesView->model()->removeRow(iter->row(), iter->parent());
|
||||
}
|
||||
|
||||
ui_.salesView->collapseAll();
|
||||
updateStatLabel();
|
||||
}
|
||||
|
||||
void MainWindow::onPrintSaleReceiptButtonClicked([[maybe_unused]] bool checked)
|
||||
|
@ -389,6 +404,9 @@ void MainWindow::onCancelAllArticlesButtonClicked([[maybe_unused]] bool checked)
|
|||
return;
|
||||
|
||||
dynamic_cast<BasketModel*>(ui_.basketView->model())->cancelSale();
|
||||
|
||||
ui_.basketSumLabel->setText(marketplace_->getBasketSumAsString().c_str()); // Update basket sum
|
||||
ui_.sellerNoEdit->setFocus();
|
||||
}
|
||||
|
||||
void MainWindow::onAboutQt() { QMessageBox::aboutQt(this); }
|
||||
|
@ -431,6 +449,7 @@ void MainWindow::onImportSellerExcelActionTriggered()
|
|||
fs::path filePath(filename.toStdWString());
|
||||
|
||||
ExcelReader::readSellersFromFile(filePath, marketplace_.get());
|
||||
updateStatLabel();
|
||||
}
|
||||
|
||||
void MainWindow::onImportSellerJsonActionTriggered()
|
||||
|
@ -452,6 +471,7 @@ void MainWindow::onImportSellerJsonActionTriggered()
|
|||
fs::path filePath(filename.toStdWString());
|
||||
|
||||
JsonUtil::importSellers(filePath, marketplace_.get());
|
||||
updateStatLabel();
|
||||
}
|
||||
|
||||
void MainWindow::onExportSellerJsonActionTriggered()
|
||||
|
@ -471,8 +491,10 @@ void MainWindow::onExportSalesJsonActionTriggered()
|
|||
{
|
||||
QSettings settings;
|
||||
|
||||
auto filename = QFileDialog::getSaveFileName(this, "Umsätze/Transaktionen exportieren",
|
||||
QString(), "JSON Dateien (*.json)");
|
||||
auto filename = QFileDialog::getSaveFileName(
|
||||
this, "Umsätze/Transaktionen exportieren",
|
||||
QString("kima2_umsaetze_kasse") + settings.value("global/cashPointNo").toString() + ".json",
|
||||
"JSON Dateien (*.json)");
|
||||
|
||||
if (filename.isEmpty())
|
||||
return;
|
||||
|
@ -506,6 +528,7 @@ void MainWindow::onImportSalesJsonActionTriggered()
|
|||
marketplace_->loadFromDb();
|
||||
}
|
||||
setSaleModel();
|
||||
updateStatLabel();
|
||||
}
|
||||
|
||||
void MainWindow::writeGeometry()
|
||||
|
@ -533,3 +556,14 @@ void MainWindow::closeEvent(QCloseEvent* event)
|
|||
writeGeometry();
|
||||
event->accept();
|
||||
}
|
||||
|
||||
void MainWindow::updateStatLabel()
|
||||
{
|
||||
std::string statistics("<b>KIMA2 - Version ");
|
||||
statistics += PROJECT_VERSION;
|
||||
statistics += "</b><br />Verkäufer: " + std::to_string(marketplace_->getSellers().size() - 1);
|
||||
statistics += "<br />Kunden: " + std::to_string(marketplace_->getSales().size());
|
||||
statistics += "<br />Umsatz: " + marketplace_->getOverallSumAsString();
|
||||
|
||||
ui_.statLabel->setText(statistics.c_str());
|
||||
}
|
|
@ -47,6 +47,7 @@ class MainWindow : public QMainWindow
|
|||
void setSaleModel();
|
||||
void writeGeometry();
|
||||
void readGeometry();
|
||||
void updateStatLabel();
|
||||
|
||||
Ui::MainWindow ui_;
|
||||
std::unique_ptr<Marketplace> marketplace_;
|
||||
|
|
|
@ -92,7 +92,16 @@
|
|||
<bool>false</bool>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<property name="margin">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
|
@ -166,7 +175,7 @@
|
|||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Stornieren</string>
|
||||
<string>&Stornieren</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -176,7 +185,7 @@
|
|||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Alles stornieren</string>
|
||||
<string>&Alles stornieren</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -331,6 +340,37 @@ drucken</string>
|
|||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="statLabel">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::RichText</enum>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_6">
|
||||
<item>
|
||||
|
@ -379,7 +419,7 @@ drucken</string>
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>817</width>
|
||||
<height>29</height>
|
||||
<height>24</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QMenu" name="menu_Datei">
|
||||
|
@ -433,8 +473,7 @@ drucken</string>
|
|||
<action name="actionQuit">
|
||||
<property name="icon">
|
||||
<iconset theme="application-exit">
|
||||
<normaloff/>
|
||||
</iconset>
|
||||
<normaloff>.</normaloff>.</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Beenden</string>
|
||||
|
|
|
@ -4,8 +4,9 @@
|
|||
|
||||
#include <QMessageBox>
|
||||
|
||||
PriceDialog::PriceDialog(QWidget* parent, Qt::WindowFlags f) : QDialog(parent, f)
|
||||
PriceDialog::PriceDialog(QWidget* parent, bool forceDesc, Qt::WindowFlags f) : QDialog(parent, f)
|
||||
{
|
||||
forceDesc_ = forceDesc;
|
||||
ui_.setupUi(this);
|
||||
ui_.priceSpinBox->setFocus();
|
||||
}
|
||||
|
@ -21,7 +22,18 @@ void PriceDialog::accept()
|
|||
"Es sind nur 0,50 Cent-Schritte erlaubt.", QMessageBox::StandardButton::Ok,
|
||||
this)
|
||||
.exec();
|
||||
} else if (forceDesc_ && ui_.descEdit->text().trimmed().isEmpty()) {
|
||||
QMessageBox(QMessageBox::Icon::Warning, "Artikelbeschreibung fehlt",
|
||||
"Da Sie auf das Sonderkonto buchen ist eine Artikelbeschreibung erforderlich.",
|
||||
QMessageBox::StandardButton::Ok, this)
|
||||
.exec();
|
||||
ui_.descEdit->setFocus();
|
||||
} else {
|
||||
QDialog::accept();
|
||||
}
|
||||
}
|
||||
|
||||
void PriceDialog::setForceDesc(bool force)
|
||||
{
|
||||
forceDesc_ = force;
|
||||
}
|
|
@ -10,15 +10,17 @@ class PriceDialog : public QDialog
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
PriceDialog(QWidget* parent = nullptr,
|
||||
PriceDialog(QWidget* parent = nullptr, bool forceDesc = false,
|
||||
Qt::WindowFlags f = Qt::WindowTitleHint | Qt::WindowSystemMenuHint);
|
||||
int getPrice() const;
|
||||
std::string getDescription() const;
|
||||
void setForceDesc(bool force);
|
||||
|
||||
private:
|
||||
void on_model_duplicateSellerNo(const QString& message);
|
||||
virtual void accept() override;
|
||||
Ui::PriceDialog ui_;
|
||||
bool forceDesc_;
|
||||
};
|
||||
|
||||
#endif
|
|
@ -161,9 +161,10 @@ void ReportDialog::onPrintReportButtonClicked()
|
|||
(static_cast<double>(numArticlesSold) / static_cast<double>(numArticlesOffered)) * 100;
|
||||
content += QString("Registrierte Verkäufer: %1\n").arg(sellers.size() - 1, 6);
|
||||
content += QString("Angelieferte Artikel: %1\n").arg(numArticlesOffered, 6);
|
||||
content += QString("Verkaufte Artikel: %1 (%L2 %)\n\n")
|
||||
content += QString("Verkaufte Artikel: %1 (%L2 %)\n")
|
||||
.arg(numArticlesSold, 6)
|
||||
.arg(percentArticlesSold, 0, 'f', 2);
|
||||
content += QString("Anzahl Kunden: %1\n\n").arg(market_->getSales().size(), 6);
|
||||
content += QString("Gesamtumsatz: %1\n").arg(market_->getOverallSumAsString().c_str(), 10);
|
||||
content +=
|
||||
QString("Ausgezahlt: %1\n")
|
||||
|
|
|
@ -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->getCompleteArticleNo().c_str();
|
||||
return (std::string("Verk. ") + std::to_string(article->getSeller()->getSellerNo()) + " (" + article->getCompleteArticleNo() + ")").c_str();
|
||||
case 1:
|
||||
return article->getPriceAsString().c_str();
|
||||
case 2:
|
||||
|
@ -146,7 +146,7 @@ QVariant SaleModel::headerData(int section, Qt::Orientation orientation, int rol
|
|||
if (orientation == Qt::Horizontal) {
|
||||
switch (section) {
|
||||
case 0:
|
||||
return "Zeit / Art.Nr.";
|
||||
return "Zeit / Verk.Nr. (Art.Nr)";
|
||||
case 1:
|
||||
return "Preis";
|
||||
default:
|
||||
|
|
|
@ -46,7 +46,8 @@ PosPrinter::PosPrinter(const PrinterDevice& printerDevice) : printerDevice_(prin
|
|||
|
||||
if (printerDevice_.idVendor == 0) {
|
||||
for (const auto& supported : supportedPrinters_.models) {
|
||||
if (desc.idVendor == std::get<0>(supported) && desc.idProduct == std::get<1>(supported)) {
|
||||
if (desc.idVendor == std::get<0>(supported) &&
|
||||
desc.idProduct == std::get<1>(supported)) {
|
||||
numDevice = i;
|
||||
printerEndpoint_ = std::get<2>(supported);
|
||||
break;
|
||||
|
@ -161,8 +162,8 @@ void PosPrinter::printSaleReceipt(Sale* sale)
|
|||
commandStream << sale->getTimestampFormatted() << "\n\n";
|
||||
commandStream << Command::LEFT_ALIGN;
|
||||
for (const auto& article : sale->getArticles()) {
|
||||
commandStream << "Art. " << article->getCompleteArticleNo() << "........... "
|
||||
<< article->getPriceAsString() << "\n";
|
||||
commandStream << "Verk.Nr. " << article->getSeller()->getSellerNoAsString()
|
||||
<< "........... " << article->getPriceAsString() << "\n";
|
||||
}
|
||||
commandStream << "\nGesamt................. " << sale->sumAsString() << "\n";
|
||||
commandStream << Command::CENTERING;
|
||||
|
|
Loading…
Reference in a new issue