=== added file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/StatisticalProgramDetailsReportAction.java' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/StatisticalProgramDetailsReportAction.java 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/StatisticalProgramDetailsReportAction.java 2012-12-17 02:46:17 +0000 @@ -0,0 +1,199 @@ +/* + * 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.HashSet; +import java.util.List; + +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.paging.ActionPagingSupport; +import org.hisp.dhis.patient.Patient; +import org.hisp.dhis.program.ProgramStage; +import org.hisp.dhis.program.ProgramStageInstance; +import org.hisp.dhis.program.ProgramStageInstanceService; +import org.hisp.dhis.program.ProgramStageService; + +/** + * @author Chau Thu Tran + * + * @version StatisticalProgramDetailsReportAction.java 12:37:43 PM Dec 16, 2012 + * $ + */ +public class StatisticalProgramDetailsReportAction + extends ActionPagingSupport +{ + // ------------------------------------------------------------------------- + // Dependencies + // ------------------------------------------------------------------------- + + private ProgramStageService programStageService; + + public void setProgramStageService( ProgramStageService programStageService ) + { + this.programStageService = programStageService; + } + + private ProgramStageInstanceService programStageInstanceService; + + public void setProgramStageInstanceService( ProgramStageInstanceService programStageInstanceService ) + { + this.programStageInstanceService = programStageInstanceService; + } + + private OrganisationUnitService organisationUnitService; + + public void setOrganisationUnitService( OrganisationUnitService organisationUnitService ) + { + this.organisationUnitService = organisationUnitService; + } + + private OrganisationUnitSelectionManager selectionManager; + + public void setSelectionManager( OrganisationUnitSelectionManager selectionManager ) + { + this.selectionManager = selectionManager; + } + + private I18nFormat format; + + public void setFormat( I18nFormat format ) + { + this.format = format; + } + + // ------------------------------------------------------------------------- + // Input/output + // ------------------------------------------------------------------------- + + private Integer programStageId; + + public void setProgramStageId( Integer programStageId ) + { + this.programStageId = programStageId; + } + + private String startDate; + + public void setStartDate( String startDate ) + { + this.startDate = startDate; + } + + private String endDate; + + public void setEndDate( String endDate ) + { + this.endDate = endDate; + } + + private Integer status; + + public void setStatus( Integer status ) + { + this.status = status; + } + + private String facilityLB; + + public void setFacilityLB( String facilityLB ) + { + this.facilityLB = facilityLB; + } + + private Integer total; + + public void setTotal( Integer total ) + { + this.total = total; + } + + private ProgramStage programStage; + + public ProgramStage getProgramStage() + { + return programStage; + } + + private List programStageInstances = new ArrayList(); + + public List getProgramStageInstances() + { + return programStageInstances; + } + + // ------------------------------------------------------------------------- + // Action implementation + // ------------------------------------------------------------------------- + + public String execute() + throws Exception + { + OrganisationUnit organisationUnit = selectionManager.getSelectedOrganisationUnit(); + + programStage = programStageService.getProgramStage( programStageId ); + + 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() ) ); + } + + this.paging = createPaging( total ); + + programStageInstances = programStageInstanceService.getStatisticalProgramStageDetailsReport( programStage, + orgunitIds, sDate, eDate, status, paging.getStartPos(), paging.getPageSize() ); + + return SUCCESS; + } +} === added file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/statisticalProgramDetailsReport.vm' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/statisticalProgramDetailsReport.vm 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/statisticalProgramDetailsReport.vm 2012-12-17 02:46:17 +0000 @@ -0,0 +1,68 @@ +
+ + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + #foreach( $programStageInstance in $programStageInstances ) + #set( $patient = $programStageInstance.programInstance.patient ) + + + + + + + + + + #end + +
#$i18n.getString('full_name')$i18n.getString( "gender" )$i18n.getString( "date_of_birth" )$i18n.getString( "age" )$i18n.getString( "phone_number" )$i18n.getString( "orgunit" )
+ #set( $nr = ( ( $paging.getCurrentPage() - 1 ) * $paging.pageSize ) + $velocityCount ) + $nr + $!encoder.htmlEncode($patient.getFullName())$i18n.getString($!patient.gender)$format.formatDate( $!patient.birthDate)$!patient.getAge()$!patient.phoneNumber$!encoder.htmlEncode($!patient.organisationUnit.name)
+
+

+
+ #parse( "/dhis-web-commons/paging/paging.vm" ) +
+
+ + \ No newline at end of file === 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-17 02:46:17 +0000 @@ -0,0 +1,41 @@ +

$!encoder.htmlEncode( $grid.title )

+ +
+
$!encoder.htmlEncode( $grid.subtitle )
+ + + + #foreach( $header in $grid.getVisibleHeaders() ) + + #end + + + + #foreach( $row in $grid.getRows() ) + + #foreach( $col in $row ) + #set( $index = ( $velocityCount - 1 ) ) + #if($index==0) + #set( $programStageId = $col ) + #elseif( $grid.getHeaders().get( $index ).meta ) + + #else + #if($index==2 || $index==4 || $index==6 || $index==8) + #set($status = $index/2) + #if($col==0) + + #else + + #end + #else + + #end + #end + #end + + #end + +
$!encoder.htmlEncode( $header.name )
$!encoder.htmlEncode( $col )$!format.formatValue( $col )$!format.formatValue( $col )$!format.formatValue( $col )
+
+ +