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.

53 lines
1.1 KiB
C++

#include "variablefiller.h"
#include "../settingsservice.h"
VariableFiller::VariableFiller()
{
}
VariableFiller::~VariableFiller()
{
}
void VariableFiller::fill(ReportPtr report, int recordId)
{
if (m_settings.isNull())
{
loadSettings();
}
QMap<QString, QString> vars;
vars[COMPANY] = m_settings->firmName();
vars[STREET] = m_settings->street();
vars[HOUSE_NUMBER] = m_settings->houseNumber();
vars[CITY] = m_settings->city();
vars[ZIP_CODE] = m_settings->zipCode();
vars[IC] = QString::number(m_settings->ic());
vars[DIC] = m_settings->dic();
vars[LOGO_PATH] = m_settings->logoPath();
if (recordId > 0)
{
vars[RECORD_ID] = QString::number(recordId);
}
else
{
vars[RECORD_ID] = "";
}
report->setVariables(vars);
}
void VariableFiller::fillList(QList<ReportPtr> reports, int recordId)
{
foreach (ReportPtr report, reports) {
fill(report, recordId);
}
}
void VariableFiller::loadSettings()
{
SettingsService srv("CORE");
m_settings = srv.loadSettings<GlobalSettings>();
}