← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2212: Bug Fixed in Dashboard/Graphical Analysis/Regular Export to Excel

 

------------------------------------------------------------
revno: 2212
committer: Mithilesh Kumar Thakur<mithilesh.hisp@xxxxxxxxx>
branch nick: trunk
timestamp: Thu 2010-09-23 16:34:04 +0530
message:
  Bug Fixed in Dashboard/Graphical Analysis/Regular Export to Excel
modified:
  local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/action/ExportToExcelAction.java
  local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ga/action/charts/GenerateChartDataAction.java
  local/in/dhis-web-dashboard/src/main/resources/META-INF/dhis/beans.xml


--
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 'local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/action/ExportToExcelAction.java'
--- local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/action/ExportToExcelAction.java	2010-06-04 11:50:05 +0000
+++ local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/action/ExportToExcelAction.java	2010-09-23 11:04:04 +0000
@@ -26,24 +26,32 @@
 import jxl.write.WritableWorkbook;
 
 import org.apache.struts2.ServletActionContext;
-import org.hisp.dhis.external.location.LocationManager;
+import org.hisp.dhis.config.ConfigurationService;
+import org.hisp.dhis.config.Configuration_IN;
 
 import com.keypoint.PngEncoder;
+import com.opensymphony.xwork2.Action;
 import com.opensymphony.xwork2.ActionContext;
-import com.opensymphony.xwork2.ActionSupport;
 
-public class ExportToExcelAction extends ActionSupport
+public class ExportToExcelAction implements Action
 {
     // -------------------------------------------------------------------------
     // Dependencies
     // -------------------------------------------------------------------------
-
+/*
     private LocationManager locationManager;
 
     public void setLocationManager( LocationManager locationManager )
     {
         this.locationManager = locationManager;
     }
+ */  
+    private ConfigurationService configurationService;
+
+    public void setConfigurationService( ConfigurationService configurationService )
+    {
+        this.configurationService = configurationService;
+    }
     
     // -------------------------------------------------------------------------
     // Input & output
@@ -149,14 +157,14 @@
         else if(chartDisplayOption.equalsIgnoreCase("desend")) { sortByDesscending(); }
         else if(chartDisplayOption.equalsIgnoreCase("alphabet")) { sortByAlphabet(); }          
                 
-        File outputReportFile = locationManager.getFileForWriting( UUID.randomUUID().toString() + ".xls", "db", "output" );
-        
-        /*
-        String outputReportPath = System.getProperty( "user.home" ) + File.separator + "dhis" + File.separator + "ra"
+        //File outputReportFile = locationManager.getFileForWriting( UUID.randomUUID().toString() + ".xls", "db", "output" );
+        
+        
+        String outputReportFile = System.getProperty( "user.home" ) + File.separator + "dhis" + File.separator + configurationService.getConfigurationByKey( Configuration_IN.KEY_REPORTFOLDER ).getValue()
         + File.separator + "output" + File.separator + UUID.randomUUID().toString() + ".xls";
-        */
+       
         
-        WritableWorkbook outputReportWorkbook = Workbook.createWorkbook( outputReportFile );
+        WritableWorkbook outputReportWorkbook = Workbook.createWorkbook( new File(outputReportFile) );
         WritableSheet sheet0 = outputReportWorkbook.createSheet( "ChartOutput", 0 );
         
         if(viewSummary.equals( "no" ))

=== modified file 'local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ga/action/charts/GenerateChartDataAction.java'
--- local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ga/action/charts/GenerateChartDataAction.java	2010-09-22 12:16:23 +0000
+++ local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ga/action/charts/GenerateChartDataAction.java	2010-09-23 11:04:04 +0000
@@ -1528,33 +1528,7 @@
                         }
                     }
                 }
-              //22/09/2010 add 
-                Double tempVal = aggregationService
-                .getAggregatedIndicatorValue( ind, startPeriod.getStartDate(), endPeriod.getEndDate(),
-                    childOrgUnit );
-                
-                if( tempVal != null)
-                {  
-                    serviceValues[countForServiceList][countForChildOrgUnitList] /= noOfChildren;
-                    serviceValues[countForServiceList][countForChildOrgUnitList] = Math
-                        .round( serviceValues[countForServiceList][countForChildOrgUnitList] * Math.pow( 10, 1 ) )
-                        / Math.pow( 10, 1 );
-
-                    numVal = Math.round( numVal * Math.pow( 10, 1 ) ) / Math.pow( 10, 1 );
-                    denVal = Math.round( denVal * Math.pow( 10, 1 ) ) / Math.pow( 10, 1 );
-                }
-                else
-                {  
-                    serviceValues[countForServiceList][countForChildOrgUnitList] = 0.0;
-                    serviceValues[countForServiceList][countForChildOrgUnitList] = 0.0;
-                    numVal = 0.0;
-                    denVal = 0.0;
-                }
-
-                // end 22/09/2010
-                    
-                    
-                    
+
                 serviceValues[countForServiceList][countForChildOrgUnitList] /= noOfChildren;
                 serviceValues[countForServiceList][countForChildOrgUnitList] = Math
                     .round( serviceValues[countForServiceList][countForChildOrgUnitList] * Math.pow( 10, 1 ) )

=== modified file 'local/in/dhis-web-dashboard/src/main/resources/META-INF/dhis/beans.xml'
--- local/in/dhis-web-dashboard/src/main/resources/META-INF/dhis/beans.xml	2010-09-04 13:07:00 +0000
+++ local/in/dhis-web-dashboard/src/main/resources/META-INF/dhis/beans.xml	2010-09-23 11:04:04 +0000
@@ -765,9 +765,11 @@
     <bean id="org.hisp.dhis.dashboard.action.ExportToExcelAction"
 		class="org.hisp.dhis.dashboard.action.ExportToExcelAction"
 		scope="prototype">
-        <property name="locationManager">
+ <!--   <property name="locationManager">
             <ref bean="org.hisp.dhis.external.location.LocationManager"/>
-        </property>
+        </property>-->
+		<property name="configurationService" ref="org.hisp.dhis.config.ConfigurationService">
+		</property>
     </bean>
 	
     <bean id="org.hisp.dhis.dashboard.action.GetSortedDataAction"