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 {
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)
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};
int m_totalPrice{0};

@ -47,20 +47,12 @@ 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](const QModelIndex &current, const QModelIndex &) {
ShopService srv;
connect(ui->tableVouchers->selectionModel(), &QItemSelectionModel::currentRowChanged, [this, &srv](const QModelIndex &current, const QModelIndex &) {
QSharedPointer<Voucher> voucher = m_voucherModel->itemFromIndex(current);
if (voucher->items().isEmpty()) {
srv.load(voucher);

@ -16,7 +16,6 @@ ShopSettingsForm::ShopSettingsForm(QWidget *parent) :
registerBinding(ui->lettersPerLine);
registerBinding(ui->byMessage);
#ifdef EET
registerBinding(ui->eetActive);
registerBinding(ui->eetShopId);
registerBinding(ui->eetRegisterId);
@ -27,9 +26,6 @@ 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);

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

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

@ -437,7 +437,9 @@ QList<IShopItemPtr> ShopService::allSellableItems(const QString& category/* = ""
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()
@ -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 = "");
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);

Loading…
Cancel
Save