Added pay voucher feature. Added dialog with paied vouchers. Added
support for printing receipts on POS printer.
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
#include "shopsettings.h"
|
||||
|
||||
ShopSettings::ShopSettings(QObject *parent) : QObject(parent)
|
||||
{
|
||||
m_codepage = ASCII;
|
||||
m_lettersPerLine = 48;
|
||||
}
|
||||
|
||||
QString ShopSettings::output() const
|
||||
{
|
||||
return m_output;
|
||||
}
|
||||
|
||||
void ShopSettings::setOutput(const QString &output)
|
||||
{
|
||||
m_output = output;
|
||||
}
|
||||
|
||||
ShopSettings::CODEPAGE ShopSettings::codepage() const
|
||||
{
|
||||
return m_codepage;
|
||||
}
|
||||
|
||||
void ShopSettings::setCodepage(const CODEPAGE &codepage)
|
||||
{
|
||||
m_codepage = codepage;
|
||||
}
|
||||
|
||||
int ShopSettings::lettersPerLine() const
|
||||
{
|
||||
return m_lettersPerLine;
|
||||
}
|
||||
|
||||
void ShopSettings::setLettersPerLine(int lettersPerLine)
|
||||
{
|
||||
m_lettersPerLine = lettersPerLine;
|
||||
}
|
||||
|
||||
QString ShopSettings::byMessage() const
|
||||
{
|
||||
return m_byMessage;
|
||||
}
|
||||
|
||||
void ShopSettings::setByMessage(const QString &byMessage)
|
||||
{
|
||||
m_byMessage = byMessage;
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
#ifndef RECEIPTSETTINGS_H
|
||||
#define RECEIPTSETTINGS_H
|
||||
|
||||
#include <QObject>
|
||||
|
||||
class ShopSettings : public QObject
|
||||
{
|
||||
Q_PROPERTY(QString output READ output WRITE setOutput)
|
||||
Q_PROPERTY(int lettersPerLine READ lettersPerLine WRITE setLettersPerLine)
|
||||
Q_PROPERTY(QString byMessage READ byMessage WRITE setByMessage)
|
||||
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
||||
enum CODEPAGE
|
||||
{
|
||||
ASCII
|
||||
};
|
||||
|
||||
explicit ShopSettings(QObject *parent = 0);
|
||||
|
||||
QString output() const;
|
||||
void setOutput(const QString &output);
|
||||
|
||||
CODEPAGE codepage() const;
|
||||
void setCodepage(const CODEPAGE &codepage);
|
||||
|
||||
int lettersPerLine() const;
|
||||
void setLettersPerLine(int lettersPerLine);
|
||||
|
||||
QString byMessage() const;
|
||||
void setByMessage(const QString &byMessage);
|
||||
|
||||
private:
|
||||
QString m_output;
|
||||
CODEPAGE m_codepage;
|
||||
int m_lettersPerLine;
|
||||
QString m_byMessage;
|
||||
};
|
||||
|
||||
typedef QSharedPointer<ShopSettings> ShopSettingsPtr;
|
||||
|
||||
#endif // RECEIPTSETTINGS_H
|
||||
@@ -0,0 +1,36 @@
|
||||
#include "shopsettingsform.h"
|
||||
#include "ui_shopsettingsform.h"
|
||||
|
||||
#include <settingsservice.h>
|
||||
|
||||
ShopSettingsForm::ShopSettingsForm(QWidget *parent) :
|
||||
FormBinder<ShopSettings>(parent),
|
||||
ui(new Ui::ShopSettingsForm)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
registerBinding(ui->output);
|
||||
registerBinding(ui->lettersPerLine);
|
||||
registerBinding(ui->byMessage);
|
||||
}
|
||||
|
||||
ShopSettingsForm::~ShopSettingsForm()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void ShopSettingsForm::loadEntity()
|
||||
{
|
||||
SettingsService srv("SHOP");
|
||||
ShopSettingsPtr settings = srv.loadSettings<ShopSettings>();
|
||||
setEntity(settings);
|
||||
}
|
||||
|
||||
bool ShopSettingsForm::saveRecord()
|
||||
{
|
||||
bindToData();
|
||||
SettingsService srv("SHOP");
|
||||
srv.saveSettings(entity());
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
#ifndef SHOPSETTINGSFORM_H
|
||||
#define SHOPSETTINGSFORM_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <formbinder.h>
|
||||
#include "shopsettings.h"
|
||||
|
||||
namespace Ui {
|
||||
class ShopSettingsForm;
|
||||
}
|
||||
|
||||
class ShopSettingsForm : public FormBinder<ShopSettings>
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit ShopSettingsForm(QWidget *parent = 0);
|
||||
~ShopSettingsForm();
|
||||
|
||||
private:
|
||||
Ui::ShopSettingsForm *ui;
|
||||
|
||||
// IForm interface
|
||||
public:
|
||||
void loadEntity();
|
||||
|
||||
public slots:
|
||||
bool saveRecord();
|
||||
};
|
||||
|
||||
#endif // SHOPSETTINGSFORM_H
|
||||
@@ -0,0 +1,60 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>ShopSettingsForm</class>
|
||||
<widget class="QWidget" name="ShopSettingsForm">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>608</width>
|
||||
<height>450</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>Printer</string>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Output device</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="output"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Letters per line</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QSpinBox" name="lettersPerLine"/>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Footer text</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLineEdit" name="byMessage"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
Reference in New Issue
Block a user