← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 9792: Minor fix for tabular aggregate report.

 

------------------------------------------------------------
revno: 9792
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2013-02-12 22:57:46 +0700
message:
  Minor fix for tabular aggregate report.
modified:
  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/org/hisp/dhis/caseentry/i18n_module.properties
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/app.js
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonTabularAggregateReport.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-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-02-11 15:09:56 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramStageInstanceStore.java	2013-02-12 15:57:46 +0000
@@ -412,40 +412,91 @@
         if ( deSum != null )
         {
             subTitle = i18n.getString( "group_by" ) + ": "
-                + dataElementService.getDataElement( deSum ).getDisplayName();
-        }
-
-        // Filter is orgunit
-        if ( position == PatientAggregateReport.POSITION_ROW_PERIOD_COLUMN_DATA
-            || position == PatientAggregateReport.POSITION_ROW_DATA_COLUMN_PERIOD
-            || position == PatientAggregateReport.POSITION_ROW_PERIOD
-            || position == PatientAggregateReport.POSITION_ROW_PERIOD_COLUMN_DATA
-            || position == PatientAggregateReport.POSITION_ROW_DATA
-            || position == PatientAggregateReport.POSITION_ROW_DATA_COLUMN_PERIOD )
-        {
-            grid.setSubtitle( subTitle + "; " + i18n.getString( "orgunit" ) + ": "
-                + getFilterOrgunitDescription( orgunitIds ) );
-        }
-
-        // Filter is period
-        if ( position == PatientAggregateReport.POSITION_ROW_ORGUNIT
-            || position == PatientAggregateReport.POSITION_ROW_ORGUNIT_COLUMN_DATA
-            || position == PatientAggregateReport.POSITION_ROW_DATA
-            || position == PatientAggregateReport.POSITION_ROW_DATA_COLUMN_ORGUNIT )
-        {
-            grid.setSubtitle( subTitle + "; " + i18n.getString( "period" ) + ": "
-                + getFilterPeriodDescription( periods, format ) );
-        }
-
-        // Filter is data
-        if ( position == PatientAggregateReport.POSITION_ROW_ORGUNIT_COLUMN_PERIOD
-            || position == PatientAggregateReport.POSITION_ROW_PERIOD_COLUMN_ORGUNIT
-            || position == PatientAggregateReport.POSITION_ROW_ORGUNIT_ROW_PERIOD
-            || position == PatientAggregateReport.POSITION_ROW_PERIOD
-            || position == PatientAggregateReport.POSITION_ROW_ORGUNIT )
-        {
-            grid.setSubtitle( subTitle + "; " + i18n.getString( "data_filter" ) + ": "
-                + getFilterDataDescription( deFilters ) );
+                + dataElementService.getDataElement( deSum ).getDisplayName() + "; ";
+        }
+
+        // Filter is only one orgunit
+        if ( position == PatientAggregateReport.POSITION_ROW_PERIOD_COLUMN_DATA )
+        {
+            String orgunitName = organisationUnitService.getOrganisationUnit( orgunitIds.iterator().next() )
+                .getDisplayName();
+            grid.setSubtitle( subTitle + i18n.getString( "orgunit" ) + ": " + orgunitName );
+        }
+        // Filter is only one period
+        else if ( position == PatientAggregateReport.POSITION_ROW_ORGUNIT_COLUMN_DATA
+            || position == PatientAggregateReport.POSITION_ROW_DATA )
+        {
+
+            Period period = periods.iterator().next();
+            String periodName = "";
+            if ( period.getPeriodType() != null )
+            {
+                periodName += format.formatPeriod( period );
+            }
+            else
+            {
+                String startDate = format.formatDate( period.getStartDate() );
+                String endDate = format.formatDate( period.getEndDate() );
+                periodName += startDate + " -> " + endDate;
+            }
+            grid.setSubtitle( subTitle + i18n.getString( "period" ) + ": " + periodName );
+        }
+        else
+        {
+            // Orgunit filter description
+            String filterOrgunitDes = "";
+            if ( position == PatientAggregateReport.POSITION_ROW_DATA_COLUMN_PERIOD
+                || position == PatientAggregateReport.POSITION_ROW_PERIOD
+                || position == PatientAggregateReport.POSITION_ROW_DATA
+                || position == PatientAggregateReport.POSITION_ROW_DATA_COLUMN_PERIOD )
+            {
+                filterOrgunitDes = getFilterOrgunitDescription( orgunitIds );
+
+                if ( !filterOrgunitDes.isEmpty() )
+                {
+                    filterOrgunitDes = i18n.getString( "orgunit" ) + ": " + filterOrgunitDes + "; ";
+                }
+            }
+
+            // Period filter description
+            String filterPeriodDes = "";
+            if ( position == PatientAggregateReport.POSITION_ROW_ORGUNIT
+                || position == PatientAggregateReport.POSITION_ROW_ORGUNIT_COLUMN_DATA
+                || position == PatientAggregateReport.POSITION_ROW_DATA
+                || position == PatientAggregateReport.POSITION_ROW_DATA_COLUMN_ORGUNIT )
+            {
+                filterPeriodDes = getFilterPeriodDescription( periods, format );
+
+                if ( !filterPeriodDes.isEmpty() )
+                {
+                    filterPeriodDes = i18n.getString( "period" ) + ": " + filterPeriodDes + "; ";
+                }
+            }
+
+            // Data filter description
+            String filterDataDes = "";
+            if ( position == PatientAggregateReport.POSITION_ROW_ORGUNIT_COLUMN_PERIOD
+                || position == PatientAggregateReport.POSITION_ROW_PERIOD_COLUMN_ORGUNIT
+                || position == PatientAggregateReport.POSITION_ROW_ORGUNIT_ROW_PERIOD
+                || position == PatientAggregateReport.POSITION_ROW_PERIOD
+                || position == PatientAggregateReport.POSITION_ROW_ORGUNIT )
+            {
+                filterDataDes = getFilterDataDescription( deFilters );
+                if ( !filterDataDes.isEmpty() )
+                {
+                    filterDataDes = i18n.getString( "data_filter" ) + ": " + filterDataDes + "; ";
+                }
+            }
+
+            subTitle += filterOrgunitDes + filterPeriodDes + filterDataDes;
+            if ( subTitle.isEmpty() )
+            {
+                grid.setSubtitle( i18n.getString( "filter" ) + ": [" + i18n.getString( "none" ) + "]");
+            }
+            else
+            {
+                grid.setSubtitle( subTitle );
+            }
         }
 
         // ---------------------------------------------------------------------
@@ -1511,9 +1562,10 @@
                     description += deName + " " + operator + " " + value + " AND ";
                 }
             }
+            description = description.substring( 0, description.length() - 5 );
         }
 
-        return description.substring( 0, description.length() - 5 );
+        return description;
     }
 
     // ---------------------------------------------------------------------

=== 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-02-11 15:09:56 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties	2013-02-12 15:57:46 +0000
@@ -548,4 +548,5 @@
 select_a_dataelement_for_sum_avg_operator = Please select a data element for sum/avg operator
 runing_validation_rules = Validation rules are being processed, please wait ...
 program_enrollment = Program enrollment
-sum_avg_of = Sum/Avg of
\ No newline at end of file
+sum_avg_of = Sum/Avg of
+filter = Filter
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/app.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/app.js	2013-02-11 15:09:56 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/app.js	2013-02-12 15:57:46 +0000
@@ -1230,7 +1230,11 @@
 								Ext.getCmp('deSumCbx').setValue( f.deSum );
 								Ext.getCmp('aggregateType').setValue( f.aggregateType );
 								Ext.getCmp('levelCombobox').setValue( f.level );
-																
+													
+								TR.store.aggregateDataelement.add(
+									{'value': f.deSumId,'name': deSumName}
+								);				
+
 								// Program stage									
 								var storeProgramStage = TR.store.programStage;
 								storeProgramStage.parent = f.programStageId;

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonTabularAggregateReport.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonTabularAggregateReport.vm	2013-01-30 09:34:29 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonTabularAggregateReport.vm	2013-02-12 15:57:46 +0000
@@ -75,7 +75,7 @@
 		#foreach( ${dataElement} in $!{selectedDataElements} )
 			{
 				"id": "de_${dataElement.id}",
-				"name": "$!encoder.jsonEncode( ${dataElement.name} )",
+				"name": "$!encoder.jsonEncode( ${dataElement.displayName} )",
 				"compulsory": "${dataElement.compulsory}",
 				"valueType": #if( $dataElement.optionSet )
 								"list"
@@ -90,7 +90,8 @@
 	"limitRecords": "$!aggregateReport.limitRecords",
 	"position": "${aggregateReport.position}",
 	"deGroupBy": #if($!aggregateReport.deGroupBy) "de_$!aggregateReport.deGroupBy.id" #else "" #end,
-	"deSum": #if($!aggregateReport.deSum) "de_$!aggregateReport.deSum.id" #else "" #end,
+	"deSumId": #if($!aggregateReport.deSum) "de_$!aggregateReport.deSum.id" #else "" #end,
+	"deSumName": #if($!aggregateReport.deSum) "$!encoder.jsonEncode( ${aggregateReport.deSum.displayName})" #else "" #end,
 	"aggregateType": "${aggregateReport.aggregateType}",
 	"useCompletedEvents": "$!aggregateReport.useCompletedEvents",
 	"userOrganisationUnit": "$!aggregateReport.userOrganisationUnit",