=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/GenerateReportAction.java' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/GenerateReportAction.java 2012-12-13 08:48:54 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/GenerateReportAction.java 2012-12-14 05:49:05 +0000 @@ -78,13 +78,6 @@ this.programInstanceService = programInstanceService; } - private ProgramStageInstanceService programStageInstanceService; - - public void setProgramStageInstanceService( ProgramStageInstanceService programStageInstanceService ) - { - this.programStageInstanceService = programStageInstanceService; - } - private OrganisationUnitService organisationUnitService; public void setOrganisationUnitService( OrganisationUnitService organisationUnitService ) @@ -165,13 +158,6 @@ { return total; } - - private Map completedMap = new HashMap(); - - public Map getCompletedMap() - { - return completedMap; - } // ------------------------------------------------------------------------- // Action implementation @@ -223,12 +209,6 @@ programInstances = programInstanceService.getProgramInstances( program, orgunitIds, sDate, eDate, paging.getStartPos(), paging.getPageSize() ); - for ( ProgramStage programStage : program.getProgramStages() ) - { - int completedNo = programStageInstanceService.getProgramInstancesCount( programStage, orgunitIds, - sDate, eDate ); - completedMap.put( programStage.getId(), completedNo ); - } } return SUCCESS; === added file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/GenerateStatisticalProgramReportAction.java' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/GenerateStatisticalProgramReportAction.java 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/GenerateStatisticalProgramReportAction.java 2012-12-14 05:49:05 +0000 @@ -0,0 +1,233 @@ +/* + * 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.report; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Date; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; + +import org.hisp.dhis.i18n.I18nFormat; +import org.hisp.dhis.organisationunit.OrganisationUnit; +import org.hisp.dhis.organisationunit.OrganisationUnitService; +import org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager; +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.ProgramStage; +import org.hisp.dhis.program.ProgramStageInstanceService; + +import com.opensymphony.xwork2.Action; + +/** + * @author Chau Thu Tran + * + * @version GenerateStatisticalProgramReportAction.java 11:13:25 AM Dec 14, 2012 $ + */ +public class GenerateStatisticalProgramReportAction 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 ProgramInstanceService programInstanceService; + + public void setProgramInstanceService( ProgramInstanceService programInstanceService ) + { + this.programInstanceService = programInstanceService; + } + + private ProgramStageInstanceService programStageInstanceService; + + public void setProgramStageInstanceService( ProgramStageInstanceService programStageInstanceService ) + { + this.programStageInstanceService = programStageInstanceService; + } + + private OrganisationUnitService organisationUnitService; + + public void setOrganisationUnitService( OrganisationUnitService organisationUnitService ) + { + this.organisationUnitService = organisationUnitService; + } + + 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 String startDate; + + public void setStartDate( String startDate ) + { + this.startDate = startDate; + } + + private String endDate; + + public void setEndDate( String endDate ) + { + this.endDate = endDate; + } + + private String facilityLB; + + public void setFacilityLB( String facilityLB ) + { + this.facilityLB = facilityLB; + } + + private OrganisationUnit organisationUnit; + + public OrganisationUnit getOrganisationUnit() + { + return organisationUnit; + } + + private Collection programInstances = new ArrayList(); + + public Collection getProgramInstances() + { + return programInstances; + } + + private Map statusMap = new HashMap(); + + public Map getStatusMap() + { + return statusMap; + } + + private Program program; + + public Program getProgram() + { + return program; + } + + private int total; + + public int getTotal() + { + return total; + } + + private Map completedMap = new HashMap(); + + public Map getCompletedMap() + { + return completedMap; + } + + // ------------------------------------------------------------------------- + // Action implementation + // ------------------------------------------------------------------------- + + public String execute() + throws Exception + { + organisationUnit = selectionManager.getSelectedOrganisationUnit(); + + program = programService.getProgram( programId ); + + Date sDate = format.parseDate( startDate ); + + Date eDate = format.parseDate( endDate ); + + // --------------------------------------------------------------------- + // Get orgunitIds + // --------------------------------------------------------------------- + + Collection orgunitIds = new HashSet(); + + if ( facilityLB.equals( "selected" ) ) + { + orgunitIds.add( organisationUnit.getId() ); + } + else if ( facilityLB.equals( "childrenOnly" ) ) + { + orgunitIds.addAll( organisationUnitService.getOrganisationUnitHierarchy().getChildren( + organisationUnit.getId() ) ); + orgunitIds.remove( organisationUnit.getId() ); + } + else + { + orgunitIds.addAll( organisationUnitService.getOrganisationUnitHierarchy().getChildren( + organisationUnit.getId() ) ); + } + + if ( orgunitIds.size() > 0 ) + { + // --------------------------------------------------------------------- + // Program instances for the selected program + // --------------------------------------------------------------------- + + total = programInstanceService.countProgramInstances( program, orgunitIds, sDate, eDate ); + + for ( ProgramStage programStage : program.getProgramStages() ) + { + int completedNo = programStageInstanceService.getProgramInstancesCount( programStage, orgunitIds, + sDate, eDate ); + completedMap.put( programStage.getId(), completedNo ); + } + } + + 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-12-13 08:48:54 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml 2012-12-14 05:49:05 +0000 @@ -246,7 +246,6 @@ - + + + + + + + + === 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-12-13 08:48:54 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties 2012-12-14 05:49:05 +0000 @@ -56,7 +56,7 @@ search_result_matching_the_search_criteria=Result matches the search criteria registering_unit=Registering unit select=Select -program_summary_report=Program Summary Report +program_summary_report=Program summary report intro_program_summary=View the summary report to get an overview of the services provided for a program. other_facility=Private facility error_required_field=Please enter value for all data element in red color @@ -477,4 +477,7 @@ you_have_active_filters = You have active filters back_to_event_list = Back to event list add_patient_and_add_new = Add person and Add new -number_of_completed_events = Completed Events No. \ No newline at end of file +events_completed = Events completed +statistical_program = Statistical Program +statistical_program_report = Statistical program report +intro_statistical_program = Statistical reports on program performance, e.g. drop-out rates, how many completed every month/year - counts/percentages etc \ 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-11-20 15:34:17 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/struts.xml 2012-12-14 05:49:05 +0000 @@ -323,6 +323,7 @@ /content.vm /dhis-web-caseentry/report.vm javascript/commons.js,javascript/report.js + F_GENERATE_PROGRAM_SUMMARY_REPORT /dhis-web-caseentry/records.vm + + + /main.vm + /dhis-web-caseentry/statisticalProgramReportSelect.vm + /dhis-web-caseentry/reportsMenu.vm + ../dhis-web-commons/ouwt/ouwt.js,javascript/statisticalReport.js + style/style.css + F_GENERATE_STATISTICAL_PROGRAM_REPORT + + + + /content.vm + /dhis-web-caseentry/statisticalProgramReport.vm + javascript/commons.js,javascript/statisticalReport.js + F_GENERATE_STATISTICAL_PROGRAM_REPORT + + === 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 2012-12-07 13:55:41 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/index.vm 2012-12-14 05:49:05 +0000 @@ -27,6 +27,10 @@ #introListImgItem( "app/index.html" "tabular_report" "summaryreport" ) #end + #if( $auth.hasAccess( "dhis-web-caseentry", "statisticalProgramReportSelect" ) ) + #introListImgItem( "statisticalProgramReportSelect.action" "statistical_program" "validationanalysis" ) + #end + #if( $auth.hasAccess( "dhis-web-caseentry", "caseAggregationForm" ) ) #introListImgItem( "caseAggregationForm.action" "manual_person_aggregation" "caseaggregation" ) #end === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/report.js' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/report.js 2012-12-07 13:55:41 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/report.js 2012-12-14 05:49:05 +0000 @@ -9,7 +9,7 @@ function loadGeneratedReport() { showLoader(); - + jQuery( "#contentDiv" ).load( "generateReport.action", { programId: getFieldValue( 'programId' ), === added file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/statisticalReport.js' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/statisticalReport.js 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/statisticalReport.js 2012-12-14 05:49:05 +0000 @@ -0,0 +1,24 @@ +function organisationUnitSelected( orgUnits, orgUnitNames ) +{ + setFieldValue( 'orgunitname', orgUnitNames[0] ); +} + +selection.setListenerFunction( organisationUnitSelected ); + +function generatedStatisticalProgramReport() +{ + showLoader(); + + jQuery( "#contentDiv" ).load( "generateStatisticalProgramReport.action", + { + programId: getFieldValue( 'programId' ), + startDate: getFieldValue( 'startDate' ), + endDate: getFieldValue( 'endDate' ), + facilityLB: $('input[name=facilityLB]:checked').val() + }, function() + { + setTableStyles(); + hideLoader(); + showById( 'contentDiv' ); + }); +} \ No newline at end of file === 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 2012-12-07 13:55:41 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/menu.vm 2012-12-14 05:49:05 +0000 @@ -38,6 +38,9 @@ #if( $auth.hasAccess( "dhis-web-caseentry", "generateTabularReport" ) )
  • $i18n.getString( "tabular_report" ) 
  • #end + #if( $auth.hasAccess( "dhis-web-caseentry", "statisticalProgramReportSelect" ) ) +
  • $i18n.getString( "statistical_program" ) 
  • + #end #if( $auth.hasAccess( "dhis-web-caseentry", "caseAggregationForm" ) ) === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/report.vm' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/report.vm 2012-12-13 08:48:54 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/report.vm 2012-12-14 05:49:05 +0000 @@ -1,17 +1,7 @@ - - - - - - #foreach($programStage in $program.programStages) +
    $i18n.getString( "program_stage")$i18n.getString("number_of_completed_events")
    - - - - #end - - - +
    $encoder.htmlEncode($programStage.name)$completedMap.get($programStage.id)
    $i18n.getString( "total_result" ) + $i18n.getString( "total_result" ): #if($!total) $total #else @@ -21,7 +11,6 @@
    - #if( $programInstances && $programInstances.size() > 0 )

    #parse( "/dhis-web-caseentry/colorHelp.vm" )

    === 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-07 13:55:41 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/reportsMenu.vm 2012-12-14 05:49:05 +0000 @@ -7,6 +7,9 @@ #if( $auth.hasAccess( "dhis-web-caseentry", "generateTabularReport" ) )
  • $i18n.getString( "tabular_report" ) 
  • #end + #if( $auth.hasAccess( "dhis-web-caseentry", "statisticalProgramReportSelect" ) ) +
  • $i18n.getString( "statistical_program" ) 
  • + #end
    === added file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/statisticalProgramReport.vm' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/statisticalProgramReport.vm 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/statisticalProgramReport.vm 2012-12-14 05:49:05 +0000 @@ -0,0 +1,40 @@ +

    $encoder.htmlEncode($program.name) ( )

    +
    + $i18n.getString( "total_result" ): #if($!total) $total #else 0 #end +
    + + + + + + #if($total>0) + + + + + + + + + #set( $mark = false ) + #foreach($programStage in $program.programStages) + #set($completeEventsNo = $completedMap.get($programStage.id) ) + + + + + + + #set( $mark = !$mark ) + #end + + #end +
    $i18n.getString( "program_stage")$i18n.getString("events_completed")$i18n.getString("percent")
    $encoder.htmlEncode($programStage.name)$completeEventsNo
    === added file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/statisticalProgramReportSelect.vm' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/statisticalProgramReportSelect.vm 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/statisticalProgramReportSelect.vm 2012-12-14 05:49:05 +0000 @@ -0,0 +1,79 @@ + + +

    $i18n.getString( "statistical_program_report" )

    +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + +
    + +
    + +
    $i18n.getString('use_data_from_level') + $i18n.getString('selected') + $i18n.getString('children_only') + $i18n.getString('all') +
    + +
    + +
    + +
    + +#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 2012-12-07 13:55:41 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/style/style.css 2012-12-14 05:49:05 +0000 @@ -282,7 +282,6 @@ padding-top:3px; padding-bottom:3px; border-bottom:1px solid #cad5e5; - cursor:pointer; } div.event-dashboard @@ -498,3 +497,10 @@ width:60%; overflow:hidden; } + +.gridTable th, .gridTable td { + line-height: 170%; + text-align: center; + width: 150px; +} + === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/resources/org/hisp/dhis/user/i18n_module.properties' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/resources/org/hisp/dhis/user/i18n_module.properties 2012-12-10 13:53:34 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/resources/org/hisp/dhis/user/i18n_module.properties 2012-12-14 05:49:05 +0000 @@ -172,6 +172,7 @@ F_ACTIVITY_PLAN_EXPORT = Export Activity Plan to XLS file F_GENERATE_ACTIVITY_PLANS = Generate Activity Plans F_GENERATE_PROGRAM_SUMMARY_REPORT = Generate Program Summary Report +F_GENERATE_STATISTICAL_PROGRAM_REPORT = Generate Statistical Program Report F_GENERATE_BENEFICIARY_TABULAR_REPORT = Generate Person Tabular report F_PATIENT_AGGREGATION = Person Aggregation F_GENERATE_PATIENT_CHART = Generate Person Chart