Merge branch 'master' of https://git.bukova.info/repos/git/prodejna
This commit is contained in:
@@ -0,0 +1,62 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE TS>
|
||||
<TS version="2.1" language="cs_CZ">
|
||||
<context>
|
||||
<name>AddressbookForm</name>
|
||||
<message>
|
||||
<location filename="../addressbookform.ui" line="14"/>
|
||||
<source>Form</source>
|
||||
<translation></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../addressbookform.ui" line="20"/>
|
||||
<source>Title</source>
|
||||
<translation>Titul</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../addressbookform.ui" line="30"/>
|
||||
<source>First Name</source>
|
||||
<translation>Křestní jméno</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../addressbookform.ui" line="62"/>
|
||||
<source>Last Name</source>
|
||||
<translation>Příjmení</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../addressbookform.ui" line="69"/>
|
||||
<source>Day of Birth</source>
|
||||
<translation>Datum narození</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../addressbookform.ui" line="76"/>
|
||||
<source>ID Card Number</source>
|
||||
<translation>Číslo dokladu totožnosti</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../addressbookform.ui" line="83"/>
|
||||
<source>City</source>
|
||||
<translation>Město</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../addressbookform.ui" line="90"/>
|
||||
<source>ZTP</source>
|
||||
<translation>ZTP</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../addressbookform.ui" line="97"/>
|
||||
<source>Street</source>
|
||||
<translation>Ulice</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../addressbookform.ui" line="107"/>
|
||||
<source>House Number</source>
|
||||
<translation>Číslo popisné</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../addressbookform.ui" line="114"/>
|
||||
<source>ZIP</source>
|
||||
<translation>PSČ</translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
||||
Binary file not shown.
@@ -20,7 +20,7 @@
|
||||
<message>
|
||||
<location filename="../mainwindow.ui" line="14"/>
|
||||
<source>MainWindow</source>
|
||||
<translation>Nastaveni</translation>
|
||||
<translation type="unfinished">Prodejna</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mainwindow.ui" line="64"/>
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE TS>
|
||||
<TS version="2.1" language="cs_CZ">
|
||||
<context>
|
||||
<name>CommodityForm</name>
|
||||
<message>
|
||||
<location filename="../commodityform.ui" line="14"/>
|
||||
<source>Form</source>
|
||||
<translation>Zboží</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../commodityform.ui" line="20"/>
|
||||
<source>Name</source>
|
||||
<translation>Název</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../commodityform.ui" line="30"/>
|
||||
<source>Short Name</source>
|
||||
<translation>Zobrazit na účtence</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../commodityform.ui" line="40"/>
|
||||
<source>Code</source>
|
||||
<translation>Kód</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../commodityform.ui" line="50"/>
|
||||
<source>Type</source>
|
||||
<translation>Druh</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../commodityform.ui" line="57"/>
|
||||
<source>Price</source>
|
||||
<translation>Cena</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../commodityform.ui" line="64"/>
|
||||
<source>Vat</source>
|
||||
<translation>DPH</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../commodityform.ui" line="71"/>
|
||||
<source>Count</source>
|
||||
<translation>Počet</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../commodityform.cpp" line="18"/>
|
||||
<source>None</source>
|
||||
<translation>Žádná</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../commodityform.cpp" line="19"/>
|
||||
<source>High</source>
|
||||
<translation>Vysoká</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../commodityform.cpp" line="20"/>
|
||||
<source>First Lower</source>
|
||||
<translation>První snížená</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../commodityform.cpp" line="21"/>
|
||||
<source>Second Lower</source>
|
||||
<translation>Druhá snížená</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>CommoditySettingsForm</name>
|
||||
<message>
|
||||
<location filename="../commoditysettingsform.ui" line="14"/>
|
||||
<source>Form</source>
|
||||
<translation></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../commoditysettingsform.ui" line="26"/>
|
||||
<source>+</source>
|
||||
<translation>+</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../commoditysettingsform.ui" line="37"/>
|
||||
<source>-</source>
|
||||
<translation>-</translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
||||
+44
-2
@@ -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<T> entity = m_list.at(index.row());
|
||||
QObject *rawEntity = (QObject*)entity.data();
|
||||
|
||||
@@ -189,6 +205,21 @@ public:
|
||||
m_translations = translations;
|
||||
}
|
||||
|
||||
QList<int> selectedRows() const
|
||||
{
|
||||
return m_selectedRows;
|
||||
}
|
||||
|
||||
QList<QSharedPointer<T> > selectedItems()
|
||||
{
|
||||
QList<QSharedPointer<T> > 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<QSharedPointer<T> > m_list;
|
||||
QList<QSharedPointer<T> > m_fullList;
|
||||
QList<int> m_selectedRows;
|
||||
QMap<QString, QString> 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
|
||||
|
||||
|
||||
@@ -65,6 +65,10 @@ void Context::loadPlugins()
|
||||
m_plugins.append(plugin);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
qDebug() << pluginLoader.errorString();
|
||||
}
|
||||
}
|
||||
|
||||
QString dbPath = m_settings->value("db/path", "").toString();
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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<int> cols);
|
||||
|
||||
bool checkboxSelect() const;
|
||||
void setCheckboxSelect(bool checkboxSelect);
|
||||
|
||||
private:
|
||||
QList<int> m_editableCols;
|
||||
};
|
||||
|
||||
@@ -126,86 +126,132 @@
|
||||
<translation></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/globalsettingsform.ui" line="20"/>
|
||||
<location filename="../settings/globalsettingsform.ui" line="33"/>
|
||||
<source>Base settings</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/globalsettingsform.ui" line="121"/>
|
||||
<source>Company info</source>
|
||||
<translation>Informace o společnosti</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/globalsettingsform.ui" line="29"/>
|
||||
<location filename="../settings/globalsettingsform.ui" line="130"/>
|
||||
<source>IC</source>
|
||||
<translation>IČO</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/globalsettingsform.ui" line="39"/>
|
||||
<location filename="../settings/globalsettingsform.ui" line="140"/>
|
||||
<source>VAT number</source>
|
||||
<translation>DIČ</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/globalsettingsform.ui" line="49"/>
|
||||
<location filename="../settings/globalsettingsform.ui" line="150"/>
|
||||
<source>VAT payer</source>
|
||||
<translation>Plátce DPH</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/globalsettingsform.ui" line="62"/>
|
||||
<location filename="../settings/globalsettingsform.ui" line="163"/>
|
||||
<source>VAT rates</source>
|
||||
<translation>Sazby DPH</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/globalsettingsform.ui" line="68"/>
|
||||
<location filename="../settings/globalsettingsform.ui" line="169"/>
|
||||
<source>High</source>
|
||||
<translation>Vysoká</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/globalsettingsform.ui" line="82"/>
|
||||
<location filename="../settings/globalsettingsform.ui" line="183"/>
|
||||
<source>First lower</source>
|
||||
<translation>První snížená</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/globalsettingsform.ui" line="96"/>
|
||||
<location filename="../settings/globalsettingsform.ui" line="197"/>
|
||||
<source>Second lower</source>
|
||||
<translation>Druhá snížená</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/globalsettingsform.ui" line="116"/>
|
||||
<location filename="../settings/globalsettingsform.ui" line="218"/>
|
||||
<location filename="../settings/globalsettingsform.ui" line="279"/>
|
||||
<source>Number series</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/globalsettingsform.ui" line="247"/>
|
||||
<source>Edit name</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/globalsettingsform.ui" line="258"/>
|
||||
<source>Season</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/globalsettingsform.ui" line="265"/>
|
||||
<source>Create new</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/globalsettingsform.ui" line="39"/>
|
||||
<source>Contact</source>
|
||||
<translation>Kontaktní údaje</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/globalsettingsform.ui" line="122"/>
|
||||
<location filename="../settings/globalsettingsform.ui" line="45"/>
|
||||
<source>Firm Name</source>
|
||||
<translation>Název společnosti</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/globalsettingsform.ui" line="132"/>
|
||||
<location filename="../settings/globalsettingsform.ui" line="55"/>
|
||||
<source>Street</source>
|
||||
<translation>Ulice</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/globalsettingsform.ui" line="142"/>
|
||||
<location filename="../settings/globalsettingsform.ui" line="65"/>
|
||||
<source>House Number</source>
|
||||
<translation>Číslo popisné</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/globalsettingsform.ui" line="152"/>
|
||||
<location filename="../settings/globalsettingsform.ui" line="75"/>
|
||||
<source>City</source>
|
||||
<translation>Město</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/globalsettingsform.ui" line="162"/>
|
||||
<location filename="../settings/globalsettingsform.ui" line="85"/>
|
||||
<source>ZIP code</source>
|
||||
<translation>PSČ</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/globalsettingsform.ui" line="175"/>
|
||||
<location filename="../settings/globalsettingsform.ui" line="181"/>
|
||||
<location filename="../settings/globalsettingsform.ui" line="98"/>
|
||||
<location filename="../settings/globalsettingsform.ui" line="104"/>
|
||||
<source>Logo</source>
|
||||
<translation>Logo</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/globalsettingsform.ui" line="188"/>
|
||||
<location filename="../settings/globalsettingsform.ui" line="111"/>
|
||||
<source>Select file</source>
|
||||
<translation>Vyber soubor</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/globalsettingsform.cpp" line="77"/>
|
||||
<source>Switch season</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/globalsettingsform.cpp" line="77"/>
|
||||
<source>Realy switch active season?</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/globalsettingsform.cpp" line="138"/>
|
||||
<source>New season</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/globalsettingsform.cpp" line="138"/>
|
||||
<source>Realy create new season and switch to it?</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>GridForm</name>
|
||||
@@ -314,6 +360,19 @@
|
||||
<translation>Název filtru</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>SeasonNameDialog</name>
|
||||
<message>
|
||||
<location filename="../settings/seasonnamedialog.ui" line="14"/>
|
||||
<source>Season</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/seasonnamedialog.ui" line="23"/>
|
||||
<source>Season name</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>SettingsForm</name>
|
||||
<message>
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -0,0 +1,82 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE TS>
|
||||
<TS version="2.1" language="cs_CZ">
|
||||
<context>
|
||||
<name>AccServiceForm</name>
|
||||
<message>
|
||||
<location filename="../accserviceform.ui" line="14"/>
|
||||
<source>Form</source>
|
||||
<translation>Služba</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../accserviceform.ui" line="20"/>
|
||||
<source>Service Name</source>
|
||||
<translation>Název</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../accserviceform.ui" line="30"/>
|
||||
<source>Price</source>
|
||||
<translation>Cena</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../accserviceform.ui" line="37"/>
|
||||
<source>Service Type</source>
|
||||
<translation>Druh</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../accserviceform.ui" line="47"/>
|
||||
<source>Sale Possible</source>
|
||||
<translation>Umožnit slevu</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../accserviceform.ui" line="54"/>
|
||||
<source>Active</source>
|
||||
<translation>Aktivní</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../accserviceform.ui" line="64"/>
|
||||
<source>ServiceCode</source>
|
||||
<translation>Kód</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../accserviceform.ui" line="74"/>
|
||||
<source>Vat Type</source>
|
||||
<translation>Sazba DPH</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../accserviceform.cpp" line="18"/>
|
||||
<source>Car</source>
|
||||
<translation>Vozidlo</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../accserviceform.cpp" line="18"/>
|
||||
<source>Tent</source>
|
||||
<translation>Stan</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../accserviceform.cpp" line="18"/>
|
||||
<source>OTHER</source>
|
||||
<translation>Ostatní</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../accserviceform.cpp" line="21"/>
|
||||
<source>None</source>
|
||||
<translation>Žádná</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../accserviceform.cpp" line="22"/>
|
||||
<source>High</source>
|
||||
<translation>Vysoká</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../accserviceform.cpp" line="23"/>
|
||||
<source>First Lower</source>
|
||||
<translation>První snížená</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../accserviceform.cpp" line="24"/>
|
||||
<source>Second Lower</source>
|
||||
<translation>Druhá snížená</translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
||||
@@ -28,6 +28,7 @@ ReceiptLoadForm::ReceiptLoadForm(QWidget *parent) :
|
||||
ui->tabVouchers->setColumnWidth(2, 200);
|
||||
|
||||
m_itemModel = new AutoTableModel<VoucherItem>(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<VoucherItemPtr> 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;
|
||||
|
||||
@@ -16,6 +16,8 @@ class ReceiptLoadForm : public QDialog
|
||||
public:
|
||||
explicit ReceiptLoadForm(QWidget *parent = 0);
|
||||
~ReceiptLoadForm();
|
||||
QList<VoucherItemPtr> selectedItems();
|
||||
VoucherPtr selectedVoucher();
|
||||
|
||||
private slots:
|
||||
void on_lineEdit_textChanged(const QString &text);
|
||||
|
||||
@@ -57,6 +57,7 @@ CREATE TABLE \"Voucher\" (
|
||||
"translations" : {
|
||||
"CZ" : {
|
||||
"name" : "Název",
|
||||
"code" : "Kod",
|
||||
"count" : "Počet",
|
||||
"unitPrice" : "Jednotková cena",
|
||||
"vatRate" : "Procento DPH",
|
||||
|
||||
+22
-2
@@ -62,6 +62,7 @@ void ShopForm::loadLast()
|
||||
if (m_commodityModel == NULL)
|
||||
{
|
||||
m_commodityModel = new AutoTableModel<ShopItem>(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<VoucherItem*>(sender());
|
||||
if (item != NULL && item->count() == 0)
|
||||
@@ -253,7 +273,7 @@ void ShopForm::addItem(QSharedPointer<IShopItem> 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)
|
||||
|
||||
+1
-1
@@ -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);
|
||||
|
||||
|
||||
+38
-12
@@ -7,14 +7,14 @@ ShopService::ShopService()
|
||||
{
|
||||
}
|
||||
|
||||
QSharedPointer<Voucher> ShopService::createVoucher()
|
||||
VoucherPtr ShopService::createVoucher()
|
||||
{
|
||||
QSharedPointer<Voucher> voucher(new Voucher);
|
||||
voucher->setStatus(Voucher::NEW);
|
||||
return voucher;
|
||||
}
|
||||
|
||||
void ShopService::addShopItem(QSharedPointer<Voucher> voucher, QSharedPointer<IShopItem> item, int count)
|
||||
void ShopService::addShopItem(VoucherPtr voucher, QSharedPointer<IShopItem> item, int count)
|
||||
{
|
||||
QSharedPointer<VoucherItem> vItem(new VoucherItem);
|
||||
vItem->setName(item->name());
|
||||
@@ -29,7 +29,7 @@ void ShopService::addShopItem(QSharedPointer<Voucher> voucher, QSharedPointer<IS
|
||||
updateRelatedItem(vItem.data(), count);
|
||||
}
|
||||
|
||||
void ShopService::calculate(QSharedPointer<Voucher> voucher)
|
||||
void ShopService::calculate(VoucherPtr voucher)
|
||||
{
|
||||
QDecDouble total;
|
||||
|
||||
@@ -68,7 +68,7 @@ void ShopService::calculate(QSharedPointer<Voucher> voucher)
|
||||
voucher->setTotalPrice(total);
|
||||
}
|
||||
|
||||
void ShopService::calculateItem(QSharedPointer<VoucherItem> item)
|
||||
void ShopService::calculateItem(VoucherItemPtr item)
|
||||
{
|
||||
loadSettings();
|
||||
if (m_gs->vatPayer())
|
||||
@@ -84,13 +84,13 @@ void ShopService::calculateItem(QSharedPointer<VoucherItem> item)
|
||||
}
|
||||
}
|
||||
|
||||
void ShopService::loadItems(QSharedPointer<Voucher> voucher)
|
||||
void ShopService::loadItems(VoucherPtr voucher)
|
||||
{
|
||||
Service<VoucherItem> srv;
|
||||
voucher->setItems(srv.all(QString("voucher = %1").arg(voucher->id())));
|
||||
}
|
||||
|
||||
void ShopService::pay(QSharedPointer<Voucher> 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<VoucherItemPtr> items, VoucherPtr source, VoucherPtr target)
|
||||
{
|
||||
Transaction tx;
|
||||
|
||||
QList<QSharedPointer<Voucher> > ShopService::savedVouchers()
|
||||
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<VoucherPtr> ShopService::savedVouchers()
|
||||
{
|
||||
return all(QString("status = %1").arg(QString::number(Voucher::NOT_PAID)));
|
||||
}
|
||||
|
||||
QList<QSharedPointer<Voucher> > ShopService::tempVouchers()
|
||||
QList<VoucherPtr> ShopService::tempVouchers()
|
||||
{
|
||||
return all(QString("status = %1").arg(QString::number(Voucher::TEMPORARY)));
|
||||
}
|
||||
|
||||
QList<QSharedPointer<Voucher> > ShopService::paiedVouchers()
|
||||
QList<VoucherPtr> ShopService::paiedVouchers()
|
||||
{
|
||||
return all(QString("status = %1").arg(QString::number(Voucher::PAID)));
|
||||
}
|
||||
|
||||
QList<QSharedPointer<ShopItem> > ShopService::allSellableItems()
|
||||
QList<ShopItemPtr> ShopService::allSellableItems()
|
||||
{
|
||||
QList<QSharedPointer<ShopItem> > items;
|
||||
foreach (IPlugin *plugin, Context::instance().plugins()) {
|
||||
@@ -190,7 +216,7 @@ QDecDouble ShopService::vatRate(Enums::VatType vatType)
|
||||
return vatRate;
|
||||
}
|
||||
|
||||
void ShopService::saveVoucher(QSharedPointer<Voucher> entity)
|
||||
void ShopService::saveVoucher(VoucherPtr entity)
|
||||
{
|
||||
Transaction tr;
|
||||
odb::database *db = Context::instance().db();
|
||||
@@ -205,7 +231,7 @@ void ShopService::saveVoucher(QSharedPointer<Voucher> entity)
|
||||
tr.commit();
|
||||
}
|
||||
|
||||
void ShopService::updateVoucher(QSharedPointer<Voucher> entity)
|
||||
void ShopService::updateVoucher(VoucherPtr entity)
|
||||
{
|
||||
Transaction tr;
|
||||
odb::database *db = Context::instance().db();
|
||||
|
||||
+13
-12
@@ -13,17 +13,18 @@ class ShopService : public Service<Voucher>
|
||||
{
|
||||
public:
|
||||
ShopService();
|
||||
QSharedPointer<Voucher> createVoucher();
|
||||
void addShopItem(QSharedPointer<Voucher> voucher, QSharedPointer<IShopItem> item, int count);
|
||||
void calculate(QSharedPointer<Voucher> voucher);
|
||||
void calculateItem(QSharedPointer<VoucherItem> item);
|
||||
void loadItems(QSharedPointer<Voucher> voucher);
|
||||
void pay(QSharedPointer<Voucher> voucher);
|
||||
VoucherPtr createVoucher();
|
||||
void addShopItem(VoucherPtr voucher, QSharedPointer<IShopItem> item, int count);
|
||||
void calculate(VoucherPtr voucher);
|
||||
void calculateItem(VoucherItemPtr item);
|
||||
void loadItems(VoucherPtr voucher);
|
||||
void pay(VoucherPtr voucher);
|
||||
void moveItems(QList<VoucherItemPtr> items, VoucherPtr source, VoucherPtr target);
|
||||
void updateRelatedItem(VoucherItem* item, int countAdded);
|
||||
QList<QSharedPointer<Voucher> > savedVouchers();
|
||||
QList<QSharedPointer<Voucher> > tempVouchers();
|
||||
QList<QSharedPointer<Voucher> > paiedVouchers();
|
||||
QList<QSharedPointer<ShopItem> > allSellableItems();
|
||||
QList<VoucherPtr> savedVouchers();
|
||||
QList<VoucherPtr> tempVouchers();
|
||||
QList<VoucherPtr> paiedVouchers();
|
||||
QList<ShopItemPtr> allSellableItems();
|
||||
|
||||
private:
|
||||
QDecDouble includeVat(QDecDouble price, Enums::VatType vatType);
|
||||
@@ -33,8 +34,8 @@ private:
|
||||
QDecDouble vatRate(Enums::VatType vatType);
|
||||
|
||||
public:
|
||||
void saveVoucher(QSharedPointer<Voucher> entity);
|
||||
void updateVoucher(QSharedPointer<Voucher> entity);
|
||||
void saveVoucher(VoucherPtr entity);
|
||||
void updateVoucher(VoucherPtr entity);
|
||||
};
|
||||
|
||||
#endif // SHOPSERVICE_H
|
||||
|
||||
@@ -0,0 +1,319 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE TS>
|
||||
<TS version="2.1" language="cs_CZ">
|
||||
<context>
|
||||
<name>DirectSaleForm</name>
|
||||
<message>
|
||||
<location filename="../directsaleform.ui" line="14"/>
|
||||
<source>Form</source>
|
||||
<translation>Zboží</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../directsaleform.ui" line="20"/>
|
||||
<source>Commodity Name</source>
|
||||
<translation>Název</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../directsaleform.ui" line="30"/>
|
||||
<source>Price</source>
|
||||
<translation>Cena</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../directsaleform.ui" line="44"/>
|
||||
<source>Count</source>
|
||||
<translation>Počet</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../directsaleform.ui" line="58"/>
|
||||
<source>VAT rate</source>
|
||||
<translation>Sazba DPH</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../directsaleform.cpp" line="17"/>
|
||||
<source>None</source>
|
||||
<translation>Žádná</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../directsaleform.cpp" line="18"/>
|
||||
<source>High</source>
|
||||
<translation>Vysoká</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../directsaleform.cpp" line="19"/>
|
||||
<source>First Lower</source>
|
||||
<translation>První snížená</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../directsaleform.cpp" line="20"/>
|
||||
<source>Second Lower</source>
|
||||
<translation>Druhá snížená</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>PayDialog</name>
|
||||
<message>
|
||||
<location filename="../paydialog.ui" line="14"/>
|
||||
<source>Recieve money</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../paydialog.ui" line="30"/>
|
||||
<source>Total:</source>
|
||||
<translation type="unfinished">Celkem:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../paydialog.ui" line="44"/>
|
||||
<location filename="../paydialog.ui" line="101"/>
|
||||
<source>0</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../paydialog.ui" line="59"/>
|
||||
<source>Recieved</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../paydialog.ui" line="89"/>
|
||||
<source>Return</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>PaydVouchersDialog</name>
|
||||
<message>
|
||||
<location filename="../paydvouchersdialog.ui" line="14"/>
|
||||
<source>Paied vouchers</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../paydvouchersdialog.ui" line="29"/>
|
||||
<source>Print receipt</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../paydvouchersdialog.ui" line="55"/>
|
||||
<location filename="../paydvouchersdialog.cpp" line="51"/>
|
||||
<source>Save receipt</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../paydvouchersdialog.ui" line="58"/>
|
||||
<source>...</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../paydvouchersdialog.ui" line="104"/>
|
||||
<source>Items</source>
|
||||
<translation type="unfinished">Položky</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../paydvouchersdialog.ui" line="137"/>
|
||||
<source>Total:</source>
|
||||
<translation type="unfinished">Celkem:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../paydvouchersdialog.ui" line="157"/>
|
||||
<source>0</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../paydvouchersdialog.cpp" line="51"/>
|
||||
<source>Text files (*.txt)</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>ReceiptLoadForm</name>
|
||||
<message>
|
||||
<location filename="../receiptloadform.ui" line="14"/>
|
||||
<source>Dialog</source>
|
||||
<translation></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../receiptloadform.ui" line="20"/>
|
||||
<source>Receipts</source>
|
||||
<translation>Účtenky</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../receiptloadform.ui" line="29"/>
|
||||
<source>Search</source>
|
||||
<translation>Hledat</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../receiptloadform.ui" line="42"/>
|
||||
<source>Items</source>
|
||||
<translation>Položky</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>ReceiptSaveForm</name>
|
||||
<message>
|
||||
<location filename="../receiptsaveform.ui" line="33"/>
|
||||
<source>Existing Receipts</source>
|
||||
<translation>Přidat k již uložené</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../receiptsaveform.ui" line="39"/>
|
||||
<source>Search</source>
|
||||
<translation>Hledat</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>GroupBox</source>
|
||||
<translation type="vanished">Uložit novou</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../receiptsaveform.ui" line="14"/>
|
||||
<source>Save receipt</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../receiptsaveform.ui" line="23"/>
|
||||
<source>Add to existing</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../receiptsaveform.ui" line="62"/>
|
||||
<source>Save as new</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../receiptsaveform.ui" line="69"/>
|
||||
<source>New receipt</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../receiptsaveform.ui" line="78"/>
|
||||
<source>Name</source>
|
||||
<translation>Název</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../receiptsaveform.ui" line="88"/>
|
||||
<source>Description</source>
|
||||
<translation>Popis</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../receiptsaveform.ui" line="98"/>
|
||||
<source>Search Contacts</source>
|
||||
<translation>Vyhledat kontakt</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>ShopForm</name>
|
||||
<message>
|
||||
<location filename="../shopform.ui" line="14"/>
|
||||
<source>Form</source>
|
||||
<translation></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../shopform.ui" line="50"/>
|
||||
<source>Commodity</source>
|
||||
<translation>Zboží</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../shopform.ui" line="73"/>
|
||||
<source>Count</source>
|
||||
<translation>Počet</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../shopform.ui" line="99"/>
|
||||
<source>Add Item</source>
|
||||
<translation>Přidat položku</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../shopform.ui" line="135"/>
|
||||
<source>Direct Sale</source>
|
||||
<translation>Přímý prodej</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../shopform.ui" line="148"/>
|
||||
<source>Ctrl+D</source>
|
||||
<translation></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../shopform.ui" line="221"/>
|
||||
<source>Receipt</source>
|
||||
<translation>Účtenka</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../shopform.ui" line="257"/>
|
||||
<source>Total:</source>
|
||||
<translation>Celkem:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../shopform.ui" line="274"/>
|
||||
<source>0</source>
|
||||
<translation></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../shopform.ui" line="295"/>
|
||||
<source>Temporary Save</source>
|
||||
<translation>Dočasné uložení</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../shopform.ui" line="317"/>
|
||||
<source>Save</source>
|
||||
<translation>Uložení</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../shopform.ui" line="339"/>
|
||||
<source>Load</source>
|
||||
<translation>Načíst</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../shopform.ui" line="361"/>
|
||||
<source>Show paied</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../shopform.ui" line="383"/>
|
||||
<source>Pay</source>
|
||||
<translation>Zaplatit</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../shopform.cpp" line="84"/>
|
||||
<source><< empty >></source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>ShopSettingsForm</name>
|
||||
<message>
|
||||
<location filename="../settings/shopsettingsform.ui" line="14"/>
|
||||
<source>Form</source>
|
||||
<translation type="unfinished">Zboží</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/shopsettingsform.ui" line="20"/>
|
||||
<source>Printer</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/shopsettingsform.ui" line="26"/>
|
||||
<source>Output device</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/shopsettingsform.ui" line="36"/>
|
||||
<source>Letters per line</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/shopsettingsform.ui" line="46"/>
|
||||
<source>Footer text</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>TemporaryReceiptSaveForm</name>
|
||||
<message>
|
||||
<location filename="../temporaryreceiptsaveform.ui" line="14"/>
|
||||
<source>Dialog</source>
|
||||
<translation>Dočasné uložení</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../temporaryreceiptsaveform.ui" line="20"/>
|
||||
<source>Temporary Receipt Name</source>
|
||||
<translation>Název dočasně uložené účtenky</translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
||||
Reference in New Issue
Block a user