Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 285fc8e80f | |||
| 93eb98c10a |
@@ -421,3 +421,13 @@ QDecDouble VoucherSum::totalPrice() const
|
|||||||
int VoucherSum::count() const {
|
int VoucherSum::count() const {
|
||||||
return m_count;
|
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)
|
QX_REGISTER_FRIEND_CLASS(VoucherSum)
|
||||||
public:
|
public:
|
||||||
VoucherSum() = default;
|
VoucherSum() = default;
|
||||||
|
VoucherSum(int count, int totalPrice);
|
||||||
|
|
||||||
QDecDouble totalPrice() const;
|
QDecDouble totalPrice() const;
|
||||||
int count() const;
|
int count() const;
|
||||||
|
|
||||||
|
void addPrice(QDecDouble price);
|
||||||
|
void addCount(int count);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int m_count{0};
|
int m_count{0};
|
||||||
|
|||||||
@@ -47,12 +47,20 @@ PaydVouchersDialog::PaydVouchersDialog(QWidget *parent) :
|
|||||||
ui->tableItems->setColumnHidden(0, true);
|
ui->tableItems->setColumnHidden(0, true);
|
||||||
ui->tableItems->verticalScrollBar()->setStyleSheet("QScrollBar:vertical { width: 30px; }");
|
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;
|
ShopService srv;
|
||||||
m_voucherModel->setData(srv.paiedVouchers());
|
m_voucherModel->setData(srv.paiedVouchers());
|
||||||
ui->tableVouchers->sortByColumn(0,Qt::AscendingOrder);
|
ui->tableVouchers->sortByColumn(0,Qt::AscendingOrder);
|
||||||
ui->tableVouchers->verticalScrollBar()->setStyleSheet("QScrollBar:vertical { width: 30px; }");
|
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);
|
QSharedPointer<Voucher> voucher = m_voucherModel->itemFromIndex(current);
|
||||||
if (voucher->items().isEmpty()) {
|
if (voucher->items().isEmpty()) {
|
||||||
srv.load(voucher);
|
srv.load(voucher);
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ ShopSettingsForm::ShopSettingsForm(QWidget *parent) :
|
|||||||
registerBinding(ui->lettersPerLine);
|
registerBinding(ui->lettersPerLine);
|
||||||
registerBinding(ui->byMessage);
|
registerBinding(ui->byMessage);
|
||||||
|
|
||||||
|
#ifdef EET
|
||||||
registerBinding(ui->eetActive);
|
registerBinding(ui->eetActive);
|
||||||
registerBinding(ui->eetShopId);
|
registerBinding(ui->eetShopId);
|
||||||
registerBinding(ui->eetRegisterId);
|
registerBinding(ui->eetRegisterId);
|
||||||
@@ -26,6 +27,9 @@ ShopSettingsForm::ShopSettingsForm(QWidget *parent) :
|
|||||||
registerBinding(ui->eetKeyPassword);
|
registerBinding(ui->eetKeyPassword);
|
||||||
registerBinding(ui->eetTest);
|
registerBinding(ui->eetTest);
|
||||||
registerBinding(ui->eetPlayground);
|
registerBinding(ui->eetPlayground);
|
||||||
|
#else
|
||||||
|
ui->tabWidget->removeTab(2);
|
||||||
|
#endif
|
||||||
|
|
||||||
registerBinding(ui->favBtnCols);
|
registerBinding(ui->favBtnCols);
|
||||||
registerBinding(ui->favBtnRows);
|
registerBinding(ui->favBtnRows);
|
||||||
|
|||||||
+13
-1
@@ -7,6 +7,11 @@ ShopOverview::ShopOverview(QWidget *parent) :
|
|||||||
ui(new Ui::ShopOverview)
|
ui(new Ui::ShopOverview)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
|
#ifndef EET
|
||||||
|
ui->labelUnsendEET->setVisible(false);
|
||||||
|
ui->label_6->setVisible(false);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
ShopOverview::~ShopOverview()
|
ShopOverview::~ShopOverview()
|
||||||
@@ -19,9 +24,16 @@ void ShopOverview::refresh()
|
|||||||
ShopService srv;
|
ShopService srv;
|
||||||
|
|
||||||
VoucherSum unpaid = srv.unpaidSummary();
|
VoucherSum unpaid = srv.unpaidSummary();
|
||||||
VoucherSum unsend = srv.unsendEET();
|
|
||||||
|
|
||||||
ui->labelUnapiedCount->setText(QString::number(unpaid.count()));
|
ui->labelUnapiedCount->setText(QString::number(unpaid.count()));
|
||||||
ui->labelUnpaiedAmount->setText(QString::number(unpaid.totalPrice().toDouble()));
|
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()));
|
ui->labelUnsendEET->setText(QString::number(unsend.count()));
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
+47
-3
@@ -7,7 +7,7 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>908</width>
|
<width>908</width>
|
||||||
<height>95</height>
|
<height>162</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
@@ -83,7 +83,6 @@
|
|||||||
<widget class="QLabel" name="label_6">
|
<widget class="QLabel" name="label_6">
|
||||||
<property name="font">
|
<property name="font">
|
||||||
<font>
|
<font>
|
||||||
<weight>75</weight>
|
|
||||||
<bold>true</bold>
|
<bold>true</bold>
|
||||||
</font>
|
</font>
|
||||||
</property>
|
</property>
|
||||||
@@ -102,7 +101,6 @@
|
|||||||
</property>
|
</property>
|
||||||
<property name="font">
|
<property name="font">
|
||||||
<font>
|
<font>
|
||||||
<weight>75</weight>
|
|
||||||
<bold>true</bold>
|
<bold>true</bold>
|
||||||
</font>
|
</font>
|
||||||
</property>
|
</property>
|
||||||
@@ -114,6 +112,52 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</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>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|||||||
+16
-3
@@ -437,9 +437,7 @@ QList<IShopItemPtr> ShopService::allSellableItems(const QString& category/* = ""
|
|||||||
|
|
||||||
VoucherSum ShopService::unpaidSummary()
|
VoucherSum ShopService::unpaidSummary()
|
||||||
{
|
{
|
||||||
VoucherSum sum; //= db->query_value<VoucherSum>("status = " + query::_ref((int)Voucher::NOT_PAID));
|
return summary("status = " + QString::number(Voucher::NOT_PAID));
|
||||||
|
|
||||||
return sum;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
VoucherSum ShopService::unsendEET()
|
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 = "");
|
QList<IShopItemPtr> allSellableItems(const QString& category = "");
|
||||||
QMap<QString, QString> allCategories();
|
QMap<QString, QString> allCategories();
|
||||||
VoucherSum unpaidSummary();
|
VoucherSum unpaidSummary();
|
||||||
|
VoucherSum salesSummary(QDate date);
|
||||||
VoucherSum unsendEET();
|
VoucherSum unsendEET();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QDecDouble includeVat(QDecDouble price, Enums::VatType vatType);
|
QDecDouble includeVat(QDecDouble price, Enums::VatType vatType);
|
||||||
QDecDouble excludeVat(QDecDouble price, Enums::VatType vatType);
|
QDecDouble excludeVat(QDecDouble price, Enums::VatType vatType);
|
||||||
void loadSettings();
|
void loadSettings();
|
||||||
|
VoucherSum summary(const QString& where);
|
||||||
|
|
||||||
QSharedPointer<GlobalSettings> m_gs;
|
QSharedPointer<GlobalSettings> m_gs;
|
||||||
QDecDouble vatRate(Enums::VatType vatType);
|
QDecDouble vatRate(Enums::VatType vatType);
|
||||||
|
|||||||
Reference in New Issue
Block a user