dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #20452
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 9334: Display details of persons when to click on a number in statistical program report (WIP).
------------------------------------------------------------
revno: 9334
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2012-12-17 09:46:17 +0700
message:
Display details of persons when to click on a number in statistical program report (WIP).
added:
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/webapp/dhis-web-caseentry/statisticalProgramDetailsReport.vm
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/statisticalProgramReport.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
=== 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<Patient>
+{
+ // -------------------------------------------------------------------------
+ // 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<ProgramStageInstance> programStageInstances = new ArrayList<ProgramStageInstance>();
+
+ public List<ProgramStageInstance> 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<Integer> orgunitIds = new HashSet<Integer>();
+
+ 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 @@
+<h5 id="gridSubtitleDetails"></h5>
+<script>
+ var subTitle = getFieldValue("programStageName")
+ + " - " + getStatusString( getFieldValue('status'))
+ + " - " + i18n_total_result + ": " + getFieldValue('total');
+ setInnerHTML('gridSubtitleDetails', subTitle );
+</script>
+
+<input type="hidden" id="programStageName" name="programStageName" value="$!encoder.jsEncode($programStage.name)">
+<table>
+ <tr>
+ <td>
+ <table class="listTable gridTable">
+ <colgroup>
+ <col width="30"/>
+ <col/>
+ <col/>
+ <col/>
+ <col/>
+ <col/>
+ <col/>
+ </colgroup>
+ <thead>
+ <tr>
+ <th>#</th>
+ <th>$i18n.getString('full_name')</th>
+ <th>$i18n.getString( "gender" )</th>
+ <th>$i18n.getString( "date_of_birth" )</th>
+ <th>$i18n.getString( "age" )</th>
+ <th>$i18n.getString( "phone_number" )</th>
+ <th>$i18n.getString( "orgunit" )</th>
+ </tr>
+ </thead>
+ <tbody>
+ #foreach( $programStageInstance in $programStageInstances )
+ #set( $patient = $programStageInstance.programInstance.patient )
+ <tr>
+ <td>
+ #set( $nr = ( ( $paging.getCurrentPage() - 1 ) * $paging.pageSize ) + $velocityCount )
+ $nr
+ </td>
+ <td>$!encoder.htmlEncode($patient.getFullName())</td>
+ <td>$i18n.getString($!patient.gender)</td>
+ <td>$format.formatDate( $!patient.birthDate)</td>
+ <td>$!patient.getAge()</td>
+ <td>$!patient.phoneNumber</td>
+ <td>$!encoder.htmlEncode($!patient.organisationUnit.name)</td>
+ </tr>
+ #end
+ </tbody>
+ </table>
+ </td>
+ </tr>
+ <tr>
+ <td colspan="7">
+ <p></p>
+ <div class="paging-container">
+ #parse( "/dhis-web-commons/paging/paging.vm" )
+ </div>
+ </td>
+ </tr>
+</table>
+
+<script>
+ 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/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 @@
+<h3 id="gridTitle">$!encoder.htmlEncode( $grid.title )</h3>
+
+<div id="reportTbl" name="reportTbl">
+ <h5 id="gridSubtitle">$!encoder.htmlEncode( $grid.subtitle )</h5>
+ <table class="listTable gridTable">
+ <thead>
+ <tr>
+ #foreach( $header in $grid.getVisibleHeaders() )
+ <th #if( !$header.meta )style="text-align:center"#end>$!encoder.htmlEncode( $header.name )</th>
+ #end
+ </tr>
+ </thead>
+ <tbody>
+ #foreach( $row in $grid.getRows() )
+ <tr>
+ #foreach( $col in $row )
+ #set( $index = ( $velocityCount - 1 ) )
+ #if($index==0)
+ #set( $programStageId = $col )
+ #elseif( $grid.getHeaders().get( $index ).meta )
+ <td>$!encoder.htmlEncode( $col )</td>
+ #else
+ #if($index==2 || $index==4 || $index==6 || $index==8)
+ #set($status = $index/2)
+ #if($col==0)
+ <td style="text-align:center">$!format.formatValue( $col )</td>
+ #else
+ <td style="text-align:center"><a href="javascript:statisticalProgramDetailsReport($programStageId,$status, $col)">$!format.formatValue( $col )</a></td>
+ #end
+ #else
+ <td style="text-align:center">$!format.formatValue( $col )</td>
+ #end
+ #end
+ #end
+ </tr>
+ #end
+ </tbody>
+ </table>
+</div>
+
+<div id='detailsDiv'></div>