← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 10517: Add an option to allow select comparison date ( incidentDate or enrollmentDate ) when to define t...

 

------------------------------------------------------------
revno: 10517
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2013-04-11 10:23:04 +0700
message:
  Add an option to allow select comparison date ( incidentDate or enrollmentDate ) when to define template messages of program.
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientReminder.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramInstanceStore.java
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/startup/TableAlteror.java
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramInstanceService.java
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramInstanceStore.java
  dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/patient/hibernate/PatientReminder.hbm.xml
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/program/AddProgramAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/program/UpdateProgramAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/programstage/AddProgramStageAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/programstage/UpdateProgramStageAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addProgramForm.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/program.js
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateProgramForm.vm


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientReminder.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientReminder.java	2013-04-10 08:45:43 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientReminder.java	2013-04-11 03:23:04 +0000
@@ -38,6 +38,12 @@
 {
     private static final long serialVersionUID = 3101502417481903219L;
 
+    public static final String DUE_DATE_TO_COMPARE = "duedate";
+    
+    public static final String ENROLLEMENT_DATE_TO_COMPARE = "enrollmentdate";
+    
+    public static final String INCIDENT_DATE_TO_COMPARE = "dateofincident";
+    
     public static final String TEMPLATE_MESSSAGE_PATIENT_NAME = "{patient-name}";
 
     public static final String TEMPLATE_MESSSAGE_PROGRAM_NAME = "{program-name}";
@@ -66,6 +72,8 @@
 
     private String templateMessage;
 
+    private String dateToCompare;
+
     // -------------------------------------------------------------------------
     // Constructors
     // -------------------------------------------------------------------------
@@ -126,4 +134,14 @@
         this.templateMessage = templateMessage;
     }
 
+    public String getDateToCompare()
+    {
+        return dateToCompare;
+    }
+
+    public void setDateToCompare( String dateToCompare )
+    {
+        this.dateToCompare = dateToCompare;
+    }
+
 }

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramInstanceStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramInstanceStore.java	2013-04-10 08:45:43 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramInstanceStore.java	2013-04-11 03:23:04 +0000
@@ -80,5 +80,5 @@
     Collection<ProgramInstance> getByStatus( Integer status, Program program, Collection<Integer> orgunitIds,
         Date startDate, Date endDate );
     
-    Collection<SchedulingProgramObject> getSendMesssageEvents();
+    Collection<SchedulingProgramObject> getSendMesssageEvents( String dateToCompare );
 }

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/startup/TableAlteror.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/startup/TableAlteror.java	2013-04-10 04:22:14 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/startup/TableAlteror.java	2013-04-11 03:23:04 +0000
@@ -201,6 +201,7 @@
         executeSql( "update prorgam set \"operator\"='times' where \"operator\"='SUM'" );
         
         executeSql( "update program set remindCompleted=false where remindCompleted is null" );
+        executeSql( "update patientreminder set dateToCompare='duedate' where programstageid is not null" );
         
         updateUid();
 

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramInstanceService.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramInstanceService.java	2013-04-10 08:45:43 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramInstanceService.java	2013-04-11 03:23:04 +0000
@@ -41,6 +41,7 @@
 import org.hisp.dhis.patient.PatientAttribute;
 import org.hisp.dhis.patient.PatientIdentifier;
 import org.hisp.dhis.patient.PatientIdentifierType;
+import org.hisp.dhis.patient.PatientReminder;
 import org.hisp.dhis.patientattributevalue.PatientAttributeValue;
 import org.hisp.dhis.patientattributevalue.PatientAttributeValueService;
 import org.hisp.dhis.patientdatavalue.PatientDataValue;
@@ -125,7 +126,7 @@
         return programInstanceStore.get( programs );
     }
 
-    public Collection<ProgramInstance> getProgramInstances( Collection<Program> programs,Integer status )
+    public Collection<ProgramInstance> getProgramInstances( Collection<Program> programs, Integer status )
     {
         return programInstanceStore.get( programs, status );
     }
@@ -359,7 +360,7 @@
     {
         return programInstanceStore.getByStatus( status, program, orgunitIds, startDate, endDate );
     }
-    
+
     public void removeProgramEnrollment( ProgramInstance programInstance )
     {
         programInstanceStore.removeProgramEnrollment( programInstance );
@@ -367,9 +368,14 @@
 
     public Collection<SchedulingProgramObject> getSendMesssageEvents()
     {
-        return programInstanceStore.getSendMesssageEvents();
+        Collection<SchedulingProgramObject> result = programInstanceStore
+            .getSendMesssageEvents( PatientReminder.ENROLLEMENT_DATE_TO_COMPARE );
+
+        result.addAll( programInstanceStore.getSendMesssageEvents( PatientReminder.INCIDENT_DATE_TO_COMPARE ) );
+
+        return result;
     }
-    
+
     // -------------------------------------------------------------------------
     // due-date && report-date
     // -------------------------------------------------------------------------

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramInstanceStore.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramInstanceStore.java	2013-04-10 08:45:43 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramInstanceStore.java	2013-04-11 03:23:04 +0000
@@ -245,9 +245,9 @@
         jdbcTemplate.execute( sql );
     }
 
-    public Collection<SchedulingProgramObject> getSendMesssageEvents()
+    public Collection<SchedulingProgramObject> getSendMesssageEvents( String dateToCompare )
     {
-        String sql = "select pi.programinstanceid, p.phonenumber, prm.templatemessage, "
+        String sql = "SELECT pi.programinstanceid, p.phonenumber, prm.templatemessage, "
             + "         p.firstname, p.middlename, p.lastname, org.name as orgunitName, "
             + "         pg.name as programName, pi.dateofincident , "
             + "         pi.enrollmentdate,(DATE(now()) - DATE(pi.enrollmentdate) ) as days_since_erollment_date, "
@@ -256,12 +256,13 @@
             + "              ON p.patientid=pi.patientid INNER JOIN program pg "
             + "              ON pg.programid=pi.programid INNER JOIN organisationunit org "
             + "              ON org.organisationunitid = p.organisationunitid INNER JOIN patientreminder prm "
-            + "              ON prm.programid = pi.programid   " 
+            + "              ON prm.programid = pi.programid " 
             + "       WHERE pi.status= " + ProgramInstance.STATUS_ACTIVE
             + "         and p.phonenumber is not NULL and p.phonenumber != ''   "
             + "         and prm.templatemessage is not NULL and prm.templatemessage != ''   "
             + "         and pg.type=1 and prm.daysallowedsendmessage is not null    "
-            + "         and (  DATE(now()) - DATE(pi.enrollmentdate) ) = prm.daysallowedsendmessage";
+            + "         and ( DATE(now()) - DATE(pi." + dateToCompare + ") ) = prm.daysallowedsendmessage "
+            + "         and prm.dateToCompare='" + dateToCompare + "'";
         
         SqlRowSet rs = jdbcTemplate.queryForRowSet( sql );
 

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/patient/hibernate/PatientReminder.hbm.xml'
--- dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/patient/hibernate/PatientReminder.hbm.xml	2012-09-18 09:13:01 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/patient/hibernate/PatientReminder.hbm.xml	2013-04-11 03:23:04 +0000
@@ -15,6 +15,8 @@
     <property name="daysAllowedSendMessage" />
      
     <property name="templateMessage" />
-
+    
+ 	<property name="dateToCompare" />
+ 
   </class>
 </hibernate-mapping>

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/program/AddProgramAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/program/AddProgramAction.java	2013-04-10 08:45:43 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/program/AddProgramAction.java	2013-04-11 03:23:04 +0000
@@ -214,6 +214,13 @@
         this.templateMessages = templateMessages;
     }
 
+    private List<String> datesToCompare = new ArrayList<String>();
+
+    public void setDatesToCompare( List<String> datesToCompare )
+    {
+        this.datesToCompare = datesToCompare;
+    }
+
     // -------------------------------------------------------------------------
     // Action implementation
     // -------------------------------------------------------------------------
@@ -290,10 +297,11 @@
         {
             PatientReminder reminder = new PatientReminder( "", daysAllowedSendMessages.get( i ),
                 templateMessages.get( i ) );
+            reminder.setDateToCompare(datesToCompare.get( i ));
             patientReminders.add( reminder );
         }
         program.setPatientReminders( patientReminders );
-        
+
         programService.saveProgram( program );
 
         if ( program.getType().equals( Program.SINGLE_EVENT_WITH_REGISTRATION )

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/program/UpdateProgramAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/program/UpdateProgramAction.java	2013-04-10 08:45:43 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/program/UpdateProgramAction.java	2013-04-11 03:23:04 +0000
@@ -210,6 +210,13 @@
         this.templateMessages = templateMessages;
     }
 
+    private List<String> datesToCompare = new ArrayList<String>();
+
+    public void setDatesToCompare( List<String> datesToCompare )
+    {
+        this.datesToCompare = datesToCompare;
+    }
+
     // -------------------------------------------------------------------------
     // Action implementation
     // -------------------------------------------------------------------------
@@ -283,6 +290,7 @@
         {
             PatientReminder reminder = new PatientReminder( "", daysAllowedSendMessages.get( i ),
                 templateMessages.get( i ) );
+            reminder.setDateToCompare( datesToCompare.get( i ) );
             patientReminders.add( reminder );
         }
         program.setPatientReminders( patientReminders );

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/programstage/AddProgramStageAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/programstage/AddProgramStageAction.java	2013-03-01 14:09:05 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/programstage/AddProgramStageAction.java	2013-04-11 03:23:04 +0000
@@ -246,6 +246,7 @@
         {
             PatientReminder reminder = new PatientReminder( "", daysAllowedSendMessages.get( i ),
                 templateMessages.get( i ) );
+            reminder.setDateToCompare( PatientReminder.DUE_DATE_TO_COMPARE );
             patientReminders.add( reminder );
         }
         programStage.setPatientReminders( patientReminders );

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/programstage/UpdateProgramStageAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/programstage/UpdateProgramStageAction.java	2013-03-01 14:09:05 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/programstage/UpdateProgramStageAction.java	2013-04-11 03:23:04 +0000
@@ -237,6 +237,7 @@
         {
             PatientReminder reminder = new PatientReminder( "", daysAllowedSendMessages.get( i ),
                 templateMessages.get( i ) );
+            reminder.setDateToCompare( PatientReminder.DUE_DATE_TO_COMPARE );
             patientReminders.add( reminder );
         }
         programStage.setPatientReminders( patientReminders );

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties	2013-04-10 08:45:43 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties	2013-04-11 03:23:04 +0000
@@ -377,6 +377,7 @@
 validate_success = The registration form passed validation successfully
 remind_completing_program_after_program_stage_completed = Remind completing program after a program stage completed
 days_since_enrollment_date = Days since enrollment date
-days_before_after_enrollment_date = Days before/after enrollment date
-enrollement_date = Enrollement date
-incident_date = Incident date
\ No newline at end of file
+days_before_after_comparison_date = Days before/after comparison date
+enrollment_date = Enrollment date
+incident_date = Incident date
+date_to_compare = Date to compare
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addProgramForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addProgramForm.vm	2013-04-10 08:45:43 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addProgramForm.vm	2013-04-11 03:23:04 +0000
@@ -1,5 +1,5 @@
 <script>
-	jQuery( document ).ready( function()
+jQuery( document ).ready( function()
 {
 	validation( 'addProgramForm', function( form ){ 
 		if( duplicate==true) 
@@ -25,12 +25,20 @@
 		var templateMessages = jQuery( "#templateMessages" );
 		templateMessages.empty();
 		
+		var datesToCompare = jQuery( "#datesToCompare" );
+		datesToCompare.empty();
+		
 		jQuery(".daysAllowedSendMessage").each( function( i, item ){ 
 			daysAllowedSendMessages.append( "<option value='" + item.value + "' selected='true'>" + item.value +"</option>" );
 		});
+		
 		jQuery(".templateMessage").each( function( i, item ){ 
 			templateMessages.append( "<option value='" + item.value + "' selected='true'>" +item.value+"</option>" );
 		});
+		
+		jQuery(".dateToCompare").each( function( i, item ){ 
+			datesToCompare.append( "<option value='" + item.value + "' selected='true'>" +item.value+"</option>" );
+		});
 	});
 	
 	checkValueIsExist( "name", "validateProgram.action" );	
@@ -45,6 +53,7 @@
 
 <select id='daysAllowedSendMessages' name="daysAllowedSendMessages" multiple="multiple" class="hidden"></select>
 <select id='templateMessages' name="templateMessages" multiple="multiple" class="hidden"></select>
+<select id='datesToCompare' name="datesToCompare" multiple="multiple" class="hidden"></select>
 <table>	 
 	<thead>
       <tr>
@@ -226,15 +235,16 @@
 <script>
 	var i18n_reminder = '$encoder.jsEscape( $i18n.getString( "reminder" ) , "'")';   
 	var i18n_remove_reminder = '$encoder.jsEscape( $i18n.getString( "remove_reminder" ) , "'")';   
-	var i18n_days_before_after_enrollment_date = '$encoder.jsEscape( $i18n.getString( "days_before_after_enrollment_date" ) , "'")';   
+	var i18n_days_before_after_comparison_date = '$encoder.jsEscape( $i18n.getString( "days_before_after_comparison_date" ) , "'")';   
 	var i18n_params = '$encoder.jsEscape( $i18n.getString( "params" ) , "'")';   
 	var i18n_patient_name = '$encoder.jsEscape( $i18n.getString( "patient_name" ) , "'")';   
 	var i18n_program_name = '$encoder.jsEscape( $i18n.getString( "program_name" ) , "'")';   
 	var i18n_incident_date = '$encoder.jsEscape( $i18n.getString( "incident_date" ) , "'")';   
 	var i18n_days_since_incident_date = '$encoder.jsEscape( $i18n.getString( "days_since_incident_date" ) , "'")';   
 	var i18n_orgunit_name = '$encoder.jsEscape( $i18n.getString( "orgunit_name" ) , "'")';   
-	var i18n_enrollement_date = '$encoder.jsEscape( $i18n.getString( "enrollement_date" ) , "'")';   
+	var i18n_enrollment_date = '$encoder.jsEscape( $i18n.getString( "enrollement_date" ) , "'")';   
 	var i18n_days_since_enrollment_date = '$encoder.jsEscape( $i18n.getString( "days_since_enrollment_date" ) , "'")';   
 	var i18n_message = '$encoder.jsEscape( $i18n.getString( "message" ) , "'")';   
 	var i18n_name_exists = '$encoder.jsEscape( $i18n.getString( "name_exists" ) , "'")';   
+	var i18n_date_to_compare = '$encoder.jsEscape( $i18n.getString( "date_to_compare" ) , "'")'; 
 </script>

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/program.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/program.js	2013-04-10 08:45:43 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/program.js	2013-04-11 03:23:04 +0000
@@ -263,7 +263,16 @@
 				+ 	'<td colspan="2">' + i18n_reminder + ' ' + rowId + '<a href="javascript:removeTemplateMessageForm('+ rowId +')"> ( '+ i18n_remove_reminder + ' )</a></td>'
 				+ '</tr>'
 				+ '<tr name="tr' + rowId + '">'
-				+ 	'<td><label>' + i18n_days_before_after_enrollment_date + '</label></td>'
+				+ 	'<td><label>' + i18n_date_to_compare + '</label></td>'
+				+ 	'<td>'
+				+		'<select class="dateToCompare">'
+				+			'<option value="dateofincident">' + i18n_incident_date + '</option>'
+				+			'<option value="enrollmentdate">' + i18n_enrollment_date + '</option>'
+				+ 		'</select>'
+				+   '</td>'
+				+ '</tr>'
+				+ '<tr name="tr' + rowId + '">'
+				+ 	'<td><label>' + i18n_days_before_after_comparison_date + '</label></td>'
 				+ 	'<td><input type="text" id="daysAllowedSendMessage' + rowId + '" name="daysAllowedSendMessage' + rowId + '" class="daysAllowedSendMessage {validate:{required:true,number:true}}"/></td>'
 				+ '</tr>'
 				+ '<tr name="tr' + rowId + '">'
@@ -274,7 +283,7 @@
 				+			'<option value="{program-name}">' + i18n_program_name + '</option>'
 				+			'<option value="{incident-date}">' + i18n_incident_date + '</option>'
 				+			'<option value="{days-since-incident-date}">' + i18n_days_since_incident_date + '</option>'
-				+			'<option value="{enrollement-date}">' + i18n_enrollement_date + '</option>'
+				+			'<option value="{enrollement-date}">' + i18n_enrollment_date + '</option>'
 				+			'<option value="{days-since-enrollement-date}">' + i18n_days_since_enrollment_date + '</option>'
 				+			'<option value="{orgunit-name}">' + i18n_orgunit_name + '</option>'
 				+		'</select>'

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateProgramForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateProgramForm.vm	2013-04-10 08:45:43 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateProgramForm.vm	2013-04-11 03:23:04 +0000
@@ -25,12 +25,20 @@
 		var templateMessages = jQuery( "#templateMessages" );
 		templateMessages.empty();
 		
+		var datesToCompare = jQuery( "#datesToCompare" );
+		datesToCompare.empty();
+		
 		jQuery(".daysAllowedSendMessage").each( function( i, item ){ 
 			daysAllowedSendMessages.append( "<option value='" + item.value + "' selected='true'>" + item.value +"</option>" );
 		});
+		
 		jQuery(".templateMessage").each( function( i, item ){ 
 			templateMessages.append( "<option value='" + item.value + "' selected='true'>" +item.value+"</option>" );
 		});
+		
+		jQuery(".dateToCompare").each( function( i, item ){ 
+			datesToCompare.append( "<option value='" + item.value + "' selected='true'>" +item.value+"</option>" );
+		});
 	});
 	
 	checkValueIsExist( "name", "validateProgram.action",{id:getFieldValue('id')} );	
@@ -44,6 +52,7 @@
 <form id="updateProgramForm" name="updateProgramForm" action="updateProgram.action" method="post" onsubmit="selectAllById('selectedPropertyIds');" >
   <select id='daysAllowedSendMessages' name="daysAllowedSendMessages" multiple="multiple" class="hidden"></select>
   <select id='templateMessages' name="templateMessages" multiple="multiple" class="hidden"></select>
+  <select id='datesToCompare' name="datesToCompare" multiple="multiple" class="hidden"></select>
   <input type="hidden" id="id" name="id" value="$program.id">
   <table id="detailsList">
     <thead>
@@ -236,7 +245,16 @@
 					</td>
 				</tr>
 				<tr name="tr$index">
-					<td><label>$i18n.getString( "days_before_after_due_date" )</label></td>
+				<td><label>$i18n.getString( "date_to_compare")</label></td>
+					<td>
+						<select class="dateToCompare"/>
+							<option value="dateofincident">$i18n.getString( "incident_date" )</option>
+							<option value="enrollmentdate">$i18n.getString( "enrollment_date" )</option>
+						</select>
+					</td>
+				</tr>
+				<tr name="tr$index">
+					<td><label>$i18n.getString( "days_before_after_comparison_date" )</label></td>
 					<td><input type="text" id="daysAllowedSendMessage$index" name="daysAllowedSendMessage$index" class="daysAllowedSendMessage {validate:{required:true,number:true}}" value="$!reminder.daysAllowedSendMessage"/></td>
 				</tr>
 				<tr name="tr$index">
@@ -282,15 +300,16 @@
 <script>
 	var i18n_reminder = '$encoder.jsEscape( $i18n.getString( "reminder" ) , "'")';   
 	var i18n_remove_reminder = '$encoder.jsEscape( $i18n.getString( "remove_reminder" ) , "'")';   
-	var i18n_days_before_after_enrollment_date = '$encoder.jsEscape( $i18n.getString( "days_before_after_enrollment_date" ) , "'")';   
+	var i18n_days_before_after_comparison_date = '$encoder.jsEscape( $i18n.getString( "days_before_after_comparison_date" ) , "'")';   
 	var i18n_params = '$encoder.jsEscape( $i18n.getString( "params" ) , "'")';   
 	var i18n_patient_name = '$encoder.jsEscape( $i18n.getString( "patient_name" ) , "'")';   
 	var i18n_program_name = '$encoder.jsEscape( $i18n.getString( "program_name" ) , "'")';   
 	var i18n_incident_date = '$encoder.jsEscape( $i18n.getString( "incident_date" ) , "'")';   
 	var i18n_days_since_incident_date = '$encoder.jsEscape( $i18n.getString( "days_since_incident_date" ) , "'")';   
 	var i18n_orgunit_name = '$encoder.jsEscape( $i18n.getString( "orgunit_name" ) , "'")';   
-	var i18n_enrollement_date = '$encoder.jsEscape( $i18n.getString( "enrollement_date" ) , "'")';   
+	var i18n_enrollment_date = '$encoder.jsEscape( $i18n.getString( "enrollement_date" ) , "'")';   
 	var i18n_days_since_enrollment_date = '$encoder.jsEscape( $i18n.getString( "days_since_enrollment_date" ) , "'")';   
 	var i18n_message = '$encoder.jsEscape( $i18n.getString( "message" ) , "'")';   
 	var i18n_name_exists = '$encoder.jsEscape( $i18n.getString( "name_exists" ) , "'")';   
+	var i18n_date_to_compare = '$encoder.jsEscape( $i18n.getString( "date_to_compare" ) , "'")'; 
 </script>