You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
47 lines
926 B
C++
47 lines
926 B
C++
#include "paydialog.h"
|
|
#include "ui_paydialog.h"
|
|
#include "shopservice.h"
|
|
|
|
PayDialog::PayDialog(QDecDouble total, QWidget *parent) :
|
|
QDialog(parent),
|
|
ui(new Ui::PayDialog)
|
|
{
|
|
ui->setupUi(this);
|
|
m_total = total;
|
|
|
|
ui->labelTotal->setText(QString::number(total.toDouble(), 'f', 2));
|
|
ui->labelReturn->setText(QString::number(0, 'f', 2));
|
|
ui->recieved->setFocus();
|
|
|
|
ShopService srv;
|
|
ui->checkEet->setVisible(srv.isEetEnabled());
|
|
}
|
|
|
|
PayDialog::~PayDialog()
|
|
{
|
|
delete ui;
|
|
}
|
|
|
|
bool PayDialog::sendToEet()
|
|
{
|
|
return ui->checkEet->checkState() == Qt::Checked;
|
|
}
|
|
|
|
|
|
void PayDialog::on_recieved_valueChanged(double value)
|
|
{
|
|
if (value >= m_total.toDouble())
|
|
{
|
|
ui->labelReturn->setText(QString::number(value - m_total.toDouble(), 'f', 2));
|
|
}
|
|
else
|
|
{
|
|
ui->labelReturn->setText(QString::number(0, 'f', 2));
|
|
}
|
|
}
|
|
|
|
void PayDialog::on_btnOk_clicked()
|
|
{
|
|
accept();
|
|
}
|