← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 10575: Add program stage completeness function.

 

------------------------------------------------------------
revno: 10575
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2013-04-16 12:41:25 +0700
message:
  Add  program stage completeness function.
added:
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/ProgramStageInstanceCompletenessAction.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/programStageCompleteness.js
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programStageCompleteness.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programStageCompletenessSelect.vm
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/index.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/menu.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/reportsMenu.vm


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

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageInstanceService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageInstanceService.java	2013-04-10 03:13:47 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageInstanceService.java	2013-04-16 05:41:25 +0000
@@ -112,20 +112,23 @@
 
     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, Boolean displayTotals, I18nFormat format,
-        I18n i18n );
+        List<Period> periods, String aggregateType, Integer limit, Boolean useCompletedEvents, Boolean displayTotals,
+        I18nFormat format, I18n i18n );
 
     // -------------------------------------------------------------------------
     // Statistical
     // -------------------------------------------------------------------------
-    
+
     Collection<ProgramStageInstance> getProgramStageInstances( Program program, Collection<Integer> orgunitIds,
         Date startDate, Date endDate, Boolean completed );
 
     int getOverDueEventCount( ProgramStage programStage, Collection<Integer> orgunitIds, Date startDate, Date endDate );
 
-    int averageNumberCompletedProgramInstance( Program program , Collection<Integer> orgunitIds, Date startDate, Date endDate, Integer status );
-    
-    Collection<Integer> getOrganisationUnitIds ( Date startDate, Date endDate );
-    
+    int averageNumberCompletedProgramInstance( Program program, Collection<Integer> orgunitIds, Date startDate,
+        Date endDate, Integer status );
+
+    Collection<Integer> getOrganisationUnitIds( Date startDate, Date endDate );
+
+    Grid getCompletenessProgramStageInstance( OrganisationUnit orgunit, Program program, String startDate, String endDate, I18n i18n );
+
 }

=== 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-04-11 08:30:45 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageInstanceStore.java	2013-04-16 05:41:25 +0000
@@ -104,9 +104,9 @@
 
     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,
-        Boolean displayTotals, I18nFormat format, I18n i18n );
-    
+        List<Period> periods, String aggregateType, Integer limit, Boolean useCompletedEvents, Boolean displayTotals,
+        I18nFormat format, I18n i18n );
+
     Collection<ProgramStageInstance> get( Program program, Collection<Integer> orgunitIds, Date startDate,
         Date endDate, Boolean completed );
 
@@ -122,4 +122,6 @@
 
     Collection<Integer> getOrgunitIds( Date startDate, Date endDate );
 
+    Grid getCompleteness( OrganisationUnit orgunit, Program program, String startDate, String endDate, I18n i18n );
+
 }

=== 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-04-10 03:13:47 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramStageInstanceService.java	2013-04-16 05:41:25 +0000
@@ -509,5 +509,11 @@
     {
         return programStageInstanceStore.getOrgunitIds( startDate, endDate );
     }
+    
+    @Override
+    public Grid getCompletenessProgramStageInstance( OrganisationUnit orgunit, Program program, String startDate, String endDate, I18n i18n )
+    {
+        return programStageInstanceStore.getCompleteness( orgunit, program, startDate, endDate, i18n );
+    }
 
 }

=== 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-04-15 17:06:42 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramStageInstanceStore.java	2013-04-16 05:41:25 +0000
@@ -404,7 +404,7 @@
             + "     and pg.type=1 and prm.daysallowedsendmessage is not null  "
             + "     and psi.executiondate is null "
             + "     and (  DATE(now()) - DATE(psi.duedate) ) = prm.daysallowedsendmessage ";
-        
+
         SqlRowSet rs = jdbcTemplate.queryForRowSet( sql );
 
         int cols = rs.getMetaData().getColumnCount();
@@ -422,7 +422,11 @@
                 String programName = rs.getString( "programName" );
                 String programStageName = rs.getString( "programStageName" );
                 String daysSinceDueDate = rs.getString( "days_since_due_date" );
-                String dueDate = rs.getString( "duedate" ).split( " " )[0];// just get date, remove timestamp
+                String dueDate = rs.getString( "duedate" ).split( " " )[0];// just
+                                                                           // get
+                                                                           // date,
+                                                                           // remove
+                                                                           // timestamp
 
                 message = message.replace( PatientReminder.TEMPLATE_MESSSAGE_PATIENT_NAME, patientName );
                 message = message.replace( PatientReminder.TEMPLATE_MESSSAGE_PROGRAM_NAME, programName );
@@ -745,6 +749,49 @@
         return rs != null ? rs.intValue() : 0;
     }
 
+    public Grid getCompleteness( OrganisationUnit orgunit, Program program, String startDate, String endDate, I18n i18n )
+    {
+        String sql = "SELECT ou.name as orgunit, ps.name as program_stage, psi.completeduser as user_name, count(psi.programstageinstanceid) as number_of_events "
+            + "         FROM programstageinstance psi INNER JOIN programstage ps "
+            + "                         ON psi.programstageid = ps.programstageid "
+            + "                 INNER JOIN organisationunit ou "
+            + "                         ON ou.organisationunitid=psi.organisationunitid"
+            + "                 INNER JOIN program pg "
+            + "                         ON pg.programid = ps.programid "
+            + "         WHERE psi.organisationunitid = "
+            + orgunit.getId()
+            + "                 AND pg.programid = "
+            + program.getId()
+            + "         GROUP BY ou.name, ps.name, psi.completeduser, psi.completeddate, psi.completed "
+            + "         HAVING psi.completeddate >= '"
+            + startDate
+            + "'                AND psi.completeddate <= '"
+            + endDate
+            + "' "
+            + "                 AND psi.completed=true "
+            + "         ORDER BY ou.name, ps.name, psi.completeduser";
+
+        SqlRowSet rs = jdbcTemplate.queryForRowSet( sql );
+
+        // Create column with Total column
+
+        Grid grid = new ListGrid();
+
+        grid.setTitle( program.getDisplayName() );
+        grid.setSubtitle( i18n.getString( "from" ) + " " + startDate + " " + i18n.getString( "to" ) + " " + endDate );
+
+        int cols = rs.getMetaData().getColumnCount();
+
+        for ( int i = 1; i <= cols; i++ )
+        {
+            grid.addHeader( new GridHeader( i18n.getString( rs.getMetaData().getColumnLabel( i ) ), false, false ) );
+        }
+
+        GridUtils.addRows( grid, rs );
+
+        return grid;
+    }
+
     // -------------------------------------------------------------------------
     // Supportive methods
     // -------------------------------------------------------------------------

=== added file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/ProgramStageInstanceCompletenessAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/ProgramStageInstanceCompletenessAction.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/ProgramStageInstanceCompletenessAction.java	2013-04-16 05:41:25 +0000
@@ -0,0 +1,136 @@
+/*
+ * Copyright (c) 2004-2012, 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 org.hisp.dhis.common.Grid;
+import org.hisp.dhis.i18n.I18n;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager;
+import org.hisp.dhis.program.Program;
+import org.hisp.dhis.program.ProgramService;
+import org.hisp.dhis.program.ProgramStageInstanceService;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Chau Thu Tran
+ * @version $ ProgramStageInstanceCompletenessAction.java Apr 16, 2013 8:53:27
+ *          AM $
+ */
+public class ProgramStageInstanceCompletenessAction
+    implements Action
+{
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
+
+    private OrganisationUnitSelectionManager selectionManager;
+
+    public void setSelectionManager( OrganisationUnitSelectionManager selectionManager )
+    {
+        this.selectionManager = selectionManager;
+    }
+
+    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;
+    }
+
+    // -------------------------------------------------------------------------
+    // Input/output
+    // -------------------------------------------------------------------------
+
+    private Integer programId;
+
+    public void setProgramId( Integer programId )
+    {
+        this.programId = programId;
+    }
+
+    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 Grid grid;
+
+    public Grid getGrid()
+    {
+        return grid;
+    }
+
+    // -------------------------------------------------------------------------
+    // Action implementation
+    // -------------------------------------------------------------------------
+
+    @Override
+    public String execute()
+        throws Exception
+    {
+        Program program = programService.getProgram( programId );
+
+        OrganisationUnit orgunit = selectionManager.getSelectedOrganisationUnit();
+
+        grid = programStageInstanceService.getCompletenessProgramStageInstance( orgunit, program, startDate, endDate,
+            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-04-16 02:02:11 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml	2013-04-16 05:41:25 +0000
@@ -1118,5 +1118,15 @@
     <property name="currentUserService" ref="org.hisp.dhis.user.CurrentUserService" />
     <property name="patientDataValueService" ref="org.hisp.dhis.patientdatavalue.PatientDataValueService" />
   </bean>
+  
+  <!-- Program-stage-completeness -->
+  
+  <bean id="org.hisp.dhis.caseentry.action.caseentry.ProgramStageInstanceCompletenessAction"
+    class="org.hisp.dhis.caseentry.action.caseentry.ProgramStageInstanceCompletenessAction"
+    scope="prototype">
+    <property name="selectionManager" ref="org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager" />
+    <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-04-16 02:02:11 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties	2013-04-16 05:41:25 +0000
@@ -629,4 +629,9 @@
 program_enrollement = Program enrollement
 stored_by = Stored by
 stored_date = Stored date
-marked = Marked
\ No newline at end of file
+marked = Marked
+user_name = User name
+program_stage_completeness = Program Stage Completeness
+intro_program_stage_completeness =  Monitor completeness of events by program
+program_stage_completeness_form = Program stage completeness
+number_of_events = Number of events
\ 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-04-15 07:46:11 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/struts.xml	2013-04-16 05:41:25 +0000
@@ -1114,5 +1114,31 @@
       <result name="pdf" type="gridPdfResult" />
     </action>
 	
+	<!-- Program-stage-completeness -->
+	
+	  <action name="programStageCompletenessSelect"
+      class="org.hisp.dhis.caseentry.action.caseentry.MultiDataEntrySelectAction">
+      <interceptor-ref name="organisationUnitTreeStack" />
+      <result name="success" type="velocity">/main.vm</result>
+      <param name="page">/dhis-web-caseentry/programStageCompletenessSelect.vm</param>
+      <param name="menu">/dhis-web-caseentry/reportsMenu.vm</param>
+      <param name="stylesheets">style/style.css</param>
+      <param name="javascripts">
+      	../dhis-web-commons/ouwt/ouwt.js,
+      	javascript/commons.js,
+      	javascript/programStageCompleteness.js</param>
+      <param name="requiredAuthorities">F_PROGRAM_STAGE_COMPLETENESS</param>
+    </action>
+    
+	<action name="generateProgramStageCompleteness"
+      class="org.hisp.dhis.caseentry.action.caseentry.ProgramStageInstanceCompletenessAction">
+      <result name="success" type="velocity">/content.vm</result>
+      <param name="page">/dhis-web-caseentry/programStageCompleteness.vm</param>
+      <param name="stylesheets">style/style.css</param>
+      <result name="xls" type="gridXlsResult" />
+      <result name="pdf" type="gridPdfResult" />
+      <param name="requiredAuthorities">F_PROGRAM_STAGE_COMPLETENESS</param>
+    </action>
+	
   </package>
 </struts>

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/index.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/index.vm	2013-03-25 08:55:41 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/index.vm	2013-04-16 05:41:25 +0000
@@ -38,6 +38,10 @@
 		#introListImgItem( "statisticalProgramReportSelect.action" "statistical_program" "validationanalysis" )
 	#end
 	
+	#if( $auth.hasAccess( "dhis-web-caseentry", "programStageCompletenessSelect" ) )
+		#introListImgItem( "programStageCompletenessSelect.action" "program_stage_completeness" "validationanalysis" )
+	#end
+	
 	#if( $auth.hasAccess( "dhis-web-caseentry", "caseAggregationForm" ) )
 		#introListImgItem( "caseAggregationForm.action" "manual_person_aggregation" "caseaggregation" )
 	#end

=== added file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/programStageCompleteness.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/programStageCompleteness.js	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/programStageCompleteness.js	2013-04-16 05:41:25 +0000
@@ -0,0 +1,38 @@
+isAjax = true;
+
+function orgunitSelected( orgUnits, orgUnitNames )
+{
+	hideById("listPatientDiv");
+	setFieldValue('orgunitName', orgUnitNames[0]);
+	setFieldValue('orgunitId', orgUnits[0]);
+}
+
+selection.setListenerFunction( orgunitSelected );
+
+function generateStageCompleteness()
+{
+	showLoader();
+	jQuery('#completenessDiv').load('generateProgramStageCompleteness.action',
+		{
+			programId: getFieldValue('programId'),
+			startDate: getFieldValue('startDate'),
+			endDate: getFieldValue('endDate')
+		}, 
+		function()
+		{
+			showById('completenessDiv');
+			setTableStyles();
+			hideLoader();
+		});
+}
+
+function exportStageCompleteness( type )
+{
+	var params = "type=" + type;
+	params += "&programId=" + getFieldValue('programId');
+	params += "&startDate=" + getFieldValue('startDate');
+	params += "&endDate=" + getFieldValue('endDate');
+	
+	var url = "generateProgramStageCompleteness.action?" + params;
+	window.location.href = url;
+}

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/menu.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/menu.vm	2013-01-29 15:19:42 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/menu.vm	2013-04-16 05:41:25 +0000
@@ -48,6 +48,9 @@
 	#if( $auth.hasAccess( "dhis-web-caseentry", "statisticalProgramReportSelect" ) )
 	<li><a href="statisticalProgramReportSelect.action"> $i18n.getString( "statistical_program" )&nbsp;</a></li>
 	#end
+	#if( $auth.hasAccess( "dhis-web-caseentry", "programStageCompletenessSelect" ) )
+	<li><a href="programStageCompletenessSelect.action"> $i18n.getString( "program_stage_completeness" )&nbsp;</a></li>
+	#end
 </ul>
 
 #if( $auth.hasAccess( "dhis-web-caseentry", "caseAggregationForm" ) )	

=== added file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programStageCompleteness.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programStageCompleteness.vm	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programStageCompleteness.vm	2013-04-16 05:41:25 +0000
@@ -0,0 +1,45 @@
+<style type="text/css">
+.gridTable th, .gridTable td
+{
+  text-align: center;
+  width: 150px;
+  line-height: 170%;
+}
+</style>
+
+<h3>$!encoder.htmlEncode( $grid.title )</h3>
+<h5>$!encoder.htmlEncode( $grid.subtitle )</h5>
+
+<table class="listTable gridTable">
+	<thead>
+		<tr>
+			<th>#</th>
+			#foreach( $header in $grid.getVisibleHeaders() )
+				<th #if( $header.meta )style="text-align:left"#end>$!encoder.htmlEncode( $header.name )</th>
+			#end
+		</tr>
+	</thead>
+	<tbody>
+		#set( $i = 1 )
+		#foreach( $row in $grid.getVisibleRows() )
+			<tr>
+				<td>$i</td>
+			#foreach( $col in $row )
+				#set( $index = ( $velocityCount - 1 ) )
+				#if( $grid.getVisibleHeaders().get( $index ).meta )
+					<td style="text-align:left">$!encoder.htmlEncode( $col )</td>
+				#else
+					<td>$col</td>
+				#end
+			#end
+			</tr>
+			#set( $i = $i + 1 )
+		#end
+	</tbody>
+</table>
+
+<script type="text/javascript">
+	jQuery(document).ready(function(){
+		setTableStyles();	
+	});
+</script>	
\ No newline at end of file

=== added file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programStageCompletenessSelect.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programStageCompletenessSelect.vm	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programStageCompletenessSelect.vm	2013-04-16 05:41:25 +0000
@@ -0,0 +1,69 @@
+<script>
+	jQuery(document).ready(	function(){
+		validation( 'activityPlanForm', function(form){
+			if(getFieldValue('export')=='false'){
+				generateStageCompleteness();
+			}
+			else{
+				exportStageCompleteness('xls');
+			}
+		});
+		
+		datePickerInRange( 'startDate' , 'endDate' );
+	});	
+</script>
+
+<h3 id='mainLinkLbl'>$i18n.getString( "program_stage_completeness_form" ) #openHelp('program_stage_completeness')</h3>
+<form id='activityPlanForm' name='activityPlanForm'>
+	<input type='hidden' id='export' value='export'>
+	<div id='selectDiv' class='advanced-search' style='width:550px;'>
+		<table style="margin-bottom:8px;width:550px;">    
+			<tr>
+				<td>
+					<label>$i18n.getString( "registering_unit" )</label>
+				</td>
+				<td>
+					<input type="text" id='orgunitName' readonly="readonly" #if( $organisationUnit ) value="$encoder.htmlEncode( $organisationUnit.name )" #else value="[$i18n.getString( 'please_select_village' )]" #end >
+				</td>
+			</tr> 
+			<tr>
+				<td>$i18n.getString('program')</td>
+				<td>
+					<select id='programId' name='programId' class="{validate:{required:true}}" >
+						<option value="">[$i18n.getString("please_select")]</option>
+						#foreach($program in $programs)
+							<option value="$program.id" type='$program.type'>$program.displayName</option>
+						#end
+					</select>
+				</td>
+			</tr>
+			<tr>
+				<td>$i18n.getString('show_events_since')</td>
+				<td>
+					<input type='text' id='startDate' name='startDate'>
+				</td>
+			</tr>
+			<tr>
+				<td>$i18n.getString('show_events_up_to')</td>
+				<td>
+					<input type='text' id='endDate' name='endDate'>
+				</td>
+			</tr>
+			<tr>
+				<td></td>
+				<td>
+					<input type="submit" class='large-button' id='listPatientBtn' value="$i18n.getString( 'generate' )" onclick="setFieldValue('export', false);">
+					<input type="submit" class='large-button' value="$i18n.getString( 'export_xls' )" onclick="setFieldValue('export', true);">
+				</td>
+			</tr>
+		</table>
+	</div>
+</form>
+
+<div id='completenessDiv' name='completenessDiv'></div>
+
+#parse( "dhis-web-commons/loader/loader.vm" )
+
+<script>
+	var i18n_please_select = '$encoder.jsEscape( $i18n.getString( "please_select" ) , "'")';
+</script>

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/reportsMenu.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/reportsMenu.vm	2012-12-14 17:07:44 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/reportsMenu.vm	2013-04-16 05:41:25 +0000
@@ -10,6 +10,9 @@
 	#if( $auth.hasAccess( "dhis-web-caseentry", "statisticalProgramReportSelect" ) )
 		<li><a href="statisticalProgramReportSelect.action"> $i18n.getString( "statistical_program" )&nbsp;</a></li>
 	#end
+	#if( $auth.hasAccess( "dhis-web-caseentry", "programStageCompletenessSelect" ) )
+	<li><a href="programStageCompletenessSelect.action"> $i18n.getString( "program_stage_completeness" )&nbsp;</a></li>
+	#end
 </ul>
 
 <br>