Added support for VAT calculations.
This commit is contained in:
+16
-1
@@ -7,6 +7,8 @@
|
||||
#include <QJsonDocument>
|
||||
#include <QMetaProperty>
|
||||
|
||||
#include <QDecDouble.hh>
|
||||
|
||||
#include "data/system.h"
|
||||
#include "service.h"
|
||||
#include "core_global.h"
|
||||
@@ -43,6 +45,12 @@ public:
|
||||
const char *propName = objSettings->metaObject()->property(i).name();
|
||||
QJsonValue v = val.toObject()[propName];
|
||||
QVariant varVal = v.toVariant();
|
||||
|
||||
if (objSettings->property(propName).canConvert<QDecDouble>())
|
||||
{
|
||||
QDecDouble dec(TO_DEC(varVal.toInt()));
|
||||
varVal = QVariant::fromValue(dec);
|
||||
}
|
||||
objSettings->setProperty(propName, varVal);
|
||||
}
|
||||
|
||||
@@ -59,7 +67,14 @@ public:
|
||||
for (int i = 0; i < objSettingsQo->metaObject()->propertyCount(); i++)
|
||||
{
|
||||
const char *propName = objSettings->metaObject()->property(i).name();
|
||||
jsonObj[propName] = QJsonValue::fromVariant(objSettingsQo->property(propName));
|
||||
QVariant val = objSettingsQo->property(propName);
|
||||
if (val.canConvert<QDecDouble>())
|
||||
{
|
||||
int vat = FROM_DEC(val.value<QDecDouble>());
|
||||
val = QVariant::fromValue(vat);
|
||||
}
|
||||
|
||||
jsonObj[propName] = QJsonValue::fromVariant(val);
|
||||
}
|
||||
|
||||
QJsonObject jsonSettings;
|
||||
|
||||
Reference in New Issue
Block a user