← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 7917: ( multiple entry form ) Allow to create many repeatable events of a program.

 

------------------------------------------------------------
revno: 7917
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2012-08-16 09:08:22 +0700
message:
  ( multiple entry form ) Allow to create many repeatable events of a program.
modified:
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/ProgramEnrollmentAction.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/colorHelp.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataRecordingSelect.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataentryRecords.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/commons.js
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/entry.js
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/multiDataEntry.js
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/patient.js
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/relationshipPatient.js
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/report.js
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/multiDataEntrySelect.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programEnrollmentForm.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programStageInstanceFlow.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/style/style.css


--
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-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/ProgramEnrollmentAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/ProgramEnrollmentAction.java	2012-06-18 03:29:11 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/ProgramEnrollmentAction.java	2012-08-16 02:08:22 +0000
@@ -53,6 +53,7 @@
 import org.hisp.dhis.program.ProgramInstanceService;
 import org.hisp.dhis.program.ProgramService;
 import org.hisp.dhis.program.ProgramStageInstance;
+import org.hisp.dhis.program.ProgramStageInstanceService;
 
 import com.opensymphony.xwork2.Action;
 
@@ -73,6 +74,8 @@
 
     private ProgramInstanceService programInstanceService;
 
+    private ProgramStageInstanceService programStageInstanceService;
+
     private PatientIdentifierTypeService identifierTypeService;
 
     private PatientIdentifierService patientIdentifierService;
@@ -113,6 +116,8 @@
 
     private Boolean hasDataEntry;
 
+    private Map<Integer, Integer> statusMap = new HashMap<Integer, Integer>();
+
     // -------------------------------------------------------------------------
     // Getters/Setters
     // -------------------------------------------------------------------------
@@ -182,6 +187,11 @@
         this.programInstanceService = programInstanceService;
     }
 
+    public void setProgramStageInstanceService( ProgramStageInstanceService programStageInstanceService )
+    {
+        this.programStageInstanceService = programStageInstanceService;
+    }
+
     public Collection<PatientIdentifierType> getIdentifierTypes()
     {
         return identifierTypes;
@@ -222,6 +232,11 @@
         return hasDataEntry;
     }
 
+    public Map<Integer, Integer> getStatusMap()
+    {
+        return statusMap;
+    }
+
     // -------------------------------------------------------------------------
     // Action implementation
     // -------------------------------------------------------------------------
@@ -248,6 +263,12 @@
 
             programStageInstances = programInstance.getProgramStageInstances();
 
+            if ( program.isRegistration() && programInstance.getProgramStageInstances() != null )
+            {
+                statusMap = programStageInstanceService.statusProgramStageInstances( programInstance
+                    .getProgramStageInstances() );
+            }
+
             loadIdentifierTypes();
 
             loadPatientAttributes();
@@ -289,8 +310,8 @@
         // Load patient-attributes of the selected program
         // ---------------------------------------------------------------------
 
-        attributeGroups = new ArrayList<PatientAttributeGroup>( patientAttributeGroupService
-            .getPatientAttributeGroups( program ) );
+        attributeGroups = new ArrayList<PatientAttributeGroup>(
+            patientAttributeGroupService.getPatientAttributeGroups( program ) );
         Collections.sort( attributeGroups, new PatientAttributeGroupSortOrderComparator() );
 
         noGroupAttributes = patientAttributeService.getPatientAttributes( program, null );
@@ -300,8 +321,8 @@
 
         for ( PatientAttributeValue patientAttributeValue : patientAttributeValues )
         {
-            patientAttributeValueMap.put( patientAttributeValue.getPatientAttribute().getId(), patientAttributeValue
-                .getValue() );
+            patientAttributeValueMap.put( patientAttributeValue.getPatientAttribute().getId(),
+                patientAttributeValue.getValue() );
         }
     }
 

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml	2012-08-15 02:57:56 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml	2012-08-16 02:08:22 +0000
@@ -635,6 +635,8 @@
 			ref="org.hisp.dhis.patientattributevalue.PatientAttributeValueService" />
 		<property name="selectedStateManager"
 			ref="org.hisp.dhis.caseentry.state.SelectedStateManager" />
+		<property name="programStageInstanceService"
+			ref="org.hisp.dhis.program.ProgramStageInstanceService" />
 	</bean>
 
 	<bean

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/colorHelp.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/colorHelp.vm	2012-08-01 15:57:03 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/colorHelp.vm	2012-08-16 02:08:22 +0000
@@ -1,4 +1,4 @@
-<a href="javascript:showColorHelp()" id="colorHelpLink" title="$i18n.getString( 'what_do_colors_mean' )" class="hidden page">$i18n.getString('what_do_colors_mean')</a>
+<a href="javascript:showColorHelp()" id="colorHelpLink" title="$i18n.getString( 'what_do_colors_mean' )">$i18n.getString('what_do_colors_mean')</a>
 <div id="colorHelpDiv" class="hidden history page">
 	<table class="colorHelpTable">
 		<col width='80px;'/>

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataRecordingSelect.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataRecordingSelect.vm	2012-08-15 02:57:56 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataRecordingSelect.vm	2012-08-16 02:08:22 +0000
@@ -1,48 +1,11 @@
 <form id='dataRecordingSelectForm' name='dataRecordingSelectForm' method='post'>
-<table class="mainPageTable" id='patientInfoDiv'> 
-	<tr>
-		<td valign="top">
-	<table>
-		<tr>            
-			<td class="bold">$i18n.getString( "full_name" ):</td>
-			<td>$encoder.htmlEncode( $patient.getFullName() )<td>
-		</tr>
-		<tr>
-			<td class="bold">$i18n.getString( "gender" ):</td>
-			<td>$i18n.getString( $patient.gender )</td>
-		</tr>
-		<tr>
-			<td class="bold">$i18n.getString( "date_of_birth" ):</td>
-			<td>$format.formatDate( $patient.birthDate ) $patient.getAge()<td>
-		</tr>
-		</table>
-	</tr>
-</table>
-
 #parse( "/dhis-web-caseentry/colorHelp.vm" )
 </p>
-		
-<div id='inputCriteria' class="page inputCriteria" style="width:490px;height:29px;">	
-	<input type='hidden' id='programStageId' name='programStageId'>
-	<table>
-	   <tr id='programIdTR'>
-			<td class='text-column'><label for="programId">$i18n.getString( "program" )</label></td>
-			<td>
-				<select id="programId" name="programId" class="criteria" onchange="loadProgramStages();" #if( $programs.size() == 0 ) disabled="disabled" #end>
-					<option value="0">[$i18n.getString( "select" )]</option>
-					#foreach( $program in $programs )
-						<option value="$program.id" type="$program.type" #if( $programId && $program.id == $programId ) selected="selected" #end>$encoder.htmlEncode( $program.name )</option>
-					#end
-				</select>
-			</td>
-		</tr>
-	</table>
-</div>
 
 <div id='programInstanceDiv' class='hidden'>
 	#parse( "/dhis-web-caseentry/programStageInstanceFlow.vm" )
 	<br>		
-	<table id='executionDateTB'>
+	<table id='executionDateTB' class='hidden'>
 		<tr>
 			<th class='text-column'><label for="executionDate">$i18n.getString( "report_date" ) </label></th>
 			<th><input type="text" id="executionDate" name="executionDate" class='criteria' value="$!format.formatDate( $programStageInstance.executionDate )" >
@@ -55,10 +18,9 @@
 		</tr>
 	</table>
 </div>
-
 </form>
 
-<p></p>
+<p></p> 
 
 <script>
 	jQuery('#dataRecordingSelectForm').ready(function(){ 
@@ -66,8 +28,7 @@
 		var programs = byId('programId');
 		if( programs.options.length == 2 )
 		{
-			 byId('programId').selectedIndex = 1;
-			 loadProgramStages();
+			byId('programId').selectedIndex = 1;
 		}
 	});
 </script>

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataentryRecords.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataentryRecords.vm	2012-08-13 05:15:26 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataentryRecords.vm	2012-08-16 02:08:22 +0000
@@ -36,6 +36,7 @@
 						#set($programStageInstances = $programStageInstanceMap.get($programInstance) )
 						<td>
 							#parse( "/dhis-web-caseentry/programStageInstanceFlow.vm" )
+							#parse( "/dhis-web-caseentry/addRepeatableEventForm.vm" )
 						</td>
 					#end
 				</tr>

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/commons.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/commons.js	2012-08-13 06:36:23 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/commons.js	2012-08-16 02:08:22 +0000
@@ -453,4 +453,111 @@
 
 function moveRight(programInstanceFlowDiv){
 	jQuery("#" + programInstanceFlowDiv).animate({scrollLeft: "+=200"}, 'fast');
-}
\ No newline at end of file
+}
+
+// ----------------------------------------------------------------------------
+// Create New Event
+// ----------------------------------------------------------------------------
+
+function showCreateNewEvent( programInstanceId )
+{
+	jQuery('#createNewEncounterDiv_' + programInstanceId ).dialog({
+			title: i18n_create_new_event,
+			maximize: true, 
+			closable: true,
+			modal:false,
+			overlay:{background:'#000000', opacity:0.1},
+			width: 450,
+			height: 160
+		}).show('fast');
+		
+	var standardInterval =  jQuery('#dataRecordingSelectDiv [name=programStageId] option:selected').attr('standardInterval');
+	var date = new Date();
+	var d = date.getDate() + eval(standardInterval);
+	var m = date.getMonth();
+	var y = date.getFullYear();
+	var edate= new Date(y, m, d);
+							
+	jQuery( '#dueDateNewEncounter_' + programInstanceId ).datepicker( "setDate" , edate );
+}
+
+function closeDueDateDiv( programInstanceId )
+{
+	jQuery('#createNewEncounterDiv_' + programInstanceId).dialog('close');
+}
+
+//------------------------------------------------------
+// Register Irregular-encounter
+//------------------------------------------------------
+
+function registerIrregularEncounter( programInstanceId, programStageId, programStageName, dueDate )
+{
+	setInnerHTML('createEventMessage_' + programInstanceId,'');
+	jQuery.postJSON( "registerIrregularEncounter.action",
+		{ 
+			programInstanceId:programInstanceId,
+			programStageId: programStageId, 
+			dueDate: dueDate 
+		}, 
+		function( json ) 
+		{   
+			var programStageInstanceId = json.message;
+			disableCompletedButton(false);
+			
+			var elementId = prefixId + programStageInstanceId;
+			var flag = false;
+			jQuery("#programStageIdTR_" + programInstanceId + " input[name='programStageBtn']").each(function(i,item){
+				var element = jQuery(item);
+				var dueDateInStage = element.attr('dueDate');
+				
+				if( dueDate < dueDateInStage && !flag)
+				{	
+					jQuery('<td><input name="programStageBtn" '
+						+ 'id="' + elementId + '" ' 
+						+ 'psid="' + programStageInstanceId + '" '
+						+ 'psname="' + programStageName + '" '
+						+ 'dueDate="' + dueDate + '" '
+						+ 'value="'+ programStageName + ' ' + dueDate + '" '
+						+ 'onclick="javascript:loadDataEntry(' + programStageInstanceId + ')" '
+						+ 'type="button" class="stage-object" '
+						+ '></td>'
+						+ '<td><img src="images/rightarrow.png"></td>')
+					.insertBefore(element.parent());
+					setEventColorStatus( elementId, 3 );
+					flag = true;
+				}
+			});
+			
+			if( !flag )
+			{
+				jQuery("#programStageIdTR_" + programInstanceId).append('<td><img src="images/rightarrow.png"></td>'
+					+ '<td><input name="programStageBtn" '
+					+ 'id="' + elementId + '" ' 
+					+ 'psid="' + programStageInstanceId + '" '
+					+ 'psname="' + programStageName + '" '
+					+ 'dueDate="' + dueDate + '" '
+					+ 'value="'+ programStageName + ' ' + dueDate + '" '
+					+ 'onclick="javascript:loadDataEntry(' + programStageInstanceId + ')" '
+					+ 'type="button" class="stage-object" '
+					+ '></td>');
+				setEventColorStatus( elementId, 3 );
+			}
+			setInnerHTML('createEventMessage_' + programInstanceId,i18n_create_event_success);
+		});
+}
+
+function disableCompletedButton( disabled )
+{
+	if(disabled){
+		disable('completeBtn');
+		disable('completeAndAddNewBtn');
+		enable('uncompleteBtn');
+		enable('uncompleteAndAddNewBtn');
+	}
+	else{
+		enable('completeBtn');
+		enable('completeAndAddNewBtn');
+		disable('uncompleteBtn');
+		disable('uncompleteAndAddNewBtn');
+	}
+}

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/entry.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/entry.js	2012-08-15 02:57:56 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/entry.js	2012-08-16 02:08:22 +0000
@@ -19,7 +19,6 @@
 	disable('validationBtn');
 	hideById('inputCriteriaDiv');
 	$('#programStageIdTR').html('');
-	hideById('programInstanceDiv');
 	hideById('colorHelpLink');
 	
 	var programId = jQuery('#dataRecordingSelectDiv [name=programId]').val();
@@ -34,7 +33,6 @@
 		},  
 		function( json ) 
 		{    
-			showById('programInstanceDiv');
 			hideById('executionDateTB');
 			if(byId('repeatableProgramStageId').options.length == 0)
 			{
@@ -91,55 +89,6 @@
 	});
 }
 
-//--------------------------------------------------------------------------------------------
-// Load data-entry-form
-//--------------------------------------------------------------------------------------------
-
-function loadDataEntry( programStageInstanceId )
-{
-	setInnerHTML('dataEntryFormDiv', '');
-	showById('executionDateTB');
-	showById('dataEntryFormDiv');
-	setFieldValue( 'dueDate', '' );
-	setFieldValue( 'executionDate', '' );
-	disable('validationBtn');
-	disableCompletedButton(true);
-	disable('uncompleteBtn');
-	
-	jQuery(".stage-object-selected").removeClass('stage-object-selected');
-	var selectedProgramStageInstance = jQuery( '#' + prefixId + programStageInstanceId );
-	selectedProgramStageInstance.addClass('stage-object-selected');
-	setFieldValue( 'programStageId', selectedProgramStageInstance.attr('psid') );
-	
-	showLoader();	
-	$( '#dataEntryFormDiv' ).load( "dataentryform.action", 
-		{ 
-			programStageInstanceId: programStageInstanceId
-		},function( )
-		{
-			var executionDate = jQuery('#dataRecordingSelectDiv input[id=executionDate]').val();
-			var completed = jQuery('#entryFormContainer input[id=completed]').val();
-			var irregular = jQuery('#entryFormContainer input[id=irregular]').val();
-			showById('inputCriteriaDiv');
-			enable('validationBtn');
-			if( executionDate == '' )
-			{
-				disable('validationBtn');
-			}
-			else if( executionDate != '' && completed == 'false' )
-			{
-				disableCompletedButton(false);
-			}
-			else if( completed == 'true' )
-			{
-				disableCompletedButton(true);
-			}
-			
-			hideLoader();
-			hideById('contentDiv'); 
-		} );
-}
-
 //------------------------------------------------------------------------------
 // Save value
 //------------------------------------------------------------------------------
@@ -620,7 +569,8 @@
 					var irregular = jQuery('#entryFormContainer [name=irregular]').val();
 					if( irregular == 'true' )
 					{
-						showCreateNewEvent();
+						var programInstanceId = jQuery('#entryFormContainer [id=programInstanceId]').val()
+						showCreateNewEvent( programInstanceId );
 					}
 					
 					var selectedProgram = jQuery('#dataRecordingSelectForm [name=programId] option:selected');
@@ -662,33 +612,6 @@
     
 }
 
-function showCreateNewEvent()
-{
-	jQuery('#createNewEncounterDiv').dialog({
-			title: i18n_create_new_event,
-			maximize: true, 
-			closable: true,
-			modal:false,
-			overlay:{background:'#000000', opacity:0.1},
-			width: 450,
-			height: 160
-		}).show('fast');
-		
-	var standardInterval =  jQuery('#dataRecordingSelectDiv [name=programStageId] option:selected').attr('standardInterval');
-	var date = new Date();
-	var d = date.getDate() + eval(standardInterval);
-	var m = date.getMonth();
-	var y = date.getFullYear();
-	var edate= new Date(y, m, d);
-							
-	jQuery('#dueDateNewEncounter').datepicker( "setDate" , edate );
-}
-
-function closeDueDateDiv()
-{
-	jQuery('#createNewEncounterDiv').dialog('close');
-}
-
 TOGGLE = {
     init : function() {
         jQuery(".togglePanel").each(function(){
@@ -757,65 +680,6 @@
 		});
 }
 
-//------------------------------------------------------
-// Register Irregular-encounter
-//------------------------------------------------------
-
-function registerIrregularEncounter( programInstanceId, programStageId, programStageName, dueDate )
-{
-	setInnerHTML('createEventMessage','');
-	jQuery.postJSON( "registerIrregularEncounter.action",
-		{ 
-			programInstanceId:programInstanceId,
-			programStageId: programStageId, 
-			dueDate: dueDate 
-		}, 
-		function( json ) 
-		{   
-			var programStageInstanceId = json.message;
-			disableCompletedButton(false);
-			
-			var elementId = prefixId + programStageInstanceId;
-			var flag = false;
-			jQuery("#programStageIdTR input[name='programStageBtn']").each(function(i,item){
-				var element = jQuery(item);
-				var dueDateInStage = element.attr('dueDate');
-				
-				if( dueDate < dueDateInStage && !flag)
-				{	
-					jQuery('<td><input name="programStageBtn" '
-						+ 'id="' + elementId + '" ' 
-						+ 'psid="' + programStageInstanceId + '" '
-						+ 'psname="' + programStageName + '" '
-						+ 'dueDate="' + dueDate + '" '
-						+ 'value="'+ programStageName + ' ' + dueDate + '" '
-						+ 'onclick="javascript:loadDataEntry(' + programStageInstanceId + ')" '
-						+ 'type="button" class="stage-object" '
-						+ '></td>'
-						+ '<td><img src="images/rightarrow.png"></td>')
-					.insertBefore(element.parent());
-					setEventColorStatus( elementId, 3 );
-					flag = true;
-				}
-			});
-			
-			if( !flag )
-			{
-				jQuery("#programStageIdTR").append('<td><img src="images/rightarrow.png"></td>'
-					+ '<td><input name="programStageBtn" '
-					+ 'id="' + elementId + '" ' 
-					+ 'psid="' + programStageInstanceId + '" '
-					+ 'psname="' + programStageName + '" '
-					+ 'dueDate="' + dueDate + '" '
-					+ 'value="'+ programStageName + ' ' + dueDate + '" '
-					+ 'onclick="javascript:loadDataEntry(' + programStageInstanceId + ')" '
-					+ 'type="button" class="stage-object" '
-					+ '></td>');
-				setEventColorStatus( elementId, 3 );
-			}
-			setInnerHTML('createEventMessage',i18n_create_event_success);
-		});
-}
 
 function autocompletedField( idField )
 {
@@ -894,19 +758,3 @@
 			input.focus();
 		});
 }
-
-function disableCompletedButton( disabled )
-{
-	if(disabled){
-		disable('completeBtn');
-		disable('completeAndAddNewBtn');
-		enable('uncompleteBtn');
-		enable('uncompleteAndAddNewBtn');
-	}
-	else{
-		enable('completeBtn');
-		enable('completeAndAddNewBtn');
-		disable('uncompleteBtn');
-		disable('uncompleteAndAddNewBtn');
-	}
-}

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/multiDataEntry.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/multiDataEntry.js	2012-08-07 05:43:56 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/multiDataEntry.js	2012-08-16 02:08:22 +0000
@@ -56,7 +56,7 @@
 	});
 }
 
-function viewPrgramStageRecords( programStageInstanceId ) 
+function loadDataEntry( programStageInstanceId ) 
 {
 	jQuery("#patientList input[name='programStageBtn']").each(function(i,item){
 		jQuery(item).removeClass('stage-object-selected');

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/patient.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/patient.js	2012-08-12 06:10:50 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/patient.js	2012-08-16 02:08:22 +0000
@@ -787,7 +787,7 @@
 			$('#dataRecordingSelectDiv [id=programId]').val( programId );
 			$('#dataRecordingSelectDiv [id=inputCriteria]').hide();
 			
-			loadProgramStages();
+			//loadProgramStages();
 			hideLoader();
 			hideById('contentDiv');
 		});

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/relationshipPatient.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/relationshipPatient.js	2012-07-30 03:39:34 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/relationshipPatient.js	2012-08-16 02:08:22 +0000
@@ -1,3 +1,51 @@
+//------------------------------------------------------------------------------
+// Load data entry form
+//------------------------------------------------------------------------------
+
+function loadDataEntry( programStageInstanceId )
+{
+	setInnerHTML('dataEntryFormDiv', '');
+	showById('executionDateTB');
+	showById('dataEntryFormDiv');
+	setFieldValue( 'dueDate', '' );
+	setFieldValue( 'executionDate', '' );
+	disable('validationBtn');
+	disableCompletedButton(true);
+	disable('uncompleteBtn');
+	
+	jQuery(".stage-object-selected").removeClass('stage-object-selected');
+	var selectedProgramStageInstance = jQuery( '#' + prefixId + programStageInstanceId );
+	selectedProgramStageInstance.addClass('stage-object-selected');
+	setFieldValue( 'programStageId', selectedProgramStageInstance.attr('psid') );
+	
+	showLoader();	
+	$( '#dataEntryFormDiv' ).load( "dataentryform.action", 
+		{ 
+			programStageInstanceId: programStageInstanceId
+		},function( )
+		{
+			var executionDate = jQuery('#dataRecordingSelectDiv input[id=executionDate]').val();
+			var completed = jQuery('#entryFormContainer input[id=completed]').val();
+			var irregular = jQuery('#entryFormContainer input[id=irregular]').val();
+			showById('inputCriteriaDiv');
+			enable('validationBtn');
+			if( executionDate == '' )
+			{
+				disable('validationBtn');
+			}
+			else if( executionDate != '' && completed == 'false' )
+			{
+				disableCompletedButton(false);
+			}
+			else if( completed == 'true' )
+			{
+				disableCompletedButton(true);
+			}
+			
+			hideLoader();
+			hideById('contentDiv'); 
+		} );
+}
 
 //------------------------------------------------------------------------------
 // Add Relationship

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/report.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/report.js	2012-07-09 03:38:52 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/report.js	2012-08-16 02:08:22 +0000
@@ -47,13 +47,14 @@
 		endDate: getFieldValue( 'endDate' )
 	}, function() 
 	{ 
+		jQuery( "[name=newEncounterBtn]" ).addClass("hidden");
 		hideLoader();
 		hideById( 'message' );
 		showById( 'contentDiv' );
 	});
 }
 
-function viewRecords( programStageInstanceId ) 
+function loadDataEntry( programStageInstanceId ) 
 {
 	$('#viewRecordsDiv' )
 		.load( 'viewRecords.action?id=' + programStageInstanceId )

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/multiDataEntrySelect.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/multiDataEntrySelect.vm	2012-08-13 07:40:34 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/multiDataEntrySelect.vm	2012-08-16 02:08:22 +0000
@@ -56,6 +56,7 @@
 	var i18n_color_quick_help = '$encoder.jsEscape( $i18n.getString( "color_quick_help" ) , "'")';
 	var i18n_male = '$encoder.jsEscape( $i18n.getString( "male" ) , "'")';
 	var i18n_female = '$encoder.jsEscape( $i18n.getString( "female" ) , "'")';
-
+	var i18n_create_new_event = '$encoder.jsEscape( $i18n.getString( "create_new_event" ) , "'")';
+	
 	var searchTextBox = '<input type="text" id="searchText" name="searchText" onkeyup="searchPatientsOnKeyUp( event );">';
 </script>

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programEnrollmentForm.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programEnrollmentForm.vm	2012-08-15 02:57:56 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programEnrollmentForm.vm	2012-08-16 02:08:22 +0000
@@ -12,7 +12,28 @@
 	
 	
 	<div id="tab-1">
-		<div id='dataRecordingSelectDiv' class='hidden'></div>
+		<div id='dataRecordingSelectDiv'>
+			<form id='dataRecordingSelectForm' name='dataRecordingSelectForm' method='post'>
+				#parse( "/dhis-web-caseentry/colorHelp.vm" )
+				</p>
+				<div id='programInstanceDiv'>
+					#parse( "/dhis-web-caseentry/programStageInstanceFlow.vm" )
+					<br>		
+					<table id='executionDateTB' class='hidden'>
+						<tr>
+							<th class='text-column'><label for="executionDate">$i18n.getString( "report_date" ) </label></th>
+							<th><input type="text" id="executionDate" name="executionDate" class='criteria' value="$!format.formatDate( $programStageInstance.executionDate )" >
+								<script type="text/javascript">
+								   datePickerValid( 'executionDate', false );
+								</script>
+							</th>
+							<th class='text-column'><label for="dueDate">$i18n.getString( "due_date" ) </label></th>
+							<th><input type="text" id="dueDate" name="dueDate" class='criteria' value="$!format.formatDate( $programStageInstance.dueDate )" readonly > </th>
+						</tr>
+					</table>
+				</div>
+			</form>
+		</div>
 		<div id='dataEntryFormDiv' class='hidden'></div>
 	</div>
 	
@@ -207,7 +228,6 @@
 		#end
 		
 		#if( $hasDataEntry == 'true' )
-			showSelectedDataRecoding( getFieldValue('patientId') );
 			$( "#tabs" ).tabs( "option", "selected", 0 );
 		#else
 			$( "#tabs" ).tabs( "option", "disabled", [0] );

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programStageInstanceFlow.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programStageInstanceFlow.vm	2012-08-15 02:57:56 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programStageInstanceFlow.vm	2012-08-16 02:08:22 +0000
@@ -1,4 +1,4 @@
-<table id='programStageIdTB$!programInstance.id' style="width:850px;height:125px;">
+<table id='programStageIdTB_$!programInstance.id' style="width:850px;height:125px;">
 	<tr>
 		<td>
 			<div class="arrow-left" onclick="moveLeft('flow_$!programInstance.id')">&nbsp;</div>
@@ -6,13 +6,20 @@
 		<td>
 			<div id='flow_$!programInstance.id' class="stage-flow">
 				<table class="stage-flow">											
-					<tr id='programStageIdTR'>
-						#foreach( $programStageInstance in $programStageInstances )
+					<tr id='programStageIdTR_$!programInstance.id'>
+						#foreach( $programStageInstance in $programInstance.programStageInstances )
 						<td>
 							<img src='images/rightarrow.png'>
 						</td>
 						<td>
-							<input type='button' id='ps_$programStageInstance.id' name='programStageBtn' class='stage-object' value='$programStageInstance.programStage.name $format.formatDate( $programStageInstance.dueDate )' onclick='javascript:viewPrgramStageRecords( $programStageInstance.id );'>
+							<input type="button" name="programStageBtn"
+								id="ps_$!programStageInstance.id"
+								psid="$programStageInstance.programStage.id"
+								psname="$programStageName.programStage.name"
+								dueDate="$format.formatDate( $programStageInstance.dueDate )"
+								class="stage-object" 
+								value="$programStageInstance.programStage.name $format.formatDate( $programStageInstance.dueDate )" 
+								onclick="javascript:loadDataEntry( $programStageInstance.id );">
 							<script>	
 								var status = $statusMap.get( $programStageInstance.id ); 
 								setEventColorStatus( 'ps_' + $programStageInstance.id ,status);
@@ -28,7 +35,52 @@
 		</td>
 		<td>&nbsp;</td>
 		<td>
-			<input type="button" class='stage-object' id="newEncounterBtn$!programInstance.id" name="newEncounterBtn$!programInstance.id" value="$i18n.getString('create_new_event')" onClick="javascript:showCreateNewEvent();" #if($!programInstance.id) style='display:none' #end>
+			<input type="button" class='stage-object' id="newEncounterBtn_$!programInstance.id" name="newEncounterBtn" value="$i18n.getString('create_new_event')" onClick="javascript:showCreateNewEvent('$!programInstance.id');" >
 		</td>
 	</tr>			
 </table>
+
+<div id='createNewEncounterDiv_$!programInstance.id' class='hidden'>
+	<table>
+		<tr>
+			<td>$i18n.getString( 'program_stage' )</td>
+			<td>
+				<select id='repeatableProgramStageId' name='repeatableProgramStageId'>
+					#foreach( $programStage in $programInstance.program.programStages )
+						#if( $programStage.irregular=='true')
+							<option value="$programStage.id">$!programStage.name</option>
+						#end
+					#end
+				</select>
+			</td>
+		</tr>
+		<tr>
+			<td>$i18n.getString( 'due_date' )</td>
+			<td><input id='dueDateNewEncounter_$programInstance.id' name='dueDateNewEncounter_$!programInstance.id' style='width:260px;'></td>
+			<script type="text/javascript">
+			   datePicker( 'dueDateNewEncounter_$programInstance.id', false );
+			</script>
+		</tr>
+		<tr>
+			<td></td>
+			<td>
+				<input type='button' value='$i18n.getString("create")' onclick='registerIrregularEncounter( "$!programInstance.id",getFieldValue("repeatableProgramStageId"), jQuery("#repeatableProgramStageId option:selected").text(),getFieldValue("dueDateNewEncounter_$programInstance.id" ) );' />
+				<input type='button' value='$i18n.getString("cancel")' onclick="closeDueDateDiv('$!programInstance.id');" />
+			</td>
+		</tr>
+		</tr>
+		<tr>
+			<td></td>
+			<td id='createEventMessage_$!programInstance.id' style='color:green'></td>
+		</tr>
+	</table>
+</div>
+
+<script>
+	var i18n_create_event_success = '$encoder.jsEscape( $i18n.getString( "create_event_success" ) , "'" )';
+	var options = jQuery("#createNewEncounterDiv_$!programInstance.id [id=repeatableProgramStageId] option").length;
+	if( options==0 )
+		jQuery("[name=newEncounterBtn]").addClass("hidden");
+</script>
+
+

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/style/style.css'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/style/style.css	2012-08-15 02:57:56 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/style/style.css	2012-08-16 02:08:22 +0000
@@ -157,12 +157,12 @@
 
 input.stage-object[type="button"]:hover
 {
-	opacity: 0.75;
+	border: 5px solid;
 }
 
 input.stage-object-selected[type="button"]
 {
-    opacity: 0.75;
+    border: 5px solid;
 }
 
 input.patient-object[type="button"]