Compare commits

..

No commits in common. '285fc8e80ffb1a9f844103f69b961273d6fed063' and 'e958c86eb7d4df2316aec15627dbe64d3322b626' have entirely different histories.

@ -421,13 +421,3 @@ 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,14 +210,10 @@ 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};
int m_totalPrice{0}; int m_totalPrice{0};

@ -47,20 +47,12 @@ 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](const QModelIndex &current, const QModelIndex &) { connect(ui->tableVouchers->selectionModel(), &QItemSelectionModel::currentRowChanged, [this, &srv](const QModelIndex &current, 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,7 +16,6 @@ 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);
@ -27,9 +26,6 @@ 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);

@ -7,11 +7,6 @@ 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()
@ -24,16 +19,9 @@ 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
} }

@ -7,7 +7,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>908</width> <width>908</width>
<height>162</height> <height>95</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -83,6 +83,7 @@
<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>
@ -101,6 +102,7 @@
</property> </property>
<property name="font"> <property name="font">
<font> <font>
<weight>75</weight>
<bold>true</bold> <bold>true</bold>
</font> </font>
</property> </property>
@ -112,52 +114,6 @@
</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>

@ -437,7 +437,9 @@ QList<IShopItemPtr> ShopService::allSellableItems(const QString& category/* = ""
VoucherSum ShopService::unpaidSummary() VoucherSum ShopService::unpaidSummary()
{ {
return summary("status = " + QString::number(Voucher::NOT_PAID)); VoucherSum sum; //= db->query_value<VoucherSum>("status = " + query::_ref((int)Voucher::NOT_PAID));
return sum;
} }
VoucherSum ShopService::unsendEET() VoucherSum ShopService::unsendEET()
@ -549,18 +551,3 @@ 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,14 +44,12 @@ 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);

Loading…
Cancel
Save