=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseaggregation/CaseAggregationResultDetailsAction.java' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseaggregation/CaseAggregationResultDetailsAction.java 2012-02-07 08:39:49 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseaggregation/CaseAggregationResultDetailsAction.java 2012-02-27 06:09:39 +0000 @@ -35,6 +35,7 @@ import org.hisp.dhis.caseaggregation.CaseAggregationCondition; import org.hisp.dhis.caseaggregation.CaseAggregationConditionService; import org.hisp.dhis.dataelement.DataElement; +import org.hisp.dhis.i18n.I18nFormat; import org.hisp.dhis.organisationunit.OrganisationUnit; import org.hisp.dhis.organisationunit.OrganisationUnitService; import org.hisp.dhis.patient.Patient; @@ -42,6 +43,7 @@ import org.hisp.dhis.patientdatavalue.PatientDataValueService; import org.hisp.dhis.period.Period; import org.hisp.dhis.period.PeriodService; +import org.hisp.dhis.period.PeriodType; import org.hisp.dhis.program.ProgramStageInstance; import com.opensymphony.xwork2.Action; @@ -65,6 +67,8 @@ private PatientDataValueService patientDataValueService; + private I18nFormat format; + // ------------------------------------------------------------------------- // Input/Output // ------------------------------------------------------------------------- @@ -73,10 +77,12 @@ private Integer aggregationConditionId; - private Integer periodId; + private String periodTypeName; + + private String startDate; private Map> mapPatients; - + private Map> mapEvents; // ------------------------------------------------------------------------- @@ -103,6 +109,16 @@ this.periodService = periodService; } + public void setPeriodTypeName( String periodTypeName ) + { + this.periodTypeName = periodTypeName; + } + + public void setStartDate( String startDate ) + { + this.startDate = startDate; + } + public Map> getMapPatients() { return mapPatients; @@ -122,10 +138,10 @@ { this.aggregationConditionId = aggregationConditionId; } - - public void setPeriodId( Integer periodId ) + + public void setFormat( I18nFormat format ) { - this.periodId = periodId; + this.format = format; } // ------------------------------------------------------------------------- @@ -136,32 +152,33 @@ public String execute() throws Exception { - OrganisationUnit orgunit = organisationUnitService.getOrganisationUnit( orgunitId ); - Period period = periodService.getPeriod( periodId ); + PeriodType periodType = periodService.getPeriodTypeByName( periodTypeName ); + Period period = periodType.createPeriod( format.parseDate( startDate ) ); CaseAggregationCondition aggCondition = aggregationConditionService .getCaseAggregationCondition( aggregationConditionId ); - if( aggCondition.getOperator().equals( CaseAggregationCondition.AGGRERATION_SUM ) ) + if ( aggCondition.getOperator().equals( CaseAggregationCondition.AGGRERATION_SUM ) ) { mapEvents = new HashMap>(); - - Collection programStageInstances = aggregationConditionService.getProgramStageInstances( aggCondition, orgunit, period ); + + Collection programStageInstances = aggregationConditionService + .getProgramStageInstances( aggCondition, orgunit, period ); for ( ProgramStageInstance programStageInstance : programStageInstances ) { - Collection dataElements = aggregationConditionService.getDataElementsInCondition( aggCondition - .getAggregationExpression() ); + Collection dataElements = aggregationConditionService + .getDataElementsInCondition( aggCondition.getAggregationExpression() ); Collection dataValues = new HashSet(); - + if ( dataElements.size() > 0 ) { dataValues = patientDataValueService.getPatientDataValues( programStageInstance, dataElements ); } - + mapEvents.put( programStageInstance, dataValues ); } } @@ -170,20 +187,20 @@ mapPatients = new HashMap>(); Collection patients = aggregationConditionService.getPatients( aggCondition, orgunit, period ); - + for ( Patient patient : patients ) { - Collection dataElements = aggregationConditionService.getDataElementsInCondition( aggCondition - .getAggregationExpression() ); - + Collection dataElements = aggregationConditionService + .getDataElementsInCondition( aggCondition.getAggregationExpression() ); + Collection dataValues = new HashSet(); - + if ( dataElements.size() > 0 ) { - dataValues = patientDataValueService.getPatientDataValues( patient, - dataElements, period.getStartDate(), period.getEndDate() ); + dataValues = patientDataValueService.getPatientDataValues( patient, dataElements, period + .getStartDate(), period.getEndDate() ); } - + mapPatients.put( patient, dataValues ); } } === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/caseAggregationResult.vm' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/caseAggregationResult.vm 2012-02-27 05:35:23 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/caseAggregationResult.vm 2012-02-27 06:09:39 +0000 @@ -50,7 +50,7 @@ $dataValue.value $!mapStatusValues.get( $statusKey ) - $i18n.getString( 'show_details' ) + $i18n.getString( 'show_details' ) #set( $mark = !$mark ) === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/caseagg.js' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/caseagg.js 2012-02-27 05:35:23 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/caseagg.js 2012-02-27 06:09:39 +0000 @@ -103,12 +103,13 @@ } } -function viewResultDetails( orgunitId, periodId, aggregationConditionId ) +function viewResultDetails( orgunitId, periodTypeName, startDate, aggregationConditionId ) { $('#contentDetails' ).val(''); var url = 'caseAggregationResultDetails.action?'; url+= 'orgunitId=' + orgunitId; - url+= '&periodId=' + periodId; + url+= '&periodTypeName=' + periodTypeName; + url+= '&startDate=' + startDate; url+= '&aggregationConditionId=' + aggregationConditionId; $('#contentDetails' ).load(url).dialog({