44 lines
1.0 KiB
C++
44 lines
1.0 KiB
C++
#ifndef TEMPLATEDAO_H
|
|
#define TEMPLATEDAO_H
|
|
|
|
#include <QObject>
|
|
#include <QString>
|
|
#include <QSqlQuery>
|
|
#include <QSqlError>
|
|
#include <QDebug>
|
|
#include <QVector>
|
|
|
|
class Template
|
|
{
|
|
public:
|
|
int id = 0;
|
|
QString name;
|
|
QString description;
|
|
QString documentType; // budget, invoice, project, purchase, third, generic
|
|
double widthMM = 210;
|
|
double heightMM = 297;
|
|
double marginTop = 20;
|
|
double marginBottom = 20;
|
|
double marginLeft = 20;
|
|
double marginRight = 20;
|
|
QString content; // JSON con definicion de elementos
|
|
bool isDefault = false;
|
|
QString createdBy;
|
|
};
|
|
|
|
class TemplateDAO : public QObject
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit TemplateDAO(QObject *parent = nullptr) : QObject(parent) {}
|
|
|
|
static bool create(Template &tpl);
|
|
static QVector<Template> getAll();
|
|
static Template getById(int id);
|
|
static bool update(const Template &tpl);
|
|
static bool remove(int id);
|
|
static Template getDefaultForType(const QString &documentType);
|
|
};
|
|
|
|
#endif // TEMPLATEDAO_H
|