← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2387: Excel reporting - Fixed bug <689515> Can't generate a report.

 

------------------------------------------------------------
revno: 2387
committer: Hieu <hieu.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2010-12-16 15:48:12 +0700
message:
  Excel reporting - Fixed bug <689515> Can't generate a report.
modified:
  dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/export/action/GenerateReportSupport.java


--
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-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/export/action/GenerateReportSupport.java'
--- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/export/action/GenerateReportSupport.java	2010-10-29 12:19:15 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/export/action/GenerateReportSupport.java	2010-12-16 08:48:12 +0000
@@ -132,7 +132,7 @@
 
     protected PeriodService periodService;
 
-    protected PeriodGenericManager periodGenericManager;   
+    protected PeriodGenericManager periodGenericManager;
 
     protected ReportExcelService reportService;
 
@@ -391,8 +391,8 @@
     }
 
     protected void installPeriod( Period period )
-    {       
-        
+    {
+
         Calendar calendar = Calendar.getInstance();
 
         // Monthly period
@@ -463,12 +463,17 @@
 
         this.initFormulaEvaluating();
 
-        ExcelUtils.writeValueByPOI( reportExcel.getOrganisationRow(), reportExcel.getOrganisationColumn(),
-            organisationUnit.getName(), ExcelUtils.TEXT, templateWorkbook.getSheetAt( 0 ), csText );
-        
-        ExcelUtils.writeValueByPOI( reportExcel.getPeriodRow(), reportExcel.getPeriodColumn(), format
-            .formatPeriod( period ), ExcelUtils.TEXT, templateWorkbook.getSheetAt( 0 ), csText );
-        
+        if ( reportExcel.getOrganisationRow() != null && reportExcel.getOrganisationColumn() != null )
+        {
+            ExcelUtils.writeValueByPOI( reportExcel.getOrganisationRow(), reportExcel.getOrganisationColumn(),
+                organisationUnit.getName(), ExcelUtils.TEXT, templateWorkbook.getSheetAt( 0 ), csText );
+        }
+
+        if ( reportExcel.getPeriodRow() != null && reportExcel.getPeriodColumn() != null )
+        {
+            ExcelUtils.writeValueByPOI( reportExcel.getPeriodRow(), reportExcel.getPeriodColumn(), format
+                .formatPeriod( period ), ExcelUtils.TEXT, templateWorkbook.getSheetAt( 0 ), csText );
+        }
     }
 
     protected double getIndicatorValue( ReportExcelItem reportItem, OrganisationUnit organisationUnit )
@@ -705,7 +710,7 @@
     {
         Double aggregatedValue = aggregationService.getAggregatedDataValue( dataElement, optionCombo, startDate,
             endDate, organisationUnit );
-        
+
         if ( aggregatedValue == null )
         {
             aggregatedValue = 0.0;
@@ -735,12 +740,17 @@
 
         this.initFormulaEvaluating();
 
-        ExcelUtils.writeValueByPOI( reportExcel.getOrganisationRow(), reportExcel.getOrganisationColumn(),
-            organisationUnitGroup.getName(), ExcelUtils.TEXT, templateWorkbook.getSheetAt( 0 ), csText );
-
-        ExcelUtils.writeValueByPOI( reportExcel.getPeriodRow(), reportExcel.getPeriodColumn(), format
-            .formatPeriod( period ), ExcelUtils.TEXT, templateWorkbook.getSheetAt( 0 ), csText );
-
+        if ( reportExcel.getOrganisationRow() != null && reportExcel.getOrganisationColumn() != null )
+        {
+            ExcelUtils.writeValueByPOI( reportExcel.getOrganisationRow(), reportExcel.getOrganisationColumn(),
+                organisationUnitGroup.getName(), ExcelUtils.TEXT, templateWorkbook.getSheetAt( 0 ), csText );
+        }
+
+        if ( reportExcel.getPeriodRow() != null && reportExcel.getPeriodColumn() != null )
+        {
+            ExcelUtils.writeValueByPOI( reportExcel.getPeriodRow(), reportExcel.getPeriodColumn(), format
+                .formatPeriod( period ), ExcelUtils.TEXT, templateWorkbook.getSheetAt( 0 ), csText );
+        }
     }
 
     // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~