Skip to content

Commit

Permalink
DCM-41: Support BiMonthly period type in Automation
Browse files Browse the repository at this point in the history
  • Loading branch information
Piumal1999 committed Jun 25, 2021
1 parent 83df953 commit 133f50d
Showing 1 changed file with 9 additions and 0 deletions.
Expand Up @@ -1482,6 +1482,15 @@ public String transformToDHISPeriod(Calendar startDate, Calendar endDate, String
.equals(endDate.get(Calendar.YEAR) + "Q" + getQuarterNumber(endDate))) {
period = startDate.get(Calendar.YEAR) + "Q" + getQuarterNumber(startDate);
}
} else if (ReportingPeriodType.BiMonthly.name().equals(periodType)) {
sdf = new SimpleDateFormat("yyyyMM");
startDate.add(Calendar.MONTH, -2);
startDate.set(Calendar.DAY_OF_MONTH, 1);
setBasicsStartsAndEnds(startDate, endDate);
endDate.add(Calendar.MONTH, 1);
endDate.set(Calendar.DAY_OF_MONTH, endDate.getActualMaximum(Calendar.DAY_OF_MONTH));
if (lastRun == null || !sdf.format(lastRun).equals(sdf.format(endDate.getTime())))
period = new SimpleDateFormat("yyyyMM").format(startDate.getTime()) + "B";
}
return period;
}
Expand Down

0 comments on commit 133f50d

Please sign in to comment.