If macro EET is not defined EET functions will be hidden.
This commit is contained in:
@@ -421,3 +421,13 @@ QDecDouble VoucherSum::totalPrice() const
|
||||
int VoucherSum::count() const {
|
||||
return m_count;
|
||||
}
|
||||
|
||||
VoucherSum::VoucherSum(int count, int totalPrice) : m_count(count), m_totalPrice(totalPrice) {}
|
||||
|
||||
void VoucherSum::addPrice(QDecDouble price) {
|
||||
m_totalPrice += FROM_DEC(price);
|
||||
}
|
||||
|
||||
void VoucherSum::addCount(int count) {
|
||||
m_count += count;
|
||||
}
|
||||
|
||||
@@ -210,9 +210,13 @@ class VoucherSum
|
||||
QX_REGISTER_FRIEND_CLASS(VoucherSum)
|
||||
public:
|
||||
VoucherSum() = default;
|
||||
VoucherSum(int count, int totalPrice);
|
||||
|
||||
QDecDouble totalPrice() const;
|
||||
int count() const;
|
||||
|
||||
void addPrice(QDecDouble price);
|
||||
void addCount(int count);
|
||||
|
||||
private:
|
||||
int m_count{0};
|
||||
|
||||
@@ -47,12 +47,20 @@ PaydVouchersDialog::PaydVouchersDialog(QWidget *parent) :
|
||||
ui->tableItems->setColumnHidden(0, true);
|
||||
ui->tableItems->verticalScrollBar()->setStyleSheet("QScrollBar:vertical { width: 30px; }");
|
||||
|
||||
#ifndef EET
|
||||
ui->btnEetNotSen->setVisible(false);
|
||||
ui->btnSendEet->setVisible(false);
|
||||
ui->label_2->setVisible(false);
|
||||
ui->lblEetStatus->setVisible(false);
|
||||
#endif
|
||||
|
||||
ShopService srv;
|
||||
m_voucherModel->setData(srv.paiedVouchers());
|
||||
ui->tableVouchers->sortByColumn(0,Qt::AscendingOrder);
|
||||
ui->tableVouchers->verticalScrollBar()->setStyleSheet("QScrollBar:vertical { width: 30px; }");
|
||||
|
||||
connect(ui->tableVouchers->selectionModel(), &QItemSelectionModel::currentRowChanged, [this, &srv](const QModelIndex ¤t, const QModelIndex &) {
|
||||
connect(ui->tableVouchers->selectionModel(), &QItemSelectionModel::currentRowChanged, [this](const QModelIndex ¤t, const QModelIndex &) {
|
||||
ShopService srv;
|
||||
QSharedPointer<Voucher> voucher = m_voucherModel->itemFromIndex(current);
|
||||
if (voucher->items().isEmpty()) {
|
||||
srv.load(voucher);
|
||||
|
||||
@@ -16,6 +16,7 @@ ShopSettingsForm::ShopSettingsForm(QWidget *parent) :
|
||||
registerBinding(ui->lettersPerLine);
|
||||
registerBinding(ui->byMessage);
|
||||
|
||||
#ifdef EET
|
||||
registerBinding(ui->eetActive);
|
||||
registerBinding(ui->eetShopId);
|
||||
registerBinding(ui->eetRegisterId);
|
||||
@@ -26,6 +27,9 @@ ShopSettingsForm::ShopSettingsForm(QWidget *parent) :
|
||||
registerBinding(ui->eetKeyPassword);
|
||||
registerBinding(ui->eetTest);
|
||||
registerBinding(ui->eetPlayground);
|
||||
#else
|
||||
ui->tabWidget->removeTab(2);
|
||||
#endif
|
||||
|
||||
registerBinding(ui->favBtnCols);
|
||||
registerBinding(ui->favBtnRows);
|
||||
|
||||
+13
-1
@@ -7,6 +7,11 @@ ShopOverview::ShopOverview(QWidget *parent) :
|
||||
ui(new Ui::ShopOverview)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
#ifndef EET
|
||||
ui->labelUnsendEET->setVisible(false);
|
||||
ui->label_6->setVisible(false);
|
||||
#endif
|
||||
}
|
||||
|
||||
ShopOverview::~ShopOverview()
|
||||
@@ -19,9 +24,16 @@ void ShopOverview::refresh()
|
||||
ShopService srv;
|
||||
|
||||
VoucherSum unpaid = srv.unpaidSummary();
|
||||
VoucherSum unsend = srv.unsendEET();
|
||||
|
||||
ui->labelUnapiedCount->setText(QString::number(unpaid.count()));
|
||||
ui->labelUnpaiedAmount->setText(QString::number(unpaid.totalPrice().toDouble()));
|
||||
|
||||
VoucherSum today = srv.salesSummary(QDate::currentDate());
|
||||
ui->labelSales->setText(QString::number(today.totalPrice().toDouble()));
|
||||
ui->labelNumSales->setText(QString::number(today.count()));
|
||||
|
||||
#ifdef EET
|
||||
VoucherSum unsend = srv.unsendEET();
|
||||
ui->labelUnsendEET->setText(QString::number(unsend.count()));
|
||||
#endif
|
||||
}
|
||||
|
||||
+47
-3
@@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>908</width>
|
||||
<height>95</height>
|
||||
<height>162</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@@ -83,7 +83,6 @@
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
@@ -102,7 +101,6 @@
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
@@ -114,6 +112,52 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Today sales:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QLabel" name="labelSales">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>90</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>Number of sales today:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QLabel" name="labelNumSales">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>90</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
+16
-3
@@ -437,9 +437,7 @@ QList<IShopItemPtr> ShopService::allSellableItems(const QString& category/* = ""
|
||||
|
||||
VoucherSum ShopService::unpaidSummary()
|
||||
{
|
||||
VoucherSum sum; //= db->query_value<VoucherSum>("status = " + query::_ref((int)Voucher::NOT_PAID));
|
||||
|
||||
return sum;
|
||||
return summary("status = " + QString::number(Voucher::NOT_PAID));
|
||||
}
|
||||
|
||||
VoucherSum ShopService::unsendEET()
|
||||
@@ -551,3 +549,18 @@ void ShopService::update(VoucherPtr entity, qx::QxSession* pSession) {
|
||||
}
|
||||
}
|
||||
|
||||
VoucherSum ShopService::salesSummary(QDate date) {
|
||||
return summary("payDateTime >= '" + date.toString("yyyy-MM-dd") + "'");
|
||||
}
|
||||
|
||||
VoucherSum ShopService::summary(const QString& where) {
|
||||
auto sums = all(where);
|
||||
VoucherSum sum(sums.count(), 0);
|
||||
|
||||
for (const auto& item : sums) {
|
||||
sum.addPrice(item->totalPrice());
|
||||
}
|
||||
|
||||
return sum;
|
||||
}
|
||||
|
||||
|
||||
@@ -44,12 +44,14 @@ public:
|
||||
QList<IShopItemPtr> allSellableItems(const QString& category = "");
|
||||
QMap<QString, QString> allCategories();
|
||||
VoucherSum unpaidSummary();
|
||||
VoucherSum salesSummary(QDate date);
|
||||
VoucherSum unsendEET();
|
||||
|
||||
private:
|
||||
QDecDouble includeVat(QDecDouble price, Enums::VatType vatType);
|
||||
QDecDouble excludeVat(QDecDouble price, Enums::VatType vatType);
|
||||
void loadSettings();
|
||||
VoucherSum summary(const QString& where);
|
||||
|
||||
QSharedPointer<GlobalSettings> m_gs;
|
||||
QDecDouble vatRate(Enums::VatType vatType);
|
||||
|
||||
Reference in New Issue
Block a user