diff --git a/addressbook/translations/addressbook_cs_CZ.ts b/addressbook/translations/addressbook_cs_CZ.ts
new file mode 100644
index 0000000..64d466c
--- /dev/null
+++ b/addressbook/translations/addressbook_cs_CZ.ts
@@ -0,0 +1,62 @@
+
+
+
+
+ AddressbookForm
+
+
+
+
+
+
+
+
+ Titul
+
+
+
+
+ Křestní jméno
+
+
+
+
+ Příjmení
+
+
+
+
+ Datum narození
+
+
+
+
+ Číslo dokladu totožnosti
+
+
+
+
+ Město
+
+
+
+
+ ZTP
+
+
+
+
+ Ulice
+
+
+
+
+ Číslo popisné
+
+
+
+
+ PSČ
+
+
+
diff --git a/application/translations/prodejna_cs_CZ.qm b/application/translations/prodejna_cs_CZ.qm
index ff3af12..f569e5d 100644
Binary files a/application/translations/prodejna_cs_CZ.qm and b/application/translations/prodejna_cs_CZ.qm differ
diff --git a/application/translations/prodejna_cz.ts b/application/translations/prodejna_cz.ts
index cc1072e..8d1a56b 100644
--- a/application/translations/prodejna_cz.ts
+++ b/application/translations/prodejna_cz.ts
@@ -20,7 +20,7 @@
- Nastaveni
+ Prodejna
diff --git a/commodity/translations/commodity_cs_CZ.ts b/commodity/translations/commodity_cs_CZ.ts
new file mode 100644
index 0000000..db5539e
--- /dev/null
+++ b/commodity/translations/commodity_cs_CZ.ts
@@ -0,0 +1,85 @@
+
+
+
+
+ CommodityForm
+
+
+
+ Zboží
+
+
+
+
+ Název
+
+
+
+
+ Zobrazit na účtence
+
+
+
+
+ Kód
+
+
+
+
+ Druh
+
+
+
+
+ Cena
+
+
+
+
+ DPH
+
+
+
+
+ Počet
+
+
+
+
+ Žádná
+
+
+
+
+ Vysoká
+
+
+
+
+ První snížená
+
+
+
+
+ Druhá snížená
+
+
+
+ CommoditySettingsForm
+
+
+
+
+
+
+
+
+ +
+
+
+
+
+ -
+
+
+
diff --git a/core/autotablemodel.h b/core/autotablemodel.h
index 6f45b0f..2b12a38 100644
--- a/core/autotablemodel.h
+++ b/core/autotablemodel.h
@@ -24,6 +24,7 @@ public:
:ITableModel(parent)
{
filtered = false;
+ m_checkboxSelect = false;
}
virtual ~AutoTableModel() {}
@@ -50,6 +51,21 @@ public:
QVariant data(const QModelIndex &index, int role) const
{
+ if (index.column() == 0 && m_checkboxSelect)
+ {
+ if (role == Qt::CheckStateRole)
+ {
+ if (m_selectedRows.contains(index.row()))
+ {
+ return Qt::Checked;
+ }
+ else
+ {
+ return Qt::Unchecked;
+ }
+ }
+ }
+
QSharedPointer entity = m_list.at(index.row());
QObject *rawEntity = (QObject*)entity.data();
@@ -189,6 +205,21 @@ public:
m_translations = translations;
}
+ QList selectedRows() const
+ {
+ return m_selectedRows;
+ }
+
+ QList > selectedItems()
+ {
+ QList > ret;
+ foreach (int row, m_selectedRows) {
+ ret.append(m_list[row]);
+ }
+
+ return ret;
+ }
+
protected:
void handleFilter(const QString &filter) override
{
@@ -220,10 +251,10 @@ protected:
private:
QList > m_list;
QList > m_fullList;
+ QList m_selectedRows;
QMap m_translations;
bool filtered;
-
// QAbstractItemModel interface
public:
virtual bool setData(const QModelIndex &index, const QVariant &value, int role) override
@@ -236,10 +267,21 @@ public:
rawEntity->setProperty(rawEntity->metaObject()->property(index.column() + 1).name(), value);
}
+ if (role == Qt::CheckStateRole)
+ {
+ if (m_selectedRows.contains(index.row()))
+ {
+ m_selectedRows.removeOne(index.row());
+ }
+ else
+ {
+ m_selectedRows.append(index.row());
+ }
+ }
+
emit editCompleted();
return true;
}
};
#endif // ODBTABLEMODEL_H
-
diff --git a/core/context.cpp b/core/context.cpp
index c658df6..7b92ef3 100644
--- a/core/context.cpp
+++ b/core/context.cpp
@@ -65,6 +65,10 @@ void Context::loadPlugins()
m_plugins.append(plugin);
}
}
+ else
+ {
+ qDebug() << pluginLoader.errorString();
+ }
}
QString dbPath = m_settings->value("db/path", "").toString();
diff --git a/core/itablemodel.cpp b/core/itablemodel.cpp
index 50f689b..6c7ff0b 100644
--- a/core/itablemodel.cpp
+++ b/core/itablemodel.cpp
@@ -3,7 +3,17 @@
ITableModel::ITableModel(QObject *parent)
:QAbstractTableModel(parent)
{
+ m_checkboxSelect = false;
+}
+
+bool ITableModel::checkboxSelect() const
+{
+ return m_checkboxSelect;
+}
+void ITableModel::setCheckboxSelect(bool checkboxSelect)
+{
+ m_checkboxSelect = checkboxSelect;
}
void ITableModel::filter(const QString &filter)
@@ -18,6 +28,11 @@ void ITableModel::restore()
Qt::ItemFlags ITableModel::flags(const QModelIndex &index) const
{
+ if (index.column() == 0 && m_checkboxSelect)
+ {
+ return Qt::ItemIsSelectable | Qt::ItemIsUserCheckable | Qt::ItemIsEnabled;
+ }
+
if (m_editableCols.contains(index.column()))
{
return Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsEnabled;
diff --git a/core/itablemodel.h b/core/itablemodel.h
index e30780f..b337c16 100644
--- a/core/itablemodel.h
+++ b/core/itablemodel.h
@@ -16,6 +16,7 @@ public:
protected:
virtual void handleFilter(const QString &filter) = 0;
virtual void handleRestore() = 0;
+ bool m_checkboxSelect;
public slots:
void filter(const QString &filter);
@@ -29,6 +30,9 @@ public:
virtual Qt::ItemFlags flags(const QModelIndex &index) const override;
void setEditableCols(const QList cols);
+ bool checkboxSelect() const;
+ void setCheckboxSelect(bool checkboxSelect);
+
private:
QList m_editableCols;
};
diff --git a/core/translations/core_cs_CZ.ts b/core/translations/core_cs_CZ.ts
index e23a684..6fd7131 100644
--- a/core/translations/core_cs_CZ.ts
+++ b/core/translations/core_cs_CZ.ts
@@ -126,86 +126,132 @@
-
+
+
+
+
+
+
Informace o společnosti
-
+
IČO
-
+
DIČ
-
+
Plátce DPH
-
+
Sazby DPH
-
+
Vysoká
-
+
První snížená
-
+
Druhá snížená
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Kontaktní údaje
-
+
Název společnosti
-
+
Ulice
-
+
Číslo popisné
-
+
Město
-
+
PSČ
-
-
+
+
Logo
-
+
Vyber soubor
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
GridForm
@@ -314,6 +360,19 @@
Název filtru
+
+ SeasonNameDialog
+
+
+
+
+
+
+
+
+
+
+
SettingsForm
diff --git a/odb.pri b/odb.pri
index 5459420..ab3dc7b 100644
--- a/odb.pri
+++ b/odb.pri
@@ -46,7 +46,7 @@ ODB_FLAGS += -I $$PWD/core
ODB_FLAGS += -I $$PWD/qdecimal/src
ODB_FLAGS += -I $$PWD/qdecimal/decnumber
ODB_FLAGS += $$ODB_OTHER_INCLUDES
-ODB_FLAGS += -D __PIC__
+ODB_FLAGS += -x -std=c++11 -x -fPIC
win32 {
ODB_FLAGS += -I d:/prac/odb/libodb-2.4.0
diff --git a/services/translations/services_cs_CZ.ts b/services/translations/services_cs_CZ.ts
new file mode 100644
index 0000000..a065c7e
--- /dev/null
+++ b/services/translations/services_cs_CZ.ts
@@ -0,0 +1,82 @@
+
+
+
+
+ AccServiceForm
+
+
+
+ Služba
+
+
+
+
+ Název
+
+
+
+
+ Cena
+
+
+
+
+ Druh
+
+
+
+
+ Umožnit slevu
+
+
+
+
+ Aktivní
+
+
+
+
+ Kód
+
+
+
+
+ Sazba DPH
+
+
+
+
+ Vozidlo
+
+
+
+
+ Stan
+
+
+
+
+ Ostatní
+
+
+
+
+ Žádná
+
+
+
+
+ Vysoká
+
+
+
+
+ První snížená
+
+
+
+
+ Druhá snížená
+
+
+
diff --git a/shop/receiptloadform.cpp b/shop/receiptloadform.cpp
index 9622c27..1eff0a6 100644
--- a/shop/receiptloadform.cpp
+++ b/shop/receiptloadform.cpp
@@ -28,6 +28,7 @@ ReceiptLoadForm::ReceiptLoadForm(QWidget *parent) :
ui->tabVouchers->setColumnWidth(2, 200);
m_itemModel = new AutoTableModel(this);
+ m_itemModel->setCheckboxSelect(true);
ui->tabItems->setModel(m_itemModel);
connect(ui->tabVouchers->selectionModel(), &QItemSelectionModel::currentRowChanged, [this](const QModelIndex ¤t, QModelIndex){
@@ -43,6 +44,16 @@ ReceiptLoadForm::~ReceiptLoadForm()
delete ui;
}
+QList ReceiptLoadForm::selectedItems()
+{
+ return m_itemModel->selectedItems();
+}
+
+VoucherPtr ReceiptLoadForm::selectedVoucher()
+{
+ return m_voucherModel->itemFromIndex(ui->tabVouchers->currentIndex());
+}
+
void ReceiptLoadForm::on_lineEdit_textChanged(const QString &text)
{
QSortFilterProxyModel proxy;
diff --git a/shop/receiptloadform.h b/shop/receiptloadform.h
index ec022d3..f49954d 100644
--- a/shop/receiptloadform.h
+++ b/shop/receiptloadform.h
@@ -16,6 +16,8 @@ class ReceiptLoadForm : public QDialog
public:
explicit ReceiptLoadForm(QWidget *parent = 0);
~ReceiptLoadForm();
+ QList selectedItems();
+ VoucherPtr selectedVoucher();
private slots:
void on_lineEdit_textChanged(const QString &text);
diff --git a/shop/shop.json b/shop/shop.json
index 9f54cc6..ccd3cab 100644
--- a/shop/shop.json
+++ b/shop/shop.json
@@ -57,6 +57,7 @@ CREATE TABLE \"Voucher\" (
"translations" : {
"CZ" : {
"name" : "Název",
+ "code" : "Kod",
"count" : "Počet",
"unitPrice" : "Jednotková cena",
"vatRate" : "Procento DPH",
diff --git a/shop/shopform.cpp b/shop/shopform.cpp
index 985bca5..4d29d80 100644
--- a/shop/shopform.cpp
+++ b/shop/shopform.cpp
@@ -62,6 +62,7 @@ void ShopForm::loadLast()
if (m_commodityModel == NULL)
{
m_commodityModel = new AutoTableModel(this);
+ m_commodityModel->setTranslations(Context::instance().plugin("SHOP")->translations());
ui->commodityTable->setModel(m_commodityModel);
connect(ui->commodityTable->selectionModel(), &QItemSelectionModel::currentRowChanged, [this](const QModelIndex ¤t, const QModelIndex &){
@@ -70,6 +71,8 @@ void ShopForm::loadLast()
}
m_commodityModel->setData(srv.allSellableItems());
+ ui->commodityTable->horizontalHeader()->setSectionResizeMode(1, QHeaderView::Stretch);
+ ui->commodityTable->setColumnHidden(3, true);
}
void ShopForm::fillRaceiptCombo()
@@ -132,10 +135,27 @@ void ShopForm::on_loadButton_clicked()
{
ReceiptLoadForm *form = new ReceiptLoadForm(this);
form->setAttribute(Qt::WA_DeleteOnClose);
+
+ connect(form, &QDialog::accepted, [this, form](){
+ ShopService srv;
+
+ if (m_voucher.isNull())
+ {
+ m_voucher = srv.createVoucher();
+ }
+
+ srv.moveItems(form->selectedItems(), form->selectedVoucher(), this->m_voucher);
+
+ m_itemsModel->setData(m_voucher->items());
+
+ connectItemSignals();
+ onCountChanged();
+ });
+
form->show();
}
-void ShopForm::onCountChanged(int oldCount)
+void ShopForm::onCountChanged(int oldCount/* = 0*/)
{
VoucherItem *item = qobject_cast(sender());
if (item != NULL && item->count() == 0)
@@ -253,7 +273,7 @@ void ShopForm::addItem(QSharedPointer item, int count)
srv.addShopItem(m_voucher, item, count);
this->m_itemsModel->addRow(m_voucher->items()[m_voucher->items().count() - 1]);
connect(m_voucher->items()[m_voucher->items().count() - 1].data(), SIGNAL(countChanged(int)), this, SLOT(onCountChanged(int)));
- onCountChanged(0);
+ onCountChanged();
}
void ShopForm::on_receiptCombo_currentIndexChanged(int)
diff --git a/shop/shopform.h b/shop/shopform.h
index d2eecd6..d26d4ff 100644
--- a/shop/shopform.h
+++ b/shop/shopform.h
@@ -32,7 +32,7 @@ private slots:
void on_loadButton_clicked();
- void onCountChanged(int oldCount);
+ void onCountChanged(int oldCount = 0);
void on_receiptCombo_currentIndexChanged(int index);
diff --git a/shop/shopservice.cpp b/shop/shopservice.cpp
index 5692915..9aa6895 100644
--- a/shop/shopservice.cpp
+++ b/shop/shopservice.cpp
@@ -7,14 +7,14 @@ ShopService::ShopService()
{
}
-QSharedPointer ShopService::createVoucher()
+VoucherPtr ShopService::createVoucher()
{
QSharedPointer voucher(new Voucher);
voucher->setStatus(Voucher::NEW);
return voucher;
}
-void ShopService::addShopItem(QSharedPointer voucher, QSharedPointer item, int count)
+void ShopService::addShopItem(VoucherPtr voucher, QSharedPointer item, int count)
{
QSharedPointer vItem(new VoucherItem);
vItem->setName(item->name());
@@ -29,7 +29,7 @@ void ShopService::addShopItem(QSharedPointer voucher, QSharedPointer voucher)
+void ShopService::calculate(VoucherPtr voucher)
{
QDecDouble total;
@@ -68,7 +68,7 @@ void ShopService::calculate(QSharedPointer voucher)
voucher->setTotalPrice(total);
}
-void ShopService::calculateItem(QSharedPointer item)
+void ShopService::calculateItem(VoucherItemPtr item)
{
loadSettings();
if (m_gs->vatPayer())
@@ -84,13 +84,13 @@ void ShopService::calculateItem(QSharedPointer item)
}
}
-void ShopService::loadItems(QSharedPointer voucher)
+void ShopService::loadItems(VoucherPtr voucher)
{
Service srv;
voucher->setItems(srv.all(QString("voucher = %1").arg(voucher->id())));
}
-void ShopService::pay(QSharedPointer voucher)
+void ShopService::pay(VoucherPtr voucher)
{
Transaction tx;
NumberSeriesService srvNs;
@@ -119,23 +119,49 @@ void ShopService::updateRelatedItem(VoucherItem* item, int countAdded)
selSrv->addedToVoucher(item->refId(), countAdded);
}
}
+void ShopService::moveItems(QList items, VoucherPtr source, VoucherPtr target)
+{
+ Transaction tx;
+
+ if (target->status() == Voucher::NEW && target->id() == 0)
+ {
+ this->saveVoucher(target);
+ }
+
+ odb::database *db = Context::instance().db();
+
+ foreach (VoucherItemPtr item, items) {
+ QString sql = QString("update VoucherItem set voucher = %1 where id = %2").arg(QString::number(target->id()), QString::number(item->id()));
+ db->execute(sql.toStdString());
+ }
+
+ loadItems(source);
+ loadItems(target);
+
+ if (source->items().isEmpty())
+ {
+ erase(source);
+ }
+
+ tx.commit();
+}
-QList > ShopService::savedVouchers()
+QList ShopService::savedVouchers()
{
return all(QString("status = %1").arg(QString::number(Voucher::NOT_PAID)));
}
-QList > ShopService::tempVouchers()
+QList ShopService::tempVouchers()
{
return all(QString("status = %1").arg(QString::number(Voucher::TEMPORARY)));
}
-QList > ShopService::paiedVouchers()
+QList ShopService::paiedVouchers()
{
return all(QString("status = %1").arg(QString::number(Voucher::PAID)));
}
-QList > ShopService::allSellableItems()
+QList ShopService::allSellableItems()
{
QList > items;
foreach (IPlugin *plugin, Context::instance().plugins()) {
@@ -190,7 +216,7 @@ QDecDouble ShopService::vatRate(Enums::VatType vatType)
return vatRate;
}
-void ShopService::saveVoucher(QSharedPointer entity)
+void ShopService::saveVoucher(VoucherPtr entity)
{
Transaction tr;
odb::database *db = Context::instance().db();
@@ -205,7 +231,7 @@ void ShopService::saveVoucher(QSharedPointer entity)
tr.commit();
}
-void ShopService::updateVoucher(QSharedPointer entity)
+void ShopService::updateVoucher(VoucherPtr entity)
{
Transaction tr;
odb::database *db = Context::instance().db();
diff --git a/shop/shopservice.h b/shop/shopservice.h
index f941ca3..e4b5bf6 100644
--- a/shop/shopservice.h
+++ b/shop/shopservice.h
@@ -13,17 +13,18 @@ class ShopService : public Service
{
public:
ShopService();
- QSharedPointer createVoucher();
- void addShopItem(QSharedPointer voucher, QSharedPointer item, int count);
- void calculate(QSharedPointer voucher);
- void calculateItem(QSharedPointer item);
- void loadItems(QSharedPointer voucher);
- void pay(QSharedPointer voucher);
+ VoucherPtr createVoucher();
+ void addShopItem(VoucherPtr voucher, QSharedPointer item, int count);
+ void calculate(VoucherPtr voucher);
+ void calculateItem(VoucherItemPtr item);
+ void loadItems(VoucherPtr voucher);
+ void pay(VoucherPtr voucher);
+ void moveItems(QList items, VoucherPtr source, VoucherPtr target);
void updateRelatedItem(VoucherItem* item, int countAdded);
- QList > savedVouchers();
- QList > tempVouchers();
- QList > paiedVouchers();
- QList > allSellableItems();
+ QList savedVouchers();
+ QList tempVouchers();
+ QList paiedVouchers();
+ QList allSellableItems();
private:
QDecDouble includeVat(QDecDouble price, Enums::VatType vatType);
@@ -33,8 +34,8 @@ private:
QDecDouble vatRate(Enums::VatType vatType);
public:
- void saveVoucher(QSharedPointer entity);
- void updateVoucher(QSharedPointer entity);
+ void saveVoucher(VoucherPtr entity);
+ void updateVoucher(VoucherPtr entity);
};
#endif // SHOPSERVICE_H
diff --git a/shop/translations/shop_cs_CZ.ts b/shop/translations/shop_cs_CZ.ts
new file mode 100644
index 0000000..c92efdf
--- /dev/null
+++ b/shop/translations/shop_cs_CZ.ts
@@ -0,0 +1,319 @@
+
+
+
+
+ DirectSaleForm
+
+
+
+ Zboží
+
+
+
+
+ Název
+
+
+
+
+ Cena
+
+
+
+
+ Počet
+
+
+
+
+ Sazba DPH
+
+
+
+
+ Žádná
+
+
+
+
+ Vysoká
+
+
+
+
+ První snížená
+
+
+
+
+ Druhá snížená
+
+
+
+ PayDialog
+
+
+
+
+
+
+
+
+ Celkem:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ PaydVouchersDialog
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Položky
+
+
+
+
+ Celkem:
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ReceiptLoadForm
+
+
+
+
+
+
+
+
+ Účtenky
+
+
+
+
+ Hledat
+
+
+
+
+ Položky
+
+
+
+ ReceiptSaveForm
+
+
+
+ Přidat k již uložené
+
+
+
+
+ Hledat
+
+
+
+ Uložit novou
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Název
+
+
+
+
+ Popis
+
+
+
+
+ Vyhledat kontakt
+
+
+
+ ShopForm
+
+
+
+
+
+
+
+
+ Zboží
+
+
+
+
+ Počet
+
+
+
+
+ Přidat položku
+
+
+
+
+ Přímý prodej
+
+
+
+
+
+
+
+
+
+ Účtenka
+
+
+
+
+ Celkem:
+
+
+
+
+
+
+
+
+
+ Dočasné uložení
+
+
+
+
+ Uložení
+
+
+
+
+ Načíst
+
+
+
+
+
+
+
+
+
+ Zaplatit
+
+
+
+
+
+
+
+
+ ShopSettingsForm
+
+
+
+ Zboží
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ TemporaryReceiptSaveForm
+
+
+
+ Dočasné uložení
+
+
+
+
+ Název dočasně uložené účtenky
+
+
+