diff --git a/api/src/main/java/org/openmrs/module/reporting/dataset/definition/RepeatPerTimePeriodDataSetDefinition.java b/api/src/main/java/org/openmrs/module/reporting/dataset/definition/RepeatPerTimePeriodDataSetDefinition.java index b39240cc8e..92b80d9608 100644 --- a/api/src/main/java/org/openmrs/module/reporting/dataset/definition/RepeatPerTimePeriodDataSetDefinition.java +++ b/api/src/main/java/org/openmrs/module/reporting/dataset/definition/RepeatPerTimePeriodDataSetDefinition.java @@ -9,6 +9,8 @@ */ package org.openmrs.module.reporting.dataset.definition; +import java.util.Date; + import org.openmrs.module.reporting.common.TimePeriod; import org.openmrs.module.reporting.definition.configuration.ConfigurationProperty; import org.openmrs.module.reporting.evaluation.parameter.Mapped; @@ -52,6 +54,12 @@ public class RepeatPerTimePeriodDataSetDefinition extends BaseDataSetDefinition @ConfigurationProperty private TimePeriod repeatPerTimePeriod; + @ConfigurationProperty(group = "obsDateTimeGroup") + private Date startDate; + + @ConfigurationProperty(group = "obsDateTimeGroup") + private Date endDate; + public Mapped getBaseDefinition() { return baseDefinition; } @@ -68,4 +76,20 @@ public void setRepeatPerTimePeriod(TimePeriod repeatPerTimePeriod) { this.repeatPerTimePeriod = repeatPerTimePeriod; } + public Date getstartDate() { + return startDate; + } + + public void setStartDate(Date startDate){ + this.startDate = startDate; + } + + public Date getendDate() { + return endDate; + } + + public void setEndDate(Date endDate){ + this.endDate = endDate; + } + } diff --git a/api/src/main/java/org/openmrs/module/reporting/dataset/definition/evaluator/RepeatPerTimePeriodDataSetEvaluator.java b/api/src/main/java/org/openmrs/module/reporting/dataset/definition/evaluator/RepeatPerTimePeriodDataSetEvaluator.java index e51b99ca3b..ca9df31392 100644 --- a/api/src/main/java/org/openmrs/module/reporting/dataset/definition/evaluator/RepeatPerTimePeriodDataSetEvaluator.java +++ b/api/src/main/java/org/openmrs/module/reporting/dataset/definition/evaluator/RepeatPerTimePeriodDataSetEvaluator.java @@ -56,7 +56,7 @@ public DataSet evaluate(DataSetDefinition dataSetDefinition, EvaluationContext e } DateTime thisPeriodStart = new DateTime(((Date) evalContext.getParameterValue("startDate")).getTime()); - DateTime end = new DateTime(DateUtil.getEndOfDayIfTimeExcluded((Date) evalContext.getParameterValue("endDate")).getTime()); + DateTime end = new DateTime(DateUtil.getEndOfDayIfTimeExcluded((Date) dsd.getendDate()).getTime()); while (thisPeriodStart.isBefore(end)) { DateTime nextPeriodStart = thisPeriodStart.plus(period.getJodaPeriod());