From 334f590efd4bad8e036d37e5db7372f9d3e72aee Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Tue, 14 Jul 2020 19:57:29 +0300 Subject: [PATCH] Calculation of subtotals has been fixed --- common.pri | 2 +- limereport/lrbanddesignintf.cpp | 5 +++++ limereport/lrbanddesignintf.h | 2 ++ limereport/lrgroupfunctions.cpp | 8 ++++++++ limereport/lrgroupfunctions.h | 1 + limereport/lrreportrender.cpp | 7 ++++++- 6 files changed, 23 insertions(+), 2 deletions(-) diff --git a/common.pri b/common.pri index ba97b71..88f260c 100644 --- a/common.pri +++ b/common.pri @@ -133,7 +133,7 @@ RCC_DIR = $${ARCH_DIR}/$${BUILD_TYPE}/rcc LIMEREPORT_VERSION_MAJOR = 1 LIMEREPORT_VERSION_MINOR = 5 -LIMEREPORT_VERSION_RELEASE = 58 +LIMEREPORT_VERSION_RELEASE = 60 LIMEREPORT_VERSION = '$${LIMEREPORT_VERSION_MAJOR}.$${LIMEREPORT_VERSION_MINOR}.$${LIMEREPORT_VERSION_RELEASE}' DEFINES *= LIMEREPORT_VERSION_STR=\\\"$${LIMEREPORT_VERSION}\\\" diff --git a/limereport/lrbanddesignintf.cpp b/limereport/lrbanddesignintf.cpp index 008e9a6..19e63c0 100644 --- a/limereport/lrbanddesignintf.cpp +++ b/limereport/lrbanddesignintf.cpp @@ -752,6 +752,11 @@ void BandDesignIntf::emitBandRendered(BandDesignIntf* band) emit bandRendered(band); } +void BandDesignIntf::emitBandReRendered(BandDesignIntf *oldBand, BandDesignIntf *newBand) +{ + emit bandReRendered(oldBand, newBand); +} + void BandDesignIntf::setSplittable(bool value){ if (m_splitable!=value){ bool oldValue = m_splitable; diff --git a/limereport/lrbanddesignintf.h b/limereport/lrbanddesignintf.h index d093831..02e70dc 100644 --- a/limereport/lrbanddesignintf.h +++ b/limereport/lrbanddesignintf.h @@ -216,6 +216,7 @@ public: void parentObjectLoadFinished(); void objectLoadFinished(); void emitBandRendered(BandDesignIntf *band); + void emitBandReRendered(BandDesignIntf* oldBand, BandDesignIntf* newBand); bool isSplittable() const {return m_splitable;} void setSplittable(bool value); @@ -273,6 +274,7 @@ public: signals: void bandRendered(BandDesignIntf* band); + void bandReRendered(BandDesignIntf* oldBand, BandDesignIntf* newBand); void preparedForRender(); void bandRegistred(); protected: diff --git a/limereport/lrgroupfunctions.cpp b/limereport/lrgroupfunctions.cpp index 1061ea5..edc516e 100644 --- a/limereport/lrgroupfunctions.cpp +++ b/limereport/lrgroupfunctions.cpp @@ -97,6 +97,14 @@ void GroupFunction::slotBandRendered(BandDesignIntf *band) } } +void GroupFunction::slotBandReRendered(BandDesignIntf *oldBand, BandDesignIntf *newBand) +{ + if (m_valuesByBand.contains(oldBand)){ + m_valuesByBand.insert(newBand, m_valuesByBand.value(oldBand)); + m_valuesByBand.remove(oldBand); + } +} + QVariant GroupFunction::addition(QVariant value1, QVariant value2) { return value1.toDouble()+value2.toDouble(); diff --git a/limereport/lrgroupfunctions.h b/limereport/lrgroupfunctions.h index 28cc08b..0c4acba 100644 --- a/limereport/lrgroupfunctions.h +++ b/limereport/lrgroupfunctions.h @@ -56,6 +56,7 @@ public: virtual QVariant calculate(PageItemDesignIntf* page = 0)=0; public slots: void slotBandRendered(BandDesignIntf* band); + void slotBandReRendered(BandDesignIntf* oldBand, BandDesignIntf* newBand); protected: void setName(const QString& value){m_name=value;} QVariant addition(QVariant value1, QVariant value2); diff --git a/limereport/lrreportrender.cpp b/limereport/lrreportrender.cpp index 65e39c9..b18c71c 100644 --- a/limereport/lrreportrender.cpp +++ b/limereport/lrreportrender.cpp @@ -386,7 +386,10 @@ void ReportRender::extractGroupFuntionsFromItem(ContentItemDesignIntf* contentIt if (dataBand){ GroupFunction* gf = datasources()->addGroupFunction(functionName,captures.at(Const::VALUE_INDEX),band->objectName(),dataBand->objectName()); if (gf){ - connect(dataBand,SIGNAL(bandRendered(BandDesignIntf*)),gf,SLOT(slotBandRendered(BandDesignIntf*))); + connect(dataBand, SIGNAL(bandRendered(BandDesignIntf*)), + gf, SLOT(slotBandRendered(BandDesignIntf*))); + connect(dataBand, SIGNAL(bandReRendered(BandDesignIntf*, BandDesignIntf*)), + gf, SLOT(slotBandReRendered(BandDesignIntf*, BandDesignIntf*))); } } else { GroupFunction* gf = datasources()->addGroupFunction(functionName,captures.at(Const::VALUE_INDEX),band->objectName(),captures.at(dsIndex)); @@ -547,6 +550,7 @@ BandDesignIntf* ReportRender::renderBand(BandDesignIntf *patternBand, BandDesign if (!bandIsSliced){ BandDesignIntf* t = renderData(patternBand); t->copyBookmarks(bandClone); + patternBand->emitBandReRendered(bandClone, t); delete bandClone; bandClone = t; } @@ -554,6 +558,7 @@ BandDesignIntf* ReportRender::renderBand(BandDesignIntf *patternBand, BandDesign if (!registerBand(bandClone)) { BandDesignIntf* upperPart = dynamic_cast(bandClone->cloneUpperPart(m_maxHeightByColumn[m_currentColumn])); registerBand(upperPart); + patternBand->emitBandReRendered(bandClone, upperPart); delete bandClone; bandClone = NULL; };