I try to auto calculate EDD but does not work. Some Screenshot of work are attached here.
concepts are given below
#code are given below on file : Karnali_Implementation\openmrs\obscalculator\BahmniObsValueCalculator.groovy
BahmniObservation lmpObservation = find("ANC-Last menstrual period", observations, null)
def calculatedConceptName = "ANC-Expected delivery date"
if (hasValue(lmpObservation)) {
parent = obsParent(lmpObservation, null)
def calculatedObs = find(calculatedConceptName, observations, null)
Date obsDatetime = getDate(lmpObservation)
LocalDate edd = new LocalDate(lmpObservation.getValue()).plusMonths(9).plusWeeks(1)
if (calculatedObs == null)
calculatedObs = createObs(calculatedConceptName, parent, bahmniEncounterTransaction, obsDatetime) as BahmniObservation
calculatedObs.setValue(edd)
return
} else {
def calculatedObs = find(calculatedConceptName, observations, null)
if (hasValue(calculatedObs)) {
voidObs(calculatedObs)
}
}