diff --git a/MangoApp.pro b/MangoApp.pro index a848cbd..872bcab 100644 --- a/MangoApp.pro +++ b/MangoApp.pro @@ -3,4 +3,5 @@ TEMPLATE = subdirs SUBDIRS += MangoModel \ MangoDatabase \ MangoService \ + MangoReports \ Mango diff --git a/MangoReports/MangoReports.pro b/MangoReports/MangoReports.pro new file mode 100644 index 0000000..15545ec --- /dev/null +++ b/MangoReports/MangoReports.pro @@ -0,0 +1,34 @@ +#------------------------------------------------- +# +# Project created by QtCreator 2012-08-10T17:19:22 +# +#------------------------------------------------- + +QT -= gui + +TARGET = MangoReports +TEMPLATE = lib + +DEFINES += MANGOREPORTS_LIBRARY + +SOURCES += report.cpp \ + logginreport.cpp + +HEADERS += report.h\ + MangoReports_global.h \ + logginreport.h + +unix:DESTDIR = ../bin +unix:OBJECTS_DIR = build/_obj +unix:MOC_DIR = build/_moc +unix:RCC_DIR = build/_rcc +unix:UI_DIR = build/_ui + +win32:DESTDIR = ../bin +win32:OBJECTS_DIR = build/_obj +win32:MOC_DIR = build/_moc +win32:RCC_DIR = build/_rcc +win32:UI_DIR = build/_ui + +LIBS += -L$$PWD/../bin/ -lMangoModel +LIBS += -L$$PWD/../bin/ -lMangoService diff --git a/MangoReports/MangoReports_global.h b/MangoReports/MangoReports_global.h new file mode 100644 index 0000000..d378ebf --- /dev/null +++ b/MangoReports/MangoReports_global.h @@ -0,0 +1,12 @@ +#ifndef MANGOREPORTS_GLOBAL_H +#define MANGOREPORTS_GLOBAL_H + +#include + +#if defined(MANGOREPORTS_LIBRARY) +# define MANGOREPORTSSHARED_EXPORT Q_DECL_EXPORT +#else +# define MANGOREPORTSSHARED_EXPORT Q_DECL_IMPORT +#endif + +#endif // MANGOREPORTS_GLOBAL_H diff --git a/MangoReports/logginreport.cpp b/MangoReports/logginreport.cpp new file mode 100644 index 0000000..9b14a02 --- /dev/null +++ b/MangoReports/logginreport.cpp @@ -0,0 +1,16 @@ +#include "logginreport.h" + +LogginReport::LogginReport(const QDateTime& from, const QDateTime& to) + :Report(from, to) +{ +} + +QString LogginReport::getHTML() +{ + +} + +QString LogginReport::getReportTemplateName() +{ + return ":/reports/LogginReport.html"; +} diff --git a/MangoReports/logginreport.h b/MangoReports/logginreport.h new file mode 100644 index 0000000..12f645f --- /dev/null +++ b/MangoReports/logginreport.h @@ -0,0 +1,16 @@ +#ifndef LOGGINREPORT_H +#define LOGGINREPORT_H + +#include "MangoReports_global.h" +#include "report.h" + +class MANGOREPORTSSHARED_EXPORT LogginReport: public Report +{ +public: + LogginReport(const QDateTime& from, const QDateTime& to); + + virtual QString getHTML(); + virtual QString getReportTemplateName(); +}; + +#endif // LOGGINREPORT_H diff --git a/MangoReports/report.cpp b/MangoReports/report.cpp new file mode 100644 index 0000000..78c1f12 --- /dev/null +++ b/MangoReports/report.cpp @@ -0,0 +1,19 @@ +#include "report.h" + +Report::Report(const QDateTime& from, const QDateTime& to) +{ + this->m_from = from; + this->m_to = to; +} + +QString Report::getTemplateFileContent() +{ + QFile *reportFile = new QFile(getReportTemplateName()); + + if ( ! reportFile->open(QIODevice::ReadOnly | QIODevice::Text) ) { + return "Error"; + } + + QString htmlContent = reportFile->readAll(); + return htmlContent; +} diff --git a/MangoReports/report.h b/MangoReports/report.h new file mode 100644 index 0000000..21a775d --- /dev/null +++ b/MangoReports/report.h @@ -0,0 +1,21 @@ +#ifndef REPORT_H +#define REPORT_H + +#include "MangoReports_global.h" + +#include +#include + +class MANGOREPORTSSHARED_EXPORT Report { +public: + Report(const QDateTime& from, const QDateTime& to); + QString getTemplateFileContent(); + + virtual QString getHTML() = 0; + virtual QString getReportTemplateName() = 0; + +private: + QDateTime m_from, m_to; +}; + +#endif // REPORT_H