Fase 2: Template engine, DAO, editor visual, plantillas y motor de exportacion PDF/XLSX/DOCX

This commit is contained in:
2026-06-09 23:26:35 +02:00
parent 7d607f5139
commit ed1ac4266c
12 changed files with 908 additions and 2 deletions
+44
View File
@@ -0,0 +1,44 @@
#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