← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 3396: Merging Code from 2.1 - work in progress

 

------------------------------------------------------------
revno: 3396
committer: Bharath <chbharathk@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2011-04-15 17:04:10 +0530
message:
  Merging Code from 2.1 - work in progress
modified:
  local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/action/ExportAnnualDataToExcelAction.java
  local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/ds/action/GenerateDataStatusResultAction.java
  local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/ds/action/GenerateGroupWiseDataStatusResultAction.java
  local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/ds/action/GenerateSummaryDataStatusResultAction.java
  local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/ga/action/charts/GenerateChartAction1.java
  local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/ga/action/charts/GenerateChartDataElementAction.java
  local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/ga/action/charts/GenerateDrillDownResultAction.java
  local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/ta/action/GenerateTabularAnalysisResultAction.java
  local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/tr/action/GenerateTargetAnalysisDataAction.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 'local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/action/ExportAnnualDataToExcelAction.java'
--- local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/action/ExportAnnualDataToExcelAction.java	2010-12-29 07:47:36 +0000
+++ local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/action/ExportAnnualDataToExcelAction.java	2011-04-15 11:34:10 +0000
@@ -63,10 +63,11 @@
 
 /**
  * @author Mithilesh Kumar Thakur
- *
+ * 
  * @version ExportAnnualDataToExcelAction.java Dec 24, 2010 5:10:42 PM
  */
-public class ExportAnnualDataToExcelAction implements Action
+public class ExportAnnualDataToExcelAction
+    implements Action
 {
 
     private ConfigurationService configurationService;
@@ -75,39 +76,39 @@
     {
         this.configurationService = configurationService;
     }
-    
+
     private IndicatorService indicatorService;
 
     public void setIndicatorService( IndicatorService indicatorService )
     {
         this.indicatorService = indicatorService;
     }
+
     private ExpressionService expressionService;
 
     public void setExpressionService( ExpressionService expressionService )
     {
         this.expressionService = expressionService;
     }
-    
+
     // -------------------------------------------------------------------------
     // Input & output
     // -------------------------------------------------------------------------
-    
+
     double[][] data1;
 
     double[][] numDataArray;
-    
+
     double[][] denumDataArray;
 
     String[] series1;
 
-   // String[] denumDataArray;
+    // String[] denumDataArray;
 
     String[] categories1;
 
-  //  String[] categories2;
+    // String[] categories2;
 
-    
     private InputStream inputStream;
 
     public InputStream getInputStream()
@@ -116,13 +117,10 @@
     }
 
     /*
-    private String contentType;
-
-    public String getContentType()
-    {
-        return contentType;
-    }
-    */
+     * private String contentType;
+     * 
+     * public String getContentType() { return contentType; }
+     */
 
     private String fileName;
 
@@ -132,35 +130,32 @@
     }
 
     /*
-    private int bufferSize;
-
-    public int getBufferSize()
-    {
-        return bufferSize;
-    }
-    */
+     * private int bufferSize;
+     * 
+     * public int getBufferSize() { return bufferSize; }
+     */
 
     private String viewSummary;
-    
+
     public void setViewSummary( String viewSummary )
     {
         this.viewSummary = viewSummary;
     }
-   
+
     private String chartDisplayOption;
 
     public void setChartDisplayOption( String chartDisplayOption )
     {
         this.chartDisplayOption = chartDisplayOption;
     }
-    
+
     private String radioButtonValue;
-    
+
     public void setRadioButtonValue( String radioButtonValue )
     {
         this.radioButtonValue = radioButtonValue;
     }
-    
+
     private Integer selctedIndicatorId;
 
     public void setSelctedIndicatorId( Integer selctedIndicatorId )
@@ -168,19 +163,19 @@
         this.selctedIndicatorId = selctedIndicatorId;
     }
 
-    //private Indicator selectedIndicator;
+    // private Indicator selectedIndicator;
     // -------------------------------------------------------------------------
     // Action implementation
     // -------------------------------------------------------------------------
 
     public String execute()
         throws Exception
-    {   
+    {
         int tempCol1 = 0;
         int tempRow1 = 1;
-       // int tempCol2 = 0;
-        
-        if( radioButtonValue.equals( "indicator" ) )
+        // int tempCol2 = 0;
+
+        if ( radioButtonValue.equals( "indicator" ) )
         {
             System.out.println( "indicator" );
         }
@@ -188,538 +183,464 @@
         {
             System.out.println( "dataelement" );
         }
-       // System.out.println("Complete path is :" + radioButtonValue.equals( "indicator" ) );
-        
+        // System.out.println("Complete path is :" + radioButtonValue.equals(
+        // "indicator" ) );
+
         ActionContext ctx = ActionContext.getContext();
-        HttpServletRequest req = (HttpServletRequest) ctx.get( ServletActionContext.HTTP_REQUEST );                        
+        HttpServletRequest req = (HttpServletRequest) ctx.get( ServletActionContext.HTTP_REQUEST );
         HttpSession session = req.getSession();
-        BufferedImage chartImage = (BufferedImage) session.getAttribute("chartImage");
-        PngEncoder encoder = new PngEncoder(chartImage, false, 0, 9);
-        
+        BufferedImage chartImage = (BufferedImage) session.getAttribute( "chartImage" );
+        PngEncoder encoder = new PngEncoder( chartImage, false, 0, 9 );
+
         byte[] encoderBytes = encoder.pngEncode();
         Double[][] objData1 = (Double[][]) session.getAttribute( "data1" );
-        
+
         Double[][] objnumData1 = (Double[][]) session.getAttribute( "numServiceValues" );
         Double[][] objdenumData1 = (Double[][]) session.getAttribute( "denumServiceValues" );
-        //Double[][] objData2 = (Double[][]) session.getAttribute( "data2" );
-        
+        // Double[][] objData2 = (Double[][]) session.getAttribute( "data2" );
+
         String[] series1S = (String[]) session.getAttribute( "series1" );
-        //String[] series2S = (String[]) session.getAttribute( "series2" );
+        // String[] series2S = (String[]) session.getAttribute( "series2" );
         String[] categories1S = (String[]) session.getAttribute( "categories1" );
-       // String[] categories2S = (String[]) session.getAttribute( "categories2" );
-                        
-
-      //  initialzeAllLists(series1S, series2S, categories1S, categories2S);
-        initialzeAllLists(series1S, categories1S );
-        
-        //if(objData1 == null || objData2 == null || series1 == null || series2 == null || categories1 == null || categories2 == null )
-        if( objData1 == null || series1 == null ||  categories1 == null || objnumData1 == null || objdenumData1 == null  )
-                System.out.println("Session Objects are null");
+        // String[] categories2S = (String[]) session.getAttribute(
+        // "categories2" );
+
+        // initialzeAllLists(series1S, series2S, categories1S, categories2S);
+        initialzeAllLists( series1S, categories1S );
+
+        // if(objData1 == null || objData2 == null || series1 == null || series2
+        // == null || categories1 == null || categories2 == null )
+        if ( objData1 == null || series1 == null || categories1 == null || objnumData1 == null || objdenumData1 == null )
+            System.out.println( "Session Objects are null" );
         else
-                System.out.println("Session Objects are not null");
-        
+            System.out.println( "Session Objects are not null" );
+
         data1 = convertDoubleTodouble( objData1 );
-        
+
         numDataArray = convertDoubleTodouble( objnumData1 );
         denumDataArray = convertDoubleTodouble( objdenumData1 );
-        
-        //System.out.println(" Selected Indicator Id is : " + selctedIndicatorId + " ,selected Indicator :"  + selectedIndicator );
-        
-        //selectedIndicator = new Indicator();
-        //selectedIndicator = indicatorService.getIndicator( selctedIndicatorId );
-        //String IndicatorName =  selectedIndicator.getName();
-        
-       // System.out.println(" Selected Indicator Id is : " + selctedIndicatorId + " ,selected Indicator :"  + selectedIndicator );
-        
-      //  data2 = convertDoubleTodouble( objData2 );
-        
-        if(chartDisplayOption == null || chartDisplayOption.equalsIgnoreCase("none")) { }
-        //else if(chartDisplayOption.equalsIgnoreCase("ascend")) { sortByAscending(); }
-       // else if(chartDisplayOption.equalsIgnoreCase("desend")) { sortByDesscending(); }
-       // else if(chartDisplayOption.equalsIgnoreCase("alphabet")) { sortByAlphabet(); }          
-                
-        //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";
-          String outputReportFile = System.getenv( "DHIS2_HOME" ) + File.separator + configurationService.getConfigurationByKey( Configuration_IN.KEY_REPORTFOLDER ).getValue()
-          + File.separator + "output" + File.separator + UUID.randomUUID().toString() + ".xls";
-       
-       // System.out.println("Env Variable is  :" + System.getenv( "DHIS2_HOME" ) );
-       // System.out.println("Complete path is :" + outputReportFile );
-        
-        WritableWorkbook outputReportWorkbook = Workbook.createWorkbook( new File(outputReportFile) );
+
+        // System.out.println(" Selected Indicator Id is : " +
+        // selctedIndicatorId + " ,selected Indicator :" + selectedIndicator );
+
+        // selectedIndicator = new Indicator();
+        // selectedIndicator = indicatorService.getIndicator( selctedIndicatorId
+        // );
+        // String IndicatorName = selectedIndicator.getName();
+
+        // System.out.println(" Selected Indicator Id is : " +
+        // selctedIndicatorId + " ,selected Indicator :" + selectedIndicator );
+
+        // data2 = convertDoubleTodouble( objData2 );
+
+        if ( chartDisplayOption == null || chartDisplayOption.equalsIgnoreCase( "none" ) )
+        {
+        }
+        // else if(chartDisplayOption.equalsIgnoreCase("ascend")) {
+        // sortByAscending(); }
+        // else if(chartDisplayOption.equalsIgnoreCase("desend")) {
+        // sortByDesscending(); }
+        // else if(chartDisplayOption.equalsIgnoreCase("alphabet")) {
+        // sortByAlphabet(); }
+
+        // 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";
+        String outputReportFile = System.getenv( "DHIS2_HOME" ) + File.separator
+            + configurationService.getConfigurationByKey( Configuration_IN.KEY_REPORTFOLDER ).getValue()
+            + File.separator + "output" + File.separator + UUID.randomUUID().toString() + ".xls";
+
+        // System.out.println("Env Variable is  :" + System.getenv( "DHIS2_HOME"
+        // ) );
+        // System.out.println("Complete path is :" + outputReportFile );
+
+        WritableWorkbook outputReportWorkbook = Workbook.createWorkbook( new File( outputReportFile ) );
         WritableSheet sheet0 = outputReportWorkbook.createSheet( "ChartOutput", 0 );
-        
-        if( viewSummary.equals( "no" ))
+
+        if ( viewSummary.equals( "no" ) )
         {
-            WritableImage writableImage = new WritableImage(0,1,10,23,encoderBytes);
+            WritableImage writableImage = new WritableImage( 0, 1, 10, 23, encoderBytes );
             sheet0.addImage( writableImage );
             tempRow1 = 24;
-        }    
-       else
-       {
-           // tempRow1 -= objData1.length;
+        }
+        else
+        {
+            // tempRow1 -= objData1.length;
             tempRow1 = 0;
-       }
+        }
         tempCol1 = 0;
-        //tempCol2 = 0;
+        // tempCol2 = 0;
         tempRow1++;
-        
-        
-        WritableCellFormat wCellformat1 = new WritableCellFormat();                            
+
+        WritableCellFormat wCellformat1 = new WritableCellFormat();
         wCellformat1.setBorder( Border.ALL, BorderLineStyle.THIN );
         wCellformat1.setAlignment( Alignment.CENTRE );
         wCellformat1.setVerticalAlignment( VerticalAlignment.CENTRE );
         wCellformat1.setWrap( true );
-    
-        WritableCellFormat wCellformat2 = new WritableCellFormat();                            
+
+        WritableCellFormat wCellformat2 = new WritableCellFormat();
         wCellformat2.setBorder( Border.ALL, BorderLineStyle.THIN );
         wCellformat2.setAlignment( Alignment.CENTRE );
-        wCellformat2.setVerticalAlignment( VerticalAlignment.TOP);
-        wCellformat2.setBackground( Colour.GRAY_25 );                
+        wCellformat2.setVerticalAlignment( VerticalAlignment.TOP );
+        wCellformat2.setBackground( Colour.GRAY_25 );
         wCellformat2.setWrap( true );
-        
+
         /*
-        WritableCellFormat wCellformat3 = new WritableCellFormat();                            
-        wCellformat3.setBorder( Border.ALL, BorderLineStyle.THIN );
-        wCellformat3.setAlignment( Alignment.CENTRE );
-        wCellformat3.setVerticalAlignment( VerticalAlignment.CENTRE );
-        wCellformat3.setBackground( Colour.BLACK );                
-        wCellformat3.setWrap( true );
-       // wCellformat3.setFont( WritableFont.BOLD );
-        //wCellformat3.WritableFont();
-        */
-        
+         * WritableCellFormat wCellformat3 = new WritableCellFormat();
+         * wCellformat3.setBorder( Border.ALL, BorderLineStyle.THIN );
+         * wCellformat3.setAlignment( Alignment.CENTRE );
+         * wCellformat3.setVerticalAlignment( VerticalAlignment.CENTRE );
+         * wCellformat3.setBackground( Colour.BLACK ); wCellformat3.setWrap(
+         * true ); // wCellformat3.setFont( WritableFont.BOLD );
+         * //wCellformat3.WritableFont();
+         */
+
         WritableFont wfobj2 = new WritableFont( WritableFont.ARIAL, 10, WritableFont.BOLD );
         WritableCellFormat wcf = new WritableCellFormat( wfobj2 );
         wcf.setBorder( Border.ALL, BorderLineStyle.THIN );
         wcf.setAlignment( Alignment.CENTRE );
-        //wcf.setShrinkToFit(true);
+        // wcf.setShrinkToFit(true);
         wcf.setVerticalAlignment( VerticalAlignment.CENTRE );
         wcf.setWrap( true );
-        
-        if( radioButtonValue.equals( "indicator" ) )
+
+        if ( radioButtonValue.equals( "indicator" ) )
         {
             System.out.println( "in excel indicator" );
-            
-            sheet0.addCell( new Label( tempCol1, tempRow1, "Years", wCellformat2) );
-            sheet0.addCell( new Label( tempCol1+1, tempRow1, "", wCellformat2) );
-            
+
+            sheet0.addCell( new Label( tempCol1, tempRow1, "Years", wCellformat2 ) );
+            sheet0.addCell( new Label( tempCol1 + 1, tempRow1, "", wCellformat2 ) );
+
             tempCol1++;
-            
-            //for time display
-            for(int i=0; i< categories1.length; i++)
-            {   
-                sheet0.addCell( new Label( tempCol1+1, tempRow1, categories1[i], wCellformat2) );
+
+            // for time display
+            for ( int i = 0; i < categories1.length; i++ )
+            {
+                sheet0.addCell( new Label( tempCol1 + 1, tempRow1, categories1[i], wCellformat2 ) );
                 tempCol1++;
             }
-           
-            tempRow1 = tempRow1+1;
-            
+
+            tempRow1 = tempRow1 + 1;
+
             int tempRowValue = 0;
-            for( int j=0; j< series1.length; j++ )
+            for ( int j = 0; j < series1.length; j++ )
             {
                 tempCol1 = 0;
-                sheet0.mergeCells( tempCol1 , tempRow1, tempCol1, tempRow1+2 ); 
-                sheet0.addCell( new Label( tempCol1, tempRow1, series1[j], wCellformat2) );
-                
+                sheet0.mergeCells( tempCol1, tempRow1, tempCol1, tempRow1 + 2 );
+                sheet0.addCell( new Label( tempCol1, tempRow1, series1[j], wCellformat2 ) );
+
                 int tempNumCol = 1;
-                
-                sheet0.addCell( new Label( tempNumCol, tempRow1, "Num", wCellformat2) );
-                tempNumCol =  tempNumCol+1;
-                for( int k=0;k<categories1.length;k++ )
+
+                sheet0.addCell( new Label( tempNumCol, tempRow1, "Num", wCellformat2 ) );
+                tempNumCol = tempNumCol + 1;
+                for ( int k = 0; k < categories1.length; k++ )
                 {
-                   // tempCol1 = 0;
+                    // tempCol1 = 0;
                     sheet0.addCell( new Number( tempNumCol, tempRow1, numDataArray[j][k], wCellformat1 ) );
                     tempNumCol++;
                 }
                 int tempDenumCol = 1;
-                
-                sheet0.addCell( new Label( tempDenumCol, tempRow1+1, "Den", wCellformat2) );
-                
-                tempDenumCol = tempDenumCol+1;
-                
-                for( int k=0;k<categories1.length;k++ )
-                { 
-                  //  tempRow1 = 0;
-                   sheet0.addCell( new Number( tempDenumCol, tempRow1+1, denumDataArray[j][k], wCellformat1 ) );
-                   tempDenumCol++;
-               }
-               int tempValueCol = 1;
-              
-               sheet0.addCell( new Label( tempValueCol, tempRow1+2, "Val", wCellformat2) );
-               tempValueCol = tempValueCol+1;
-                
-                for( int k=0;k<categories1.length;k++ )
-                { 
-                    //tempRow1 = 0;
-                    sheet0.addCell( new Number( tempValueCol, tempRow1+2, data1[j][k], wcf ) );
+
+                sheet0.addCell( new Label( tempDenumCol, tempRow1 + 1, "Den", wCellformat2 ) );
+
+                tempDenumCol = tempDenumCol + 1;
+
+                for ( int k = 0; k < categories1.length; k++ )
+                {
+                    // tempRow1 = 0;
+                    sheet0.addCell( new Number( tempDenumCol, tempRow1 + 1, denumDataArray[j][k], wCellformat1 ) );
+                    tempDenumCol++;
+                }
+                int tempValueCol = 1;
+
+                sheet0.addCell( new Label( tempValueCol, tempRow1 + 2, "Val", wCellformat2 ) );
+                tempValueCol = tempValueCol + 1;
+
+                for ( int k = 0; k < categories1.length; k++ )
+                {
+                    // tempRow1 = 0;
+                    sheet0.addCell( new Number( tempValueCol, tempRow1 + 2, data1[j][k], wcf ) );
                     tempValueCol++;
                 }
-               
-               tempRow1 = tempRow1+3;
-               tempRow1++;
-               tempRowValue = tempRow1++; 
+
+                tempRow1 = tempRow1 + 3;
+                tempRow1++;
+                tempRowValue = tempRow1++;
             }
-            
+
             tempRow1 = tempRowValue;
-            
-            tempRow1 = tempRow1+2;
-            sheet0.addCell( new Label( tempCol1, tempRow1, "Indicators Names", wCellformat2) );
-            
-            sheet0.mergeCells( tempCol1+1 , tempRow1, tempCol1 + 2, tempRow1 );
-            sheet0.addCell( new Label( tempCol1+1, tempRow1, "Formula", wCellformat2) );
-            
-            sheet0.addCell( new Label( tempCol1+3, tempRow1, "Numerator DataElements", wCellformat2) );
-            sheet0.addCell( new Label( tempCol1+4, tempRow1, "Denominator DataElements", wCellformat2) );
-            
-            tempRow1 = tempRow1+1;
-            
-           // for(int j=0; j< series1.length; j++)
-           // {
-                Indicator indicator =  indicatorService.getIndicator( selctedIndicatorId );
-                
-                //Indicator indicator =  indicatorService.getIndicatorByName( IndicatorName );
-                
-                sheet0.addCell( new Label( tempCol1, tempRow1, indicator.getName(), wCellformat1 ) );
-                String formula = indicator.getNumeratorDescription() + "/" +  indicator.getDenominatorDescription();
-                
-                sheet0.addCell( new Label( tempCol1+1, tempRow1,formula , wCellformat1 ) );
-                String factor = "X" + indicator.getIndicatorType().getFactor();
-                
-                sheet0.addCell( new Label( tempCol1+2, tempRow1, factor, wCellformat1) );
-                sheet0.addCell( new Label( tempCol1+3, tempRow1, expressionService.getExpressionDescription( indicator.getNumerator()), wCellformat1 ) );
-                sheet0.addCell( new Label( tempCol1+4, tempRow1, expressionService.getExpressionDescription( indicator.getDenominator() ), wCellformat1 ) );
-                
-                tempRow1++;
-            //}
+
+            tempRow1 = tempRow1 + 2;
+            sheet0.addCell( new Label( tempCol1, tempRow1, "Indicators Names", wCellformat2 ) );
+
+            sheet0.mergeCells( tempCol1 + 1, tempRow1, tempCol1 + 2, tempRow1 );
+            sheet0.addCell( new Label( tempCol1 + 1, tempRow1, "Formula", wCellformat2 ) );
+
+            sheet0.addCell( new Label( tempCol1 + 3, tempRow1, "Numerator DataElements", wCellformat2 ) );
+            sheet0.addCell( new Label( tempCol1 + 4, tempRow1, "Denominator DataElements", wCellformat2 ) );
+
+            tempRow1 = tempRow1 + 1;
+
+            // for(int j=0; j< series1.length; j++)
+            // {
+            Indicator indicator = indicatorService.getIndicator( selctedIndicatorId );
+
+            // Indicator indicator = indicatorService.getIndicatorByName(
+            // IndicatorName );
+
+            sheet0.addCell( new Label( tempCol1, tempRow1, indicator.getName(), wCellformat1 ) );
+            String formula = indicator.getNumeratorDescription() + "/" + indicator.getDenominatorDescription();
+
+            sheet0.addCell( new Label( tempCol1 + 1, tempRow1, formula, wCellformat1 ) );
+            String factor = "X" + indicator.getIndicatorType().getFactor();
+
+            sheet0.addCell( new Label( tempCol1 + 2, tempRow1, factor, wCellformat1 ) );
+            sheet0.addCell( new Label( tempCol1 + 3, tempRow1, expressionService.getExpressionDescription( indicator
+                .getNumerator() ), wCellformat1 ) );
+            sheet0.addCell( new Label( tempCol1 + 4, tempRow1, expressionService.getExpressionDescription( indicator
+                .getDenominator() ), wCellformat1 ) );
+
+            tempRow1++;
+            // }
         }
-        
+
         else
         {
             System.out.println( "in DataElements Excel sheet" );
-            
-            sheet0.addCell( new Label( tempCol1, tempRow1, "Years", wCellformat2) );
-            //tempCol1++;
-            
-            //for time display
-            for(int i=0; i< categories1.length; i++)
-            {   
-                sheet0.addCell( new Label( tempCol1+1, tempRow1, categories1[i], wCellformat2) );
+
+            sheet0.addCell( new Label( tempCol1, tempRow1, "Years", wCellformat2 ) );
+            // tempCol1++;
+
+            // for time display
+            for ( int i = 0; i < categories1.length; i++ )
+            {
+                sheet0.addCell( new Label( tempCol1 + 1, tempRow1, categories1[i], wCellformat2 ) );
                 tempCol1++;
             }
-           
-            tempRow1 = tempRow1+1;
-            
-            for(int j=0; j< series1.length; j++)
+
+            tempRow1 = tempRow1 + 1;
+
+            for ( int j = 0; j < series1.length; j++ )
             {
                 tempCol1 = 0;
-                //sheet0.mergeCells( tempCol1 , tempRow1, tempCol1, tempRow1+2 ); 
-                sheet0.addCell( new Label( tempCol1, tempRow1, series1[j], wCellformat2) );
-                
+                // sheet0.mergeCells( tempCol1 , tempRow1, tempCol1, tempRow1+2
+                // );
+                sheet0.addCell( new Label( tempCol1, tempRow1, series1[j], wCellformat2 ) );
+
                 tempCol1++;
-                for( int k=0;k<categories1.length;k++ )
-                { 
+                for ( int k = 0; k < categories1.length; k++ )
+                {
                     sheet0.addCell( new Number( tempCol1, tempRow1, data1[j][k], wCellformat1 ) );
                     tempCol1++;
                 }
-               
-               tempRow1++;
-            }
-              
-        }
-   
-        /*       
-        sheet0.addCell( new Label( tempCol1, tempRow1, "Indicators", wCellformat2) );
-        sheet0.addCell( new Label( tempCol1+1, tempRow1, "", wCellformat2) );
-       
-       // System.out.println(tempCol1);
-        tempCol1++;
-        
-        //System.out.println(tempCol1);
-        for(int i=0; i< categories1.length; i++)
-        {   
-            sheet0.addCell( new Label( tempCol1+1, tempRow1, categories1[i], wCellformat2) );
-            tempCol1++;
-        }
-       
-        tempRow1 = tempRow1+1;
-        for(int j=0; j< series1.length; j++)
-        {
-            tempCol1 = 0;
-            sheet0.mergeCells( tempCol1 , tempRow1, tempCol1, tempRow1+2 ); 
-            sheet0.addCell( new Label( tempCol1, tempRow1, series1[j], wCellformat2) );
-            
-            int tempNumCol = 1;
-            
-            sheet0.addCell( new Label( tempNumCol, tempRow1, "Num", wCellformat2) );
-            tempNumCol =  tempNumCol+1;
-            for( int k=0;k<categories1.length;k++ )
-            {
-               // tempCol1 = 0;
-                sheet0.addCell( new Number( tempNumCol, tempRow1, numDataArray[j][k], wCellformat1 ) );
-                tempNumCol++;
-            }
-            int tempDenumCol = 1;
-            
-            sheet0.addCell( new Label( tempDenumCol, tempRow1+1, "Den", wCellformat2) );
-            
-            tempDenumCol = tempDenumCol+1;
-            for( int k=0;k<categories1.length;k++ )
-            { 
-              //  tempRow1 = 0;
-               sheet0.addCell( new Number( tempDenumCol, tempRow1+1, denumDataArray[j][k], wCellformat1 ) );
-               tempDenumCol++;
-           }
-           int tempValueCol = 1;
-          
-           
-           sheet0.addCell( new Label( tempValueCol, tempRow1+2, "Val", wCellformat2) );
-           tempValueCol = tempValueCol+1;
-            
-            for( int k=0;k<categories1.length;k++ )
-            { 
-                //tempRow1 = 0;
-                sheet0.addCell( new Number( tempValueCol, tempRow1+2, data1[j][k], wcf ) );
-                tempValueCol++;
-            }
-           
-           tempRow1 = tempRow1+3;
-           tempRow1++;
-            
-        }
-        
-        */
-        
-        /*        
-        
-        sheet0.mergeCells( tempCol1 , tempRow1, tempCol1, tempRow1+1 );
-        sheet0.addCell( new Label( tempCol1, tempRow1, "Indicators", wCellformat2) );
-        tempCol1++;
-        tempCol2++;
-       // sheet0.mergeCells( tempCol1 , tempRow1, tempCol1 + 3, tempRow1 );
-        for(int i=0; i< categories1.length; i++)
-        {                        
-            //cell1 = sheet0.getWritableCell(tempCol1, tempRow1);
-           // cellFormat1 = cell1.getCellFormat();
-         
-            sheet0.mergeCells( tempCol1 , tempRow1, tempCol1 + 2, tempRow1 );
-            sheet0.addCell( new Label( tempCol1, tempRow1, categories1[i], wCellformat2) );
-           
-           // sheet0.mergeCells( tempCol1 , tempRow1, tempCol1 + 3, tempRow1 );
-            sheet0.addCell( new Label( tempCol1, tempRow1+1, "Num", wCellformat2) );
-            sheet0.addCell( new Label( tempCol1+1, tempRow1+1, "Den", wCellformat2) );
-            sheet0.addCell( new Label( tempCol1+2, tempRow1+1, "Val", wCellformat2) );
-        
-            tempCol1 = tempCol1+3;
-            //tempCol2++;
-        }
-        tempRow1 = tempRow1+2;
-       // tempCol1 = 1;
-        
-        tempCol1 = 0;
-        for(int j=0; j< series1.length; j++)
-        {
-            tempCol1 = 0;
-            sheet0.addCell( new Label( tempCol1, tempRow1, series1[j], wCellformat2) );
-            
-            
-            tempCol1++;
-            for( int k=0;k<categories1.length;k++ )
-            { 
-                //sheet0.addCell( new Number( tempColNo, tempRowNo, Double.parseDouble( tempStr ), wCellformat ) );
-                sheet0.addCell( new Number( tempCol1, tempRow1, numDataArray[j][k], wCellformat1 ) );
-                sheet0.addCell( new Number( tempCol1+1, tempRow1, denumDataArray[j][k], wCellformat1 ) );
-                sheet0.addCell( new Number( tempCol1+2, tempRow1, data1[j][k], wCellformat1 ) );
-                
-                tempCol1 = tempCol1+3; 
-            }
-            
-            tempRow1++;
-        }
- 
- */       
-// 23/12/2010
-        
-       // tempCol1++;
-
-    //cell1 = sheet0.getWritableCell(tempCol1, tempRow1);
-    //cellFormat1 = cell1.getCellFormat();
-    
-   // sheet0.addCell( new Number( tempCol1, tempRow1, data1[j][k], wCellformat1 ) );
-        //sheet0.addCell( new Number( tempCol1, tempRow1, ""+data1[j][k], wCellformat1) );
-  
-   // tempCol1++;                
-
-
-
-        
-  
-/*                
-        int count1 = 0;
-        int count2 = 0;
-        int flag1 = 0;
-        while(count1 <= categories1.length)
-        {
-            for(int j=0;j<data1.length;j++)
-            {            
-                tempCol1 = 1;
+
                 tempRow1++;
-                WritableCellFormat wCellformat1 = new WritableCellFormat();                            
-                wCellformat1.setBorder( Border.ALL, BorderLineStyle.THIN );
-                wCellformat1.setWrap( true );
-
-                WritableCellFormat wCellformat2 = new WritableCellFormat();                            
-                wCellformat2.setBorder( Border.ALL, BorderLineStyle.THIN );
-                wCellformat2.setAlignment( Alignment.CENTRE );
-                wCellformat2.setBackground( Colour.GRAY_25 );                
-                wCellformat2.setWrap( true );
-
-                
-                WritableCell cell1;
-                CellFormat cellFormat1;
-                            
-                for(int k=count2;k<count1;k++)
-                {
-                    if(k==count2 && j==0)
-                    {                                       
-                        tempCol1 = 0;
-                        tempRow1++;
-                        cell1 = sheet0.getWritableCell(tempCol1, tempRow1);
-                        cellFormat1 = cell1.getCellFormat();
-
-
-                        if (cell1.getType() == CellType.LABEL)
-                        {
-                            Label l = (Label) cell1;
-                            l.setString("Service");
-                            l.setCellFormat( cellFormat1 );
-                        }
-                        else
-                        {
-                            sheet0.addCell( new Label( tempCol1, tempRow1, "Indicators", wCellformat2) );
-                        }
-                        tempCol1++;
-                    
-                        for(int i=count2; i< count1; i++)
-                        {                        
-                            cell1 = sheet0.getWritableCell(tempCol1, tempRow1);
-                            cellFormat1 = cell1.getCellFormat();
-                          if (cell1.getType() == CellType.LABEL)
-                          {
-                                Label l = (Label) cell1;
-                               l.setString(categories1[i]);
-                                l.setCellFormat( cellFormat1 );
-                           }
-                            else
-                         {
-                                sheet0.addCell( new Label( tempCol1, tempRow1, categories1[i], wCellformat2) );
-                          }
-                            tempCol1++;
-                        }
-                        tempRow1++;
-                        tempCol1 = 1;
-                    }
-                
-                
-                    if(k==count2)
-                    {
-                        tempCol1 = 0;
-                        cell1 = sheet0.getWritableCell(tempCol1, tempRow1);
-                        cellFormat1 = cell1.getCellFormat();
-
-                        if (cell1.getType() == CellType.LABEL)
-                        {
-                            Label l = (Label) cell1;
-                            l.setString(series1[j]);
-                            l.setCellFormat( cellFormat1 );
-                        }
-                        else
-                        {
-                            sheet0.addCell( new Label( tempCol1, tempRow1, series1[j], wCellformat2) );
-                        }
-                        tempCol1++;
-                    }
-                    cell1 = sheet0.getWritableCell(tempCol1, tempRow1);
-                    cellFormat1 = cell1.getCellFormat();
-
-                    if (cell1.getType() == CellType.LABEL)
-                    {
-                        Label l = (Label) cell1;
-                        l.setString(""+data1[j][k]);
-                        l.setCellFormat( cellFormat1 );
-                    }
-                    else
-                    {
-                        sheet0.addCell( new Number( tempCol1, tempRow1, data1[j][k], wCellformat1 ) );
-                        //sheet0.addCell( new Number( tempCol1, tempRow1, ""+data1[j][k], wCellformat1) );
-                    }
-                    tempCol1++;                
-                }
             }
-            if(flag1 == 1) break;
-            count2 = count1;
-            if( (count1+10 > categories1.length) && (categories1.length - count1 <= 10))
-                {
-                count1 += categories1.length - count1;
-                flag1 = 1;
-                }
-            else
-                count1 += 10;
-        } 
-*/        
+
+        }
+
+        /*
+         * sheet0.addCell( new Label( tempCol1, tempRow1, "Indicators",
+         * wCellformat2) ); sheet0.addCell( new Label( tempCol1+1, tempRow1, "",
+         * wCellformat2) );
+         * 
+         * // System.out.println(tempCol1); tempCol1++;
+         * 
+         * //System.out.println(tempCol1); for(int i=0; i< categories1.length;
+         * i++) { sheet0.addCell( new Label( tempCol1+1, tempRow1,
+         * categories1[i], wCellformat2) ); tempCol1++; }
+         * 
+         * tempRow1 = tempRow1+1; for(int j=0; j< series1.length; j++) {
+         * tempCol1 = 0; sheet0.mergeCells( tempCol1 , tempRow1, tempCol1,
+         * tempRow1+2 ); sheet0.addCell( new Label( tempCol1, tempRow1,
+         * series1[j], wCellformat2) );
+         * 
+         * int tempNumCol = 1;
+         * 
+         * sheet0.addCell( new Label( tempNumCol, tempRow1, "Num", wCellformat2)
+         * ); tempNumCol = tempNumCol+1; for( int k=0;k<categories1.length;k++ )
+         * { // tempCol1 = 0; sheet0.addCell( new Number( tempNumCol, tempRow1,
+         * numDataArray[j][k], wCellformat1 ) ); tempNumCol++; } int
+         * tempDenumCol = 1;
+         * 
+         * sheet0.addCell( new Label( tempDenumCol, tempRow1+1, "Den",
+         * wCellformat2) );
+         * 
+         * tempDenumCol = tempDenumCol+1; for( int k=0;k<categories1.length;k++
+         * ) { // tempRow1 = 0; sheet0.addCell( new Number( tempDenumCol,
+         * tempRow1+1, denumDataArray[j][k], wCellformat1 ) ); tempDenumCol++; }
+         * int tempValueCol = 1;
+         * 
+         * 
+         * sheet0.addCell( new Label( tempValueCol, tempRow1+2, "Val",
+         * wCellformat2) ); tempValueCol = tempValueCol+1;
+         * 
+         * for( int k=0;k<categories1.length;k++ ) { //tempRow1 = 0;
+         * sheet0.addCell( new Number( tempValueCol, tempRow1+2, data1[j][k],
+         * wcf ) ); tempValueCol++; }
+         * 
+         * tempRow1 = tempRow1+3; tempRow1++;
+         * 
+         * }
+         */
+
+        /*
+         * 
+         * sheet0.mergeCells( tempCol1 , tempRow1, tempCol1, tempRow1+1 );
+         * sheet0.addCell( new Label( tempCol1, tempRow1, "Indicators",
+         * wCellformat2) ); tempCol1++; tempCol2++; // sheet0.mergeCells(
+         * tempCol1 , tempRow1, tempCol1 + 3, tempRow1 ); for(int i=0; i<
+         * categories1.length; i++) { //cell1 = sheet0.getWritableCell(tempCol1,
+         * tempRow1); // cellFormat1 = cell1.getCellFormat();
+         * 
+         * sheet0.mergeCells( tempCol1 , tempRow1, tempCol1 + 2, tempRow1 );
+         * sheet0.addCell( new Label( tempCol1, tempRow1, categories1[i],
+         * wCellformat2) );
+         * 
+         * // sheet0.mergeCells( tempCol1 , tempRow1, tempCol1 + 3, tempRow1 );
+         * sheet0.addCell( new Label( tempCol1, tempRow1+1, "Num", wCellformat2)
+         * ); sheet0.addCell( new Label( tempCol1+1, tempRow1+1, "Den",
+         * wCellformat2) ); sheet0.addCell( new Label( tempCol1+2, tempRow1+1,
+         * "Val", wCellformat2) );
+         * 
+         * tempCol1 = tempCol1+3; //tempCol2++; } tempRow1 = tempRow1+2; //
+         * tempCol1 = 1;
+         * 
+         * tempCol1 = 0; for(int j=0; j< series1.length; j++) { tempCol1 = 0;
+         * sheet0.addCell( new Label( tempCol1, tempRow1, series1[j],
+         * wCellformat2) );
+         * 
+         * 
+         * tempCol1++; for( int k=0;k<categories1.length;k++ ) {
+         * //sheet0.addCell( new Number( tempColNo, tempRowNo,
+         * Double.parseDouble( tempStr ), wCellformat ) ); sheet0.addCell( new
+         * Number( tempCol1, tempRow1, numDataArray[j][k], wCellformat1 ) );
+         * sheet0.addCell( new Number( tempCol1+1, tempRow1,
+         * denumDataArray[j][k], wCellformat1 ) ); sheet0.addCell( new Number(
+         * tempCol1+2, tempRow1, data1[j][k], wCellformat1 ) );
+         * 
+         * tempCol1 = tempCol1+3; }
+         * 
+         * tempRow1++; }
+         */
+        // 23/12/2010
+        // tempCol1++;
+        // cell1 = sheet0.getWritableCell(tempCol1, tempRow1);
+        // cellFormat1 = cell1.getCellFormat();
+        // sheet0.addCell( new Number( tempCol1, tempRow1, data1[j][k],
+        // wCellformat1 ) );
+        // sheet0.addCell( new Number( tempCol1, tempRow1, ""+data1[j][k],
+        // wCellformat1) );
+        // tempCol1++;
+
+        /*
+         * int count1 = 0; int count2 = 0; int flag1 = 0; while(count1 <=
+         * categories1.length) { for(int j=0;j<data1.length;j++) { tempCol1 = 1;
+         * tempRow1++; WritableCellFormat wCellformat1 = new
+         * WritableCellFormat(); wCellformat1.setBorder( Border.ALL,
+         * BorderLineStyle.THIN ); wCellformat1.setWrap( true );
+         * 
+         * WritableCellFormat wCellformat2 = new WritableCellFormat();
+         * wCellformat2.setBorder( Border.ALL, BorderLineStyle.THIN );
+         * wCellformat2.setAlignment( Alignment.CENTRE );
+         * wCellformat2.setBackground( Colour.GRAY_25 ); wCellformat2.setWrap(
+         * true );
+         * 
+         * 
+         * WritableCell cell1; CellFormat cellFormat1;
+         * 
+         * for(int k=count2;k<count1;k++) { if(k==count2 && j==0) { tempCol1 =
+         * 0; tempRow1++; cell1 = sheet0.getWritableCell(tempCol1, tempRow1);
+         * cellFormat1 = cell1.getCellFormat();
+         * 
+         * 
+         * if (cell1.getType() == CellType.LABEL) { Label l = (Label) cell1;
+         * l.setString("Service"); l.setCellFormat( cellFormat1 ); } else {
+         * sheet0.addCell( new Label( tempCol1, tempRow1, "Indicators",
+         * wCellformat2) ); } tempCol1++;
+         * 
+         * for(int i=count2; i< count1; i++) { cell1 =
+         * sheet0.getWritableCell(tempCol1, tempRow1); cellFormat1 =
+         * cell1.getCellFormat(); if (cell1.getType() == CellType.LABEL) { Label
+         * l = (Label) cell1; l.setString(categories1[i]); l.setCellFormat(
+         * cellFormat1 ); } else { sheet0.addCell( new Label( tempCol1,
+         * tempRow1, categories1[i], wCellformat2) ); } tempCol1++; }
+         * tempRow1++; tempCol1 = 1; }
+         * 
+         * 
+         * if(k==count2) { tempCol1 = 0; cell1 =
+         * sheet0.getWritableCell(tempCol1, tempRow1); cellFormat1 =
+         * cell1.getCellFormat();
+         * 
+         * if (cell1.getType() == CellType.LABEL) { Label l = (Label) cell1;
+         * l.setString(series1[j]); l.setCellFormat( cellFormat1 ); } else {
+         * sheet0.addCell( new Label( tempCol1, tempRow1, series1[j],
+         * wCellformat2) ); } tempCol1++; } cell1 =
+         * sheet0.getWritableCell(tempCol1, tempRow1); cellFormat1 =
+         * cell1.getCellFormat();
+         * 
+         * if (cell1.getType() == CellType.LABEL) { Label l = (Label) cell1;
+         * l.setString(""+data1[j][k]); l.setCellFormat( cellFormat1 ); } else {
+         * sheet0.addCell( new Number( tempCol1, tempRow1, data1[j][k],
+         * wCellformat1 ) ); //sheet0.addCell( new Number( tempCol1, tempRow1,
+         * ""+data1[j][k], wCellformat1) ); } tempCol1++; } } if(flag1 == 1)
+         * break; count2 = count1; if( (count1+10 > categories1.length) &&
+         * (categories1.length - count1 <= 10)) { count1 += categories1.length -
+         * count1; flag1 = 1; } else count1 += 10; }
+         */
         outputReportWorkbook.write();
         outputReportWorkbook.close();
 
         fileName = "Chart Output.xls";
-                
+
         inputStream = new BufferedInputStream( new FileInputStream( outputReportFile ) );
 
-
         return SUCCESS;
     }
-    
-    
-//    public void initialzeAllLists(String[]series1S, String[] series2S, String[] categories1S, String[] categories2S)
-    public void initialzeAllLists(String[]series1S, String[] categories1S)
+
+    // public void initialzeAllLists(String[]series1S, String[] series2S,
+    // String[] categories1S, String[] categories2S)
+    public void initialzeAllLists( String[] series1S, String[] categories1S )
     {
         int i;
         series1 = new String[series1S.length];
-       // series2 = new String[series2S.length];
+        // series2 = new String[series2S.length];
         categories1 = new String[categories1S.length];
-       // categories2 = new String[categories2S.length];
-        
-        for(i = 0; i < series1S.length; i++)
-        {
-                series1[i] = series1S[i];
-        }
-
-        for(i = 0; i < categories1S.length; i++)
-        {
-                categories1[i] = categories1S[i];
-        }
-   
+        // categories2 = new String[categories2S.length];
+
+        for ( i = 0; i < series1S.length; i++ )
+        {
+            series1[i] = series1S[i];
+        }
+
+        for ( i = 0; i < categories1S.length; i++ )
+        {
+            categories1[i] = categories1S[i];
+        }
+
     }
-    
+
     public double[][] convertDoubleTodouble( Double[][] objData )
     {
-        //System.out.println("Before Sorting : ");
+        // System.out.println("Before Sorting : ");
         double[][] data = new double[objData.length][objData[0].length];
         for ( int i = 0; i < objData.length; i++ )
         {
             for ( int j = 0; j < objData[0].length; j++ )
             {
                 data[i][j] = objData[i][j].doubleValue();
-                //System.out.print(categories1[j]+": "+data[i][j]+", ");                
+                // System.out.print(categories1[j]+": "+data[i][j]+", ");
             }
-            //System.out.println("");
+            // System.out.println("");
         }
 
         return data;
     }// convertDoubleTodouble end
 
-
-}// class end 
+}// class end
 

=== modified file 'local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/ds/action/GenerateDataStatusResultAction.java'
--- local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/ds/action/GenerateDataStatusResultAction.java	2010-12-08 07:24:10 +0000
+++ local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/ds/action/GenerateDataStatusResultAction.java	2011-04-15 11:34:10 +0000
@@ -100,7 +100,7 @@
     }
     
     @SuppressWarnings("unused")
-	private Comparator<OrganisationUnit> orgUnitComparator;
+    private Comparator<OrganisationUnit> orgUnitComparator;
 
     public void setOrgUnitComparator( Comparator<OrganisationUnit> orgUnitComparator )
     {
@@ -117,6 +117,13 @@
         return ouMapDataStatusResult;
     }
 
+    private Map<OrganisationUnit, List<Integer>> ouMapDataElementCount;
+    
+    public Map<OrganisationUnit, List<Integer>> getOuMapDataElementCount()
+    {
+        return ouMapDataElementCount;
+    }
+
     private Collection<Period> periodList;
 
     public Collection<Period> getPeriodList()
@@ -151,6 +158,8 @@
     {
         return dataStatusResult;
     }
+    
+
 
     private Map<DataSet, Collection<Period>> dataSetPeriods;
 
@@ -179,7 +188,7 @@
     {
         return maxOULevel;
     }
-
+    
     // ---------------------------------------------------------------
     // Input Parameters
     // ---------------------------------------------------------------
@@ -316,6 +325,21 @@
     int orgUnitCount;
 
     private String dataViewName;
+    
+    private int dataSetMemberCount1;
+    
+    public int getDataSetMemberCount1()
+    {
+        return dataSetMemberCount1;
+    }
+    
+    
+    private Integer dataElementCount;
+    
+    public Integer getDataElementCount()
+    {
+        return dataElementCount;
+    }
 
     // ---------------------------------------------------------------
     // Action Implementation
@@ -327,7 +351,10 @@
         System.out.println("Inside Normal DtaaStatus Reult Action");
         orgUnitCount = 0;
         dataViewName = "";
-
+        
+        ouMapDataElementCount = new HashMap<OrganisationUnit,List<Integer>>();//Map for DataElement count
+        
+        
         // Intialization
         periodNameList = new ArrayList<String>();
         ouMapDataStatusResult = new HashMap<OrganisationUnit, List<Integer>>();
@@ -456,12 +483,14 @@
         Collection<DataElement> dataElements = new ArrayList<DataElement>();
         dataElements = selDataSet.getDataElements();
 
-        int dataSetMemberCount1 = 0;
+        dataSetMemberCount1 = 0;
         for ( DataElement de1 : dataElements )
         {
             dataSetMemberCount1 += de1.getCategoryCombo().getOptionCombos().size();
         }
-
+       
+        //System.out.println( "DataSet Member Count :"  + dataSetMemberCount1  );
+        
         deInfo = getDEInfo( dataElements );
 
         Iterator<OrganisationUnit> orgUnitListIterator = orgUnitList.iterator();
@@ -486,16 +515,19 @@
             Period p;
 
             double dataStatusPercentatge;
+            
             List<Integer> dsResults = new ArrayList<Integer>();
+            List<Integer> deCounts = new ArrayList<Integer>();
             while ( periodIterator.hasNext() )
             {
                 System.out.println("Inside period Iterator Loop");
                 p = (Period) periodIterator.next();
                 periodInfo = "" + p.getId();
-
+                dataElementCount = 0;
                 if ( dso == null )
                 {
                     dsResults.add( -1 );
+                    deCounts.add( -1 );
                     continue;
                 }
                 else if ( !dso.contains( o ) )
@@ -526,6 +558,7 @@
                         {
                             //System.out.println( "Result is : \t" + sqlResultSet.getLong( 1 ) );
                             dataStatusPercentatge = ((double) sqlResultSet.getInt( 1 ) / (double) (dataSetMemberCount1 * orgUnitCount)) * 100.0;
+                            
                         }
                         catch ( Exception e )
                         {
@@ -539,8 +572,10 @@
                         dataStatusPercentatge = 100;
 
                     dataStatusPercentatge = Math.round( dataStatusPercentatge * Math.pow( 10, 0 ) ) / Math.pow( 10, 0 );
-
+                    
                     dsResults.add( (int) dataStatusPercentatge );
+                    //dataElementCount = sqlResultSet.getInt( 1 );
+                    deCounts.add( -1 );
                     continue;
                 }
 
@@ -563,25 +598,32 @@
                 {
                     try
                     {
+                        dataElementCount = sqlResultSet.getInt( 1 );
                         dataStatusPercentatge = ((double) sqlResultSet.getInt( 1 ) / (double) dataSetMemberCount1) * 100.0;
                     }
                     catch ( Exception e )
                     {
+                        dataElementCount = -1;
                         dataStatusPercentatge = 0.0;
                     }
                 }
                 else
+                {
                     dataStatusPercentatge = 0.0;
-
+                    dataElementCount = -1;
+                }
+                
                 if ( dataStatusPercentatge > 100.0 )
                     dataStatusPercentatge = 100;
 
-                dataStatusPercentatge = Math.round( dataStatusPercentatge * Math.pow( 10, 0 ) ) / Math.pow( 10, 0 );
-
+                dataStatusPercentatge = Math.round( dataStatusPercentatge * Math.pow( 10, 0 ) ) / Math.pow( 10, 0 );                
+                
                 dsResults.add( (int) dataStatusPercentatge );
+                deCounts.add( dataElementCount );
             }
 
             ouMapDataStatusResult.put( o, dsResults );
+            ouMapDataElementCount.put( o, deCounts );
         }
 
         // For Level Names

=== modified file 'local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/ds/action/GenerateGroupWiseDataStatusResultAction.java'
--- local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/ds/action/GenerateGroupWiseDataStatusResultAction.java	2010-12-08 07:24:10 +0000
+++ local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/ds/action/GenerateGroupWiseDataStatusResultAction.java	2011-04-15 11:34:10 +0000
@@ -340,11 +340,21 @@
     {
         return dsSize;
     }
+    
+    private List<Integer> dataElementCount;
+    
+    public List<Integer> getDataElementCount()
+    {
+        return dataElementCount;
+    }
+    
     // ---------------------------------------------------------------
     // Action Implementation
     // ---------------------------------------------------------------
     
- //   @SuppressWarnings({ "deprecation", "unchecked" })
+ 
+
+    //   @SuppressWarnings({ "deprecation", "unchecked" })
     public String execute()
         throws Exception
     {
@@ -356,6 +366,8 @@
         deMapGroupCount = new HashMap<DataElementGroup, Integer>(); // dataelement Group Count
         
         results = new ArrayList<Integer>();
+        dataElementCount = new ArrayList<Integer>();
+        
         maxOULevel = 1;
         minOULevel = organisationUnitService.getNumberOfOrganisationalLevels();
 
@@ -510,9 +522,9 @@
             }
 
             // detaElement Group member Count
-            Integer deGroupMemberCount = dataElements.size();
+            //Integer deGroupMemberCount = dataElements.size();
             
-            deMapGroupCount.put( deg, deGroupMemberCount );
+            deMapGroupCount.put( deg, deGroupMemberCount1 );
             
             deInfo = getDEInfo( dataElements );
 
@@ -545,6 +557,7 @@
               //  @SuppressWarnings("unused")
                // Collection dataValueResult;
                 double dataStatusPercentatge;
+                int tempDataElementCount = 0;
 
                 while ( periodIterator.hasNext() )
                 {
@@ -554,6 +567,7 @@
                     if ( dso == null )
                     {
                         results.add( -1 );
+                        dataElementCount.add( -1 );
                         continue;
                     }
                     else if ( !dso.contains( o ) )
@@ -595,7 +609,11 @@
                         dataStatusPercentatge = Math.round( dataStatusPercentatge * Math.pow( 10, 0 ) )
                             / Math.pow( 10, 0 );
 
+                        tempDataElementCount = sqlResultSet.getInt( 1 );
+                        dataElementCount.add( tempDataElementCount );
+                        
                         results.add( (int) dataStatusPercentatge );
+                        dataElementCount.add( -1 );
                         continue;
                     }
 
@@ -632,7 +650,10 @@
                         dataStatusPercentatge = 100;
 
                     dataStatusPercentatge = Math.round( dataStatusPercentatge * Math.pow( 10, 0 ) ) / Math.pow( 10, 0 );
-
+                    
+                    tempDataElementCount = sqlResultSet.getInt( 1 );
+                    dataElementCount.add( tempDataElementCount );
+                    
                     results.add( (int) dataStatusPercentatge );
                 }
             }

=== modified file 'local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/ds/action/GenerateSummaryDataStatusResultAction.java'
--- local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/ds/action/GenerateSummaryDataStatusResultAction.java	2011-03-01 09:39:28 +0000
+++ local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/ds/action/GenerateSummaryDataStatusResultAction.java	2011-04-15 11:34:10 +0000
@@ -85,6 +85,27 @@
     // Output Parameters
     // ---------------------------------------------------------------
 
+    private Map<OrganisationUnit, Integer> ouMapForColor;
+    
+    public Map<OrganisationUnit, Integer> getOuMapForColor()
+    {
+        return ouMapForColor;
+    }
+
+    private Map<OrganisationUnit, Integer> ouMapForChildDSAssociation;
+    
+    public Map<OrganisationUnit, Integer> getOuMapForChildDSAssociation()
+    {
+        return ouMapForChildDSAssociation;
+    }
+
+    private Map<OrganisationUnit, List<Integer>> ouMapStatusResult;
+
+    public Map<OrganisationUnit, List<Integer>> getOuMapStatusResult()
+    {
+        return ouMapStatusResult;
+    }
+
     private Map<OrganisationUnit, List<Integer>> ouMapSummaryStatusResult;
 
     public Map<OrganisationUnit, List<Integer>> getOuMapSummaryStatusResult()
@@ -266,6 +287,9 @@
         dataViewName = "";
 
         // Intialization
+        ouMapForChildDSAssociation = new HashMap<OrganisationUnit, Integer>();
+        ouMapForColor =  new HashMap<OrganisationUnit, Integer>();
+        ouMapStatusResult = new HashMap<OrganisationUnit, List<Integer>>();
         periodNameList = new ArrayList<String>();
         ouMapSummaryStatusResult = new HashMap<OrganisationUnit, List<Integer>>();
         maxOULevel = 1;
@@ -293,12 +317,10 @@
         {
             selectedOrgUnit = organisationUnitService.getOrganisationUnit( Integer.parseInt( orgUnitListCB.get( 0 ) ) );
             orgUnitList.addAll( organisationUnitService.getOrganisationUnitWithChildren( selectedOrgUnit.getId() ) );
-            //getChildOrgUnitTree( selectedOrgUnit );
         }
         else if ( facilityLB.equals( "immChildren" ) )
         {
             selectedOrgUnit = organisationUnitService.getOrganisationUnit( Integer.parseInt( orgUnitListCB.get( 0 ) ) );
-            //number = selectedOrgUnit.getChildren().size();
             Iterator<String> orgUnitIterator = orgUnitListCB.iterator();
             while ( orgUnitIterator.hasNext() )
             {
@@ -403,6 +425,19 @@
             List<Integer> dsResults = new ArrayList<Integer>();
             List<Integer> dsSummaryResults = new ArrayList<Integer>();
            
+            List<OrganisationUnit> childOrgUnits = new ArrayList<OrganisationUnit>();
+            if ( !dso.contains( o ) )
+            {
+                childOrgUnits = filterChildOrgUnitsByDataSet( selDataSet, o );
+                ouMapForChildDSAssociation.put( o, childOrgUnits.size() );
+                ouMapForColor.put( o, 0 );
+            }
+            else
+            {
+                ouMapForChildDSAssociation.put( o, -1 );
+                ouMapForColor.put( o, 1 );
+            }
+            
             while ( periodIterator.hasNext() )
             {
                 p = (Period) periodIterator.next();
@@ -412,15 +447,16 @@
                 {
                     dsResults.add( -1 );
                     dsSummaryResults.add( -1 );
+                    ouMapForChildDSAssociation.put( o, -1 );
                     continue;
                 }
                 else if ( !dso.contains( o ) )
                 {
-                    List<OrganisationUnit> childOrgUnits = new ArrayList<OrganisationUnit>();
-                    childOrgUnits = filterChildOrgUnitsByDataSet( selDataSet, o );
+                    //List<OrganisationUnit> childOrgUnits = new ArrayList<OrganisationUnit>();
+                    //childOrgUnits = filterChildOrgUnitsByDataSet( selDataSet, o );
+                    
+                    int dataStatusCount = 0;
                     Iterator<OrganisationUnit> assignedChildrenIterator = childOrgUnits.iterator();
-                    int dataStatusCount = 0;
-
                     while ( assignedChildrenIterator.hasNext() )
                     {
                         OrganisationUnit cUnit = (OrganisationUnit) assignedChildrenIterator.next();
@@ -469,12 +505,17 @@
                             dataStatusCount += 1;
                         }
                     }
+                    
                     dsSummaryResults.add( dataStatusCount );
+                    Double tempDouble = ( (double) dataStatusCount /(double) childOrgUnits.size() ) * 100.0;
+                    tempDouble = Math.round( tempDouble * Math.pow( 10, 0 ) ) / Math.pow( 10, 0 );
+                    dsResults.add( tempDouble.intValue() );
                     continue;
                 }
 
                 orgUnitInfo = "" + o.getId();
-
+                
+                
                 if ( includeZeros == null )
                 {
                     query = "SELECT COUNT(*) FROM " + dataViewName + " WHERE dataelementid IN (" + deInfo
@@ -506,7 +547,6 @@
                     dataStatusPercentatge = 100;
 
                 dataStatusPercentatge = Math.round( dataStatusPercentatge * Math.pow( 10, 0 ) ) / Math.pow( 10, 0 );
-                dsResults.add( (int) dataStatusPercentatge );
 
                 if ( dataStatusPercentatge >= 5.0 )
                 {
@@ -516,9 +556,12 @@
                 {
                     dsSummaryResults.add( 0 );
                 }
+                
+                dsResults.add( -1 );
             }
             
             ouMapSummaryStatusResult.put( o, dsSummaryResults );
+            ouMapStatusResult.put( o, dsResults );
         }
 
         // For Level Names

=== modified file 'local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/ga/action/charts/GenerateChartAction1.java'
--- local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/ga/action/charts/GenerateChartAction1.java	2010-12-23 07:23:23 +0000
+++ local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/ga/action/charts/GenerateChartAction1.java	2011-04-15 11:34:10 +0000
@@ -153,12 +153,12 @@
 
         initialzeAllLists( series1S,  categories1S );
       
-        System.out.println( "\n data1 : " + objData1 );
-        System.out.println( "\n series1 : " + series1S );
-        System.out.println( "\n categories1 : " + categories1S );
-        System.out.println( "\n chartTitle : " + chartTitle );
-        System.out.println( "\n xAxisTitle : " + xAxis_Title );
-        System.out.println( "\n yAxisTitle : " + yAxis_Title );
+        //System.out.println( "\n data1 : " + objData1 );
+        //System.out.println( "\n series1 : " + series1S );
+        //System.out.println( "\n categories1 : " + categories1S );
+        //System.out.println( "\n chartTitle : " + chartTitle );
+        //System.out.println( "\n xAxisTitle : " + xAxis_Title );
+        //System.out.println( "\n yAxisTitle : " + yAxis_Title );
        
         
         if( objData1 == null || series1 == null ||  categories1 == null ||  chartTitle == null || xAxis_Title == null || yAxis_Title == null )
@@ -176,7 +176,7 @@
         
         initializeDataLists();
         
-        System.out.println( "current chart Type is : " + currentChart + " ,And Chart Display Option is : " + chartDisplayOption );
+        //System.out.println( "current chart Type is : " + currentChart + " ,And Chart Display Option is : " + chartDisplayOption );
         
         if ( currentChart == null )
         {

=== modified file 'local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/ga/action/charts/GenerateChartDataElementAction.java'
--- local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/ga/action/charts/GenerateChartDataElementAction.java	2011-03-01 09:39:28 +0000
+++ local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/ga/action/charts/GenerateChartDataElementAction.java	2011-04-15 11:34:10 +0000
@@ -72,24 +72,25 @@
 
 /**
  * @author Mithilesh Kumar Thakur
- *
+ * 
  * @version GenerateChartDataElementAction.java Oct 25, 2010 12:20:22 PM
  */
-public class GenerateChartDataElementAction implements Action
+public class GenerateChartDataElementAction
+    implements Action
 {
-   
+
     private final String PERIODWISE = "period";
 
     private final String CHILDREN = "children";
 
     private final String SELECTED = "random";
-    
+
     private final String OPTIONCOMBO = "optioncombo";
-    
+
     // -------------------------------------------------------------------------
     // Dependencies
     // -------------------------------------------------------------------------
-   
+
     private StatementManager statementManager;
 
     public void setStatementManager( StatementManager statementManager )
@@ -103,28 +104,28 @@
     {
         this.dataElementService = dataElementService;
     }
-    
+
     private DataElementCategoryService dataElementCategoryService;
 
     public void setDataElementCategoryService( DataElementCategoryService dataElementCategoryService )
     {
         this.dataElementCategoryService = dataElementCategoryService;
     }
-    
+
     private OrganisationUnitService organisationUnitService;
 
     public void setOrganisationUnitService( OrganisationUnitService organisationUnitService )
     {
         this.organisationUnitService = organisationUnitService;
     }
-    
+
     private OrganisationUnitGroupService organisationUnitGroupService;
 
     public void setOrganisationUnitGroupService( OrganisationUnitGroupService organisationUnitGroupService )
     {
         this.organisationUnitGroupService = organisationUnitGroupService;
     }
-    
+
     private AggregationService aggregationService;
 
     public void setAggregationService( AggregationService aggregationService )
@@ -145,9 +146,9 @@
     {
         this.periodService = periodService;
     }
-    
+
     private CaseAggregationConditionService caseAggregationConditionService;
-    
+
     public void setCaseAggregationConditionService( CaseAggregationConditionService caseAggregationConditionService )
     {
         this.caseAggregationConditionService = caseAggregationConditionService;
@@ -159,25 +160,25 @@
     {
         this.format = format;
     }
-    
+
     // --------------------------------------------------------------------------
     // Parameters
     // --------------------------------------------------------------------------
-    
+
     private HttpSession session;
 
     public HttpSession getSession()
     {
         return session;
     }
-    
+
     private List<Object> selectedServiceList;
 
     public List<Object> getSelectedServiceList()
     {
         return selectedServiceList;
     }
-    
+
     // -------------------------------------------------------------------------
     // Input
     // -------------------------------------------------------------------------
@@ -190,29 +191,29 @@
     }
 
     private String deSelection;
-    
+
     public void setDeSelection( String deSelection )
     {
         this.deSelection = deSelection;
     }
-    
+
     public String getDeSelection()
     {
         return deSelection;
     }
-    
+
     private String ougGroupSetCB;
-    
+
     public void setOugGroupSetCB( String ougGroupSetCB )
     {
         this.ougGroupSetCB = ougGroupSetCB;
     }
-    
+
     public String getOugGroupSetCB()
     {
         return ougGroupSetCB;
     }
-   
+
     private List<String> orgUnitGroupList;
 
     public List<String> getOrgUnitGroupList()
@@ -226,26 +227,26 @@
     }
 
     private String aggDataCB;
-    
+
     public void setAggDataCB( String aggDataCB )
     {
         this.aggDataCB = aggDataCB;
     }
-    
+
     public String getAggDataCB()
     {
         return aggDataCB;
     }
 
     private List<String> orgUnitListCB;
-    
+
     public void setOrgUnitListCB( List<String> orgUnitListCB )
     {
         this.orgUnitListCB = orgUnitListCB;
     }
-    
+
     private String categoryLB;
-    
+
     public String getCategoryLB()
     {
         return categoryLB;
@@ -255,9 +256,9 @@
     {
         this.categoryLB = categoryLB;
     }
-    
+
     private String selectedButton;
-    
+
     public String getSelectedButton()
     {
         return selectedButton;
@@ -267,14 +268,14 @@
     {
         this.selectedButton = selectedButton;
     }
-    
+
     private String periodTypeLB;
-    
+
     public void setPeriodTypeLB( String periodTypeLB )
     {
         this.periodTypeLB = periodTypeLB;
     }
-    
+
     private List<String> yearLB;
 
     public void setYearLB( List<String> yearLB )
@@ -288,42 +289,42 @@
     {
         this.periodLB = periodLB;
     }
-    
+
     private DataElementChartResult dataElementChartResult;
-    
+
     public DataElementChartResult getDataElementChartResult()
     {
         return dataElementChartResult;
     }
-    
+
     List<String> yseriesList;
 
     public List<String> getYseriesList()
     {
         return yseriesList;
     }
-    
+
     private List<String> selectedValues;
-    
+
     public List<String> getSelectedValues()
     {
         return selectedValues;
     }
 
     private List<String> selectedStatus;
-    
+
     public List<String> getSelectedStatus()
     {
         return selectedStatus;
     }
-    
+
     private List<String> selectedDrillDownData;
-    
+
     public List<String> getSelectedDrillDownData()
     {
         return selectedDrillDownData;
     }
-    
+
     ListTool listTool;
 
     public ListTool getListTool()
@@ -332,22 +333,34 @@
     }
 
     private List<OrganisationUnit> selOUList;
+
     private List<DataElementCategoryOptionCombo> selectedOptionComboList;
+
     private OrganisationUnit selectedOrgUnit;
+
     private OrganisationUnitGroup selOrgUnitGroup;
+
     private List<OrganisationUnit> selOUGroupMemberList = new ArrayList<OrganisationUnit>();
-    private  List<String> periodNames;
+
+    private List<String> periodNames;
+
     private List<Date> selStartPeriodList;
+
     private List<Date> selEndPeriodList;
+
     private String drillDownPeriodStartDate;
+
     private String drillDownPeriodEndDate;
+
     private String drillDownPeriodNames;
+
     private String aggChecked;
-    
+
     // -------------------------------------------------------------------------
     // Action Implementation
     // -------------------------------------------------------------------------
-    public String execute()  throws Exception
+    public String execute()
+        throws Exception
     {
         statementManager.initialise();
 
@@ -362,8 +375,8 @@
         selectedDrillDownData = new ArrayList<String>();
 
         aggChecked = "";
-        
-        if( aggDataCB != null )
+
+        if ( aggDataCB != null )
         {
             aggChecked = "1";
         }
@@ -372,9 +385,9 @@
             aggChecked = "0";
         }
 
-        //----------------------------------------------------------------------
+        // ----------------------------------------------------------------------
         // Period Info
-        //----------------------------------------------------------------------
+        // ----------------------------------------------------------------------
         String monthOrder[] = { "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12" };
         int monthDays[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
 
@@ -385,16 +398,16 @@
         drillDownPeriodNames = "";
         SimpleDateFormat simpleDateFormat = new SimpleDateFormat( "MMM-yyyy" );
         periodNames = new ArrayList<String>();
-        
-        if( periodTypeLB.equalsIgnoreCase( WeeklyPeriodType.NAME ) )
+
+        if ( periodTypeLB.equalsIgnoreCase( WeeklyPeriodType.NAME ) )
         {
             int periodCount = 0;
-            for( String periodStr : periodLB )
+            for ( String periodStr : periodLB )
             {
                 startD = periodStr.split( "To" )[0].trim();
                 endD = periodStr.split( "To" )[1].trim();
-                
-                if( periodCount == periodLB.size()-1 )
+
+                if ( periodCount == periodLB.size() - 1 )
                 {
                     drillDownPeriodStartDate += startD;
                     drillDownPeriodEndDate += endD;
@@ -406,7 +419,7 @@
                     drillDownPeriodEndDate += endD + ";";
                     drillDownPeriodNames += periodStr + ";";
                 }
-                
+
                 selStartPeriodList.add( format.parseDate( startD ) );
                 selEndPeriodList.add( format.parseDate( endD ) );
                 periodNames.add( periodStr );
@@ -422,9 +435,9 @@
                 if ( periodTypeLB.equalsIgnoreCase( YearlyPeriodType.NAME ) )
                 {
                     startD = "" + selYear + "-01-01";
-                    endD = "" + selYear  + "-12-31";
-                    
-                    if( periodCount == yearLB.size()-1 )
+                    endD = "" + selYear + "-12-31";
+
+                    if ( periodCount == yearLB.size() - 1 )
                     {
                         drillDownPeriodStartDate += startD;
                         drillDownPeriodEndDate += endD;
@@ -436,28 +449,28 @@
                         drillDownPeriodEndDate += endD + ";";
                         drillDownPeriodNames += selYear + ";";
                     }
-                    
+
                     selStartPeriodList.add( format.parseDate( startD ) );
                     selEndPeriodList.add( format.parseDate( endD ) );
                     periodNames.add( "" + selYear );
                     continue;
                 }
-               
-                for( String periodStr : periodLB )
+
+                for ( String periodStr : periodLB )
                 {
                     if ( periodTypeLB.equalsIgnoreCase( MonthlyPeriodType.NAME ) )
                     {
                         int period = Integer.parseInt( periodStr );
                         simpleDateFormat = new SimpleDateFormat( "MMM-yyyy" );
-                        
+
                         startD = "" + selYear + "-" + monthOrder[period] + "-01";
-                        endD = "" + selYear  + "-" + monthOrder[period] + "-" + monthDays[period];
-                       
-                        if ( ((( selYear ) % 400 == 0 ) || ((( selYear) % 100 != 0 && ( selYear ) % 4 == 0))) && period == 1 )
+                        endD = "" + selYear + "-" + monthOrder[period] + "-" + monthDays[period];
+
+                        if ( (((selYear) % 400 == 0) || (((selYear) % 100 != 0 && (selYear) % 4 == 0))) && period == 1 )
                         {
-                            endD = "" + selYear  + "-" + monthOrder[period] + "-" + ( monthDays[period] + 1 );
-                        } 
-                        
+                            endD = "" + selYear + "-" + monthOrder[period] + "-" + (monthDays[period] + 1);
+                        }
+
                         drillDownPeriodStartDate += startD + ";";
                         drillDownPeriodEndDate += endD + ";";
                         drillDownPeriodNames += simpleDateFormat.format( format.parseDate( startD ) ) + ";";
@@ -496,8 +509,8 @@
                             periodNames.add( (selYear) + "-Q4" );
                             drillDownPeriodNames += selYear + "-Q4" + ";";
                         }
-                        
-                        if( periodCount == periodLB.size()-1 )
+
+                        if ( periodCount == periodLB.size() - 1 )
                         {
                             drillDownPeriodStartDate += startD;
                             drillDownPeriodEndDate += endD;
@@ -507,7 +520,7 @@
                             drillDownPeriodStartDate += startD + ";";
                             drillDownPeriodEndDate += endD + ";";
                         }
-                        
+
                         selStartPeriodList.add( format.parseDate( startD ) );
                         selEndPeriodList.add( format.parseDate( endD ) );
                     }
@@ -528,7 +541,7 @@
                             periodNames.add( selYear + "-HY2" );
                             drillDownPeriodNames += selYear + "-HY2" + ";";
                         }
-                       
+
                         drillDownPeriodStartDate += startD + ";";
                         drillDownPeriodEndDate += endD + ";";
                         selStartPeriodList.add( format.parseDate( startD ) );
@@ -536,25 +549,28 @@
                     }
                     else if ( periodTypeLB.equalsIgnoreCase( DailyPeriodType.NAME ) )
                     {
-                       String  month = periodStr.split( "-" )[0] ;
-                       String  date = periodStr.split( "-" )[1] ;
-                       startD = selYear + "-" + periodStr;
-                       endD = selYear + "-" + periodStr ;
-                       
-                       if ( selYear  % 4 != 0 && month.trim().equalsIgnoreCase( "02" )  && date.trim().equalsIgnoreCase( "29" ) )
+                        String month = periodStr.split( "-" )[0];
+                        String date = periodStr.split( "-" )[1];
+                        startD = selYear + "-" + periodStr;
+                        endD = selYear + "-" + periodStr;
+
+                        if ( selYear % 4 != 0 && month.trim().equalsIgnoreCase( "02" )
+                            && date.trim().equalsIgnoreCase( "29" ) )
                         {
                             startD = selYear + "-" + month + "-" + date;
                             endD = selYear + "-" + month + "-" + date;
                             continue;
                         }
-                        
-                       if ( (( selYear % 400 == 0) || (( selYear % 100 != 0 && selYear % 4 == 0))) && month.trim().equalsIgnoreCase( "02" )  && date.trim().equalsIgnoreCase( "29" ) ); 
+
+                        if ( ((selYear % 400 == 0) || ((selYear % 100 != 0 && selYear % 4 == 0)))
+                            && month.trim().equalsIgnoreCase( "02" ) && date.trim().equalsIgnoreCase( "29" ) )
+                            ;
                         {
                             startD = selYear + "-" + month + "-" + date;
-                            endD = selYear  + "-" + month + "-" + date;
+                            endD = selYear + "-" + month + "-" + date;
                         }
-                       
-                        if( periodCount == periodLB.size()-1 )
+
+                        if ( periodCount == periodLB.size() - 1 )
                         {
                             drillDownPeriodStartDate += startD;
                             drillDownPeriodEndDate += endD;
@@ -566,7 +582,7 @@
                             drillDownPeriodEndDate += endD + ";";
                             drillDownPeriodNames += startD + ";";
                         }
-                        
+
                         selStartPeriodList.add( format.parseDate( startD ) );
                         selEndPeriodList.add( format.parseDate( endD ) );
                         periodNames.add( startD );
@@ -574,21 +590,21 @@
                 }
                 periodCount++;
             }
-        }    
-        
-        //----------------------------------------------------------------------
-        // DataElement Information        
-        //----------------------------------------------------------------------
+        }
+
+        // ----------------------------------------------------------------------
+        // DataElement Information
+        // ----------------------------------------------------------------------
         List<DataElement> dataElementList = new ArrayList<DataElement>();
-        
+
         if ( deSelection == null )
         {
             System.out.println( "deOptionValue is null" );
             return null;
         }
-        
+
         if ( deSelection.equalsIgnoreCase( OPTIONCOMBO ) )
-        { 
+        {
             Iterator<String> deIterator = selectedDataElements.iterator();
             while ( deIterator.hasNext() )
             {
@@ -598,7 +614,8 @@
                 DataElement dataElement = dataElementService.getDataElement( dataElementId );
                 dataElementList.add( dataElement );
                 int optionComboId = Integer.parseInt( partsOfServiceId[1] );
-                DataElementCategoryOptionCombo decoc = dataElementCategoryService.getDataElementCategoryOptionCombo( optionComboId );
+                DataElementCategoryOptionCombo decoc = dataElementCategoryService
+                    .getDataElementCategoryOptionCombo( optionComboId );
                 selectedOptionComboList.add( decoc );
             }
         }
@@ -612,680 +629,772 @@
                 dataElementList.add( dataElement );
             }
         }
-       
+
         selectedServiceList = new ArrayList<Object>( dataElementList );
-        
-        //----------------------------------------------------------------------
+
+        // ----------------------------------------------------------------------
         // OrgUnit Information
-        //----------------------------------------------------------------------
+        // ----------------------------------------------------------------------
         for ( String ouStr : orgUnitListCB )
         {
             OrganisationUnit orgUnit = organisationUnitService.getOrganisationUnit( Integer.parseInt( ouStr ) );
             selOUList.add( orgUnit );
         }
 
-        if ( categoryLB.equalsIgnoreCase( PERIODWISE )&& ougGroupSetCB == null )
+        if ( categoryLB.equalsIgnoreCase( PERIODWISE ) && ougGroupSetCB == null )
         {
             System.out.println( "Chart Generation Start Time is : " + new Date() );
-           
-            dataElementChartResult = generateChartDataPeriodWise( selStartPeriodList,selEndPeriodList,periodNames,dataElementList,selectedOptionComboList,selOUList.iterator().next() );
+
+            dataElementChartResult = generateChartDataPeriodWise( selStartPeriodList, selEndPeriodList, periodNames,
+                dataElementList, selectedOptionComboList, selOUList.iterator().next() );
         }
         else if ( categoryLB.equalsIgnoreCase( CHILDREN ) && ougGroupSetCB == null )
         {
             System.out.println( "Chart Generation Start Time is : " + new Date() );
-            
+
             selectedOrgUnit = new OrganisationUnit();
             selectedOrgUnit = organisationUnitService.getOrganisationUnit( Integer.parseInt( orgUnitListCB.get( 0 ) ) );
-            
+
             List<OrganisationUnit> childOrgUnitList = new ArrayList<OrganisationUnit>();
-            childOrgUnitList = new ArrayList<OrganisationUnit>( selectedOrgUnit.getChildren());
-            
-            dataElementChartResult = generateChartDataWithChildrenWise( selStartPeriodList,selEndPeriodList,periodNames,dataElementList,selectedOptionComboList,childOrgUnitList );
+            childOrgUnitList = new ArrayList<OrganisationUnit>( selectedOrgUnit.getChildren() );
+
+            dataElementChartResult = generateChartDataWithChildrenWise( selStartPeriodList, selEndPeriodList,
+                periodNames, dataElementList, selectedOptionComboList, childOrgUnitList );
         }
         else if ( categoryLB.equalsIgnoreCase( SELECTED ) && ougGroupSetCB == null )
         {
             System.out.println( "Chart Generation Start Time is : " + new Date() );
-            
-            dataElementChartResult = generateChartDataSelectedOrgUnitWise( selStartPeriodList,selEndPeriodList,periodNames,dataElementList,selectedOptionComboList,selOUList );
+
+            dataElementChartResult = generateChartDataSelectedOrgUnitWise( selStartPeriodList, selEndPeriodList,
+                periodNames, dataElementList, selectedOptionComboList, selOUList );
         }
         else if ( categoryLB.equalsIgnoreCase( PERIODWISE ) && ougGroupSetCB != null )
         {
             System.out.println( "Chart Generation Start Time is : " + new Date() );
-          
+
             selectedOrgUnit = organisationUnitService.getOrganisationUnit( Integer.parseInt( orgUnitListCB.get( 0 ) ) );
-            List<OrganisationUnit> orgUnitChildList = new ArrayList<OrganisationUnit>( organisationUnitService.getOrganisationUnitWithChildren( selectedOrgUnit.getId() ) );
-           
-            selOrgUnitGroup = organisationUnitGroupService.getOrganisationUnitGroup( Integer.parseInt( orgUnitGroupList.get( 0 ) ) );
+            List<OrganisationUnit> orgUnitChildList = new ArrayList<OrganisationUnit>( organisationUnitService
+                .getOrganisationUnitWithChildren( selectedOrgUnit.getId() ) );
+
+            selOrgUnitGroup = organisationUnitGroupService.getOrganisationUnitGroup( Integer.parseInt( orgUnitGroupList
+                .get( 0 ) ) );
             selOUGroupMemberList = new ArrayList<OrganisationUnit>( selOrgUnitGroup.getMembers() );
             selOUGroupMemberList.retainAll( orgUnitChildList );
-            
-            dataElementChartResult = generateChartDataOrgGroupPeriodWise(selStartPeriodList,selEndPeriodList,periodNames,dataElementList,selectedOptionComboList,selOUGroupMemberList);
+
+            dataElementChartResult = generateChartDataOrgGroupPeriodWise( selStartPeriodList, selEndPeriodList,
+                periodNames, dataElementList, selectedOptionComboList, selOUGroupMemberList );
         }
         else if ( categoryLB.equalsIgnoreCase( CHILDREN ) && ougGroupSetCB != null )
         {
             System.out.println( "Chart Generation Start Time is : " + new Date() );
-            
+
             selectedOrgUnit = organisationUnitService.getOrganisationUnit( Integer.parseInt( orgUnitListCB.get( 0 ) ) );
-            List<OrganisationUnit> orgUnitChildList = new ArrayList<OrganisationUnit>( organisationUnitService.getOrganisationUnitWithChildren( selectedOrgUnit.getId() ) );
-            
+            List<OrganisationUnit> orgUnitChildList = new ArrayList<OrganisationUnit>( organisationUnitService
+                .getOrganisationUnitWithChildren( selectedOrgUnit.getId() ) );
+
             int groupCount = 0;
             for ( String orgUnitGroupId : orgUnitGroupList )
             {
-                OrganisationUnitGroup selOrgUnitGroup = organisationUnitGroupService.getOrganisationUnitGroup( Integer.parseInt( orgUnitGroupId ) );
-                List<OrganisationUnit> selectedOUGroupMemberList = new ArrayList<OrganisationUnit>( selOrgUnitGroup.getMembers() );
+                OrganisationUnitGroup selOrgUnitGroup = organisationUnitGroupService.getOrganisationUnitGroup( Integer
+                    .parseInt( orgUnitGroupId ) );
+                List<OrganisationUnit> selectedOUGroupMemberList = new ArrayList<OrganisationUnit>( selOrgUnitGroup
+                    .getMembers() );
                 selOUGroupMemberList.addAll( selectedOUGroupMemberList );
                 groupCount++;
             }
-            
+
             selOUGroupMemberList.retainAll( orgUnitChildList );
-            
-            dataElementChartResult = generateChartDataSelectedOrgUnitWise( selStartPeriodList,selEndPeriodList,periodNames,dataElementList,selectedOptionComboList,selOUGroupMemberList );
+
+            dataElementChartResult = generateChartDataSelectedOrgUnitWise( selStartPeriodList, selEndPeriodList,
+                periodNames, dataElementList, selectedOptionComboList, selOUGroupMemberList );
         }
         else if ( categoryLB.equalsIgnoreCase( SELECTED ) && ougGroupSetCB != null )
         {
             System.out.println( "Chart Generation Start Time is : " + new Date() );
-            
-            Map<OrganisationUnitGroup,List<OrganisationUnit>> orgUnitGroupMap = new HashMap<OrganisationUnitGroup,List<OrganisationUnit>>();
-           
-           selectedOrgUnit = organisationUnitService.getOrganisationUnit( Integer.parseInt( orgUnitListCB.get( 0 ) ) );
-           List<OrganisationUnit> orgUnitChildList = new ArrayList<OrganisationUnit>( organisationUnitService.getOrganisationUnitWithChildren( selectedOrgUnit.getId() ) );
-           
-           for ( String orgUnitGroupId : orgUnitGroupList )
-           {
-               OrganisationUnitGroup selOrgUnitGroup = organisationUnitGroupService.getOrganisationUnitGroup( Integer.parseInt( orgUnitGroupId ) );
-               List<OrganisationUnit> selectedOUGroupMemberList = new ArrayList<OrganisationUnit>( selOrgUnitGroup.getMembers() );
-               selectedOUGroupMemberList.retainAll( orgUnitChildList );
-               orgUnitGroupMap.put( selOrgUnitGroup,  selectedOUGroupMemberList);
-           }
-          
-           dataElementChartResult = generateChartDataSelectedOrgUnitGroupWise( selStartPeriodList,selEndPeriodList,periodNames,dataElementList,selectedOptionComboList,orgUnitGroupMap );
+
+            Map<OrganisationUnitGroup, List<OrganisationUnit>> orgUnitGroupMap = new HashMap<OrganisationUnitGroup, List<OrganisationUnit>>();
+
+            selectedOrgUnit = organisationUnitService.getOrganisationUnit( Integer.parseInt( orgUnitListCB.get( 0 ) ) );
+            List<OrganisationUnit> orgUnitChildList = new ArrayList<OrganisationUnit>( organisationUnitService
+                .getOrganisationUnitWithChildren( selectedOrgUnit.getId() ) );
+
+            for ( String orgUnitGroupId : orgUnitGroupList )
+            {
+                OrganisationUnitGroup selOrgUnitGroup = organisationUnitGroupService.getOrganisationUnitGroup( Integer
+                    .parseInt( orgUnitGroupId ) );
+                List<OrganisationUnit> selectedOUGroupMemberList = new ArrayList<OrganisationUnit>( selOrgUnitGroup
+                    .getMembers() );
+                selectedOUGroupMemberList.retainAll( orgUnitChildList );
+                orgUnitGroupMap.put( selOrgUnitGroup, selectedOUGroupMemberList );
+            }
+
+            dataElementChartResult = generateChartDataSelectedOrgUnitGroupWise( selStartPeriodList, selEndPeriodList,
+                periodNames, dataElementList, selectedOptionComboList, orgUnitGroupMap );
         }
-       
+
         ActionContext ctx = ActionContext.getContext();
         HttpServletRequest req = (HttpServletRequest) ctx.get( ServletActionContext.HTTP_REQUEST );
 
         session = req.getSession();
-        
+
         session.setAttribute( "data1", dataElementChartResult.getData() );
         session.setAttribute( "series1", dataElementChartResult.getSeries() );
         session.setAttribute( "categories1", dataElementChartResult.getCategories() );
         session.setAttribute( "chartTitle", dataElementChartResult.getChartTitle() );
         session.setAttribute( "xAxisTitle", dataElementChartResult.getXAxis_Title() );
         session.setAttribute( "yAxisTitle", dataElementChartResult.getYAxis_Title() );
-        
+
         System.out.println( "Chart Generation End Time is : " + new Date() );
         statementManager.destroy();
-        
+
         return SUCCESS;
     }
-    
+
     // -------------------------------------------------------------------------
     // Methods for getting Chart Data only Period Wise start
     // -------------------------------------------------------------------------
-    public DataElementChartResult generateChartDataPeriodWise( List<Date> selStartPeriodList,List<Date> selEndPeriodList,List<String> periodNames,List<DataElement> dataElementList,List<DataElementCategoryOptionCombo> decocList,OrganisationUnit orgUnit ) throws Exception
+    public DataElementChartResult generateChartDataPeriodWise( List<Date> selStartPeriodList,
+        List<Date> selEndPeriodList, List<String> periodNames, List<DataElement> dataElementList,
+        List<DataElementCategoryOptionCombo> decocList, OrganisationUnit orgUnit )
+        throws Exception
     {
-       DataElementChartResult dataElementChartResult;
-       
-       String[] series = new String[dataElementList.size()];
-       String[] categories = new String[selStartPeriodList.size()];
-       Double[][] data = new Double[dataElementList.size()][selStartPeriodList.size()];
-       String chartTitle = "OrganisationUnit : " + orgUnit.getShortName();
-       String xAxis_Title = "Time Line";
-       String yAxis_Title = "Value";
-       
-       int serviceCount = 0;     
-     
-       for( DataElement dataElement : dataElementList )
-       {
-           DataElementCategoryOptionCombo decoc;
-
-           DataElementCategoryCombo dataElementCategoryCombo = dataElement.getCategoryCombo();
-
-           List<DataElementCategoryOptionCombo> optionCombos = new ArrayList<DataElementCategoryOptionCombo>( dataElementCategoryCombo.getOptionCombos() );
-           
-           if ( deSelection.equalsIgnoreCase( OPTIONCOMBO ) )
-           {
-               decoc = decocList.get( serviceCount );
-                   
-               series[serviceCount] = dataElement.getName() + " : " + decoc.getName();
-               
-               CaseAggregationCondition caseAggregationCondition = caseAggregationConditionService.getCaseAggregationCondition( dataElement, decoc );
-
-               if( caseAggregationCondition == null )
-               {
-                   selectedStatus.add( "no" );
-               }
-               else
-               {
-                   selectedStatus.add( "yes" );
-               }
-
-               yseriesList.add( dataElement.getName() + " : " + decoc.getName() );
-           }
-           else
-           {
-               decoc = dataElementCategoryService.getDefaultDataElementCategoryOptionCombo();
-               series[serviceCount] = dataElement.getName();
-
-               CaseAggregationCondition caseAggregationCondition = caseAggregationConditionService.getCaseAggregationCondition( dataElement, decoc );
-               
-               if( caseAggregationCondition == null )
-               {
-                   selectedStatus.add( "no" );
-               }
-               else
-               {
-                   selectedStatus.add( "yes" );
-               }
-               
-               yseriesList.add( dataElement.getName() );
-           }
-           
-           int periodCount = 0;
-           for( Date startDate : selStartPeriodList )
-           {
-               Date endDate = selEndPeriodList.get( periodCount );
-               String drillDownPeriodName = periodNames.get( periodCount );
-               String tempStartDate = format.formatDate( startDate );
-               String tempEndDate   = format.formatDate( endDate );
-               
-               categories[periodCount] = periodNames.get( periodCount );
-               PeriodType periodType = periodService.getPeriodTypeByName( periodTypeLB );
-               
-               String values = orgUnit.getId() + ":"+ dataElement.getId() + ":"+ decoc.getId() + ":"  + periodType + ":" + tempStartDate + ":" + tempEndDate;
-               selectedValues.add( values );
-               
-               String drillDownData = orgUnit.getId() + ":" + "0" + ":" + dataElement.getId() + ":"+ decoc.getId() + ":"  + periodTypeLB + ":" + tempStartDate + ":" + tempEndDate + ":" + drillDownPeriodName + ":" + deSelection + ":" + aggChecked;
-               selectedDrillDownData.add( drillDownData );
-               
-               Double aggDataValue = 0.0;
-
-               Iterator<DataElementCategoryOptionCombo> optionComboIterator = optionCombos.iterator();
-               while ( optionComboIterator.hasNext() )
-               {
-                   DataElementCategoryOptionCombo decoc1 = (DataElementCategoryOptionCombo) optionComboIterator.next();
-
-                   if( aggDataCB != null )
-                   {
-                       Double temp = aggregationService.getAggregatedDataValue( dataElement, decoc1, startDate, endDate, orgUnit );
-                       if( temp != null ) aggDataValue += temp;
-                   }
-                   else
-                   {
-                       Collection<Period> periods = periodService.getPeriodsBetweenDates( startDate, endDate );
-                       for( Period period : periods )
-                       {
-                           DataValue dataValue = dataValueService.getDataValue( orgUnit, dataElement, period, decoc1 );
-                           try
-                           {
-                               aggDataValue += Double.parseDouble( dataValue.getValue() );
-                           }
-                           catch( Exception e )
-                           {
-                           }
-                       }
-                   }
-               }
-               
-               data[serviceCount][periodCount] = aggDataValue;
-               
-               if( dataElement.getType().equalsIgnoreCase( DataElement.VALUE_TYPE_INT ) )
-               {
-                  if ( dataElement.getNumberType().equalsIgnoreCase( DataElement.VALUE_TYPE_INT ) )
-                  {
-                      data[serviceCount][periodCount] = Math.round( data[serviceCount][periodCount] * Math.pow( 10, 0 ) ) / Math.pow( 10, 0 );
-                  }
-                  else
-                  {
-                      data[serviceCount][periodCount] = Math.round( data[serviceCount][periodCount] * Math.pow( 10, 1 ) ) / Math.pow( 10, 1 );
-                  }
-               }
-               periodCount++;
-           }
-           
-           serviceCount++;          
-       }
-       
-       dataElementChartResult = new DataElementChartResult( series, categories, data, chartTitle, xAxis_Title, yAxis_Title );
-
-       return dataElementChartResult;
+        DataElementChartResult dataElementChartResult;
+
+        String[] series = new String[dataElementList.size()];
+        String[] categories = new String[selStartPeriodList.size()];
+        Double[][] data = new Double[dataElementList.size()][selStartPeriodList.size()];
+        String chartTitle = "OrganisationUnit : " + orgUnit.getShortName();
+        String xAxis_Title = "Time Line";
+        String yAxis_Title = "Value";
+
+        int serviceCount = 0;
+
+        for ( DataElement dataElement : dataElementList )
+        {
+            DataElementCategoryOptionCombo decoc;
+
+            DataElementCategoryCombo dataElementCategoryCombo = dataElement.getCategoryCombo();
+
+            List<DataElementCategoryOptionCombo> optionCombos = new ArrayList<DataElementCategoryOptionCombo>(
+                dataElementCategoryCombo.getOptionCombos() );
+
+            if ( deSelection.equalsIgnoreCase( OPTIONCOMBO ) )
+            {
+                decoc = decocList.get( serviceCount );
+
+                series[serviceCount] = dataElement.getName() + " : " + decoc.getName();
+
+                CaseAggregationCondition caseAggregationCondition = caseAggregationConditionService
+                    .getCaseAggregationCondition( dataElement, decoc );
+
+                if ( caseAggregationCondition == null )
+                {
+                    selectedStatus.add( "no" );
+                }
+                else
+                {
+                    selectedStatus.add( "yes" );
+                }
+
+                yseriesList.add( dataElement.getName() + " : " + decoc.getName() );
+            }
+            else
+            {
+                decoc = dataElementCategoryService.getDefaultDataElementCategoryOptionCombo();
+                series[serviceCount] = dataElement.getName();
+
+                CaseAggregationCondition caseAggregationCondition = caseAggregationConditionService
+                    .getCaseAggregationCondition( dataElement, decoc );
+
+                if ( caseAggregationCondition == null )
+                {
+                    selectedStatus.add( "no" );
+                }
+                else
+                {
+                    selectedStatus.add( "yes" );
+                }
+
+                yseriesList.add( dataElement.getName() );
+            }
+
+            int periodCount = 0;
+            for ( Date startDate : selStartPeriodList )
+            {
+                Date endDate = selEndPeriodList.get( periodCount );
+                String drillDownPeriodName = periodNames.get( periodCount );
+                String tempStartDate = format.formatDate( startDate );
+                String tempEndDate = format.formatDate( endDate );
+
+                categories[periodCount] = periodNames.get( periodCount );
+                PeriodType periodType = periodService.getPeriodTypeByName( periodTypeLB );
+
+                String values = orgUnit.getId() + ":" + dataElement.getId() + ":" + decoc.getId() + ":" + periodTypeLB
+                    + ":" + tempStartDate + ":" + tempEndDate;
+                selectedValues.add( values );
+
+                String drillDownData = orgUnit.getId() + ":" + "0" + ":" + dataElement.getId() + ":" + decoc.getId()
+                    + ":" + periodTypeLB + ":" + tempStartDate + ":" + tempEndDate + ":" + drillDownPeriodName + ":"
+                    + deSelection + ":" + aggChecked;
+                selectedDrillDownData.add( drillDownData );
+
+                Double aggDataValue = 0.0;
+
+                Iterator<DataElementCategoryOptionCombo> optionComboIterator = optionCombos.iterator();
+                while ( optionComboIterator.hasNext() )
+                {
+                    DataElementCategoryOptionCombo decoc1 = (DataElementCategoryOptionCombo) optionComboIterator.next();
+
+                    if ( aggDataCB != null )
+                    {
+                        Double temp = aggregationService.getAggregatedDataValue( dataElement, decoc1, startDate,
+                            endDate, orgUnit );
+                        if ( temp != null )
+                            aggDataValue += temp;
+                    }
+                    else
+                    {
+                        Collection<Period> periods = periodService.getPeriodsBetweenDates( startDate, endDate );
+                        for ( Period period : periods )
+                        {
+                            DataValue dataValue = dataValueService.getDataValue( orgUnit, dataElement, period, decoc1 );
+                            try
+                            {
+                                aggDataValue += Double.parseDouble( dataValue.getValue() );
+                            }
+                            catch ( Exception e )
+                            {
+                            }
+                        }
+                    }
+                }
+
+                data[serviceCount][periodCount] = aggDataValue;
+
+                if ( dataElement.getType().equalsIgnoreCase( DataElement.VALUE_TYPE_INT ) )
+                {
+                    if ( dataElement.getNumberType().equalsIgnoreCase( DataElement.VALUE_TYPE_INT ) )
+                    {
+                        data[serviceCount][periodCount] = Math.round( data[serviceCount][periodCount]
+                            * Math.pow( 10, 0 ) )
+                            / Math.pow( 10, 0 );
+                    }
+                    else
+                    {
+                        data[serviceCount][periodCount] = Math.round( data[serviceCount][periodCount]
+                            * Math.pow( 10, 1 ) )
+                            / Math.pow( 10, 1 );
+                    }
+                }
+                periodCount++;
+            }
+
+            serviceCount++;
+        }
+
+        dataElementChartResult = new DataElementChartResult( series, categories, data, chartTitle, xAxis_Title,
+            yAxis_Title );
+
+        return dataElementChartResult;
     }
-    
+
     // -------------------------------------------------------------------------
     // Methods for getting Chart Data With Children Wise start
     // -------------------------------------------------------------------------
-        
-    public DataElementChartResult generateChartDataWithChildrenWise( List<Date> selStartPeriodList,List<Date> selEndPeriodList,List<String> periodNames,List<DataElement> dataElementList,List<DataElementCategoryOptionCombo> decocList,List<OrganisationUnit> childOrgUnitList ) throws Exception
+
+    public DataElementChartResult generateChartDataWithChildrenWise( List<Date> selStartPeriodList,
+        List<Date> selEndPeriodList, List<String> periodNames, List<DataElement> dataElementList,
+        List<DataElementCategoryOptionCombo> decocList, List<OrganisationUnit> childOrgUnitList )
+        throws Exception
     {
-       DataElementChartResult dataElementChartResult;
-       
-       String[] series = new String[dataElementList.size()];
-       String[] categories = new String[childOrgUnitList.size()];
-       Double[][] data = new Double[dataElementList.size()][childOrgUnitList.size()];
-       String chartTitle = "OrganisationUnit : " + selectedOrgUnit.getShortName();
-       
-       String xAxis_Title = "Facilities";
-       String yAxis_Title = "Value";
-    
-       int serviceCount = 0;     
-     
-       for( DataElement dataElement : dataElementList )
-       {
-           DataElementCategoryOptionCombo decoc;
-
-           DataElementCategoryCombo dataElementCategoryCombo = dataElement.getCategoryCombo();
-           List<DataElementCategoryOptionCombo> optionCombos = new ArrayList<DataElementCategoryOptionCombo>( dataElementCategoryCombo.getOptionCombos() );
-
-           if ( deSelection.equalsIgnoreCase( OPTIONCOMBO ) )
-           {
-               decoc = decocList.get( serviceCount );
-                   
-               series[serviceCount] = dataElement.getName() + " : " + decoc.getName();
-               yseriesList.add( dataElement.getName() + " : " + decoc.getName() );
-           }
-           else
-           {
-               decoc = dataElementCategoryService.getDefaultDataElementCategoryOptionCombo();
-               series[serviceCount] = dataElement.getName();
-               
-               yseriesList.add( dataElement.getName() );
-           }
-           
-           int childCount = 0;
-           for( OrganisationUnit orgChild : childOrgUnitList )
-           {
-               categories[childCount] = orgChild.getName();
-               
-               String drillDownData = orgChild.getId() + ":" + "0" + ":" + dataElement.getId() + ":"+ decoc.getId() + ":"  + periodTypeLB + ":" + drillDownPeriodStartDate + ":" + drillDownPeriodEndDate + ":" + drillDownPeriodNames + ":" + deSelection + ":" + aggChecked;
-               selectedDrillDownData.add( drillDownData );
-               
-               Double aggDataValue = 0.0;
-
-               int periodCount = 0;
-               for( Date startDate : selStartPeriodList )
-               {
-                   Date endDate = selEndPeriodList.get( periodCount );
-                   Collection<Period> periods = periodService.getPeriodsBetweenDates( startDate, endDate );
-
-                   Iterator<DataElementCategoryOptionCombo> optionComboIterator = optionCombos.iterator();
-                   while ( optionComboIterator.hasNext() )
-                   {
-                       DataElementCategoryOptionCombo decoc1 = (DataElementCategoryOptionCombo) optionComboIterator.next();
-
-                       if( aggDataCB != null )
-                       {
-                           Double tempAggDataValue = aggregationService.getAggregatedDataValue( dataElement, decoc1, startDate, endDate, orgChild );
-                           if(tempAggDataValue != null ) aggDataValue += tempAggDataValue;
-                       }
-                       else
-                       {
-                           for( Period period : periods )
-                           {
-                               DataValue dataValue = dataValueService.getDataValue( orgChild, dataElement, period, decoc1 );
-                               try
-                               {
-                                   aggDataValue += Double.parseDouble( dataValue.getValue() );
-                               }
-                               catch( Exception e )
-                               {
-                               }
-                           }
-                       }
-                   }
-                   periodCount++;
-               }
- 
-               data[serviceCount][childCount] = aggDataValue;
-               
-               if( dataElement.getType().equalsIgnoreCase( DataElement.VALUE_TYPE_INT ) )
-               {
-                  if ( dataElement.getNumberType().equalsIgnoreCase( DataElement.VALUE_TYPE_INT ) )
-                  {
-                      data[serviceCount][childCount] = Math.round( data[serviceCount][childCount] * Math.pow( 10, 0 ) ) / Math.pow( 10, 0 );
-                  }
-                  else
-                  {
-                      data[serviceCount][childCount] = Math.round( data[serviceCount][childCount] * Math.pow( 10, 1 ) ) / Math.pow( 10, 1 );
-                  }
-               }
-               childCount++;
-           }
-           
-           serviceCount++;          
-       }
-    
-       dataElementChartResult = new DataElementChartResult( series, categories, data, chartTitle, xAxis_Title, yAxis_Title );
-       return dataElementChartResult;
+        DataElementChartResult dataElementChartResult;
+
+        String[] series = new String[dataElementList.size()];
+        String[] categories = new String[childOrgUnitList.size()];
+        Double[][] data = new Double[dataElementList.size()][childOrgUnitList.size()];
+        String chartTitle = "OrganisationUnit : " + selectedOrgUnit.getShortName();
+
+        String xAxis_Title = "Facilities";
+        String yAxis_Title = "Value";
+
+        int serviceCount = 0;
+
+        for ( DataElement dataElement : dataElementList )
+        {
+            DataElementCategoryOptionCombo decoc;
+
+            DataElementCategoryCombo dataElementCategoryCombo = dataElement.getCategoryCombo();
+            List<DataElementCategoryOptionCombo> optionCombos = new ArrayList<DataElementCategoryOptionCombo>(
+                dataElementCategoryCombo.getOptionCombos() );
+
+            if ( deSelection.equalsIgnoreCase( OPTIONCOMBO ) )
+            {
+                decoc = decocList.get( serviceCount );
+
+                series[serviceCount] = dataElement.getName() + " : " + decoc.getName();
+                yseriesList.add( dataElement.getName() + " : " + decoc.getName() );
+            }
+            else
+            {
+                decoc = dataElementCategoryService.getDefaultDataElementCategoryOptionCombo();
+                series[serviceCount] = dataElement.getName();
+
+                yseriesList.add( dataElement.getName() );
+            }
+
+            int childCount = 0;
+            for ( OrganisationUnit orgChild : childOrgUnitList )
+            {
+                categories[childCount] = orgChild.getName();
+
+                String drillDownData = orgChild.getId() + ":" + "0" + ":" + dataElement.getId() + ":" + decoc.getId()
+                    + ":" + periodTypeLB + ":" + drillDownPeriodStartDate + ":" + drillDownPeriodEndDate + ":"
+                    + drillDownPeriodNames + ":" + deSelection + ":" + aggChecked;
+                selectedDrillDownData.add( drillDownData );
+
+                Double aggDataValue = 0.0;
+
+                int periodCount = 0;
+                for ( Date startDate : selStartPeriodList )
+                {
+                    Date endDate = selEndPeriodList.get( periodCount );
+                    Collection<Period> periods = periodService.getPeriodsBetweenDates( startDate, endDate );
+
+                    Iterator<DataElementCategoryOptionCombo> optionComboIterator = optionCombos.iterator();
+                    while ( optionComboIterator.hasNext() )
+                    {
+                        DataElementCategoryOptionCombo decoc1 = (DataElementCategoryOptionCombo) optionComboIterator
+                            .next();
+
+                        if ( aggDataCB != null )
+                        {
+                            Double tempAggDataValue = aggregationService.getAggregatedDataValue( dataElement, decoc1,
+                                startDate, endDate, orgChild );
+                            if ( tempAggDataValue != null )
+                                aggDataValue += tempAggDataValue;
+                        }
+                        else
+                        {
+                            for ( Period period : periods )
+                            {
+                                DataValue dataValue = dataValueService.getDataValue( orgChild, dataElement, period,
+                                    decoc1 );
+                                try
+                                {
+                                    aggDataValue += Double.parseDouble( dataValue.getValue() );
+                                }
+                                catch ( Exception e )
+                                {
+                                }
+                            }
+                        }
+                    }
+                    periodCount++;
+                }
+
+                data[serviceCount][childCount] = aggDataValue;
+
+                if ( dataElement.getType().equalsIgnoreCase( DataElement.VALUE_TYPE_INT ) )
+                {
+                    if ( dataElement.getNumberType().equalsIgnoreCase( DataElement.VALUE_TYPE_INT ) )
+                    {
+                        data[serviceCount][childCount] = Math
+                            .round( data[serviceCount][childCount] * Math.pow( 10, 0 ) )
+                            / Math.pow( 10, 0 );
+                    }
+                    else
+                    {
+                        data[serviceCount][childCount] = Math
+                            .round( data[serviceCount][childCount] * Math.pow( 10, 1 ) )
+                            / Math.pow( 10, 1 );
+                    }
+                }
+                childCount++;
+            }
+
+            serviceCount++;
+        }
+
+        dataElementChartResult = new DataElementChartResult( series, categories, data, chartTitle, xAxis_Title,
+            yAxis_Title );
+        return dataElementChartResult;
     }
-    
+
     // -------------------------------------------------------------------------
     // Methods for getting Chart Data With Selected Wise start
     // -------------------------------------------------------------------------
-    public DataElementChartResult generateChartDataSelectedOrgUnitWise( List<Date> selStartPeriodList,List<Date> selEndPeriodList,List<String> periodNames,List<DataElement> dataElementList,List<DataElementCategoryOptionCombo> decocList,List<OrganisationUnit> selOUList ) throws Exception
+    public DataElementChartResult generateChartDataSelectedOrgUnitWise( List<Date> selStartPeriodList,
+        List<Date> selEndPeriodList, List<String> periodNames, List<DataElement> dataElementList,
+        List<DataElementCategoryOptionCombo> decocList, List<OrganisationUnit> selOUList )
+        throws Exception
     {
-       DataElementChartResult dataElementChartResult;
-       
-       String[] series = new String[dataElementList.size()];
-       String[] categories = new String[selOUList.size()];
-       Double[][] data = new Double[dataElementList.size()][selOUList.size()];
-       String chartTitle = "OrganisationUnit : -----" ;
-       String xAxis_Title = "Facilities";
-       String yAxis_Title = "Value";
-    
-       int serviceCount = 0;     
-     
-       for( DataElement dataElement : dataElementList )
-       {
-           DataElementCategoryOptionCombo decoc;
-           DataElementCategoryCombo dataElementCategoryCombo = dataElement.getCategoryCombo();
-           List<DataElementCategoryOptionCombo> optionCombos = new ArrayList<DataElementCategoryOptionCombo>( dataElementCategoryCombo.getOptionCombos() );
-           
-           if ( deSelection.equalsIgnoreCase( OPTIONCOMBO ) )
-           {
-               decoc = decocList.get( serviceCount );
-               series[serviceCount] = dataElement.getName() + " : " + decoc.getName();
-               yseriesList.add( dataElement.getName() + " : " + decoc.getName() );
-           }
-           else
-           {
-               decoc = dataElementCategoryService.getDefaultDataElementCategoryOptionCombo();
-               series[serviceCount] = dataElement.getName();
-               yseriesList.add( dataElement.getName() );
-           }
-           
-           int orgUnitCount = 0;
-           for( OrganisationUnit orgunit : selOUList )
-           {             
-               categories[orgUnitCount] = orgunit.getName();
-               String drillDownData = orgunit.getId() + ":" + "0" + ":" + dataElement.getId() + ":"+ decoc.getId() + ":"  + periodTypeLB + ":" + drillDownPeriodStartDate + ":" + drillDownPeriodEndDate + ":" + drillDownPeriodNames + ":" + deSelection + ":" + aggChecked;
-               selectedDrillDownData.add( drillDownData );
-               
-               Double aggDataValue = 0.0;
-               
-               int periodCount = 0;
-               for( Date startDate : selStartPeriodList )
-               {
-                   Date endDate = selEndPeriodList.get( periodCount );
-                   Collection<Period> periods = periodService.getPeriodsBetweenDates( startDate, endDate );
-
-                   Iterator<DataElementCategoryOptionCombo> optionComboIterator = optionCombos.iterator();
-                   while ( optionComboIterator.hasNext() )
-                   {
-                       DataElementCategoryOptionCombo decoc1 = (DataElementCategoryOptionCombo) optionComboIterator.next();
-
-                       if( aggDataCB != null )
-                       {
-                           Double tempAggDataValue = aggregationService.getAggregatedDataValue( dataElement, decoc1, startDate, endDate, orgunit );
-                           if(tempAggDataValue != null ) aggDataValue += tempAggDataValue;
-                       }
-                       else
-                       {
-                           for( Period period : periods )
-                           {
-                               DataValue dataValue = dataValueService.getDataValue( orgunit, dataElement, period, decoc1 );
-                               try
-                               {
-                                   aggDataValue += Double.parseDouble( dataValue.getValue() );
-                               }
-                               catch( Exception e )
-                               {
-                               }
-                           }
-                       }
-                   }
-                   periodCount++;
-               }
- 
-               data[serviceCount][orgUnitCount] = aggDataValue;
-               
-               if( dataElement.getType().equalsIgnoreCase( DataElement.VALUE_TYPE_INT ) )
-               {
-                  if ( dataElement.getNumberType().equalsIgnoreCase( DataElement.VALUE_TYPE_INT ) )
-                  {
-                      data[serviceCount][orgUnitCount] = Math.round( data[serviceCount][orgUnitCount] * Math.pow( 10, 0 ) ) / Math.pow( 10, 0 );
-                  }
-                  else
-                  {
-                      data[serviceCount][orgUnitCount] = Math.round( data[serviceCount][orgUnitCount] * Math.pow( 10, 1 ) ) / Math.pow( 10, 1 );
-                  }
-               }
-               orgUnitCount++;
-           }
-           serviceCount++;          
-       }
-    
-       dataElementChartResult = new DataElementChartResult( series, categories, data, chartTitle, xAxis_Title, yAxis_Title );
-
-       return dataElementChartResult;
+        DataElementChartResult dataElementChartResult;
+
+        String[] series = new String[dataElementList.size()];
+        String[] categories = new String[selOUList.size()];
+        Double[][] data = new Double[dataElementList.size()][selOUList.size()];
+        String chartTitle = "OrganisationUnit : -----";
+        String xAxis_Title = "Facilities";
+        String yAxis_Title = "Value";
+
+        int serviceCount = 0;
+
+        for ( DataElement dataElement : dataElementList )
+        {
+            DataElementCategoryOptionCombo decoc;
+            DataElementCategoryCombo dataElementCategoryCombo = dataElement.getCategoryCombo();
+            List<DataElementCategoryOptionCombo> optionCombos = new ArrayList<DataElementCategoryOptionCombo>(
+                dataElementCategoryCombo.getOptionCombos() );
+
+            if ( deSelection.equalsIgnoreCase( OPTIONCOMBO ) )
+            {
+                decoc = decocList.get( serviceCount );
+                series[serviceCount] = dataElement.getName() + " : " + decoc.getName();
+                yseriesList.add( dataElement.getName() + " : " + decoc.getName() );
+            }
+            else
+            {
+                decoc = dataElementCategoryService.getDefaultDataElementCategoryOptionCombo();
+                series[serviceCount] = dataElement.getName();
+                yseriesList.add( dataElement.getName() );
+            }
+
+            int orgUnitCount = 0;
+            for ( OrganisationUnit orgunit : selOUList )
+            {
+                categories[orgUnitCount] = orgunit.getName();
+                String drillDownData = orgunit.getId() + ":" + "0" + ":" + dataElement.getId() + ":" + decoc.getId()
+                    + ":" + periodTypeLB + ":" + drillDownPeriodStartDate + ":" + drillDownPeriodEndDate + ":"
+                    + drillDownPeriodNames + ":" + deSelection + ":" + aggChecked;
+                selectedDrillDownData.add( drillDownData );
+
+                Double aggDataValue = 0.0;
+
+                int periodCount = 0;
+                for ( Date startDate : selStartPeriodList )
+                {
+                    Date endDate = selEndPeriodList.get( periodCount );
+                    Collection<Period> periods = periodService.getPeriodsBetweenDates( startDate, endDate );
+
+                    Iterator<DataElementCategoryOptionCombo> optionComboIterator = optionCombos.iterator();
+                    while ( optionComboIterator.hasNext() )
+                    {
+                        DataElementCategoryOptionCombo decoc1 = (DataElementCategoryOptionCombo) optionComboIterator
+                            .next();
+
+                        if ( aggDataCB != null )
+                        {
+                            Double tempAggDataValue = aggregationService.getAggregatedDataValue( dataElement, decoc1,
+                                startDate, endDate, orgunit );
+                            if ( tempAggDataValue != null )
+                                aggDataValue += tempAggDataValue;
+                        }
+                        else
+                        {
+                            for ( Period period : periods )
+                            {
+                                DataValue dataValue = dataValueService.getDataValue( orgunit, dataElement, period,
+                                    decoc1 );
+                                try
+                                {
+                                    aggDataValue += Double.parseDouble( dataValue.getValue() );
+                                }
+                                catch ( Exception e )
+                                {
+                                }
+                            }
+                        }
+                    }
+                    periodCount++;
+                }
+
+                data[serviceCount][orgUnitCount] = aggDataValue;
+
+                if ( dataElement.getType().equalsIgnoreCase( DataElement.VALUE_TYPE_INT ) )
+                {
+                    if ( dataElement.getNumberType().equalsIgnoreCase( DataElement.VALUE_TYPE_INT ) )
+                    {
+                        data[serviceCount][orgUnitCount] = Math.round( data[serviceCount][orgUnitCount]
+                            * Math.pow( 10, 0 ) )
+                            / Math.pow( 10, 0 );
+                    }
+                    else
+                    {
+                        data[serviceCount][orgUnitCount] = Math.round( data[serviceCount][orgUnitCount]
+                            * Math.pow( 10, 1 ) )
+                            / Math.pow( 10, 1 );
+                    }
+                }
+                orgUnitCount++;
+            }
+            serviceCount++;
+        }
+
+        dataElementChartResult = new DataElementChartResult( series, categories, data, chartTitle, xAxis_Title,
+            yAxis_Title );
+
+        return dataElementChartResult;
     }
-        
+
     // -------------------------------------------------------------------------
     // Methods for getting Chart Data OrgGroup Period Wise start
     // -------------------------------------------------------------------------
-       
-    public DataElementChartResult generateChartDataOrgGroupPeriodWise( List<Date> selStartPeriodList,List<Date> selEndPeriodList,List<String> periodNames,List<DataElement> dataElementList,List<DataElementCategoryOptionCombo> decocList,List<OrganisationUnit> selOUGroupMemberList ) throws Exception
+
+    public DataElementChartResult generateChartDataOrgGroupPeriodWise( List<Date> selStartPeriodList,
+        List<Date> selEndPeriodList, List<String> periodNames, List<DataElement> dataElementList,
+        List<DataElementCategoryOptionCombo> decocList, List<OrganisationUnit> selOUGroupMemberList )
+        throws Exception
     {
-       DataElementChartResult dataElementChartResult;
-       
-       String[] series = new String[dataElementList.size()];
-       String[] categories = new String[selStartPeriodList.size()];
-       Double[][] data = new Double[dataElementList.size()][selStartPeriodList.size()];
-       String chartTitle = "OrganisationUnit : " + selectedOrgUnit.getShortName()+ "( Group- " + selOrgUnitGroup.getName() +  " )";
-       String xAxis_Title = "Time Line";
-       String yAxis_Title = "Value";
-       
-       int serviceCount = 0;     
-     
-       for( DataElement dataElement : dataElementList )
-       {
-           DataElementCategoryOptionCombo decoc;
-           DataElementCategoryCombo dataElementCategoryCombo = dataElement.getCategoryCombo();
-           List<DataElementCategoryOptionCombo> optionCombos = new ArrayList<DataElementCategoryOptionCombo>( dataElementCategoryCombo.getOptionCombos() );
-          
-           if ( deSelection.equalsIgnoreCase( OPTIONCOMBO ) )
-           {
-               decoc = decocList.get( serviceCount );
-               series[serviceCount] = dataElement.getName() + " : " + decoc.getName();
-               yseriesList.add( dataElement.getName() + " : " + decoc.getName() );
-           }
-           else
-           {
-               decoc = dataElementCategoryService.getDefaultDataElementCategoryOptionCombo();
-               series[serviceCount] = dataElement.getName();
-               yseriesList.add( dataElement.getName() );
-           }
-              
-           int periodCount = 0;
-           for( Date startDate : selStartPeriodList )
-           {
-               Date endDate = selEndPeriodList.get( periodCount );
-               categories[periodCount] = periodNames.get( periodCount );
-               Double aggDataValue = 0.0;
-               
-               String tempStartDate = format.formatDate( startDate );
-               String tempEndDate   = format.formatDate( endDate );
-               String drillDownPeriodName = periodNames.get( periodCount );
-               
-               Collection<Period> periods = periodService.getPeriodsBetweenDates( startDate, endDate );
-               String drillDownData = selectedOrgUnit.getId() + ":"+ selOrgUnitGroup.getId() + ":" + dataElement.getId() + ":"+ decoc.getId() + ":"  + periodTypeLB + ":" + tempStartDate + ":" + tempEndDate + ":" + drillDownPeriodName + ":" + deSelection + ":" + aggChecked;
-               selectedDrillDownData.add( drillDownData );
-             
-               int orgGroupCount = 0;
-               for( OrganisationUnit orgUnit : selOUGroupMemberList )
-               {
-                   Iterator<DataElementCategoryOptionCombo> optionComboIterator = optionCombos.iterator();
-                   while ( optionComboIterator.hasNext() )
-                   {
-                       DataElementCategoryOptionCombo decoc1 = (DataElementCategoryOptionCombo) optionComboIterator.next();
-
-                       if( aggDataCB != null )
-                       {
-                           Double tempAggDataValue = aggregationService.getAggregatedDataValue( dataElement, decoc1, startDate, endDate, orgUnit );
-                           if(tempAggDataValue != null ) aggDataValue += tempAggDataValue;
-                       }
-                       else
-                       {
-                           for( Period period : periods )
-                           {
-                               DataValue dataValue = dataValueService.getDataValue( orgUnit, dataElement, period, decoc1 );
-                               try
-                               {
-                                   aggDataValue += Double.parseDouble( dataValue.getValue() );
-                               }
-                               catch( Exception e )
-                               {
-                               }
-                           }
-                       }
-                   }
-                   orgGroupCount++;
-               }
-   
-               data[serviceCount][periodCount] = aggDataValue;
-               
-               if( dataElement.getType().equalsIgnoreCase( DataElement.VALUE_TYPE_INT ) )
-               {
-                  if ( dataElement.getNumberType().equalsIgnoreCase( DataElement.VALUE_TYPE_INT ) )
-                  {
-                      data[serviceCount][periodCount] = Math.round( data[serviceCount][periodCount] * Math.pow( 10, 0 ) ) / Math.pow( 10, 0 );
-                  }
-                  else
-                  {
-                      data[serviceCount][periodCount] = Math.round( data[serviceCount][periodCount] * Math.pow( 10, 1 ) ) / Math.pow( 10, 1 );
-                  }
-               }
-               periodCount++;    
-           }
-           
-           serviceCount++;          
-       }
-    
-       dataElementChartResult = new DataElementChartResult( series, categories, data, chartTitle, xAxis_Title, yAxis_Title );
-       
-      return dataElementChartResult;
-    
-   }
-    
+        DataElementChartResult dataElementChartResult;
+
+        String[] series = new String[dataElementList.size()];
+        String[] categories = new String[selStartPeriodList.size()];
+        Double[][] data = new Double[dataElementList.size()][selStartPeriodList.size()];
+        String chartTitle = "OrganisationUnit : " + selectedOrgUnit.getShortName() + "( Group- "
+            + selOrgUnitGroup.getName() + " )";
+        String xAxis_Title = "Time Line";
+        String yAxis_Title = "Value";
+
+        int serviceCount = 0;
+
+        for ( DataElement dataElement : dataElementList )
+        {
+            DataElementCategoryOptionCombo decoc;
+            DataElementCategoryCombo dataElementCategoryCombo = dataElement.getCategoryCombo();
+            List<DataElementCategoryOptionCombo> optionCombos = new ArrayList<DataElementCategoryOptionCombo>(
+                dataElementCategoryCombo.getOptionCombos() );
+
+            if ( deSelection.equalsIgnoreCase( OPTIONCOMBO ) )
+            {
+                decoc = decocList.get( serviceCount );
+                series[serviceCount] = dataElement.getName() + " : " + decoc.getName();
+                yseriesList.add( dataElement.getName() + " : " + decoc.getName() );
+            }
+            else
+            {
+                decoc = dataElementCategoryService.getDefaultDataElementCategoryOptionCombo();
+                series[serviceCount] = dataElement.getName();
+                yseriesList.add( dataElement.getName() );
+            }
+
+            int periodCount = 0;
+            for ( Date startDate : selStartPeriodList )
+            {
+                Date endDate = selEndPeriodList.get( periodCount );
+                categories[periodCount] = periodNames.get( periodCount );
+                Double aggDataValue = 0.0;
+
+                String tempStartDate = format.formatDate( startDate );
+                String tempEndDate = format.formatDate( endDate );
+                String drillDownPeriodName = periodNames.get( periodCount );
+
+                Collection<Period> periods = periodService.getPeriodsBetweenDates( startDate, endDate );
+                String drillDownData = selectedOrgUnit.getId() + ":" + selOrgUnitGroup.getId() + ":"
+                    + dataElement.getId() + ":" + decoc.getId() + ":" + periodTypeLB + ":" + tempStartDate + ":"
+                    + tempEndDate + ":" + drillDownPeriodName + ":" + deSelection + ":" + aggChecked;
+                selectedDrillDownData.add( drillDownData );
+
+                int orgGroupCount = 0;
+                for ( OrganisationUnit orgUnit : selOUGroupMemberList )
+                {
+                    Iterator<DataElementCategoryOptionCombo> optionComboIterator = optionCombos.iterator();
+                    while ( optionComboIterator.hasNext() )
+                    {
+                        DataElementCategoryOptionCombo decoc1 = (DataElementCategoryOptionCombo) optionComboIterator
+                            .next();
+
+                        if ( aggDataCB != null )
+                        {
+                            Double tempAggDataValue = aggregationService.getAggregatedDataValue( dataElement, decoc1,
+                                startDate, endDate, orgUnit );
+                            if ( tempAggDataValue != null )
+                                aggDataValue += tempAggDataValue;
+                        }
+                        else
+                        {
+                            for ( Period period : periods )
+                            {
+                                DataValue dataValue = dataValueService.getDataValue( orgUnit, dataElement, period,
+                                    decoc1 );
+                                try
+                                {
+                                    aggDataValue += Double.parseDouble( dataValue.getValue() );
+                                }
+                                catch ( Exception e )
+                                {
+                                }
+                            }
+                        }
+                    }
+                    orgGroupCount++;
+                }
+
+                data[serviceCount][periodCount] = aggDataValue;
+
+                if ( dataElement.getType().equalsIgnoreCase( DataElement.VALUE_TYPE_INT ) )
+                {
+                    if ( dataElement.getNumberType().equalsIgnoreCase( DataElement.VALUE_TYPE_INT ) )
+                    {
+                        data[serviceCount][periodCount] = Math.round( data[serviceCount][periodCount]
+                            * Math.pow( 10, 0 ) )
+                            / Math.pow( 10, 0 );
+                    }
+                    else
+                    {
+                        data[serviceCount][periodCount] = Math.round( data[serviceCount][periodCount]
+                            * Math.pow( 10, 1 ) )
+                            / Math.pow( 10, 1 );
+                    }
+                }
+                periodCount++;
+            }
+
+            serviceCount++;
+        }
+
+        dataElementChartResult = new DataElementChartResult( series, categories, data, chartTitle, xAxis_Title,
+            yAxis_Title );
+
+        return dataElementChartResult;
+
+    }
+
     // -------------------------------------------------------------------------
     // Methods for getting Chart Data OrgGroup Selected orgUnit Wise start
     // -------------------------------------------------------------------------
-       
-    public DataElementChartResult generateChartDataSelectedOrgUnitGroupWise( List<Date> selStartPeriodList,List<Date> selEndPeriodList,List<String> periodNames,List<DataElement> dataElementList,List<DataElementCategoryOptionCombo> decocList,Map<OrganisationUnitGroup,List<OrganisationUnit>> orgUnitGroupMap ) throws Exception
+
+    public DataElementChartResult generateChartDataSelectedOrgUnitGroupWise( List<Date> selStartPeriodList,
+        List<Date> selEndPeriodList, List<String> periodNames, List<DataElement> dataElementList,
+        List<DataElementCategoryOptionCombo> decocList,
+        Map<OrganisationUnitGroup, List<OrganisationUnit>> orgUnitGroupMap )
+        throws Exception
     {
-       DataElementChartResult dataElementChartResult;
-       
-       String[] series = new String[dataElementList.size()];
-       String[] categories = new String[orgUnitGroupMap.keySet().size()];
-       Double[][] data = new Double[dataElementList.size()][orgUnitGroupMap.keySet().size()];
-       String chartTitle = "OrganisationUnit : " + selectedOrgUnit.getShortName() +" - ";
-       String xAxis_Title = "Organisation Unit Group";
-       String yAxis_Title = "Value";
-       
-       int serviceCount = 0;     
-     
-       for( DataElement dataElement : dataElementList )
-       {
-           DataElementCategoryOptionCombo decoc;
-           DataElementCategoryCombo dataElementCategoryCombo = dataElement.getCategoryCombo();
-           List<DataElementCategoryOptionCombo> optionCombos = new ArrayList<DataElementCategoryOptionCombo>( dataElementCategoryCombo.getOptionCombos() );
-          
-           if ( deSelection.equalsIgnoreCase( OPTIONCOMBO ) )
-           {
-               decoc = decocList.get( serviceCount );
-               series[serviceCount] = dataElement.getName() + " : " + decoc.getName();
-               yseriesList.add( dataElement.getName() + " : " + decoc.getName() );
-           }
-           else
-           {
-               decoc = dataElementCategoryService.getDefaultDataElementCategoryOptionCombo();
-               series[serviceCount] = dataElement.getName();
-               yseriesList.add( dataElement.getName() );
-           }
-   
-           int orgGroupCount = 0;
-           for( OrganisationUnitGroup orgUnitGroup : orgUnitGroupMap.keySet() )
-           {
-               Double aggDataValue = 0.0;
-               
-               categories[orgGroupCount] = orgUnitGroup.getName();
-               String drillDownData = selectedOrgUnit.getId() + ":" + orgUnitGroup.getId() + ":" + dataElement.getId() + ":"+ decoc.getId() + ":"  + periodTypeLB + ":" + drillDownPeriodStartDate + ":" + drillDownPeriodEndDate + ":" + drillDownPeriodNames + ":" + deSelection + ":" + aggChecked;
-               selectedDrillDownData.add( drillDownData );
-               
-               if( serviceCount == 0 )
-               {
-                   chartTitle += orgUnitGroup.getName() + ",";
-               }
-               Collection<OrganisationUnit> orgUnitGroupMembers = orgUnitGroupMap.get( orgUnitGroup );
-               
-               if( orgUnitGroupMembers == null || orgUnitGroupMembers.size() == 0 )
-               {
-                   data[serviceCount][orgGroupCount] = aggDataValue;
-                   orgGroupCount++;
-                   continue;
-               }
-               for( OrganisationUnit orgUnit : orgUnitGroupMembers )
-               {
-                   int periodCount = 0;
-                   for( Date startDate : selStartPeriodList )
-                   {
-                       Date endDate = selEndPeriodList.get( periodCount );
-                     
-                       Collection<Period> periods = periodService.getPeriodsBetweenDates( startDate, endDate );                               
-
-                       Iterator<DataElementCategoryOptionCombo> optionComboIterator = optionCombos.iterator();
-                       while ( optionComboIterator.hasNext() )
-                       {
-                           DataElementCategoryOptionCombo decoc1 = (DataElementCategoryOptionCombo) optionComboIterator.next();
-
-                           if( aggDataCB != null )
-                           {
-                               Double tempAggDataValue = aggregationService.getAggregatedDataValue( dataElement, decoc1, startDate, endDate, orgUnit );
-                               if(tempAggDataValue != null ) aggDataValue += tempAggDataValue;
-                           }
-                           else
-                           {
-                               for( Period period : periods )
-                               {    
-                                   DataValue dataValue = dataValueService.getDataValue( orgUnit, dataElement, period, decoc1 );
-                                   
-                                   try
-                                   {
-                                       aggDataValue += Double.parseDouble( dataValue.getValue() );
-                                   }
-                                   catch( Exception e )
-                                   {
-                                       
-                                   }
-                               }
-                           }
-                       }
-                       periodCount++;  
-                   }  
-               }
-               data[serviceCount][orgGroupCount] = aggDataValue;
-               
-               if( dataElement.getType().equalsIgnoreCase( DataElement.VALUE_TYPE_INT ) )
-               {
-                  if ( dataElement.getNumberType().equalsIgnoreCase( DataElement.VALUE_TYPE_INT ) )
-                  {
-                      data[serviceCount][orgGroupCount] = Math.round( data[serviceCount][orgGroupCount] * Math.pow( 10, 0 ) ) / Math.pow( 10, 0 );
-                  }
-                  else
-                  {
-                      data[serviceCount][orgGroupCount] = Math.round( data[serviceCount][orgGroupCount] * Math.pow( 10, 1 ) ) / Math.pow( 10, 1 );
-                  }
-               }
-              
-               orgGroupCount++;
-           }
-           
-           serviceCount++;          
-       }
-    
-       dataElementChartResult = new DataElementChartResult( series, categories, data, chartTitle, xAxis_Title, yAxis_Title );
-       
-      return dataElementChartResult;
-    
-   }
+        DataElementChartResult dataElementChartResult;
+
+        String[] series = new String[dataElementList.size()];
+        String[] categories = new String[orgUnitGroupMap.keySet().size()];
+        Double[][] data = new Double[dataElementList.size()][orgUnitGroupMap.keySet().size()];
+        String chartTitle = "OrganisationUnit : " + selectedOrgUnit.getShortName() + " - ";
+        String xAxis_Title = "Organisation Unit Group";
+        String yAxis_Title = "Value";
+
+        int serviceCount = 0;
+
+        for ( DataElement dataElement : dataElementList )
+        {
+            DataElementCategoryOptionCombo decoc;
+            DataElementCategoryCombo dataElementCategoryCombo = dataElement.getCategoryCombo();
+            List<DataElementCategoryOptionCombo> optionCombos = new ArrayList<DataElementCategoryOptionCombo>(
+                dataElementCategoryCombo.getOptionCombos() );
+
+            if ( deSelection.equalsIgnoreCase( OPTIONCOMBO ) )
+            {
+                decoc = decocList.get( serviceCount );
+                series[serviceCount] = dataElement.getName() + " : " + decoc.getName();
+                yseriesList.add( dataElement.getName() + " : " + decoc.getName() );
+            }
+            else
+            {
+                decoc = dataElementCategoryService.getDefaultDataElementCategoryOptionCombo();
+                series[serviceCount] = dataElement.getName();
+                yseriesList.add( dataElement.getName() );
+            }
+
+            int orgGroupCount = 0;
+            for ( OrganisationUnitGroup orgUnitGroup : orgUnitGroupMap.keySet() )
+            {
+                Double aggDataValue = 0.0;
+
+                categories[orgGroupCount] = orgUnitGroup.getName();
+                String drillDownData = selectedOrgUnit.getId() + ":" + orgUnitGroup.getId() + ":" + dataElement.getId()
+                    + ":" + decoc.getId() + ":" + periodTypeLB + ":" + drillDownPeriodStartDate + ":"
+                    + drillDownPeriodEndDate + ":" + drillDownPeriodNames + ":" + deSelection + ":" + aggChecked;
+                selectedDrillDownData.add( drillDownData );
+
+                if ( serviceCount == 0 )
+                {
+                    chartTitle += orgUnitGroup.getName() + ",";
+                }
+                Collection<OrganisationUnit> orgUnitGroupMembers = orgUnitGroupMap.get( orgUnitGroup );
+
+                if ( orgUnitGroupMembers == null || orgUnitGroupMembers.size() == 0 )
+                {
+                    data[serviceCount][orgGroupCount] = aggDataValue;
+                    orgGroupCount++;
+                    continue;
+                }
+                for ( OrganisationUnit orgUnit : orgUnitGroupMembers )
+                {
+                    int periodCount = 0;
+                    for ( Date startDate : selStartPeriodList )
+                    {
+                        Date endDate = selEndPeriodList.get( periodCount );
+
+                        Collection<Period> periods = periodService.getPeriodsBetweenDates( startDate, endDate );
+
+                        Iterator<DataElementCategoryOptionCombo> optionComboIterator = optionCombos.iterator();
+                        while ( optionComboIterator.hasNext() )
+                        {
+                            DataElementCategoryOptionCombo decoc1 = (DataElementCategoryOptionCombo) optionComboIterator
+                                .next();
+
+                            if ( aggDataCB != null )
+                            {
+                                Double tempAggDataValue = aggregationService.getAggregatedDataValue( dataElement,
+                                    decoc1, startDate, endDate, orgUnit );
+                                if ( tempAggDataValue != null )
+                                    aggDataValue += tempAggDataValue;
+                            }
+                            else
+                            {
+                                for ( Period period : periods )
+                                {
+                                    DataValue dataValue = dataValueService.getDataValue( orgUnit, dataElement, period,
+                                        decoc1 );
+
+                                    try
+                                    {
+                                        aggDataValue += Double.parseDouble( dataValue.getValue() );
+                                    }
+                                    catch ( Exception e )
+                                    {
+
+                                    }
+                                }
+                            }
+                        }
+                        periodCount++;
+                    }
+                }
+                data[serviceCount][orgGroupCount] = aggDataValue;
+
+                if ( dataElement.getType().equalsIgnoreCase( DataElement.VALUE_TYPE_INT ) )
+                {
+                    if ( dataElement.getNumberType().equalsIgnoreCase( DataElement.VALUE_TYPE_INT ) )
+                    {
+                        data[serviceCount][orgGroupCount] = Math.round( data[serviceCount][orgGroupCount]
+                            * Math.pow( 10, 0 ) )
+                            / Math.pow( 10, 0 );
+                    }
+                    else
+                    {
+                        data[serviceCount][orgGroupCount] = Math.round( data[serviceCount][orgGroupCount]
+                            * Math.pow( 10, 1 ) )
+                            / Math.pow( 10, 1 );
+                    }
+                }
+
+                orgGroupCount++;
+            }
+
+            serviceCount++;
+        }
+
+        dataElementChartResult = new DataElementChartResult( series, categories, data, chartTitle, xAxis_Title,
+            yAxis_Title );
+
+        return dataElementChartResult;
+
+    }
 
 }

=== modified file 'local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/ga/action/charts/GenerateDrillDownResultAction.java'
--- local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/ga/action/charts/GenerateDrillDownResultAction.java	2010-12-08 07:24:10 +0000
+++ local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/ga/action/charts/GenerateDrillDownResultAction.java	2011-04-15 11:34:10 +0000
@@ -1,671 +1,581 @@
-package org.hisp.dhis.dataanalyser.ga.action.charts;
-
-// <editor-fold defaultstate="collapsed" desc="imports">
-import java.io.BufferedInputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.InputStream;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.UUID;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-
-import jxl.Workbook;
-import jxl.format.Alignment;
-import jxl.format.Border;
-import jxl.format.BorderLineStyle;
-import jxl.format.Colour;
-import jxl.format.VerticalAlignment;
-import jxl.write.Label;
-import jxl.write.WritableCellFormat;
-import jxl.write.WritableSheet;
-import jxl.write.WritableWorkbook;
-
-import org.amplecode.quick.StatementManager;
-import org.hisp.dhis.caseaggregation.CaseAggregationCondition;
-import org.hisp.dhis.caseaggregation.CaseAggregationConditionService;
-import org.hisp.dhis.config.ConfigurationService;
-import org.hisp.dhis.config.Configuration_IN;
-import org.hisp.dhis.dataelement.DataElement;
-import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
-import org.hisp.dhis.dataelement.DataElementCategoryService;
-import org.hisp.dhis.dataelement.DataElementService;
-import org.hisp.dhis.i18n.I18nFormat;
-import org.hisp.dhis.organisationunit.OrganisationUnit;
-import org.hisp.dhis.organisationunit.OrganisationUnitService;
-import org.hisp.dhis.organisationunit.comparator.OrganisationUnitNameComparator;
-import org.hisp.dhis.patient.Patient;
-import org.hisp.dhis.patient.PatientAttribute;
-import org.hisp.dhis.patient.PatientAttributeService;
-import org.hisp.dhis.patient.PatientIdentifier;
-import org.hisp.dhis.patient.PatientIdentifierService;
-import org.hisp.dhis.patient.PatientIdentifierType;
-import org.hisp.dhis.patient.PatientIdentifierTypeService;
-import org.hisp.dhis.patientattributevalue.PatientAttributeValue;
-import org.hisp.dhis.patientattributevalue.PatientAttributeValueService;
-import org.hisp.dhis.patientdatavalue.PatientDataValue;
-import org.hisp.dhis.period.Period;
-import org.hisp.dhis.period.PeriodService;
-import org.hisp.dhis.period.PeriodType;
-import org.hisp.dhis.program.ProgramInstance;
-import org.hisp.dhis.program.ProgramStageInstance;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-import org.xml.sax.SAXException;
-import org.xml.sax.SAXParseException;
-
-import com.opensymphony.xwork2.Action;
-
-// </editor-fold>
-
-/**
- * 
- * @author Administrator
- */
-public class GenerateDrillDownResultAction
-    implements Action
-{
-
-    // -------------------------------------------------------------------------
-    // Dependencies
-    // -------------------------------------------------------------------------
-    // <editor-fold defaultstate="collapsed" desc="dependencies">
-    private StatementManager statementManager;
-
-    public void setStatementManager( StatementManager statementManager )
-    {
-        this.statementManager = statementManager;
-    }
-
-    private OrganisationUnitService organisationUnitService;
-
-    public OrganisationUnitService getOrganisationUnitService()
-    {
-        return organisationUnitService;
-    }
-
-    public void setOrganisationUnitService( OrganisationUnitService organisationUnitService )
-    {
-        this.organisationUnitService = organisationUnitService;
-    }
-
-    private CaseAggregationConditionService caseAggregationConditionService;
-    
-    public void setCaseAggregationConditionService( CaseAggregationConditionService caseAggregationConditionService )
-    {
-        this.caseAggregationConditionService = caseAggregationConditionService;
-    }
-
-    /*
-    private CaseAggregationMappingService caseAggregationMappingService;
-
-    public void setCaseAggregationMappingService( CaseAggregationMappingService caseAggregationMappingService )
-    {
-        this.caseAggregationMappingService = caseAggregationMappingService;
-    }
-    */
-    
-    private ConfigurationService configurationService;
-
-    public void setConfigurationService( ConfigurationService configurationService )
-    {
-        this.configurationService = configurationService;
-    }
-
-    private DataElementService dataElementService;
-
-    public void setDataElementService( DataElementService dataElementService )
-    {
-        this.dataElementService = dataElementService;
-    }
-
-    private DataElementCategoryService dataElementCategoryOptionComboService;
-
-    public void setDataElementCategoryOptionComboService(
-        DataElementCategoryService dataElementCategoryOptionComboService )
-    {
-        this.dataElementCategoryOptionComboService = dataElementCategoryOptionComboService;
-    }
-
-    private PeriodService periodService;
-
-    public void setPeriodService( PeriodService periodService )
-    {
-        this.periodService = periodService;
-    }
-
-    private PatientAttributeValueService patientAttributeValueService;
-
-    public void setPatientAttributeValueService( PatientAttributeValueService patientAttributeValueService )
-    {
-        this.patientAttributeValueService = patientAttributeValueService;
-    }
-
-    private PatientAttributeService patientAttributeService;
-
-    public void setPatientAttributeService( PatientAttributeService patientAttributeService )
-    {
-        this.patientAttributeService = patientAttributeService;
-    }
-
-    private PatientIdentifierService patientIdentifierService;
-
-    public void setPatientIdentifierService( PatientIdentifierService patientIdentifierService )
-    {
-        this.patientIdentifierService = patientIdentifierService;
-    }
-
-    private PatientIdentifierTypeService patientIdentifierTypeService;
-
-    public void setPatientIdentifierTypeService( PatientIdentifierTypeService patientIdentifierTypeService )
-    {
-        this.patientIdentifierTypeService = patientIdentifierTypeService;
-    }
-
-    // </editor-fold>
-    // <editor-fold defaultstate="collapsed" desc="properties">
-    public String selectedValues;
-
-    public String getSelectedValues()
-    {
-        return selectedValues;
-    }
-
-    public void setSelectedValues( String selectedValues )
-    {
-        this.selectedValues = selectedValues;
-    }
-
-    private InputStream inputStream;
-
-    public InputStream getInputStream()
-    {
-        return inputStream;
-    }
-
-    private String fileName;
-
-    public String getFileName()
-    {
-        return fileName;
-    }
-
-    public String[] values;
-
-    private String raFolderName;
-
-    private String inputTemplatePath;
-
-    private String outputReportPath;
-
-   // private Period startDate;
-
-    private OrganisationUnit selectedOrgUnit;
-
-    private DataElement de;
-
-    private DataElementCategoryOptionCombo coc;
-
-    //private CaseAggregationMapping caseAggMapping;
-
-    private List<String> serviceType;
-
-    private List<String> deCodeType;
-
-    private List<Integer> sheetList;
-
-    private List<Integer> rowList;
-
-    private List<Integer> colList;
-
-    private String deCodesXMLFileName;
-
-    private String reportFileNameTB;
-    
-    private I18nFormat format;
-    
-    public void setFormat( I18nFormat format )
-    {
-        this.format = format;
-    }
-    
-    private Date tempStartDate;
-    
-    private Date tempEndDate;
-    
-    private PeriodType periodTypeName;
-    
-    private Collection<Period> periods;
-    // </editor-fold>
-
-    public String execute()
-        throws Exception
-    {
-
-        values = selectedValues.split( ":" );
-        int orgunit = Integer.parseInt( values[0] );
-       // int periodid = Integer.parseInt( values[3] );
-        int deid = Integer.parseInt( values[1] );
-        int cocid = Integer.parseInt( values[2] );
-        
-        //06/12/2010
-        String periodType = values[3];
-        //Date  startDate = values[4];
-       // String endDate = values[5];
-        
-        tempStartDate = format.parseDate( values[4] );
-        tempEndDate   = format.parseDate( values[5] );
-        
-        
-        periodTypeName = periodService.getPeriodTypeByName( periodType );
-        periods = periodService.getPeriodsBetweenDates( periodTypeName, tempStartDate, tempEndDate );
-        
-        
-       // startDate = periodService.getPeriod( periodid );
-        selectedOrgUnit = organisationUnitService.getOrganisationUnit( orgunit );
-        de = dataElementService.getDataElement( deid );
-        coc = dataElementCategoryOptionComboService.getDataElementCategoryOptionCombo( cocid );
-        
-        System.out.println( "orgunit is " + orgunit + " de is " + deid + " coc is " + cocid + " periodType is " + periodType + " tempStartDate is " + tempStartDate + " tempEndDate is  " + tempEndDate );
-
-        statementManager.initialise();
-        raFolderName = configurationService.getConfigurationByKey( Configuration_IN.KEY_REPORTFOLDER ).getValue();
-        deCodesXMLFileName = "NBITS_DrillDownToCaseBasedDECodes.xml";
-        // System.out.println( "reportList = " + reportList );
-        deCodeType = new ArrayList<String>();
-        serviceType = new ArrayList<String>();
-
-        sheetList = new ArrayList<Integer>();
-        rowList = new ArrayList<Integer>();
-        colList = new ArrayList<Integer>();
-        reportFileNameTB = "DrillDownToCaseBased.xls";
-
-        // Initialization
-        inputTemplatePath = System.getenv( "DHIS2_HOME" ) + File.separator + raFolderName + File.separator + "template"
-            + File.separator + reportFileNameTB;
-
-        outputReportPath = System.getenv( "DHIS2_HOME" ) + File.separator + raFolderName + File.separator + "output"
-            + File.separator + UUID.randomUUID().toString() + ".xls";
-
-        // System.out.println( " inputTemplatePath " + inputTemplatePath );
-
-        generatDrillDownReport();
-        statementManager.destroy();
-        return SUCCESS;
-    }// end if loop
-
-    public void generatDrillDownReport()
-        throws Exception
-    {
-        Workbook templateWorkbook = Workbook.getWorkbook( new File( inputTemplatePath ) );
-        WritableWorkbook outputReportWorkbook = Workbook
-            .createWorkbook( new File( outputReportPath ), templateWorkbook );
-
-        // Cell formatting
-        WritableCellFormat wCellformat = new WritableCellFormat();
-        wCellformat.setBorder( Border.ALL, BorderLineStyle.THIN );
-        wCellformat.setAlignment( Alignment.CENTRE );
-        wCellformat.setVerticalAlignment( VerticalAlignment.CENTRE );
-        // System.out.println( "deCodesXMLFileName = " + deCodesXMLFileName );
-        List<String> deCodesList = getDECodes( deCodesXMLFileName );
-        // System.out.println( "deCodesList size = "+deCodesList.size() );
-        // taking expression for selected de and decoc
-        CaseAggregationCondition caseAggregationCondition = caseAggregationConditionService.getCaseAggregationCondition( de, coc );
-        //caseAggMapping = caseAggregationMappingService.getCaseAggregationMappingByOptionCombo( de, coc );
-
-        List<OrganisationUnit> orgUnitList = new ArrayList<OrganisationUnit>();
-        List<OrganisationUnit> orgUnitDataList = new ArrayList<OrganisationUnit>();
-        orgUnitList = getChildOrgUnitTree( selectedOrgUnit );
-        Map<OrganisationUnit, Integer> ouAndLevel = new HashMap<OrganisationUnit, Integer>();
-
-        List<Integer> levelsList = new ArrayList<Integer>();
-        Map<OrganisationUnit, List<PatientDataValue>> ouPatientDataValueMap = new HashMap<OrganisationUnit, List<PatientDataValue>>();
-        List<DataElement> des = new ArrayList<DataElement>();
-        String tempStr = "";
-        for ( OrganisationUnit ou : orgUnitList )
-        {
-            int level = organisationUnitService.getLevelOfOrganisationUnit( ou );
-            ouAndLevel.put( ou, level );
-            if ( !levelsList.contains( level ) )
-            {
-                levelsList.add( level );
-            }
-
-            List<PatientDataValue> patientDataValues = new ArrayList<PatientDataValue>();
-            
-            for( Period period : periods )
-            {
-                patientDataValues.addAll( caseAggregationConditionService.getPatientDataValues( caseAggregationCondition, ou, period ) );
-            }
-            
-           // patientDataValues.addAll( caseAggregationConditionService.getPatientDataValues( caseAggregationCondition, ou, startDate ) );
-           // patientDataValues = caseAggregationMappingService.getCaseAggregatePatientDataValue( ou, startDate,
-           //     caseAggMapping );
-            if ( patientDataValues != null )
-            {
-                ouPatientDataValueMap.put( ou, patientDataValues );
-                orgUnitDataList.add( ou );
-                for ( PatientDataValue patientDataValue : patientDataValues )
-                {
-                    if ( !des.contains( patientDataValue.getDataElement() ) )
-                    {
-                        des.add( patientDataValue.getDataElement() );
-                    }
-                }
-            }
-        }
-
-        WritableSheet sheet0 = outputReportWorkbook.getSheet( 0 );
-        WritableCellFormat wCellformat1 = new WritableCellFormat();
-        wCellformat1.setBorder( Border.ALL, BorderLineStyle.THIN );
-        wCellformat1.setAlignment( Alignment.CENTRE );
-        wCellformat1.setVerticalAlignment( VerticalAlignment.CENTRE );
-        wCellformat1.setWrap( true );
-        wCellformat1.setBackground( Colour.GREY_40_PERCENT );
-
-        // <editor-fold defaultstate="collapsed" desc="adding column names">
-        int count1 = 0;
-        for ( DataElement de : des )
-        {
-            // DEName
-            sheet0.addCell( new Label( 7 + count1, 1, "" + de.getName(), wCellformat1 ) );
-
-            count1++;
-        }
-        sheet0.addCell( new Label( 7 + count1, 1, "Execution Date", wCellformat1 ) );
-
-        for ( int i = levelsList.size() - 1; i >= 0; i-- )
-        {
-            int level = levelsList.get( i );
-            count1++;
-            sheet0.addCell( new Label( 7 + count1, 1, organisationUnitService.getOrganisationUnitLevelByLevel( level )
-                .getName(), wCellformat1 ) );
-        }
-
-        // </editor-fold>
-
-        int rowNo = rowList.get( 0 );
-        int srno = 0;
-        // <editor-fold defaultstate="collapsed"
-        // desc="For loop of orgUnitDataList">
-        for ( OrganisationUnit ou : orgUnitDataList )
-        {
-            List<PatientDataValue> pdvList = ouPatientDataValueMap.get( ou );
-            // System.out.println( "pdvList size = " + pdvList.size() + " ou " +
-            // ou.getName() );
-
-            // <editor-fold defaultstate="collapsed"
-            // desc="For loop of orgUnitDataList">
-            for ( PatientDataValue patientDataValue : pdvList )
-            {
-
-                ProgramStageInstance psi = patientDataValue.getProgramStageInstance();
-                ProgramInstance pi = psi.getProgramInstance();
-                String value = patientDataValue.getValue();
-                Date executionDate = psi.getExecutionDate();
-                Patient patient = pi.getPatient();
-                int colNo = 0;
-                int rowCount = 0;
-                // <editor-fold defaultstate="collapsed"
-                // desc="for loop for deCodesList">
-                for ( String deCodeString : deCodesList )
-                {
-                    tempStr = "";
-                    String sType = (String) serviceType.get( rowCount );
-                    if ( !deCodeString.equalsIgnoreCase( "NA" ) )
-                    {
-                        // <editor-fold defaultstate="collapsed"
-                        // desc="stype = caseProperty">
-                        if ( sType.equalsIgnoreCase( "caseProperty" ) )
-                        {
-                            if ( deCodeString.equalsIgnoreCase( "Name" ) )
-                            {
-                                tempStr = patient.getFullName();
-                            }
-                            else if ( deCodeString.equalsIgnoreCase( "Age" ) )
-                            {
-                                tempStr = patient.getAge();
-                            }
-                            else if ( deCodeString.equalsIgnoreCase( "Sex" ) )
-                            {
-                                if ( patient.getGender().equalsIgnoreCase( "M" ) )
-                                {
-                                    tempStr = "Male";
-                                }
-                                else if ( patient.getGender().equalsIgnoreCase( "F" ) )
-                                {
-                                    tempStr = "Female";
-                                }
-                                else
-                                {
-                                    tempStr = "";
-                                }
-                            }
-                        } // </editor-fold>
-                        // <editor-fold defaultstate="collapsed"
-                        // desc="stype = caseAttribute">
-                        else if ( sType.equalsIgnoreCase( "caseAttribute" ) )
-                        {
-                            int deCodeInt = Integer.parseInt( deCodeString );
-
-                            PatientAttribute patientAttribute = patientAttributeService.getPatientAttribute( deCodeInt );
-                            PatientAttributeValue patientAttributeValue = patientAttributeValueService
-                                .getPatientAttributeValue( patient, patientAttribute );
-                            if ( patientAttributeValue != null )
-                            {
-                                tempStr = patientAttributeValue.getValue();
-                            }
-                            else
-                            {
-                                tempStr = " ";
-                            }
-                        } // </editor-fold>
-                        // <editor-fold defaultstate="collapsed"
-                        // desc="stype = identifiertype">
-                        else if ( sType.equalsIgnoreCase( "identifiertype" ) )
-                        {
-                            int deCodeInt = Integer.parseInt( deCodeString );
-                            // _______________________Id.
-                            // no._______________________
-                            PatientIdentifierType patientIdentifierType = patientIdentifierTypeService
-                                .getPatientIdentifierType( deCodeInt );
-                            if ( patientIdentifierType != null )
-                            {
-                                PatientIdentifier patientIdentifier = patientIdentifierService.getPatientIdentifier(
-                                    patientIdentifierType, patient );
-                                if ( patientIdentifier != null )
-                                {
-                                    tempStr = patientIdentifier.getIdentifier();
-                                }
-                                else
-                                {
-                                    tempStr = " ";
-                                }
-                            }
-                        }
-                        // </editor-fold>
-                    }
-                    else
-                    {
-                        // <editor-fold defaultstate="collapsed"
-                        // desc="stype = srno">
-                        if ( sType.equalsIgnoreCase( "srno" ) )
-                        {
-                            int tempNum = 1 + srno;
-                            tempStr = String.valueOf( tempNum );
-                        }
-                        // </editor-fold>
-                    }
-                    // <editor-fold defaultstate="collapsed"
-                    // desc="adding columns">
-                    int tempColNo = colList.get( rowCount );
-                    int sheetNo = sheetList.get( rowCount );
-                    sheet0 = outputReportWorkbook.getSheet( sheetNo );
-                   // WritableCell cell = sheet0.getWritableCell( tempColNo, rowNo );
-                    // System.out.println(
-                    // "_______________________ count = "+rowCount
-                    // +"tempColNo = " + tempColNo + " rowNo = " + rowNo +
-                    // " value = " + tempStr );
-                    sheet0.addCell( new Label( tempColNo, rowNo, tempStr, wCellformat ) );
-                    colNo = tempColNo;
-                    // </editor-fold>
-
-                    rowCount++;
-                }
-                // </editor-fold>
-                // <editor-fold defaultstate="collapsed"
-                // desc="adding des columns">
-                int count = 0;
-                for ( count = 0; count < des.size(); count++ )
-                {
-                    colNo++;
-                    // DE Value
-                    sheet0.addCell( new Label( colNo, rowNo, value, wCellformat ) );
-
-                }
-                colNo++;
-                // </editor-fold>
-                // <editor-fold defaultstate="collapsed"
-                // desc="adding executiondate">
-                // Execution date
-                SimpleDateFormat simpleDateFormat = new SimpleDateFormat( "yyyy-MM-dd" );
-                String eDate = simpleDateFormat.format( executionDate );
-                sheet0.addCell( new Label( colNo, rowNo, "" + eDate, wCellformat ) );
-                // </editor-fold>
-                // <editor-fold defaultstate="collapsed"
-                // desc="adding ou in report at the end column">
-                OrganisationUnit ouname = ou;
-                for ( int i = levelsList.size() - 1; i >= 0; i-- )
-                {
-                    colNo++;
-                    int level = organisationUnitService.getLevelOfOrganisationUnit( ouname );
-                    if ( levelsList.get( i ) == level )
-                    {
-                        sheet0.addCell( new Label( colNo, rowNo, ouname.getName(), wCellformat ) );
-                        // System.out.println( colNo+" "+ rowNo+" "+
-                        // ou.getName()+" "+ wCellformat );
-                    }
-                    ouname = ouname.getParent();
-                }
-                // </editor-fold>
-                rowNo++;
-                srno++;
-            }
-            // </editor-fold>
-        }
-        // </editor-fold>
-        outputReportWorkbook.write();
-        outputReportWorkbook.close();
-
-        fileName = reportFileNameTB.replace( ".xls", "" );
-        fileName += "_" + selectedOrgUnit.getShortName() + ".xls";
-        File outputReportFile = new File( outputReportPath );
-        inputStream = new BufferedInputStream( new FileInputStream( outputReportFile ) );
-        outputReportFile.deleteOnExit();
-        // Cell formatting
-
-    }
-
-    // <editor-fold defaultstate="collapsed" desc="getChildOrgUnitTree Method">
-    @SuppressWarnings( "unchecked" )
-    public List<OrganisationUnit> getChildOrgUnitTree( OrganisationUnit orgUnit )
-    {
-        List<OrganisationUnit> orgUnitTree = new ArrayList<OrganisationUnit>();
-        orgUnitTree.add( orgUnit );
-
-        List<OrganisationUnit> children = new ArrayList<OrganisationUnit>( orgUnit.getChildren() );
-        Collections.sort( children, new OrganisationUnitNameComparator() );
-
-        Iterator childIterator = children.iterator();
-        OrganisationUnit child;
-        while ( childIterator.hasNext() )
-        {
-            child = (OrganisationUnit) childIterator.next();
-            orgUnitTree.addAll( getChildOrgUnitTree( child ) );
-        }
-        return orgUnitTree;
-    }// getChildOrgUnitTree end
-
-    // </editor-fold>
-    // <editor-fold defaultstate="collapsed" desc="getDECodes method">
-
-    public List<String> getDECodes( String fileName )
-    {
-        List<String> deCodes = new ArrayList<String>();
-        String path = System.getenv( "user.home" ) + File.separator + "dhis" + File.separator + raFolderName
-            + File.separator + fileName;
-        try
-        {
-            String newpath = System.getenv( "DHIS2_HOME" );
-            if ( newpath != null )
-            {
-                path = newpath + File.separator + File.separator + raFolderName + File.separator + fileName;
-            }
-
-        }
-        catch ( NullPointerException npe )
-        {
-            // do nothing, but we might be using this somewhere without
-            // USER_HOME set, which will throw a NPE
-        }
-
-        try
-        {
-            DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
-            DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();
-            Document doc = docBuilder.parse( new File( path ) );
-            if ( doc == null )
-            {
-                System.out.println( "There is no DECodes related XML file in the user home" );
-                return null;
-            }
-
-            NodeList listOfDECodes = doc.getElementsByTagName( "de-code" );
-            int totalDEcodes = listOfDECodes.getLength();
-
-            for ( int s = 0; s < totalDEcodes; s++ )
-            {
-                Element deCodeElement = (Element) listOfDECodes.item( s );
-                NodeList textDECodeList = deCodeElement.getChildNodes();
-                deCodes.add( ((Node) textDECodeList.item( 0 )).getNodeValue().trim() );
-                serviceType.add( deCodeElement.getAttribute( "stype" ) );
-                deCodeType.add( deCodeElement.getAttribute( "type" ) );
-                sheetList.add( new Integer( deCodeElement.getAttribute( "sheetno" ) ) );
-                rowList.add( new Integer( deCodeElement.getAttribute( "rowno" ) ) );
-                colList.add( new Integer( deCodeElement.getAttribute( "colno" ) ) );
-
-                // System.out.println( deCodes.get( s )+" : "+deCodeType.get( s
-                // ) );
-            }// end of for loop with s var
-
-        }// try block end
-        catch ( SAXParseException err )
-        {
-            System.out.println( "** Parsing error" + ", line " + err.getLineNumber() + ", uri " + err.getSystemId() );
-            System.out.println( " " + err.getMessage() );
-        }
-        catch ( SAXException e )
-        {
-            Exception x = e.getException();
-            ((x == null) ? e : x).printStackTrace();
-        }
-        catch ( Throwable t )
-        {
-            t.printStackTrace();
-        }
-
-        return deCodes;
-    }// getDECodes end
-    // </editor-fold>
-}
+package org.hisp.dhis.dataanalyser.ga.action.charts;
+
+import java.io.BufferedInputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.InputStream;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+
+import jxl.Workbook;
+import jxl.format.Alignment;
+import jxl.format.Border;
+import jxl.format.BorderLineStyle;
+import jxl.format.Colour;
+import jxl.format.VerticalAlignment;
+import jxl.write.Label;
+import jxl.write.WritableCellFormat;
+import jxl.write.WritableSheet;
+import jxl.write.WritableWorkbook;
+
+import org.amplecode.quick.StatementManager;
+import org.hisp.dhis.caseaggregation.CaseAggregationCondition;
+import org.hisp.dhis.caseaggregation.CaseAggregationConditionService;
+import org.hisp.dhis.config.ConfigurationService;
+import org.hisp.dhis.config.Configuration_IN;
+import org.hisp.dhis.dataelement.DataElement;
+import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
+import org.hisp.dhis.dataelement.DataElementCategoryService;
+import org.hisp.dhis.dataelement.DataElementService;
+import org.hisp.dhis.i18n.I18nFormat;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.organisationunit.OrganisationUnitService;
+import org.hisp.dhis.organisationunit.comparator.OrganisationUnitNameComparator;
+import org.hisp.dhis.patient.Patient;
+import org.hisp.dhis.patient.PatientAttribute;
+import org.hisp.dhis.patient.PatientAttributeService;
+import org.hisp.dhis.patient.PatientIdentifier;
+import org.hisp.dhis.patient.PatientIdentifierService;
+import org.hisp.dhis.patient.PatientIdentifierType;
+import org.hisp.dhis.patient.PatientIdentifierTypeService;
+import org.hisp.dhis.patientattributevalue.PatientAttributeValue;
+import org.hisp.dhis.patientattributevalue.PatientAttributeValueService;
+import org.hisp.dhis.patientdatavalue.PatientDataValue;
+import org.hisp.dhis.period.Period;
+import org.hisp.dhis.period.PeriodService;
+import org.hisp.dhis.period.PeriodType;
+import org.hisp.dhis.program.ProgramInstance;
+import org.hisp.dhis.program.ProgramStageInstance;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+
+import com.opensymphony.xwork2.Action;
+
+
+/**
+ * 
+ * @author Administrator
+ */
+public class GenerateDrillDownResultAction
+    implements Action
+{
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
+    private StatementManager statementManager;
+
+    public void setStatementManager( StatementManager statementManager )
+    {
+        this.statementManager = statementManager;
+    }
+
+    private OrganisationUnitService organisationUnitService;
+
+    public void setOrganisationUnitService( OrganisationUnitService organisationUnitService )
+    {
+        this.organisationUnitService = organisationUnitService;
+    }
+
+    private CaseAggregationConditionService caseAggregationConditionService;
+    
+    public void setCaseAggregationConditionService( CaseAggregationConditionService caseAggregationConditionService )
+    {
+        this.caseAggregationConditionService = caseAggregationConditionService;
+    }
+
+    private ConfigurationService configurationService;
+
+    public void setConfigurationService( ConfigurationService configurationService )
+    {
+        this.configurationService = configurationService;
+    }
+
+    private DataElementService dataElementService;
+
+    public void setDataElementService( DataElementService dataElementService )
+    {
+        this.dataElementService = dataElementService;
+    }
+
+    private DataElementCategoryService dataElementCategoryOptionComboService;
+
+    public void setDataElementCategoryOptionComboService(
+        DataElementCategoryService dataElementCategoryOptionComboService )
+    {
+        this.dataElementCategoryOptionComboService = dataElementCategoryOptionComboService;
+    }
+
+    private PeriodService periodService;
+
+    public void setPeriodService( PeriodService periodService )
+    {
+        this.periodService = periodService;
+    }
+
+    private PatientAttributeValueService patientAttributeValueService;
+
+    public void setPatientAttributeValueService( PatientAttributeValueService patientAttributeValueService )
+    {
+        this.patientAttributeValueService = patientAttributeValueService;
+    }
+
+    private PatientAttributeService patientAttributeService;
+
+    public void setPatientAttributeService( PatientAttributeService patientAttributeService )
+    {
+        this.patientAttributeService = patientAttributeService;
+    }
+
+    private PatientIdentifierService patientIdentifierService;
+
+    public void setPatientIdentifierService( PatientIdentifierService patientIdentifierService )
+    {
+        this.patientIdentifierService = patientIdentifierService;
+    }
+
+    private PatientIdentifierTypeService patientIdentifierTypeService;
+
+    public void setPatientIdentifierTypeService( PatientIdentifierTypeService patientIdentifierTypeService )
+    {
+        this.patientIdentifierTypeService = patientIdentifierTypeService;
+    }
+
+    
+    // -------------------------------------------------------------------------
+    // Input & Output
+    // -------------------------------------------------------------------------
+    public String selectedValues;
+
+    public String getSelectedValues()
+    {
+        return selectedValues;
+    }
+
+    public void setSelectedValues( String selectedValues )
+    {
+        this.selectedValues = selectedValues;
+    }
+
+    private InputStream inputStream;
+
+    public InputStream getInputStream()
+    {
+        return inputStream;
+    }
+
+    private String fileName;
+
+    public String getFileName()
+    {
+        return fileName;
+    }
+
+    public String[] values;
+
+    private String raFolderName;
+
+    private String inputTemplatePath;
+
+    private String outputReportPath;
+
+    private OrganisationUnit selectedOrgUnit;
+
+    private DataElement de;
+
+    private DataElementCategoryOptionCombo coc;
+
+    private List<String> serviceType;
+
+    private List<String> deCodeType;
+
+    private List<Integer> sheetList;
+
+    private List<Integer> rowList;
+
+    private List<Integer> colList;
+
+    private String deCodesXMLFileName;
+
+    private String reportFileNameTB;
+    
+    private I18nFormat format;
+    
+    public void setFormat( I18nFormat format )
+    {
+        this.format = format;
+    }
+    
+    private Date tempStartDate;
+    
+    private Date tempEndDate;
+    
+    private Collection<Period> periods;
+
+    // -------------------------------------------------------------------------
+    // Action Implementation
+    // -------------------------------------------------------------------------
+    public String execute()
+        throws Exception
+    {
+        // Initialization
+
+        statementManager.initialise();
+
+        deCodeType = new ArrayList<String>();
+        serviceType = new ArrayList<String>();
+        sheetList = new ArrayList<Integer>();
+        rowList = new ArrayList<Integer>();
+        colList = new ArrayList<Integer>();
+        deCodesXMLFileName = "NBITS_DrillDownToCaseBasedDECodes.xml";
+        reportFileNameTB = "DrillDownToCaseBased.xls";
+        raFolderName = configurationService.getConfigurationByKey( Configuration_IN.KEY_REPORTFOLDER ).getValue();
+
+        values = selectedValues.split( ":" );
+        int orgunit = Integer.parseInt( values[0] );
+        int deid = Integer.parseInt( values[1] );
+        int cocid = Integer.parseInt( values[2] );
+        String periodTypeName = values[3];
+        tempStartDate = format.parseDate( values[4] );
+        tempEndDate   = format.parseDate( values[5] );
+        
+        PeriodType periodType = periodService.getPeriodTypeByName( periodTypeName );
+        periods = periodService.getPeriodsBetweenDates( periodType, tempStartDate, tempEndDate );
+        
+        selectedOrgUnit = organisationUnitService.getOrganisationUnit( orgunit );
+        de = dataElementService.getDataElement( deid );
+        coc = dataElementCategoryOptionComboService.getDataElementCategoryOptionCombo( cocid );
+        
+        inputTemplatePath = System.getenv( "DHIS2_HOME" ) + File.separator + raFolderName + File.separator + "template"
+            + File.separator + reportFileNameTB;
+
+        outputReportPath = System.getenv( "DHIS2_HOME" ) + File.separator + raFolderName + File.separator + "output"
+            + File.separator + UUID.randomUUID().toString() + ".xls";
+
+        generatDrillDownReport();
+
+        statementManager.destroy();
+        
+        return SUCCESS;
+    }
+
+    public void generatDrillDownReport()
+        throws Exception
+    {
+        Workbook templateWorkbook = Workbook.getWorkbook( new File( inputTemplatePath ) );
+        WritableWorkbook outputReportWorkbook = Workbook.createWorkbook( new File( outputReportPath ), templateWorkbook );
+
+        // Cell formatting
+        WritableCellFormat wCellformat = new WritableCellFormat();
+        wCellformat.setBorder( Border.ALL, BorderLineStyle.THIN );
+        wCellformat.setAlignment( Alignment.CENTRE );
+        wCellformat.setVerticalAlignment( VerticalAlignment.CENTRE );
+        
+        List<String> deCodesList = getDECodes( deCodesXMLFileName );
+
+        // taking expression for selected de and decoc
+        CaseAggregationCondition caseAggregationCondition = caseAggregationConditionService.getCaseAggregationCondition( de, coc );
+
+        List<OrganisationUnit> orgUnitList = new ArrayList<OrganisationUnit>();
+        List<OrganisationUnit> orgUnitDataList = new ArrayList<OrganisationUnit>();
+        orgUnitList = getChildOrgUnitTree( selectedOrgUnit );
+        Map<OrganisationUnit, Integer> ouAndLevel = new HashMap<OrganisationUnit, Integer>();
+
+        List<Integer> levelsList = new ArrayList<Integer>();
+        Map<OrganisationUnit, List<PatientDataValue>> ouPatientDataValueMap = new HashMap<OrganisationUnit, List<PatientDataValue>>();
+        List<DataElement> des = new ArrayList<DataElement>();
+        String tempStr = "";
+        for ( OrganisationUnit ou : orgUnitList )
+        {
+            int level = organisationUnitService.getLevelOfOrganisationUnit( ou );
+            ouAndLevel.put( ou, level );
+            if ( !levelsList.contains( level ) )
+            {
+                levelsList.add( level );
+            }
+
+            List<PatientDataValue> patientDataValues = new ArrayList<PatientDataValue>();
+            
+            for( Period period : periods )
+            {
+                patientDataValues.addAll( caseAggregationConditionService.getPatientDataValues( caseAggregationCondition, ou, period ) );
+            }
+            
+            if ( patientDataValues != null )
+            {
+                ouPatientDataValueMap.put( ou, patientDataValues );
+                orgUnitDataList.add( ou );
+                for ( PatientDataValue patientDataValue : patientDataValues )
+                {
+                    if ( !des.contains( patientDataValue.getDataElement() ) )
+                    {
+                        des.add( patientDataValue.getDataElement() );
+                    }
+                }
+            }
+        }
+
+        WritableSheet sheet0 = outputReportWorkbook.getSheet( 0 );
+        WritableCellFormat wCellformat1 = new WritableCellFormat();
+        wCellformat1.setBorder( Border.ALL, BorderLineStyle.THIN );
+        wCellformat1.setAlignment( Alignment.CENTRE );
+        wCellformat1.setVerticalAlignment( VerticalAlignment.CENTRE );
+        wCellformat1.setWrap( true );
+        wCellformat1.setBackground( Colour.GREY_40_PERCENT );
+
+        int count1 = 0;
+        for ( DataElement de : des )
+        {
+            // DEName
+            sheet0.addCell( new Label( 7 + count1, 1, "" + de.getName(), wCellformat1 ) );
+            count1++;
+        }
+
+        sheet0.addCell( new Label( 7 + count1, 1, "Execution Date", wCellformat1 ) );
+
+        for ( int i = levelsList.size() - 1; i >= 0; i-- )
+        {
+            int level = levelsList.get( i );
+            count1++;
+            sheet0.addCell( new Label( 7 + count1, 1, organisationUnitService.getOrganisationUnitLevelByLevel( level )
+                .getName(), wCellformat1 ) );
+        }
+
+        int rowNo = rowList.get( 0 );
+        int srno = 0;
+        for ( OrganisationUnit ou : orgUnitDataList )
+        {
+            List<PatientDataValue> pdvList = ouPatientDataValueMap.get( ou );
+
+            for ( PatientDataValue patientDataValue : pdvList )
+            {
+                ProgramStageInstance psi = patientDataValue.getProgramStageInstance();
+                ProgramInstance pi = psi.getProgramInstance();
+                String value = patientDataValue.getValue();
+                Date executionDate = psi.getExecutionDate();
+                Patient patient = pi.getPatient();
+                int colNo = 0;
+                int rowCount = 0;
+                for ( String deCodeString : deCodesList )
+                {
+                    tempStr = "";
+                    String sType = (String) serviceType.get( rowCount );
+                    if ( !deCodeString.equalsIgnoreCase( "NA" ) )
+                    {
+                        if ( sType.equalsIgnoreCase( "caseProperty" ) )
+                        {
+                            if ( deCodeString.equalsIgnoreCase( "Name" ) )
+                            {
+                                tempStr = patient.getFullName();
+                            }
+                            else if ( deCodeString.equalsIgnoreCase( "Age" ) )
+                            {
+                                tempStr = patient.getAge();
+                            }
+                            else if ( deCodeString.equalsIgnoreCase( "Sex" ) )
+                            {
+                                if ( patient.getGender().equalsIgnoreCase( "M" ) )
+                                {
+                                    tempStr = "Male";
+                                }
+                                else if ( patient.getGender().equalsIgnoreCase( "F" ) )
+                                {
+                                    tempStr = "Female";
+                                }
+                                else
+                                {
+                                    tempStr = "";
+                                }
+                            }
+                        }
+                        else if ( sType.equalsIgnoreCase( "caseAttribute" ) )
+                        {
+                            int deCodeInt = Integer.parseInt( deCodeString );
+
+                            PatientAttribute patientAttribute = patientAttributeService.getPatientAttribute( deCodeInt );
+                            PatientAttributeValue patientAttributeValue = patientAttributeValueService.getPatientAttributeValue( patient, patientAttribute );
+                            if ( patientAttributeValue != null && patientAttributeValue.getValue() != null )
+                            {
+                                tempStr = patientAttributeValue.getValue();
+                            }
+                            else
+                            {
+                                tempStr = " ";
+                            }
+                        }
+                        else if ( sType.equalsIgnoreCase( "identifiertype" ) )
+                        {
+                            int deCodeInt = Integer.parseInt( deCodeString );
+
+                            PatientIdentifierType patientIdentifierType = patientIdentifierTypeService.getPatientIdentifierType( deCodeInt );
+                            if ( patientIdentifierType != null )
+                            {
+                                PatientIdentifier patientIdentifier = patientIdentifierService.getPatientIdentifier( patientIdentifierType, patient );
+                                if ( patientIdentifier != null )
+                                {
+                                    tempStr = patientIdentifier.getIdentifier();
+                                }
+                                else
+                                {
+                                    tempStr = " ";
+                                }
+                            }
+                        }
+                    }
+                    else
+                    {
+                        if ( sType.equalsIgnoreCase( "srno" ) )
+                        {
+                            int tempNum = 1 + srno;
+                            tempStr = String.valueOf( tempNum );
+                        }
+                    }
+
+                    int tempColNo = colList.get( rowCount );
+                    int sheetNo = sheetList.get( rowCount );
+                    sheet0 = outputReportWorkbook.getSheet( sheetNo );
+                    sheet0.addCell( new Label( tempColNo, rowNo, tempStr, wCellformat ) );
+                    colNo = tempColNo;
+
+                    rowCount++;
+                }
+
+                int count = 0;
+                for ( count = 0; count < des.size(); count++ )
+                {
+                    colNo++;
+                    // DE Value
+                    sheet0.addCell( new Label( colNo, rowNo, value, wCellformat ) );
+
+                }
+                colNo++;
+
+                // Execution date
+                SimpleDateFormat simpleDateFormat = new SimpleDateFormat( "yyyy-MM-dd" );
+                String eDate = simpleDateFormat.format( executionDate );
+                sheet0.addCell( new Label( colNo, rowNo, "" + eDate, wCellformat ) );
+
+                OrganisationUnit ouname = ou;
+                for ( int i = levelsList.size() - 1; i >= 0; i-- )
+                {
+                    colNo++;
+                    int level = organisationUnitService.getLevelOfOrganisationUnit( ouname );
+                    if ( levelsList.get( i ) == level )
+                    {
+                        sheet0.addCell( new Label( colNo, rowNo, ouname.getName(), wCellformat ) );
+                    }
+                    ouname = ouname.getParent();
+                }
+                rowNo++;
+                srno++;
+            }
+        }
+        outputReportWorkbook.write();
+        outputReportWorkbook.close();
+
+        fileName = reportFileNameTB.replace( ".xls", "" );
+        fileName += "_" + selectedOrgUnit.getShortName() + ".xls";
+        File outputReportFile = new File( outputReportPath );
+        inputStream = new BufferedInputStream( new FileInputStream( outputReportFile ) );
+        outputReportFile.deleteOnExit();
+
+    }
+
+    @SuppressWarnings( "unchecked" )
+    public List<OrganisationUnit> getChildOrgUnitTree( OrganisationUnit orgUnit )
+    {
+        List<OrganisationUnit> orgUnitTree = new ArrayList<OrganisationUnit>();
+        orgUnitTree.add( orgUnit );
+
+        List<OrganisationUnit> children = new ArrayList<OrganisationUnit>( orgUnit.getChildren() );
+        Collections.sort( children, new OrganisationUnitNameComparator() );
+
+        Iterator childIterator = children.iterator();
+        OrganisationUnit child;
+        while ( childIterator.hasNext() )
+        {
+            child = (OrganisationUnit) childIterator.next();
+            orgUnitTree.addAll( getChildOrgUnitTree( child ) );
+        }
+        return orgUnitTree;
+    }// getChildOrgUnitTree end
+
+
+    public List<String> getDECodes( String fileName )
+    {
+        List<String> deCodes = new ArrayList<String>();
+        String path = System.getenv( "user.home" ) + File.separator + "dhis" + File.separator + raFolderName
+            + File.separator + fileName;
+        try
+        {
+            String newpath = System.getenv( "DHIS2_HOME" );
+            if ( newpath != null )
+            {
+                path = newpath + File.separator + File.separator + raFolderName + File.separator + fileName;
+            }
+
+        }
+        catch ( NullPointerException npe )
+        {
+            // do nothing, but we might be using this somewhere without
+            // USER_HOME set, which will throw a NPE
+        }
+
+        try
+        {
+            DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
+            DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();
+            Document doc = docBuilder.parse( new File( path ) );
+            if ( doc == null )
+            {
+                System.out.println( "There is no DECodes related XML file in the user home" );
+                return null;
+            }
+
+            NodeList listOfDECodes = doc.getElementsByTagName( "de-code" );
+            int totalDEcodes = listOfDECodes.getLength();
+
+            for ( int s = 0; s < totalDEcodes; s++ )
+            {
+                Element deCodeElement = (Element) listOfDECodes.item( s );
+                NodeList textDECodeList = deCodeElement.getChildNodes();
+                deCodes.add( ((Node) textDECodeList.item( 0 )).getNodeValue().trim() );
+                serviceType.add( deCodeElement.getAttribute( "stype" ) );
+                deCodeType.add( deCodeElement.getAttribute( "type" ) );
+                sheetList.add( new Integer( deCodeElement.getAttribute( "sheetno" ) ) );
+                rowList.add( new Integer( deCodeElement.getAttribute( "rowno" ) ) );
+                colList.add( new Integer( deCodeElement.getAttribute( "colno" ) ) );
+            }// end of for loop with s var
+        }// try block end
+        catch ( SAXParseException err )
+        {
+            System.out.println( "** Parsing error" + ", line " + err.getLineNumber() + ", uri " + err.getSystemId() );
+            System.out.println( " " + err.getMessage() );
+        }
+        catch ( SAXException e )
+        {
+            Exception x = e.getException();
+            ((x == null) ? e : x).printStackTrace();
+        }
+        catch ( Throwable t )
+        {
+            t.printStackTrace();
+        }
+
+        return deCodes;
+    }// getDECodes end
+}

=== modified file 'local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/ta/action/GenerateTabularAnalysisResultAction.java'
--- local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/ta/action/GenerateTabularAnalysisResultAction.java	2011-03-01 09:39:28 +0000
+++ local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/ta/action/GenerateTabularAnalysisResultAction.java	2011-04-15 11:34:10 +0000
@@ -481,7 +481,7 @@
             + "output" + File.separator + UUID.randomUUID().toString() + ".xls";
         WritableWorkbook outputReportWorkbook = Workbook.createWorkbook( new File( outputReportPath ) );
         WritableSheet sheet0 = outputReportWorkbook.createSheet( "TabularAnalysis", 0 );
-
+        
         sheet0.mergeCells( headerCol, headerRow, headerCol, headerRow + 1 );
         sheet0.addCell( new Label( headerCol, headerRow, "Sl.No.", getCellFormat1() ) );
 
@@ -1557,7 +1557,7 @@
         throws Exception
     {
         WritableCellFormat wCellformat = new WritableCellFormat();
-
+        
         wCellformat.setBorder( Border.ALL, BorderLineStyle.THIN );
         wCellformat.setAlignment( Alignment.CENTRE );
         wCellformat.setBackground( Colour.GRAY_25 );

=== modified file 'local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/tr/action/GenerateTargetAnalysisDataAction.java'
--- local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/tr/action/GenerateTargetAnalysisDataAction.java	2011-01-20 09:57:02 +0000
+++ local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/tr/action/GenerateTargetAnalysisDataAction.java	2011-04-15 11:34:10 +0000
@@ -279,6 +279,16 @@
                 
                 for ( int j = 0; j < data2[i].length; j++ )
                 {
+                    Double tempdeTargetAggVal = deTargetAggVal;
+                    if( selButton.equalsIgnoreCase( "VIEWCCHART" ) )
+                    {
+                        tempdeTargetAggVal = deTargetAggVal * (j+1);
+                        tempdeTargetAggVal = Math.round( tempdeTargetAggVal * Math.pow( 10, 1 ) ) / Math.pow( 10, 1 );
+                    }
+                    
+                    data2[i][j] = tempdeTargetAggVal;
+
+                    /*
                     if( selButton.equalsIgnoreCase( "VIEWCCHART" ) )
                     {
                         deTargetAggVal = deTargetAggVal * (j+1);
@@ -286,6 +296,7 @@
                     }
                     
                     data2[i][j] = deTargetAggVal;
+                    */
                 }
             }
         }