← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 7969: Merge dashboard into program-enrollment form.

 

------------------------------------------------------------
revno: 7969
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2012-08-28 12:48:46 +0700
message:
  Merge dashboard into program-enrollment form.
added:
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonProgramEnrollment.vm
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/java/org/hisp/dhis/caseentry/action/patient/ProgramEnrollmentSelectAction.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/RemoveEnrollmentAction.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/SaveProgramEnrollmentAction.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/resources/org/hisp/dhis/caseentry/i18n_module.properties
  dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/struts.xml
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataEntryForm.vm
  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/patientDashboard.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientRegistrationList.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/programEnrollmentSelectForm.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/selectPatient.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-08-16 02:08:22 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/ProgramEnrollmentAction.java	2012-08-28 05:48:46 +0000
@@ -35,7 +35,6 @@
 
 import org.hisp.dhis.caseentry.state.SelectedStateManager;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
-import org.hisp.dhis.patient.Patient;
 import org.hisp.dhis.patient.PatientAttribute;
 import org.hisp.dhis.patient.PatientAttributeGroup;
 import org.hisp.dhis.patient.PatientAttributeGroupService;
@@ -44,14 +43,12 @@
 import org.hisp.dhis.patient.PatientIdentifierService;
 import org.hisp.dhis.patient.PatientIdentifierType;
 import org.hisp.dhis.patient.PatientIdentifierTypeService;
-import org.hisp.dhis.patient.PatientService;
 import org.hisp.dhis.patient.comparator.PatientAttributeGroupSortOrderComparator;
 import org.hisp.dhis.patientattributevalue.PatientAttributeValue;
 import org.hisp.dhis.patientattributevalue.PatientAttributeValueService;
 import org.hisp.dhis.program.Program;
 import org.hisp.dhis.program.ProgramInstance;
 import org.hisp.dhis.program.ProgramInstanceService;
-import org.hisp.dhis.program.ProgramService;
 import org.hisp.dhis.program.ProgramStageInstance;
 import org.hisp.dhis.program.ProgramStageInstanceService;
 
@@ -68,10 +65,6 @@
     // Dependencies
     // -------------------------------------------------------------------------
 
-    private PatientService patientService;
-
-    private ProgramService programService;
-
     private ProgramInstanceService programInstanceService;
 
     private ProgramStageInstanceService programStageInstanceService;
@@ -92,16 +85,10 @@
     // Input/Output
     // -------------------------------------------------------------------------
 
-    private Integer patientId;
-
-    private Integer programId;
+    private Integer programInstanceId;
 
     private Map<Integer, String> identiferMap;
 
-    private Patient patient;
-
-    private Program program;
-
     private ProgramInstance programInstance;
 
     private Collection<ProgramStageInstance> programStageInstances = new ArrayList<ProgramStageInstance>();
@@ -127,11 +114,6 @@
         this.selectedStateManager = selectedStateManager;
     }
 
-    public void setPatientService( PatientService patientService )
-    {
-        this.patientService = patientService;
-    }
-
     public Collection<PatientAttribute> getNoGroupAttributes()
     {
         return noGroupAttributes;
@@ -176,12 +158,7 @@
     {
         this.identifierTypeService = identifierTypeService;
     }
-
-    public void setProgramService( ProgramService programService )
-    {
-        this.programService = programService;
-    }
-
+    
     public void setProgramInstanceService( ProgramInstanceService programInstanceService )
     {
         this.programInstanceService = programInstanceService;
@@ -192,36 +169,21 @@
         this.programStageInstanceService = programStageInstanceService;
     }
 
+    public void setProgramInstanceId( Integer programInstanceId )
+    {
+        this.programInstanceId = programInstanceId;
+    }
+
     public Collection<PatientIdentifierType> getIdentifierTypes()
     {
         return identifierTypes;
     }
 
-    public void setPatientId( Integer patientId )
-    {
-        this.patientId = patientId;
-    }
-
     public ProgramInstance getProgramInstance()
     {
         return programInstance;
     }
 
-    public Patient getPatient()
-    {
-        return patient;
-    }
-
-    public Program getProgram()
-    {
-        return program;
-    }
-
-    public void setProgramId( Integer programId )
-    {
-        this.programId = programId;
-    }
-
     public Collection<ProgramStageInstance> getProgramStageInstances()
     {
         return programStageInstances;
@@ -246,35 +208,25 @@
     {
         OrganisationUnit orgunit = selectedStateManager.getSelectedOrganisationUnit();
 
-        patient = patientService.getPatient( patientId );
-
-        program = programService.getProgram( programId );
-
         // ---------------------------------------------------------------------
         // Load active ProgramInstance, completed = false
         // ---------------------------------------------------------------------
 
-        Collection<ProgramInstance> programInstances = programInstanceService.getProgramInstances( patient, program,
-            false );
-
-        if ( programInstances.iterator().hasNext() )
+        programInstance = programInstanceService.getProgramInstance( programInstanceId );
+
+        programStageInstances = programInstance.getProgramStageInstances();
+
+        if ( programInstance.getProgram().isRegistration() && programInstance.getProgramStageInstances() != null )
         {
-            programInstance = programInstances.iterator().next();
-
-            programStageInstances = programInstance.getProgramStageInstances();
-
-            if ( program.isRegistration() && programInstance.getProgramStageInstances() != null )
-            {
-                statusMap = programStageInstanceService.statusProgramStageInstances( programInstance
-                    .getProgramStageInstances() );
-            }
-
-            loadIdentifierTypes();
-
-            loadPatientAttributes();
+            statusMap = programStageInstanceService.statusProgramStageInstances( programInstance
+                .getProgramStageInstances() );
         }
 
-        hasDataEntry = showDataEntry( orgunit, program, programInstance );
+        loadIdentifierTypes(programInstance);
+
+        loadPatientAttributes(programInstance);
+
+        hasDataEntry = showDataEntry( orgunit, programInstance.getProgram(), programInstance );
 
         return SUCCESS;
     }
@@ -283,19 +235,19 @@
     // Supportive methods
     // -------------------------------------------------------------------------
 
-    private void loadIdentifierTypes()
+    private void loadIdentifierTypes( ProgramInstance programInstance )
     {
         // ---------------------------------------------------------------------
         // Load identifier types of the selected program
         // ---------------------------------------------------------------------
 
-        identifierTypes = identifierTypeService.getPatientIdentifierTypes( program );
+        identifierTypes = identifierTypeService.getPatientIdentifierTypes( programInstance.getProgram() );
         identiferMap = new HashMap<Integer, String>();
 
         if ( identifierTypes != null && identifierTypes.size() > 0 )
         {
             Collection<PatientIdentifier> patientIdentifiers = patientIdentifierService.getPatientIdentifiers(
-                identifierTypes, patient );
+                identifierTypes, programInstance.getPatient() );
 
             for ( PatientIdentifier identifier : patientIdentifiers )
             {
@@ -304,20 +256,20 @@
         }
     }
 
-    private void loadPatientAttributes()
+    private void loadPatientAttributes( ProgramInstance programInstance )
     {
         // ---------------------------------------------------------------------
         // Load patient-attributes of the selected program
         // ---------------------------------------------------------------------
 
         attributeGroups = new ArrayList<PatientAttributeGroup>(
-            patientAttributeGroupService.getPatientAttributeGroups( program ) );
+            patientAttributeGroupService.getPatientAttributeGroups( programInstance.getProgram() ) );
         Collections.sort( attributeGroups, new PatientAttributeGroupSortOrderComparator() );
 
-        noGroupAttributes = patientAttributeService.getPatientAttributes( program, null );
+        noGroupAttributes = patientAttributeService.getPatientAttributes( programInstance.getProgram(), null );
 
         Collection<PatientAttributeValue> patientAttributeValues = patientAttributeValueService
-            .getPatientAttributeValues( patient );
+            .getPatientAttributeValues( programInstance.getPatient() );
 
         for ( PatientAttributeValue patientAttributeValue : patientAttributeValues )
         {

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/ProgramEnrollmentSelectAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/ProgramEnrollmentSelectAction.java	2012-05-24 10:44:17 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/ProgramEnrollmentSelectAction.java	2012-08-28 05:48:46 +0000
@@ -28,7 +28,6 @@
 
 import java.util.ArrayList;
 import java.util.Collection;
-import java.util.HashSet;
 
 import org.hisp.dhis.caseentry.state.SelectedStateManager;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
@@ -119,28 +118,23 @@
         // Get all programs
         programs = programService.getPrograms( Program.MULTIPLE_EVENTS_WITH_REGISTRATION );
 
+        // Get single-event programs by the selected orgunit
+        Collection<Program> singleProgramsByOrgunit = programService.getPrograms(
+            Program.SINGLE_EVENT_WITH_REGISTRATION, orgunit );
+        programs.addAll( singleProgramsByOrgunit );
+
         // Except anonymous program
         programs.removeAll( programService.getPrograms( Program.SINGLE_EVENT_WITHOUT_REGISTRATION ) );
 
         // Get single-event if patient no have any single event
         // OR have un-completed single-event
-        Collection<ProgramInstance> programInstances = programInstanceService.getProgramInstances( patient, true );
-
-        Collection<Program> completedPrograms = new HashSet<Program>();
-
+        Collection<ProgramInstance> programInstances = programInstanceService.getProgramInstances( patient, false );
+        
         for ( ProgramInstance programInstance : programInstances )
         {
-            if ( programInstance.getProgram().isSingleEvent() )
-            {
-                completedPrograms.add( programInstance.getProgram() );
-            }
+            programs.remove( programInstance.getProgram() );
         }
 
-        // Get single-event programs by the selected orgunit
-        Collection<Program> singleProgramsByOrgunit = programService.getPrograms( Program.SINGLE_EVENT_WITH_REGISTRATION, orgunit );
-        singleProgramsByOrgunit.remove( completedPrograms );
-        programs.addAll( singleProgramsByOrgunit );
-
         return SUCCESS;
     }
 }

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/RemoveEnrollmentAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/RemoveEnrollmentAction.java	2012-07-05 09:07:21 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/RemoveEnrollmentAction.java	2012-08-28 05:48:46 +0000
@@ -46,8 +46,6 @@
 public class RemoveEnrollmentAction
     implements Action
 {
-    public static final String PREFIX_ATTRIBUTE = "attr";
-
     // -------------------------------------------------------------------------
     // Dependencies
     // -------------------------------------------------------------------------

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/SaveProgramEnrollmentAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/SaveProgramEnrollmentAction.java	2012-08-16 15:47:08 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/SaveProgramEnrollmentAction.java	2012-08-28 05:48:46 +0000
@@ -111,26 +111,7 @@
     {
         this.programId = programId;
     }
-
-    public Integer getProgramId()
-    {
-        return programId;
-    }
-
-    private Patient patient;
-
-    public Patient getPatient()
-    {
-        return patient;
-    }
-
-    private Program program;
-
-    public Program getProgram()
-    {
-        return program;
-    }
-
+    
     private String enrollmentDate;
 
     public void setEnrollmentDate( String enrollmentDate )
@@ -145,6 +126,20 @@
         this.dateOfIncident = dateOfIncident;
     }
 
+    private ProgramInstance programInstance;
+    
+    public ProgramInstance getProgramInstance()
+    {
+        return programInstance;
+    }
+
+    private ProgramStageInstance activeProgramStageInstance;
+    
+    public ProgramStageInstance getActiveProgramStageInstance()
+    {
+        return activeProgramStageInstance;
+    }
+
     // -------------------------------------------------------------------------
     // Action implementation
     // -------------------------------------------------------------------------
@@ -152,11 +147,11 @@
     public String execute()
         throws Exception
     {
-        patient = patientService.getPatient( patientId );
-
-        program = programService.getProgram( programId );
-
-        if ( dateOfIncident == null || dateOfIncident.isEmpty()  )
+        Patient patient = patientService.getPatient( patientId );
+
+        Program program = programService.getProgram( programId );
+
+        if ( dateOfIncident == null || dateOfIncident.isEmpty() )
         {
             dateOfIncident = enrollmentDate;
         }
@@ -164,8 +159,6 @@
         Collection<ProgramInstance> programInstances = programInstanceService.getProgramInstances( patient, program,
             false );
 
-        ProgramInstance programInstance = null;
-
         if ( programInstances.iterator().hasNext() )
         {
             programInstance = programInstances.iterator().next();
@@ -185,17 +178,24 @@
             patient.getPrograms().add( program );
             patientService.updatePatient( patient );
 
+            boolean isFirstStage = false;
             for ( ProgramStage programStage : program.getProgramStages() )
             {
                 ProgramStageInstance programStageInstance = new ProgramStageInstance();
                 programStageInstance.setProgramInstance( programInstance );
                 programStageInstance.setProgramStage( programStage );
-                Date dueDate = DateUtils.getDateAfterAddition( format.parseDate( dateOfIncident ), programStage
-                    .getMinDaysFromStart() );
+                Date dueDate = DateUtils.getDateAfterAddition( format.parseDate( dateOfIncident ),
+                    programStage.getMinDaysFromStart() );
 
                 programStageInstance.setDueDate( dueDate );
 
                 programStageInstanceService.addProgramStageInstance( programStageInstance );
+                
+                if( !isFirstStage )
+                {
+                    activeProgramStageInstance = programStageInstance;
+                    isFirstStage = true;
+                }
             }
         }
         else
@@ -215,7 +215,7 @@
                 programStageInstanceService.updateProgramStageInstance( programStageInstance );
             }
         }
-
+        
         return SUCCESS;
     }
 }

=== 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-17 06:42:32 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml	2012-08-28 05:48:46 +0000
@@ -618,9 +618,7 @@
 	<bean id="org.hisp.dhis.caseentry.action.patient.ProgramEnrollmentAction"
 		class="org.hisp.dhis.caseentry.action.patient.ProgramEnrollmentAction"
 		scope="prototype">
-		<property name="programService" ref="org.hisp.dhis.program.ProgramService" />
 		<property name="programInstanceService" ref="org.hisp.dhis.program.ProgramInstanceService" />
-		<property name="patientService" ref="org.hisp.dhis.patient.PatientService" />
 		<property name="identifierTypeService"
 			ref="org.hisp.dhis.patient.PatientIdentifierTypeService" />
 		<property name="patientIdentifierService"

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties	2012-08-21 13:51:07 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties	2012-08-28 05:48:46 +0000
@@ -420,4 +420,5 @@
 no_phone_number = No phone number
 no_comment = No comment
 please_select_program_stage = Please select program stage
-comment_added = Comment added
\ No newline at end of file
+comment_added = Comment added
+enroll_program = Enroll program
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/struts.xml	2012-08-17 06:42:32 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/struts.xml	2012-08-28 05:48:46 +0000
@@ -543,7 +543,8 @@
 
 		<action name="saveProgramEnrollment"
 			class="org.hisp.dhis.caseentry.action.patient.SaveProgramEnrollmentAction">
-			<result name="success" type="redirect">enrollmentform.action?programId=${programId}&amp;patientId=${patientId}</result>
+			<result name="success" type="velocity-json">
+				/dhis-web-caseentry/jsonProgramEnrollment.vm</result>
 			<param name="requiredAuthorities">F_PROGRAM_ENROLLMENT</param>
 		</action>
 

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataEntryForm.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataEntryForm.vm	2012-08-25 06:59:13 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataEntryForm.vm	2012-08-28 05:48:46 +0000
@@ -29,39 +29,6 @@
 <input type='hidden' name='programStageId' id='programStageId' value='$!programStageInstance.programStage.id'>
 
 
-<table class="mainPageTable" id='patientInfoDiv' class='hidden'> 
-	<tr>
-		<td valign="top">
-	<table>
-		<tr>            
-			<td class="bold">$i18n.getString( "full_name" ):</td>
-			<td>$encoder.htmlEncode( $programStageInstance.programInstance.patient.getFullName() )<td>
-		</tr>
-		<tr>
-			<td class="bold">$i18n.getString( "gender" ):</td>
-			<td>$i18n.getString("$programStageInstance.programInstance.patient.gender")</td>
-		</tr>
-		<tr>
-			<td class="bold">$i18n.getString( "date_of_birth" ):</td>
-			<td>$format.formatDate( $programStageInstance.programInstance.patient.birthDate ) $programStageInstance.programInstance.patient.getAge()<td>
-		</tr>
-		</table>
-	</tr>
-</table>
-
-<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 id='entryForm' #if($!programStageInstance.executionDate) class='visible' #else class='hidden' #end>					
 	#if( $customDataEntryFormCode )
 		#parse( "/dhis-web-caseentry/customDataEntryForm.vm" )

=== 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-16 16:31:03 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/patient.js	2012-08-28 05:48:46 +0000
@@ -337,69 +337,124 @@
 // Enrollment program
 // ----------------------------------------------------------------
 
-function showProgramEnrollmentSelectForm( patientId )
+function showProgramEnrollmentForm( patientId )
 {
-	hideById('listPatientDiv');
-	hideById('editPatientDiv');
-	hideById('selectDiv');
-	hideById('searchDiv');
-	hideById('migrationPatientDiv');
-	setInnerHTML('patientDashboard','');
-				
-	jQuery('#loaderDiv').show();
 	jQuery('#enrollmentDiv').load('showProgramEnrollmentForm.action',
 		{
 			id:patientId
-		}, function()
-		{	
-			showById('enrollmentDiv');
-			jQuery('#loaderDiv').hide();
-		});
-}
-
-function showProgramEnrollmentForm( patientId, programId )
+		}).dialog({
+			title: i18n_enroll_program,
+			maximize: true, 
+			closable: true,
+			modal:true,
+			overlay:{background:'#000000', opacity:0.1},
+			width: 500,
+			height: 200
+		});
+}
+
+function programOnchange( programId )
+{
+	if( programId==0){
+		hideById('enrollmentDateTR');
+		hideById('dateOfIncidentTR');
+	}
+	else{
+		var type = jQuery('#enrollmentDiv [name=programId] option:selected').attr('type');
+		if(type=='2'){
+			hideById('enrollmentDateTR');
+			hideById('dateOfIncidentTR');
+			disable('enrollmentDate');
+			disable('dateOfIncident');
+		}
+		else{
+			showById( 'enrollmentDateTR');
+			enable('enrollmentDate');
+			
+			var dateOfEnrollmentDescription = jQuery('#enrollmentDiv [name=programId] option:selected').attr('dateOfEnrollmentDescription');
+			var dateOfIncidentDescription = jQuery('#enrollmentDiv [name=programId] option:selected').attr('dateOfIncidentDescription');
+			setInnerHTML('enrollmentDateDescription', dateOfEnrollmentDescription);
+			setInnerHTML('dateOfIncidentDescription', dateOfIncidentDescription);
+			
+			var displayIncidentDate = jQuery('#enrollmentDiv [name=programId] option:selected').attr('displayIncidentDate');
+			if( displayIncidentDate=='true'){
+				showById( 'dateOfIncidentTR');
+				enable('dateOfIncident');
+			}
+			else{
+				hideById( 'dateOfIncidentTR');
+				disable('dateOfIncident');
+			}
+		}
+	}
+}
+
+function saveEnrollment( patientId, programId )
+{
+	var programId = jQuery('#enrollmentDiv [id=programId] option:selected').val();
+	var programName = jQuery('#enrollmentDiv [id=programId] option:selected').text();
+	var dateOfIncident = jQuery('#enrollmentDiv [id=dateOfIncident]').val();
+	var enrollmentDate = jQuery('#enrollmentDiv [id=enrollmentDate]').val();
+	
+	jQuery.postJSON( "saveProgramEnrollment.action",
+		{
+			patientId: jQuery('#enrollmentDiv [id=patientId]').val(),
+			programId: programId,
+			dateOfIncident: dateOfIncident,
+			enrollmentDate: enrollmentDate
+		}, 
+		function( json ) 
+		{    
+			var programInstanceId = json.programInstanceId;
+			var programStageInstanceId = json.activeProgramStageInstanceId;
+			var programStageName = json.activeProgramStageName;
+			var dueDate = json.dueDate;
+			var type = jQuery('#enrollmentDiv [id=programId] option:selected').attr('type');
+			
+			var activedRow = "<tr id='tr1_" + programInstanceId 
+							+ "' type='" + type +"'"
+							+ " programStageInstanceId='" + programStageInstanceId + "'>"
+							+ " <td id='td_" + programInstanceId + "'>"
+							+ " <a href='javascript:loadProgramInstance(" + programInstanceId + ", false)'>"
+							+ programName + "(" + enrollmentDate + ")</a>"
+							+ "<img id='img_" + programInstanceId + "' name='imgActive'></td>"
+							+ "<td><img src='../images/checked.png' style='cursor:pointer;' onclick='unenrollmentForm(" + programInstanceId + ")'></td>"
+							+ "</tr>";
+			
+			activedRow += "<tr id='tr2_" + programInstanceId +"'"+
+						+ " onclick='javascript:loadProgramStageRecords(" + programStageInstanceId + ", false)' style='cursor:pointer;'>"
+						+ "<td colspan='2'><a>&#8226; " + programStageName + "(" + dueDate + ")</a></td></tr>";
+
+			jQuery('#activeTB' ).prepend(activedRow);
+			jQuery('#enrollmentDiv').dialog("close");
+			
+			loadProgramInstance( programInstanceId, false );
+			showSuccessMessage(i18n_enrol_success);
+		});
+}
+
+function loadProgramInstance( programInstanceId, completed )
 {				
-	if( programId == 0 )
-	{
-		jQuery('#enrollBtn').attr('value',i18n_enroll);
-		hideEnrolmentField();
-		hideById('programEnrollmentDiv');
-		return;
-	}
-		
 	jQuery('#loaderDiv').show();
 	jQuery('#programEnrollmentDiv').load('enrollmentform.action',
 		{
-			patientId:patientId,
-			programId:programId
+			programInstanceId:programInstanceId
 		}, function()
 		{
 			showById('programEnrollmentDiv');
-			showEnrolmentField();
-			
-			var type = jQuery('#enrollmentDiv [name=programId] option:selected').attr('type');
+			var type = jQuery('#tr_'+programInstanceId).attr('type');
 			if(type=='2'){
-				hideEnrolmentField();
+				hideById('programInstanceDiv');
+				var programStageInstanceId = jQuery('#tr_'+programInstanceId).attr('programStageInstanceId');
+				loadDataEntry( programStageInstanceId );
 			}
 			else{
-				showEnrolmentField();
-				var type = jQuery('#programEnrollmentSelectDiv [name=programId] option:selected').attr('type');
-					
-				if( type=='2'){
-					hideById( 'dateOfIncidentTR');
-				}
-				else{
-					showById( 'dateOfIncidentTR');
-				}
-			}
-			
-			var displayIncidentDate = jQuery('#enrollmentDiv [name=programId] option:selected').attr('displayIncidentDate');
-			if(displayIncidentDate=='true'){
-				showIncidentDateField();
-			}else{
-				hideIncidentDateField();
-			}
-			
+				showById('programInstanceDiv');
+			}
+			activeProgramInstanceDiv( programInstanceId );
+			if( completed ){
+				hideById('newEncounterBtn_' + programInstanceId);
+			}
 			jQuery('#loaderDiv').hide();
 		});
 }
@@ -486,20 +541,24 @@
 		});
 }
 
-function unenrollmentForm()
+function unenrollmentForm( programInstanceId )
 {	
 	$.ajax({
 		type: "POST",
 		url: 'removeEnrollment.action',
-		data: "programInstanceId=" + getFieldValue('programInstanceId'),
+		data: "programInstanceId=" + programInstanceId,
 		success: function( json ) 
 		{
+			var completedRow = jQuery('#td_' + programInstanceId).html();
+			jQuery('#completedTB' ).prepend("<tr><td>" + completedRow + "</td></tr>");
+			hideById('tr1_' + programInstanceId );
+			hideById('tr2_' + programInstanceId );
+			hideById('programEnrollmentDiv');
 			showSuccessMessage( i18n_unenrol_success );
-			hideEnrolmentField( 'enrollmentDateTR' );
-			jQuery('#enrollmentDiv [name=programId]').val('0');
-			hideById( 'programEnrollmentDiv' );
 		}
     });
+	
+	
 }
 
 //-----------------------------------------------------------------------------
@@ -725,7 +784,7 @@
 	setFieldValue( 'dateOfIncident', '' );
 	hideById('enrollmentDateTR');
 	hideById('dateOfIncidentTR');
-	hideById('enrollBtn');
+	//hideById('enrollBtn');
 	hideById('unenrollBtn');
 }
   
@@ -734,7 +793,7 @@
 	showById('enrollmentDateTR');
 	showById('dateOfIncidentTR');
 	enable('dateOfIncident');
-	showById('enrollBtn');
+	//showById('enrollBtn');
 }
 
 function hideIncidentDateField()
@@ -772,6 +831,7 @@
 	hideById('searchDiv');
 	hideById('dataEntryFormDiv');
 	hideById('migrationPatientDiv');
+	hideById('dataRecordingSelectDiv');
 	
 	jQuery('#dataRecordingSelectDiv').load( 'selectDataRecording.action', 
 		{
@@ -779,14 +839,13 @@
 		},
 		function()
 		{
-			jQuery('#dataRecordingSelectDiv [id=patientInfoDiv]').hide();
 			jQuery('#dataRecordingSelectDiv [id=backBtnFromEntry]').hide();
 			showById('dataRecordingSelectDiv');
 			
 			var programId = jQuery('#programEnrollmentSelectDiv [id=programId] option:selected').val();
 			$('#dataRecordingSelectDiv [id=programId]').val( programId );
 			$('#dataRecordingSelectDiv [id=inputCriteria]').hide();
-			
+			showById('dataRecordingSelectDiv');
 			hideLoader();
 			hideById('contentDiv');
 		});
@@ -847,14 +906,13 @@
 function activeProgramInstanceDiv( programInstanceId )
 {
 	jQuery("[name=eventDiv]").each(function(){
-		jQuery(this).removeClass("link-area-active");
+		hideById(this.id);
 	});
 	
 	jQuery("[name=imgActive]").each(function(){
 		jQuery(this).attr('src','');
 	});
 	
-	jQuery('#pi_' + programInstanceId ).addClass("link-area-active");
 	jQuery("#img_" + programInstanceId ).attr('src','images/flag-blue.png');
 	showById('pi_' + programInstanceId);
 }
@@ -888,16 +946,16 @@
 function loadProgramStageRecords( programStageInstanceId, completed ) 
 {
 	showLoader();
-    jQuery('#dataEntryFromDashboard').load( "viewProgramStageRecords.action",
+    jQuery('#dataEntryFormDiv').load( "viewProgramStageRecords.action",
 		{
 			programStageInstanceId: programStageInstanceId
 		}, function() {
 			if(completed){
-				jQuery( "#dataEntryFromDashboard :input").each(function(){
+				jQuery( "#dataEntryFormDiv :input").each(function(){
 					disable(this.id);
 				});
 			}
-			showById('dataEntryFormDashboardDiv');
+			showById('dataEntryFormDiv');
 			hideLoader();
 		}).dialog(
 		{

=== 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-08-25 06:59:13 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/relationshipPatient.js	2012-08-28 05:48:46 +0000
@@ -44,21 +44,6 @@
 			
 			hideLoader();
 			hideById('contentDiv'); 
-			
-			if(isDashboard){
-				showById('executionDateTB');
-				showById('patientInfoDiv');
-				$( '#dataEntryFormDiv' ).dialog(
-					{
-						title:i18n_program_stage,
-						maximize:true, 
-						closable:true,
-						modal:false,
-						overlay:{background:'#000000', opacity:0.1},
-						width:1000,
-						height:500
-					});
-			}
 		} );
 }
 

=== added file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonProgramEnrollment.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonProgramEnrollment.vm	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonProgramEnrollment.vm	2012-08-28 05:48:46 +0000
@@ -0,0 +1,6 @@
+{
+	"programInstanceId": "${programInstance.id}",
+	"activeProgramStageInstanceId": "${activeProgramStageInstance.id}",
+	"activeProgramStageName": "$!encoder.jsonEncode( ${activeProgramStageInstance.programStage.name} )",
+	"dueDate": "$!format.formatDate( ${activeProgramStageInstance.dueDate} )"
+}
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientDashboard.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientDashboard.vm	2012-08-25 06:59:13 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientDashboard.vm	2012-08-28 05:48:46 +0000
@@ -1,7 +1,3 @@
-<script>
-	isDashboard = true;
-</script>
-
 <h4>$i18n.getString("patient_dashboard")
  &#8226; <a href="javascript:showUpdatePatientForm( '$patient.id', true )">$i18n.getString( "edit_profile" )</a>
  &#8226; <a href="javascript:setFieldValue( 'isShowPatientList', 'false' ); showRelationshipList( '$patient.id' );">$i18n.getString( "manage_relationship" )</a>
@@ -11,7 +7,7 @@
 <div id="subMenu">
 	<ul>
 		<li><a href="javascript:onClickBackBtn();">$i18n.getString( 'back_to_registration' )</a></li>
-		<li><a href="javascript:showProgramEnrollmentSelectForm( '$patient.id' )">$i18n.getString( "program_management" )</a></li>
+		<li><a href="javascript:showProgramEnrollmentForm( '$patient.id' )">$i18n.getString( "program_management" )</a></li>
 	</ul>
 </div>
 
@@ -26,7 +22,7 @@
 								<tr><th>$i18n.getString("demographics")</th></tr>
 							</table>
 							<div class="contentProviderTable">
-								<table>
+								<table width='100%'>
 									<tr>
 										<td>$i18n.getString("full_name")</td>
 										<td>$!patient.getFullName()</td>
@@ -73,30 +69,37 @@
 							</div>
 						</div>
 					</td>
-				</tr>
-				<tr><td></td></tr>
-				<tr>
 					<td>
 						<div class="link-area">
 							<table width='100%'>
 								<tr><th>$i18n.getString("active_programs")</th></tr>
 							</table>
 							<div class="contentProviderTable">
-								<table width='100%'>
+								<table width='100%' id='activeTB'>
 									#foreach( $programInstance in $activeProgramInstances )
-										<tr onclick="javascript:activeProgramInstanceDiv('$programInstance.id');" style='cursor:pointer;'>
+										#set($programStageInstanceId = '')
+										#if($programInstance.program.type==2)
+											#foreach( $programStageInstance in $programInstance.programStageInstances)
+												#set($programStageInstanceId = $programStageInstance.id)
+											#end
+										#end
+										<tr id='tr1_$programInstance.id' type='$programInstance.program.type'
+											programStageInstanceId='$programStageInstanceId'>
+											<td id='td_$programInstance.id'>
+												<a href='javascript:loadProgramInstance("$programInstance.id", false)'>$programInstance.program.name ($format.formatDate($programInstance.enrollmentDate))</a>
+												<img id="img_$programInstance.id" name='imgActive'>
+											</td>
 											<td>
-												<a href='#pi_$programInstance.id'>$programInstance.program.name ($format.formatDate($programInstance.enrollmentDate))</a>
-												<img id="img_$programInstance.id" name='imgActive'>
+												<img src='../images/checked.png' style='cursor:pointer;' onclick='unenrollmentForm("$programInstance.id")'>
 											</td>
 										</tr>
 										#set($flag = 'false')
 										#foreach( $programStageInstance in $programInstance.programStageInstances )
 											#set( $status = $statusMap.get( $programStageInstance.id ) )
 											#if( $status!=1 && $flag=='false')
-												<tr onclick="javascript:loadProgramStageRecords($programStageInstance.id, false)" style='cursor:pointer;'>
-													<td>
-														<a>>> $programStageInstance.programStage.name ($format.formatDate($programStageInstance.dueDate))</a>
+												<tr id='tr2_$programInstance.id' onclick='javascript:loadProgramStageRecords("$programStageInstance.id", false)' style='cursor:pointer;'>
+													<td colspan='2'>
+														<a>&#8226; $programStageInstance.programStage.name ($format.formatDate($programStageInstance.dueDate))</a>
 													</td>
 												</tr>
 											#set($flag = 'true')
@@ -107,20 +110,24 @@
 							</div>
 						</div>
 					</td>
-				</tr>
-				<tr><td></td></tr>
-				<tr>
 					<td>
 						<div class="link-area">
 							<table width='100%'>
 								<tr><th>$i18n.getString("completed_programs")</th></tr>
 							</table>
 							<div class="contentProviderTable">
-								<table  width='100%'>
-									#foreach( $programInstance in $completedProgramInstances )
-										<tr>
-											<td onclick="javascript:activeProgramInstanceDiv('$programInstance.id');" style='cursor:pointer;'>
-												<a href='#pi_$programInstance.id'>$programInstance.program.name ($format.formatDate($programInstance.enrollmentDate))</a>
+								<table id='completedTB' width='100%'>
+									#foreach($programInstance in $completedProgramInstances)
+										#set($programStageInstanceId = '')
+										#if($programInstance.program.type==2)
+											#foreach( $programStageInstance in $programInstance.programStageInstances)
+												#set($programStageInstanceId = $programStageInstance.id)
+											#end
+										#end
+										<tr id='tr_$programInstance.id' type='$programInstance.program.type' onclick="javascript:loadProgramInstance('$programInstance.id', true);" style='cursor:pointer;'
+											programStageInstanceId='$programStageInstanceId'>
+											<td>
+												<a>$programInstance.program.name ($format.formatDate($programInstance.enrollmentDate))</a>
 												<img id="img_$programInstance.id" name='imgActive'>
 											</td>
 										</tr>
@@ -132,42 +139,9 @@
 				</tr>
 			</table>
 		</td>
-		
-		<td valign='top'>
-			<!-- Active program-stage-instances -->
-			#foreach( $programInstance in $activeProgramInstances )
-				<div id='pi_$programInstance.id' name="eventDiv" #if( $programInstance.completed!='true' ) class="event-dashboard" #else class="event-dashboard hidden" #end>
-					<table width="100%" onclick="hideProgramInstanceDiv('$programInstance.id')" style='cursor:pointer;'>
-						<tr>
-							<th>$programInstance.program.name ($format.formatDate($programInstance.enrollmentDate) - $i18n.getString("active"))
-							</th>
-						</tr>
-					</table>
-					<div class='event-flow-dashboard'>
-						#set( $programStageInstances = $programInstance.programStageInstances )
-						#parse( "/dhis-web-caseentry/programStageInstanceFlow.vm" )
-					</div>
-				</div>
-			#end
-			
-			<!-- Completed program-stage-instances -->
-			#foreach( $programInstance in $completedProgramInstances )
-				<div id='pi_$programInstance.id' name="eventDiv" #if( $programInstance.completed!='true' ) class="event-dashboard" #else class="event-dashboard hidden" #end>
-					<table width="100%" onclick="hideProgramInstanceDiv('$programInstance.id')" style='cursor:pointer;'>
-						<tr>
-							<th>$programInstance.program.name ($format.formatDate($programInstance.enrollmentDate) - $i18n.getString("completed"))
-							</th>
-						</tr>
-					</table>
-					
-					<div class='event-flow-dashboard'>
-						#set( $programStageInstances = $programInstance.programStageInstances )
-						#parse( "/dhis-web-caseentry/programStageInstanceFlow.vm" )
-					</div>
-				</div>
-			#end
-		</td>
 	</tr>
 </table>
 
+<p>&nbsp;</p>
+<div id='programEnrollmentDiv' class='hidden'></div>
 <div id='dataEntryFormDiv'></div>
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientRegistrationList.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientRegistrationList.vm	2012-08-12 06:10:50 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientRegistrationList.vm	2012-08-28 05:48:46 +0000
@@ -95,11 +95,10 @@
 				#end
 				
 				<td>
-				  <a href="javascript:showProgramEnrollmentSelectForm( '$patient.id' )" title='$i18n.getString( "program_management" )'><img src="../images/enroll.png" alt='$i18n.getString( "program_enrollment" )'></a> 
+				  <a href="javascript:showPatientDashboardForm( '$patient.id' )" title='$i18n.getString( "patient_dashboard" )'><img src="../images/enroll.png" alt='$i18n.getString( "edit_profile" )'></a>
 				  <a href="javascript:showUpdatePatientForm( '$patient.id' )" title='$i18n.getString( "edit_profile" )'><img src="../images/edit.png" alt='$i18n.getString( "edit_profile" )'></a>
 				  <a href="javascript:setFieldValue( 'isShowPatientList', 'false' ); showRelationshipList('$patient.id')" title='$i18n.getString( "manage_relationship" )'><img src="../images/relationship.png" alt='$i18n.getString( "manage_relationship" )'></a>
                   <a href="javascript:getPatientLocation( '$patient.id' );" title='$i18n.getString( "change_patient_location" )'><img src="../icons/dataentry.png" alt='$i18n.getString( "change_patient_location" )' style='width:25px; height:25px'></a>
-				  <a href="javascript:showPatientDashboardForm( '$patient.id' )" title='$i18n.getString( "patient_dashboard" )'><img src="../images/edit_sections.png" alt='$i18n.getString( "edit_profile" )'></a>
 				  <a href="javascript:removePatient( '$patient.id', '$encoder.jsEncode( $patient.getFullName() )' )" title='$i18n.getString( "remove" )'><img src="../images/delete.png" alt='$i18n.getString( "remove" )'></a>
 				  <a href="javascript:showPatientHistory( '$patient.id' )" title='$i18n.getString( "patient_details_and_history" )'><img src="../images/information.png" alt='$i18n.getString( "patient_details_and_history" )'></a>
 				</td>

=== 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-16 03:02:18 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programEnrollmentForm.vm	2012-08-28 05:48:46 +0000
@@ -10,12 +10,9 @@
 		<li><a href="#tab-3">$i18n.getString("modify_due_date_or_visit_date")</a></li>
 	</ul>
 	
-	
 	<div id="tab-1">
 		<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>		
@@ -233,7 +230,6 @@
 		#end
 	#end
 	
-	byId('enrollBtn').value = i18n_update;
 	setInnerHTML('enrollmentDateDescription', "$!program.dateOfEnrollmentDescription" );
 	setInnerHTML('dateOfIncidentDescription', "$!program.dateOfIncidentDescription" );
 	setFieldValue('enrollmentDate', "$!format.formatDate( $programInstance.enrollmentDate )" );

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programEnrollmentSelectForm.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programEnrollmentSelectForm.vm	2012-08-25 06:59:13 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programEnrollmentSelectForm.vm	2012-08-28 05:48:46 +0000
@@ -1,113 +1,60 @@
-<h4>$i18n.getString( "program_management" )</h4>
-<div>
-	<table class='mainPageTable'>
+<script>
+	jQuery(document).ready(	function(){
+		datePickerInRangeValid( 'dateOfIncident' , 'enrollmentDate' );
+		var unSave = false;
+	});	
+</script>
+
+<form id='programEnrollmentSelectDiv' name='programEnrollmentSelectDiv' method='POST'>
+	<input type="hidden" id="patientId" name="patientId" value="$patient.id">
+	<table>
 		<tr>
-			<td>
-				<table>
-					<tr>
-						<td class='bold text-column'>$i18n.getString( "full_name" ): </td>
-						<td>$encoder.htmlEncode( $patient.getFullName() )</td>
-					</tr>
-					<tr>
-						<td class='bold text-column'>$i18n.getString( "gender" ):</td>
-						<td>$i18n.getString( $patient.gender )</td>
-					</tr>
-					<tr>
-						<td class='bold text-column'>$i18n.getString( "date_of_birth" ):</td>
-						<td>$format.formatDate( $patient.birthDate ) $patient.getAge()</td>
-					</tr>
-				</table>
-			<td>
-			#if( $patient.programs.size() > 0 )
-			<td align="right">
-				<table>
-					<tr>
-						<td class='bold text-column' style="vertical-align:top">$i18n.getString( "enrolled_for" ):</td>
-						<td rowspan='$patient.programs.size()' style="vertical-align:right">
-							#foreach( $program in $patient.programs ) 
-								$program.name<br>
-							#end
-						</td>
-					</tr>
-				</table>
+			<td class='text-column'><label for="programId">$i18n.getString( "program" )</label></td>
+			<td class='input-column'>
+				<select id="programId" name="programId" onchange='programOnchange(this.value);'>
+					<option value="">[$i18n.getString( "select" )]</option>
+					#foreach( $program in $programs )
+					<option value="$program.id" type='$program.type' 
+						displayIncidentDate='$!program.displayIncidentDate'
+						dateOfEnrollmentDescription='$!program.dateOfEnrollmentDescription'
+						dateOfIncidentDescription='$!program.dateOfIncidentDescription'>$encoder.htmlEncode( $program.name )</option>
+					#end
+				</select>
 			</td>
-			#end
-		</tr>
-		<tr>
-			<td>&nbsp;</td>
-		</tr>
-		<tr>
+			<td></td>
+			</td></td>
+		</tr>
+		
+		<tr id='enrollmentDateTR' class='hidden'>
+			<td class='text-column'><label for="enrollmentDate"><span id='enrollmentDateDescription'></span><em title="$i18n.getString( "required" )" class="required"> * </em></label></td>
+			<td colspan='2' class='input-column'><input type="text" id="enrollmentDate" name="enrollmentDate" class="{validate:{required:true}}"></td>
+		</tr>
+		
+		<tr id='dateOfIncidentTR' class='hidden'>
+			<td class='text-column'><label for="dateOfIncident"><span id='dateOfIncidentDescription'></span><em title="$i18n.getString( "required" )" class="required"> * </em></label></td>
+			<td colspan='2' class='input-column'><input type="text" id="dateOfIncident" name="dateOfIncident"  class="{validate:{required:true}}"></td>
+		</tr>
+	
+		<tr>
+			<td></td>
+			<td></td>   
+			<td></td>                             
+		</tr>
+		
+		<tr>
+			<td></td>
 			<td colspan='2'>
-				<input type="button" class='button' value="$i18n.getString( 'back_to_registration' )" onclick="loadPatientList();" >
+				<input type="button" id='enrollBtn' name='enrollBtn' class='button' value="$i18n.getString( 'enroll' )" onclick='saveEnrollment()'/>
+				<input type="button" id='unenrollBtn' name='unenrollBtn' class='button' value="$i18n.getString( 'unenroll' )" onclick='unenrollmentForm()'/>
 			</td>
 		</tr>
+		<tr>
+			<td colspan='3'><span id='message'></span></td>
+		</tr>
 	</table>
-	
-	<p></p>
-	
-	<div class='enrollment-form'>
-		<form id='programEnrollmentSelectDiv' name='programEnrollmentSelectDiv' method='POST'>
-			<input type="hidden" id="patientId" name="patientId" value="$patient.id">    
-
-			<table>
-				<tr>
-					<td class='text-column'><label for="programId">$i18n.getString( "program" )</label></td>
-					<td class='input-column'>
-						<select id="programId" name="programId" onchange="showProgramEnrollmentForm('$patient.id', this.value);" >
-							<option value="0">[$i18n.getString( "select" )]</option>
-							#foreach( $program in $programs )
-								<option value="$program.id" type='$program.type' displayIncidentDate='$!program.displayIncidentDate'>$encoder.htmlEncode( $program.name )</option>
-							#end
-						</select>
-					</td>
-					<td></td>
-					</td></td>
-				</tr>   
-				<tr id='enrollmentDateTR' class='hidden'>
-					<td class='text-column'><label for="enrollmentDate"><span id='enrollmentDateDescription'></span><em title="$i18n.getString( "required" )" class="required"> * </em></label></td>
-					<td colspan='2' class='input-column'><input type="text" id="enrollmentDate" name="enrollmentDate" class="{validate:{required:true}}"></td>
-				</tr>
-				
-				<tr id='dateOfIncidentTR' class='hidden'>
-					<td class='text-column'><label for="dateOfIncident"><span id='dateOfIncidentDescription'></span><em title="$i18n.getString( "required" )" class="required"> * </em></label></td>
-					<td colspan='2' class='input-column'><input type="text" id="dateOfIncident" name="dateOfIncident"  class="{validate:{required:true}}"></td>
-				</tr>
-			
-				<tr>
-					<td></td>
-					<td></td>   
-					<td></td>                             
-				</tr>
-				
-				<tr>
-					<td></td>
-					<td colspan='2'>
-						<input type="submit" id='enrollBtn' name='enrollBtn' class='button hidden' value="$i18n.getString( 'enroll' )" />
-						<input type="button" id='unenrollBtn' name='unenrollBtn' class='button hidden' value="$i18n.getString( 'unenroll' )" onclick='unenrollmentForm()'/>
-					</td>
-				</tr>
-				<tr>
-					<td colspan='3'><span id='message'></span></td>
-				</tr>
-			</table>
-		</form>
-	</div>
-	
-	<p></p>
-	<div id='programEnrollmentDiv' class='hidden'></div>
-</div>
+</form>
 
 <script>
 	var i18n_enroll = '$encoder.jsEscape( $i18n.getString( "enroll" ) , "'")';
 	var i18n_program_stage = '$encoder.jsEscape( $i18n.getString( "program_stage" ) , "'")';
-	var isDashboard = false;
-	
-	jQuery('#programEnrollmentSelectDiv').ready(function()
-		{
-			validation( 'programEnrollmentSelectDiv', function(form){
-                validateProgramEnrollment();
-            });
-			var unSave = false;
-			datePickerInRangeValid( 'dateOfIncident' , 'enrollmentDate' );
-		}); 
 </script>

=== 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-22 04:49:39 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programStageInstanceFlow.vm	2012-08-28 05:48:46 +0000
@@ -1,3 +1,5 @@
+#parse( "/dhis-web-caseentry/colorHelp.vm" )
+<br/>
 <table id='programStageIdTB_$!programInstance.id' style="width:850px;height:125px;">
 	<tr>
 		<td>
@@ -8,7 +10,7 @@
 				<table class="stage-flow">											
 					<tr id='programStageIdTR_$!programInstance.id'>
 						#foreach( $programStageInstance in $programInstance.programStageInstances )
-						<td>
+						<td width="5px">
 							<img src='images/rightarrow.png'>
 						</td>
 						<td>

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/selectPatient.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/selectPatient.vm	2012-08-25 06:59:13 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/selectPatient.vm	2012-08-28 05:48:46 +0000
@@ -102,6 +102,7 @@
 	var i18n_violate_validation = '$encoder.jsEscape( $i18n.getString( "violate_validation" ) , "'")';
 	var i18n_show_all_items = '$encoder.jsEscape( $i18n.getString( "show_all_items" ) , "'")';
 	var i18n_create_new_event = '$encoder.jsEscape( $i18n.getString( "create_new_event" ) , "'")';
+	var i18n_enroll_program = '$encoder.jsEscape( $i18n.getString( "enroll_program" ) , "'")';
 	var checkedDuplicate = false;
 	// -1: no search anything
 	//  0: show list all patient
@@ -110,7 +111,6 @@
 	unSave = false;
 	isAjax = true;
 	contentDiv = '';
-	var isDashboard = true;
 	
 	// ----------------------------------------------------------------
 	// Search field

=== 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-21 13:51:07 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/style/style.css	2012-08-28 05:48:46 +0000
@@ -122,14 +122,6 @@
 	text-align: right;
 }
 
-div.enrollment-form
-{
-	border:1px solid #c0c0c0; 
-	padding:10px;
-	margin-right:10px;
-	border-radius:3px;
-}
-
 /*----------------------------------------------------------------------------*/
 /* Data entry form                                                        */
 /*----------------------------------------------------------------------------*/
@@ -250,7 +242,6 @@
 {
   height: 150px;
   width: 340px;
-  margin-top:-10px;
   overflow-y: auto;
   overflow-x:hidden;
 }