← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 9954: Improve visit schedule UI.

 

------------------------------------------------------------
revno: 9954
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2013-03-04 16:38:55 +0700
message:
  Improve visit schedule UI.
added:
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/GetActivityPlansAction.java
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageInstanceService.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageInstanceStore.java
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramStageInstanceService.java
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramStageInstanceStore.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/activityPlanRecords.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/activityPlanSelect.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/cacheManifest.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/activityPlan.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/reportDataEntryForm.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-api/src/main/java/org/hisp/dhis/program/ProgramStageInstanceService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageInstanceService.java	2013-02-27 14:39:27 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageInstanceService.java	2013-03-04 09:38:55 +0000
@@ -111,7 +111,21 @@
         Collection<Integer> orgunitIds, Date startDate, Date endDate, int status, Integer max, Integer min );
 
     Grid getAggregateReport( int position, ProgramStage programStage, Collection<Integer> orgunitIds,
-        String facilityLB, Integer deGroupBy, Integer deSum, Map<Integer, Collection<String>>  deFilters, List<Period> periods,
-        String aggregateType, Integer limit, Boolean useCompletedEvents, I18nFormat format, I18n i18n );
+        String facilityLB, Integer deGroupBy, Integer deSum, Map<Integer, Collection<String>> deFilters,
+        List<Period> periods, String aggregateType, Integer limit, Boolean useCompletedEvents, I18nFormat format,
+        I18n i18n );
+
+    // -------------------------------------------------------------------------
+    // Activity plans
+    // -------------------------------------------------------------------------
+
+    List<ProgramStageInstance> activityPlanList( Program program, Collection<Integer> orgunitIds, Date startDate, Date endDate,
+        Collection<Integer> statusList, Integer min, Integer max );
+
+    Grid activityPlans( Program program, Collection<Integer> orgunitIds, Date startDate, Date endDate,
+        Collection<Integer> statusList, Integer min, Integer max, I18n i18n );
+
+    int getActiveInstanceCount( Program program, Collection<Integer> orgunitIds, Date startDate, Date endDate,
+        Collection<Integer> statusList );
 
 }

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageInstanceStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageInstanceStore.java	2013-02-27 14:39:27 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageInstanceStore.java	2013-03-04 09:38:55 +0000
@@ -105,4 +105,14 @@
         String facilityLB, Integer deGroupBy, Integer deSum, Map<Integer, Collection<String>> deFilters, List<Period> periods,
         String aggregateType, Integer limit, Boolean useCompletedEvents, I18nFormat format, I18n i18n );
 
+    // -------------------------------------------------------------------------
+    // Activity plans
+    // -------------------------------------------------------------------------
+
+    List<ProgramStageInstance> getActiveInstance( Program program, Collection<Integer> orgunitIds, Date startDate,
+        Date endDate, Collection<Integer> statusList, Integer max, Integer min );
+    
+   int getActiveInstanceCount( Program program, Collection<Integer> orgunitIds, Date startDate,
+        Date endDate, Collection<Integer> statusList );
+
 }

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramStageInstanceService.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramStageInstanceService.java	2013-02-27 14:39:27 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramStageInstanceService.java	2013-03-04 09:38:55 +0000
@@ -48,6 +48,7 @@
 import org.hisp.dhis.period.Period;
 import org.hisp.dhis.sms.outbound.OutboundSms;
 import org.hisp.dhis.system.grid.ListGrid;
+import org.hisp.dhis.system.util.DateUtils;
 import org.springframework.transaction.annotation.Transactional;
 
 /**
@@ -355,4 +356,49 @@
             deSum, deFilters, periods, aggregateType, limit, useCompletedEvents, format, i18n );
     }
 
+    public List<ProgramStageInstance> activityPlanList( Program program, Collection<Integer> orgunitIds,
+        Date startDate, Date endDate, Collection<Integer> statusList, Integer min, Integer max )
+    {
+        return programStageInstanceStore.getActiveInstance( program, orgunitIds, startDate, endDate, statusList, max,
+            min );
+    }
+
+    @Override
+    public Grid activityPlans( Program program, Collection<Integer> orgunitIds, Date startDate, Date endDate,
+        Collection<Integer> statusList, Integer min, Integer max, I18n i18n )
+    {
+        List<ProgramStageInstance> stageInstances = programStageInstanceStore.getActiveInstance( program, orgunitIds,
+            startDate, endDate, statusList, max, min );
+
+        Grid grid = new ListGrid();
+        grid.setTitle( program.getDisplayName() );
+
+        // Header
+        grid.addHeader( new GridHeader( i18n.getString( "full_name" ), false, false ) );
+        grid.addHeader( new GridHeader( i18n.getString( "date_scheduled" ), false, false ) );
+
+        String programStage = "";
+        for ( ProgramStageInstance stageInstance : stageInstances )
+        {
+            String eventName = stageInstance.getProgramStage().getDisplayName();
+            if ( !programStage.equals( eventName ) )
+            {
+                grid.addRow();
+                grid.addValue( eventName );
+                grid.addValue( "" );
+                programStage = eventName;
+            }
+            grid.addRow();
+            grid.addValue( stageInstance.getProgramInstance().getPatient().getFullName() );
+            grid.addValue( DateUtils.getMediumDateString( stageInstance.getDueDate() ) );
+        }
+
+        return grid;
+    }
+
+    public int getActiveInstanceCount( Program program, Collection<Integer> orgunitIds, Date startDate, Date endDate,
+        Collection<Integer> statusList )
+    {
+        return programStageInstanceStore.getActiveInstanceCount( program, orgunitIds, startDate, endDate, statusList );
+    }
 }

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramStageInstanceStore.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramStageInstanceStore.java	2013-02-27 14:39:27 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramStageInstanceStore.java	2013-03-04 09:38:55 +0000
@@ -41,6 +41,7 @@
 
 import org.hibernate.Criteria;
 import org.hibernate.Query;
+import org.hibernate.criterion.Disjunction;
 import org.hibernate.criterion.Order;
 import org.hibernate.criterion.Projections;
 import org.hibernate.criterion.Restrictions;
@@ -61,6 +62,7 @@
 import org.hisp.dhis.patientreport.PatientAggregateReport;
 import org.hisp.dhis.patientreport.TabularReportColumn;
 import org.hisp.dhis.period.Period;
+import org.hisp.dhis.program.Program;
 import org.hisp.dhis.program.ProgramInstance;
 import org.hisp.dhis.program.ProgramStage;
 import org.hisp.dhis.program.ProgramStageInstance;
@@ -683,6 +685,24 @@
         return grid;
     }
 
+    @SuppressWarnings( "unchecked" )
+    public List<ProgramStageInstance> getActiveInstance( Program program, Collection<Integer> orgunitIds,
+        Date startDate, Date endDate, Collection<Integer> statusList, Integer max, Integer min )
+    {
+        return getActiveInstanceCriteria( program, orgunitIds, startDate, endDate, statusList, max, min ).list();
+    }
+
+    @SuppressWarnings( "unchecked" )
+    public int getActiveInstanceCount( Program program, Collection<Integer> orgunitIds, Date startDate, Date endDate,
+        Collection<Integer> statusList )
+    {
+        Criteria criteria = getActiveInstanceCriteria( program, orgunitIds, startDate, endDate, statusList, null, null );
+
+        List<ProgramStageInstance> list = criteria.list();
+       
+        return list != null ? list.size() : 0;
+    }
+
     // -------------------------------------------------------------------------
     // Supportive methods
     // -------------------------------------------------------------------------
@@ -1752,7 +1772,7 @@
         return orgunitIds;
     }
 
-    public void fillDataInGrid( Grid grid, SqlRowSet rs, I18n i18n )
+    private void fillDataInGrid( Grid grid, SqlRowSet rs, I18n i18n )
     {
         int cols = rs.getMetaData().getColumnCount();
         int dataCols = 0;
@@ -1920,4 +1940,61 @@
         }
     }
 
+    public Criteria getActiveInstanceCriteria( Program program, Collection<Integer> orgunitIds, Date startDate,
+        Date endDate, Collection<Integer> statusList, Integer max, Integer min )
+    {
+        Criteria criteria = getCriteria();
+        criteria.createAlias( "programInstance", "programInstance" );
+        criteria.createAlias( "programStage", "programStage" );
+        criteria.createAlias( "programInstance.patient", "patient" );
+        criteria.createAlias( "patient.organisationUnit", "regOrgunit" );
+        criteria.add( Restrictions.eq( "programInstance.program", program ) );
+        criteria.add( Restrictions.isNull( "programInstance.endDate" ) );
+
+        Disjunction disjunction = Restrictions.disjunction();
+
+        for ( Integer status : statusList )
+        {
+            switch ( status )
+            {
+            case ProgramStageInstance.COMPLETED_STATUS:
+                disjunction.add( Restrictions.and( Restrictions.eq( "completed", true ),
+                    Restrictions.between( "executionDate", startDate, endDate ),
+                    Restrictions.in( "organisationUnit.id", orgunitIds ) ) );
+                break;
+            case ProgramStageInstance.VISITED_STATUS:
+                disjunction.add( Restrictions.and( Restrictions.eq( "completed", false ),
+                    Restrictions.between( "executionDate", startDate, endDate ),
+                    Restrictions.in( "organisationUnit.id", orgunitIds ) ) );
+                break;
+            case ProgramStageInstance.FUTURE_VISIT_STATUS:
+                disjunction.add( Restrictions.and(
+                    Restrictions.isNull( "executionDate" ), 
+                    Restrictions.between( "dueDate", new Date(), endDate ),
+                    Restrictions.in( "regOrgunit.id", orgunitIds ) ) );
+                break;
+            case ProgramStageInstance.LATE_VISIT_STATUS:
+                disjunction.add( Restrictions.and(
+                    Restrictions.isNull( "executionDate" ), 
+                    Restrictions.between( "dueDate", startDate, new Date() ),
+                    Restrictions.in( "regOrgunit.id", orgunitIds ) ) );
+                break;
+            default:
+                break;
+            }
+        }
+
+        criteria.add( disjunction );
+        
+        if ( min != null && max != null )
+        {
+            criteria.setFirstResult( min );
+            criteria.setMaxResults( max );
+        }
+
+        criteria.addOrder( Order.asc( "programStage.minDaysFromStart" ) );
+        criteria.addOrder( Order.desc( "dueDate" ) );
+
+        return criteria;
+    }
 }

=== added file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/GetActivityPlansAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/GetActivityPlansAction.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/GetActivityPlansAction.java	2013-03-04 09:38:55 +0000
@@ -0,0 +1,195 @@
+/*
+ * Copyright (c) 2004-2009, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ *   list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ *   this list of conditions and the following disclaimer in the documentation
+ *   and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ *   be used to endorse or promote products derived from this software without
+ *   specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package org.hisp.dhis.caseentry.action.caseentry;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.List;
+
+import org.hisp.dhis.caseentry.state.SelectedStateManager;
+import org.hisp.dhis.common.Grid;
+import org.hisp.dhis.i18n.I18n;
+import org.hisp.dhis.i18n.I18nFormat;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.paging.ActionPagingSupport;
+import org.hisp.dhis.program.Program;
+import org.hisp.dhis.program.ProgramService;
+import org.hisp.dhis.program.ProgramStageInstance;
+import org.hisp.dhis.program.ProgramStageInstanceService;
+
+/**
+ * @author Chau Thu Tran
+ * 
+ * @version GetActivityPlansAction.java 7:10:29 PM Mar 4, 2013 $
+ */
+public class GetActivityPlansAction
+    extends ActionPagingSupport<ProgramStageInstance>
+{
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
+
+    private SelectedStateManager selectedStateManager;
+
+    public void setSelectedStateManager( SelectedStateManager selectedStateManager )
+    {
+        this.selectedStateManager = selectedStateManager;
+    }
+
+    private ProgramService programService;
+
+    public void setProgramService( ProgramService programService )
+    {
+        this.programService = programService;
+    }
+
+    private ProgramStageInstanceService programStageInstanceService;
+
+    public void setProgramStageInstanceService( ProgramStageInstanceService programStageInstanceService )
+    {
+        this.programStageInstanceService = programStageInstanceService;
+    }
+
+    private I18n i18n;
+
+    public void setI18n( I18n i18n )
+    {
+        this.i18n = i18n;
+    }
+
+    private I18nFormat format;
+
+    public void setFormat( I18nFormat format )
+    {
+        this.format = format;
+    }
+
+    // -------------------------------------------------------------------------
+    // Input/output
+    // -------------------------------------------------------------------------
+
+    private Integer programId;
+
+    public void setProgramId( Integer programId )
+    {
+        this.programId = programId;
+    }
+
+    private Collection<Integer> statusList;
+
+    public void setStatusList( Collection<Integer> statusList )
+    {
+        this.statusList = statusList;
+    }
+
+    private String startDate;
+
+    public void setStartDate( String startDate )
+    {
+        this.startDate = startDate;
+    }
+
+    private String endDate;
+
+    public void setEndDate( String endDate )
+    {
+        this.endDate = endDate;
+    }
+
+    private String type;
+
+    public void setType( String type )
+    {
+        this.type = type;
+    }
+
+    private Integer total;
+
+    public Integer getTotal()
+    {
+        return total;
+    }
+
+    private Program program;
+
+    public Program getProgram()
+    {
+        return program;
+    }
+
+    private List<ProgramStageInstance> programStageInstances;
+
+    public List<ProgramStageInstance> getProgramStageInstances()
+    {
+        return programStageInstances;
+    }
+
+    private Grid grid;
+
+    public Grid getGrid()
+    {
+        return grid;
+    }
+
+    // -------------------------------------------------------------------------
+    // Implementation Action
+    // -------------------------------------------------------------------------
+
+    public String execute()
+        throws Exception
+    {
+        OrganisationUnit orgunit = selectedStateManager.getSelectedOrganisationUnit();
+
+        Collection<Integer> orgunitIds = new HashSet<Integer>();
+        orgunitIds.add( orgunit.getId() );
+
+        program = programService.getProgram( programId );
+
+        // ---------------------------------------------------------------------
+        // Program instances for the selected program
+        // ---------------------------------------------------------------------
+
+        if ( type == null )
+        {
+            total = programStageInstanceService.getActiveInstanceCount( program, orgunitIds,
+                format.parseDate( startDate ), format.parseDate( endDate ), statusList );
+
+            this.paging = createPaging( total );
+
+            programStageInstances = programStageInstanceService.activityPlanList( program, orgunitIds,
+                format.parseDate( startDate ), format.parseDate( endDate ), statusList, paging.getStartPos(),
+                paging.getPageSize() );
+        }
+        else
+        {
+            grid = programStageInstanceService.activityPlans( program, orgunitIds, format.parseDate( startDate ),
+                format.parseDate( endDate ), statusList, null, null, i18n );
+        }
+        return type == null ? SUCCESS : type;
+    }
+}

=== 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	2013-03-01 14:09:05 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml	2013-03-04 09:38:55 +0000
@@ -1095,5 +1095,17 @@
 		<property name="programStageInstanceService"
 			ref="org.hisp.dhis.program.ProgramStageInstanceService" />
 	</bean>
+	
+	<!-- Activity plans -->
+	
+	<bean id="org.hisp.dhis.caseentry.action.caseentry.GetActivityPlansAction"
+		class="org.hisp.dhis.caseentry.action.caseentry.GetActivityPlansAction"
+		scope="prototype">
+		<property name="selectedStateManager"
+			ref="org.hisp.dhis.caseentry.state.SelectedStateManager" />
+		<property name="programService" ref="org.hisp.dhis.program.ProgramService" />
+		<property name="programStageInstanceService"
+			ref="org.hisp.dhis.program.ProgramStageInstanceService" />
+	</bean>
 
 </beans>

=== 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	2013-03-02 06:07:36 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties	2013-03-04 09:38:55 +0000
@@ -567,4 +567,6 @@
 enter_a_value_greater_than_or_equal_to_nagetive_90 = Please enter a value greater than or equal to -90.
 enter_values_for_longitude_and_latitude_fields = Please enter values for both longitude and latitude fields
 enter_a_valid_number = Please enter a valid number.
-enter_a_number = Enter a number
\ No newline at end of file
+enter_a_number = Enter a number
+for = For
+date_scheduled = Date scheduled
\ 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	2013-03-01 14:09:05 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/struts.xml	2013-03-04 09:38:55 +0000
@@ -1067,10 +1067,12 @@
     </action>
 
     <action name="getActivityPlanRecords"
-      class="org.hisp.dhis.caseentry.action.caseentry.GetDataRecordsAction">
+      class="org.hisp.dhis.caseentry.action.caseentry.GetActivityPlansAction">
       <result name="success" type="velocity">/content.vm</result>
       <param name="page">/dhis-web-caseentry/activityPlanRecords.vm</param>
       <param name="stylesheets">style/style.css</param>
+      <result name="xls" type="gridXlsResult" />
+      <result name="pdf" type="gridPdfResult" />
     </action>
 
     <action name="exportActitityList"

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/activityPlanRecords.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/activityPlanRecords.vm	2013-01-23 10:27:28 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/activityPlanRecords.vm	2013-03-04 09:38:55 +0000
@@ -6,115 +6,50 @@
 		<td>&nbsp;</td>
 		<td>$!total</td>
 	</tr>
-	#if( $patients && $patients.size()>0 )
-		<tr><td class='text-column'>#parse( "/dhis-web-caseentry/colorHelp.vm" )</td></tr>
-	#end
 </table>
 
-#if( $patients && $patients.size()>0 )
-	<table id="patientList" class="listTable">
-		#set( $mark = false )                 
-		#foreach( $patient in $patients )
-			#set( $programInstance = '')
-			#set( $programInstance = $programInstanceMap.get( $patient ) )
-				<tr #alternate( $mark )>
-					<td width="10px">
-						#set( $value="")
-						#foreach( $identifierType in $programInstance.program.patientIdentifierTypes )
-							#foreach( $pIdentifier in $patient.identifiers )
-								#if($identifierType.personDisplayName=="true" && $identifierType.id==$pIdentifier.identifierType.id)
-									#set($value=$value + $pIdentifier.identifier + "&#13;&#10;" )
-								#end
-							#end
-						#end
-						#if($value=="")
-							#set($value=$patient.getFullName())
-						#end
-						<input type='button' class='patient-object' value='$value' onclick='javascript:showPatientHistory( "$programInstance.patient.id" );' title='$i18n.getString( "patient_dashboard" )'>
-					</td>
-					<td class='bold' name="toggleFlowBtn" style='cursor:pointer;font-size:25px' onclick="eventFlowToggle($programInstance.id)">
-						<a>&raquo;</a>
-					</td>
-					#set( $programStageInstances = $programInstance.programStageInstances )
-						<td>
-						<table id='tb_$programInstance.id'>	
-							<tr>
-								<td>
-									<div class="arrow-left" onclick="moveLeft('flow_$programInstance.id')">&nbsp;</div>
-								</td>
-								<td>
-									<div id='flow_$programInstance.id' class='stage-flow'>
-										<table class="table-flow">
-										<tr>
-										#set( $flag = "false" )
-										#set( $idx = 0)
-										#foreach( $programStageInstance in $programStageInstances )
-											#set( $idx = $idx + 1)
-											<td id="arrow_$programStageInstance.id" style='font-size:25px;'>&rarr;</td>
-											<td>
-												#set($title="")
-												#set($index = 0)
-												#foreach( $comment in $programStageInstance.patientComments)
-													#if( $index < 5)
-														#set( $title= $title + "$format.formatDate( $comment.createdDate ) - $comment.creator - $comment.commentText &#13;&#10;" )
-														#set( $index = $index + 1 )
-													#end
-												#end
-												#set($valueDate=$format.formatDate( $programStageInstance.dueDate ))
-												#if($!programStageInstance.executionDate)
-													#set($valueDate=$format.formatDate( $programStageInstance.executionDate ))
-												#end
-												 <input type="button" name="programStageBtn"
-													id="ps_$!programStageInstance.id"
-													psid="$programStageInstance.programStage.id"
-													psname="$encoder.htmlEncode($programStageInstance.programStage.displayName)"
-													orgunit="$encoder.htmlEncode($!programStageInstance.organisationUnit.name)"
-													programType='$programInstance.program.type'
-													reportDate="$!format.formatDate( $!programStageInstance.executionDate )"
-													reportDateDes="$programStageInstance.programStage.reportDateDescription"
-													dueDate="$format.formatDate( $programStageInstance.dueDate )"
-													status='$programStageInstance.getEventStatus()'
-													index="$idx"
-													class="stage-object" 
-													title="$title"
-													value="$encoder.htmlEncode($programStageInstance.programStage.displayName)&#13;&#10;$valueDate" 
-													onclick="javascript:loadDataEntry( $programStageInstance.id );">
-												<script>	
-													var status = $programStageInstance.getEventStatus();
-													setEventColorStatus( $programStageInstance.id ,status);
-												</script>
-											</td> 
-										#end
-										</tr>
-									</table></div>
-								</td>
-								
-								<td>
-									<div class="arrow-right" onclick="moveRight('flow_$programInstance.id')">&nbsp;</div>
-								</td>
-							</tr>
-						</table>
-					</td>
-					</tr>
-			#if( $mark )
-				#set( $mark = false )
-			#else
-				#set( $mark = true )
-			#end 
+#if( $programStageInstances && $programStageInstances.size()>0 )
+<div class='visit-schedule' height='100%'>
+	<table class='listTable'>
+		<col/>
+		<col/>
+		<col width='30%'/>
+		#set( $programStage = '' )
+		#foreach( $programStageInstance in $programStageInstances )
+			#set( $eventName = $programStageInstance.programStage.displayName )
+			#if( $eventName != $programStage)
+				<tr><td colspan='3' class='bold'>$i18n.getString('for') $eventName</td></tr>
+				<tr>
+					<th>#</th>
+					<th>$i18n.getString('full_name')</th>
+					<th>$i18n.getString('date_scheduled')</th>
+				#set( $mark = false ) 
+				#set( $nr = 0 ) 
+				#set( $programStage = $eventName )
+			#end
+			<tr #alternate( $mark )>
+				<td>
+					#set( $nr = $nr + 1 )
+					$nr
+				</td>
+				<td>$programStageInstance.programInstance.patient.getFullName()</td>
+				<td><a href="javascript:loadDataEntry( $programStageInstance.id );">
+					#if($!programStageInstance.executionDate)
+						$format.formatDate($!programStageInstance.executionDate)
+					#else
+						$format.formatDate($!programStageInstance.dueDate)
+					#end
+					</a>
+				</td>
+			</tr>
+			#set( $mark = !$mark )
 		#end
-	</table>
 	
 	<div class="paging-container">
 		#parse( "/dhis-web-commons/paging/paging.vm" )
 	</div>
-	
-	<div id="detailsInfo"></div>
+</div>
+
+<div id="detailsInfo"></div>
+
 #end
-
-<script>
-	reloadRecordList();
-	$(window).bind('resize', function(e){ 
-		resize();
-	});
-	
-</script>
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/activityPlanSelect.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/activityPlanSelect.vm	2013-01-23 10:27:28 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/activityPlanSelect.vm	2013-03-04 09:38:55 +0000
@@ -19,7 +19,6 @@
 	<input type='hidden' id='isRegistration' name= 'isRegistration' value='false'>
 	<input type='hidden' id='listAll' name='listAll'>
 	<input type='hidden' id='sendToList' name='sendToList'>
-	<input type='hidden' id='programStageInstanceId' name='programStageInstanceId' value='$programStageInstance.id'>
 	<input type='hidden' id='programStageName' name='programStageName'>
 	<input type='hidden' id='searchByProgramStage' name='searchByProgramStage' value="false">
 	<input type='hidden' id='orgunitId' name='orgunitId' value='$organisationUnit.id' >

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/cacheManifest.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/cacheManifest.vm	2013-03-02 15:09:06 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/cacheManifest.vm	2013-03-04 09:38:55 +0000
@@ -1,5 +1,5 @@
 CACHE MANIFEST
-# 2.11-SNAPSHOT V25
+# 2.11-SNAPSHOT V27
 NETWORK:
 *
 CACHE:

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/activityPlan.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/activityPlan.js	2013-02-28 09:23:38 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/activityPlan.js	2013-03-04 09:38:55 +0000
@@ -47,22 +47,21 @@
 	setFieldValue('listAll', "true");
 	hideById('listPatientDiv');
 	contentDiv = 'listPatientDiv';
+	
+	var statusList = "";
+	var statusEvent = getFieldValue('statusEvent').split('_');
+	for( var i in statusEvent){
+		statusList += "&statusList=" + statusEvent[i];
+	}
+
 	$('#contentDataRecord').html('');
-	var programId = getFieldValue('programIdAddPatient');
-	var searchTexts = "stat_" + programId
-					+ "_" + getFieldValue('startDueDate')
-					+ "_" + getFieldValue('endDueDate')
-					+ "_" + getFieldValue('orgunitId')
-					+ "_false"
-					+ "_" + getFieldValue('statusEvent');
 	
 	showLoader();
-	jQuery('#listPatientDiv').load('getActivityPlanRecords.action',
+	jQuery('#listPatientDiv').load('getActivityPlanRecords.action?' + statusList,
 		{
-			programId:programId,
-			listAll:false,
-			searchBySelectedOrgunit: false,
-			searchTexts: searchTexts
+			programId:getFieldValue('programIdAddPatient'),
+			startDate:getFieldValue('startDueDate'),
+			endDue:getFieldValue('endDueDate')
 		}, 
 		function()
 		{
@@ -75,19 +74,12 @@
 
 function exportActitityList( type )
 {
-	var programId = getFieldValue('programIdAddPatient');
-	var searchTexts = "stat_" + programId
-					+ "_" + getFieldValue('startDueDate')
-					+ "_" + getFieldValue('endDueDate')
-					+ "_" + getFieldValue('orgunitId')
-					+ "_false"
-					+ "_" + getFieldValue('statusEvent');
-	var params = "searchTexts=" + searchTexts;
-		params += "&listAll=fase";
-		params += "&type=" + type;
-		params += "&programId=" + getFieldValue('programIdAddPatient');
-		params += "&searchBySelectedOrgunit=false";
-	
+	var params  = "programId=" + getFieldValue('programIdAddPatient');
+	params += "&startDate=" + getFieldValue('startDueDate');
+	params += "&endDue=" + getFieldValue('endDueDate');
+	for( var i in statusEvent){
+		params += "&statusList=" + statusEvent[i];
+	}
 	var url = "exportActitityList.action?" + params;
 	window.location.href = url;
 }
@@ -98,16 +90,11 @@
 
 function loadDataEntry( programStageInstanceId ) 
 {
-	jQuery("#patientList input[name='programStageBtn']").each(function(i,item){
-		jQuery(item).removeClass('stage-object-selected');
-	});
-	jQuery( '#' + prefixId + programStageInstanceId ).addClass('stage-object-selected');
-	setFieldValue('programStageInstanceId', programStageInstanceId);
-	
 	$('#contentDataRecord' ).load("viewProgramStageRecords.action",
 		{
 			programStageInstanceId: programStageInstanceId
-		}, function(){
+		}, function(){	
+			showById('reportDateDiv');
 			showById('patientInforTB');
 			showById('postCommentTbl');
 			showById('entryForm');
@@ -124,32 +111,6 @@
 		});
 }
 
-function statusEventOnChange()
-{
-	if( !byId('useCalendar').checked )
-	{
-		var statusEvent = getFieldValue("statusEvent");
-		
-		if( statusEvent == '1_2_3_4' 
-			|| statusEvent == '3_4' 
-			|| statusEvent == '2_3_4' ){
-			enable('showEventSince');
-			enable('showEventUpTo');
-			setDateRange();
-		}
-		else if( statusEvent == '3' ){
-			disable('showEventSince');
-			enable('showEventUpTo');
-			setDateRange();
-		}
-		else{
-			enable('showEventSince');
-			disable('showEventUpTo');
-			setDateRange();
-		}
-	}
-}
-
 function setDateRange()
 {
 	var statusEvent = getFieldValue("statusEvent");
@@ -240,81 +201,4 @@
 	var y= date.getFullYear();
 }
 
-// --------------------------------------------------------------------
-// Cosmetic UI
-// --------------------------------------------------------------------
-
-function reloadRecordList()
-{
-	var startDate = getFieldValue('startDueDate');
-	var endDate = getFieldValue('endDueDate');
-	var arrStatus = getFieldValue('statusEvent').split('_');
-	var paddingIndex = 1;
-	
-	jQuery("#patientList .stage-object").each( function(){
-		var id = this.id.split('_')[1];
-		var dueDate = jQuery(this).attr('dueDate');
-		var statusEvent = jQuery(this).attr('status');
-		var programInstanceId = jQuery(this).attr('programInstanceId');
-		if( dueDate >= startDate && dueDate <= endDate 
-			&& jQuery.inArray(statusEvent, arrStatus) > -1)
-		{
-			if( jQuery("#tb_" + programInstanceId + " .searched").length == 0 )
-			{
-				jQuery("#arrow_" + id ).addClass("displayed");
-				var index = eval(jQuery("#ps_" + id ).attr("index"));
-				if( paddingIndex < index ){
-					 paddingIndex = index;
-				}
-			}
-			jQuery("#ps_" + id ).addClass("stage-object-selected searched");
-		}
-		hideById('arrow_' + id );
-		hideById('ps_' + id );
-	});
-	
-	jQuery(".table-flow").each( function(){
-		var scheduledEvent = jQuery(this).find("[status='3']:first");
-		scheduledEvent.addClass("stage-scheduled");
-		scheduledEvent.css('border-color', MARKED_VISIT_COLOR);
-		scheduledEvent.focus();
-		
-		var firstEvent = jQuery(this).find(".searched:first");
-		firstEvent.show();
-		var id = firstEvent.attr("id").split('_')[1];
-		showById('arrow_' + id );
-		var index = firstEvent.attr("index");
-		if( index<paddingIndex){
-			var paddingLeft = ( paddingIndex - index ) * 20;
-			jQuery('#arrow_' + id).css("padding-left", paddingLeft + "px");
-		}
-	});
-	
-	resize();
-}
-
-
-
-function eventFlowToggle( programInstanceId )
-{
-	jQuery("#tb_" + programInstanceId + " .stage-object").each( function(){
-			var programStageInstance = this.id.split('_')[1];
-			jQuery('#arrow_' + programStageInstance ).toggle();
-			jQuery('#ps_' + programStageInstance ).toggle();
-			jQuery(this).removeClass("stage-object-selected");
-		});
-	
-	if( jQuery("#tb_" + programInstanceId + " .searched").length>0)
-	{	
-		var id = jQuery("#tb_" + programInstanceId + " .searched").attr('id').split('_')[1];
-		showById("arrow_" + id);
-		showById("ps_" + id );
-	}
-	
-	jQuery("#tb_" + programInstanceId + " .table-flow").each( function(){
-		var scheduledEvent = jQuery(this).find("[status='3']:first");
-		scheduledEvent.focus();
-	});
-	
-	resize();
-}
+function entryFormContainerOnReady (){}

=== 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	2013-03-02 05:09:13 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/entry.js	2013-03-04 09:38:55 +0000
@@ -5,8 +5,12 @@
 
 function saveVal( dataElementId )
 {
-	if( jQuery('#entryFormContainer [id=programStageId]') == null) return;
+
 	var programStageId = jQuery('.stage-object-selected').attr('psid');
+	if(programStageId==undefined){
+		if( jQuery('#entryFormContainer [id=programStageId]') == null) return;
+		else programStageId = jQuery('#entryFormContainer [id=programStageId]').val();
+	}
         
 	var fieldId = programStageId + '-' + dataElementId + '-val';
 	

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/reportDataEntryForm.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/reportDataEntryForm.vm	2013-03-02 15:09:06 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/reportDataEntryForm.vm	2013-03-04 09:38:55 +0000
@@ -53,6 +53,7 @@
 
 <input type='hidden' id="programId" name="programId" type="text" readonly="readonly" value="$encoder.htmlEncode( $program.displayName )" style="min-width:350px">		
 <input id="programStageId" name="programStageId" type="hidden" value="$programStage.id" style="min-width:350px">            
+<input id="programStageInstanceId" name="programStageInstanceId" type="hidden" value="$programStageInstance.id" style="min-width:350px">            
 
 <p></p>
 #parse( "dhis-web-commons/loader/loader.vm" )

=== 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	2013-03-02 15:09:06 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/style/style.css	2013-03-04 09:38:55 +0000
@@ -526,4 +526,23 @@
 
 .coordinates2{
     width: 150px;
-}
\ No newline at end of file
+}
+
+
+.visit-schedule
+{
+  overflow-y: auto;
+  overflow-x:hidden;
+}
+
+.visit-schedule table
+{
+	width:100%;
+}
+
+.visit-schedule td
+{
+  padding-top:3px;
+  padding-bottom:3px;
+  border-bottom:1px solid #cad5e5;
+}