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