← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2479: Added DrillDown to DrillDown functionality in DataElementWise Graphical Analysis in DashBoard

 

------------------------------------------------------------
revno: 2479
committer: Mithilesh Kumar Thakur<mithilesh.hisp@xxxxxxxxx>
branch nick: trunk
timestamp: Fri 2011-01-07 11:15:11 +0530
message:
  Added DrillDown to DrillDown functionality in DataElementWise  Graphical Analysis in DashBoard
added:
  local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/ga/action/charts/GenerateDrillDownOrgUnitToPeriodChartDataElementResultAction.java
  local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/ga/action/charts/GenerateDrillDownPeriodToOrgChildChartDataElementResultAction.java
modified:
  local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/ga/action/charts/GenerateChartDataAction.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/util/DashBoardService.java
  local/in/dhis-web-dashboard/src/main/resources/META-INF/dhis/beans.xml
  local/in/dhis-web-dashboard/src/main/resources/struts.xml
  local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/graphicalAnalysisDataElementResult.vm


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/ga/action/charts/GenerateChartDataAction.java'
--- local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/ga/action/charts/GenerateChartDataAction.java	2010-12-29 16:17:28 +0000
+++ local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/ga/action/charts/GenerateChartDataAction.java	2011-01-07 05:45:11 +0000
@@ -46,7 +46,6 @@
 import org.hisp.dhis.aggregation.AggregationService;
 import org.hisp.dhis.caseaggregation.CaseAggregationCondition;
 import org.hisp.dhis.caseaggregation.CaseAggregationConditionService;
-import org.hisp.dhis.dataanalyser.util.DashBoardService;
 import org.hisp.dhis.dataanalyser.util.SurveyData;
 import org.hisp.dhis.dataelement.DataElement;
 import org.hisp.dhis.dataelement.DataElementCategoryCombo;

=== 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	2010-12-23 07:23:23 +0000
+++ local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/ga/action/charts/GenerateChartDataElementAction.java	2011-01-07 05:45:11 +0000
@@ -41,6 +41,7 @@
 
 import org.amplecode.quick.StatementManager;
 import org.apache.struts2.ServletActionContext;
+import org.apache.velocity.tools.generic.ListTool;
 import org.hisp.dhis.aggregation.AggregationService;
 import org.hisp.dhis.caseaggregation.CaseAggregationCondition;
 import org.hisp.dhis.caseaggregation.CaseAggregationConditionService;
@@ -227,6 +228,11 @@
         this.deSelection = deSelection;
     }
     
+    public String getDeSelection()
+    {
+        return deSelection;
+    }
+    
 /*
     private List<String> ougGroupSetCB;
     
@@ -241,6 +247,8 @@
     }
 */
      
+
+
     private String ougGroupSetCB;
     
     public void setOugGroupSetCB( String ougGroupSetCB )
@@ -273,6 +281,11 @@
         this.aggDataCB = aggDataCB;
     }
     
+    public String getAggDataCB()
+    {
+        return aggDataCB;
+    }
+
     private List<String> orgUnitListCB;
     
     public void setOrgUnitListCB( List<String> orgUnitListCB )
@@ -390,21 +403,49 @@
     {
         return selectedStatus;
     }
+    
+    private List<String> selectedDrillDownData;
+    
+    public List<String> getSelectedDrillDownData()
+    {
+        return selectedDrillDownData;
+    }
+    
+    ListTool listTool;
 
-   
+    public ListTool getListTool()
+    {
+        return listTool;
+    }
+    
+    private String drillDownPeriodStartDate;
+    private String drillDownPeriodEndDate;
+    private String drillDownPeriodNames;
+    
+    private String aggChecked;
+    
     // -------------------------------------------------------------------------
     // Action Implementation
     // -------------------------------------------------------------------------
     
-
-
-
     @SuppressWarnings( "unchecked" )
     public String execute()  throws Exception
     {
         statementManager.initialise();
         selectedOptionComboList = new ArrayList<DataElementCategoryOptionCombo>();
         
+        listTool = new ListTool();
+        
+        aggChecked = "";
+        
+        if( aggDataCB != null )
+        {
+            aggChecked = "1";
+        }
+        else
+        {
+            aggChecked = "0";
+        }
         selOUList = new ArrayList<OrganisationUnit>();
         System.out.println( "selected orgUnit  size : " + orgUnitListCB.size() );
         
@@ -423,8 +464,11 @@
         
         yseriesList = new ArrayList<String>();
         
-        selectedValues = new ArrayList<String>();//for DrillDown
+        selectedValues = new ArrayList<String>();//for DrillDown ( for NBIT)
         selectedStatus = new ArrayList<String>();
+        
+        selectedDrillDownData = new ArrayList<String>();//drillDown for periodWise
+        
       //  DataElement dElement = new DataElement();
         
        // DataElementCategoryOptionCombo decoc1 = new DataElementCategoryOptionCombo();
@@ -442,7 +486,10 @@
 
         String startD = "";
         String endD = "";
-
+        
+        drillDownPeriodStartDate = "";
+        drillDownPeriodEndDate = "";
+        drillDownPeriodNames = "";
         SimpleDateFormat simpleDateFormat = new SimpleDateFormat( "MMM-yyyy" );
 
         periodNames = new ArrayList<String>();
@@ -451,6 +498,7 @@
         if ( periodTypeLB.equalsIgnoreCase( WeeklyPeriodType.NAME ) )
         {
            // System.out.println( " Inside  weekly" );
+            int periodCount = 0;
             for ( String periodStr : periodLB )
             {
                 String  startWeekDate = periodStr.split( "To" )[0] ; //for start week
@@ -459,25 +507,56 @@
                 startD = startWeekDate.trim();
                 endD = endWeekDate.trim();
                 
+                // for DrillDown Period String
+                if( periodCount == periodLB.size()-1 )
+                {
+                    drillDownPeriodStartDate += startD;
+                    drillDownPeriodEndDate += endD;
+                    drillDownPeriodNames += periodStr;
+                }
+                else
+                {
+                    drillDownPeriodStartDate += startD + ";";
+                    drillDownPeriodEndDate += endD + ";";
+                    drillDownPeriodNames += periodStr + ";";
+                }
+                
                 selStartPeriodList.add( format.parseDate( startD ) );
                 selEndPeriodList.add( format.parseDate( endD ) );
                 
                 periodNames.add( periodStr );
+                periodCount++;
                 //System.out.println( startD + " : " + endD );
             }
         }
         else
         {
+            int periodCount = 0;
             for ( String year : yearLB )
             {
                 //int selYear = Integer.parseInt( year.split( "-" )[0] );
                 int selYear = Integer.parseInt( year );
-            
+                
                 if ( periodTypeLB.equalsIgnoreCase( YearlyPeriodType.NAME ) )
                 {
+                    
                     startD = "" + selYear + "-01-01";
                     endD = "" + selYear  + "-12-31";
                     
+                    // for DrillDown Period String
+                    if( periodCount == yearLB.size()-1 )
+                    {
+                        drillDownPeriodStartDate += startD;
+                        drillDownPeriodEndDate += endD;
+                        drillDownPeriodNames += selYear;
+                    }
+                    else
+                    {
+                        drillDownPeriodStartDate += startD + ";";
+                        drillDownPeriodEndDate += endD + ";";
+                        drillDownPeriodNames += selYear + ";";
+                    }
+                    
                     selStartPeriodList.add( format.parseDate( startD ) );
                     selEndPeriodList.add( format.parseDate( endD ) );
             
@@ -489,6 +568,7 @@
                     
                 }
                
+               // int periodCount = 0;
                 for ( String periodStr : periodLB )
                 {
                    // int period = Integer.parseInt( periodStr );
@@ -506,6 +586,19 @@
                         {
                             endD = "" + selYear  + "-" + monthOrder[period] + "-" + ( monthDays[period] + 1 );
                         } 
+                        
+                        // for DrillDown Period String
+                        /*if( periodCount == periodLB.size()-1 )
+                        {
+                            drillDownPeriodStartDate += startD;
+                            drillDownPeriodEndDate += endD;
+                        }
+                        else*/
+                      //  {
+                            drillDownPeriodStartDate += startD + ";";
+                            drillDownPeriodEndDate += endD + ";";
+                            drillDownPeriodNames += simpleDateFormat.format( format.parseDate( startD ) ) + ";";
+                       // }
                         selStartPeriodList.add( format.parseDate( startD ) );
                         selEndPeriodList.add( format.parseDate( endD ) );
                         periodNames.add( simpleDateFormat.format( format.parseDate( startD ) ) );
@@ -519,25 +612,42 @@
                             startD = "" + selYear + "-01-01";
                             endD = "" + selYear + "-03-31";
                             periodNames.add( selYear + "-Q1" );
+                            drillDownPeriodNames += selYear + "-Q1" + ";";
                         }
                         else if ( period == 1 )
                         {
                             startD = "" + selYear + "-04-01";
                             endD = "" + selYear + "-06-30";
                             periodNames.add( selYear + "-Q2" );
+                            drillDownPeriodNames += selYear + "-Q2" + ";";
                         }
                         else if ( period == 2 )
                         {
                             startD = "" + selYear + "-07-01";
                             endD = "" + selYear + "-09-30";
                             periodNames.add( selYear + "-Q3" );
+                            drillDownPeriodNames += selYear + "-Q3" + ";";
                         }
                         else
                         {
                             startD = "" + selYear + "-10-01";
                             endD = "" + selYear + "-12-31";
                             periodNames.add( (selYear) + "-Q4" );
-                        }
+                            drillDownPeriodNames += selYear + "-Q4" + ";";
+                        }
+                        
+                        // for DrillDown Period String
+                        if( periodCount == periodLB.size()-1 )
+                        {
+                            drillDownPeriodStartDate += startD;
+                            drillDownPeriodEndDate += endD;
+                        }
+                        else
+                        {
+                            drillDownPeriodStartDate += startD + ";";
+                            drillDownPeriodEndDate += endD + ";";
+                        }
+                        
                         selStartPeriodList.add( format.parseDate( startD ) );
                         selEndPeriodList.add( format.parseDate( endD ) );
                        // System.out.println( "Start Date : " + startD + " , End Date : " + endD );
@@ -550,13 +660,29 @@
                             startD = "" + selYear + "-01-01";
                             endD = "" + selYear + "-06-30";
                             periodNames.add( selYear + "-HY1" );
+                            drillDownPeriodNames += selYear + "-HY1" + ";";
                         }
                         else
                         {
                             startD = "" + selYear + "-07-01";
                             endD = "" + selYear + "-12-31";
                             periodNames.add( selYear + "-HY2" );
+                            drillDownPeriodNames += selYear + "-HY2" + ";";
                         }
+                       
+                        // for DrillDown Period String
+                        /*
+                        if( periodCount == periodLB.size()-1 )
+                        {
+                            drillDownPeriodStartDate += startD;
+                            drillDownPeriodEndDate += endD;
+                        }*/
+                        //else
+                       // {
+                            drillDownPeriodStartDate += startD + ";";
+                            drillDownPeriodEndDate += endD + ";";
+                        //}
+                        
                         selStartPeriodList.add( format.parseDate( startD ) );
                         selEndPeriodList.add( format.parseDate( endD ) );
                     }
@@ -582,15 +708,31 @@
                             endD = selYear  + "-" + month + "-" + date;
                         }
                        
+                        // for DrillDown Period String
+                        if( periodCount == periodLB.size()-1 )
+                        {
+                            drillDownPeriodStartDate += startD;
+                            drillDownPeriodEndDate += endD;
+                            drillDownPeriodNames += startD;
+                        }
+                        else
+                        {
+                            drillDownPeriodStartDate += startD + ";";
+                            drillDownPeriodEndDate += endD + ";";
+                            drillDownPeriodNames += startD + ";";
+                        }
+                        
                         selStartPeriodList.add( format.parseDate( startD ) );
                         selEndPeriodList.add( format.parseDate( endD ) );
                         
                         periodNames.add( startD );
                        // System.out.println( startD + " : " + endD );
                     }
-                    System.out.println( startD + " : " + endD );
+                    //System.out.println( startD + " : " + endD );
+                    //periodCount++; 
                 }
-   
+               // periodCountYear++;
+                periodCount++;
             }
       }    
         
@@ -711,9 +853,17 @@
             List<OrganisationUnit> childOrgUnitList = new ArrayList<OrganisationUnit>();
             childOrgUnitList = new ArrayList<OrganisationUnit>( selectedOrgUnit.getChildren());
             
+            System.out.println( "length of childOrgUnitList :" + childOrgUnitList.size());
             
             dataElementChartResult = generateChartDataWithChildrenWise( selStartPeriodList,selEndPeriodList,periodNames,dataElementList,selectedOptionComboList,childOrgUnitList );
-  
+           /*
+            for( String drillDown : selectedDrillDownData )
+            {
+                System.out.println( "drill Down value is :" + drillDown);
+                System.out.println( "---------");
+            }
+            */
+           // dataElementChartResult.getSeries()
         }
         else if ( categoryLB.equalsIgnoreCase( SELECTED ) && ougGroupSetCB == null )
         {
@@ -949,6 +1099,7 @@
            for( Date startDate : selStartPeriodList )
            {
                Date endDate = selEndPeriodList.get( periodCount );
+               String drillDownPeriodName = periodNames.get( periodCount );
                //format.formatDate( date )
                String tempStartDate = format.formatDate( startDate );
                String tempEndDate   = format.formatDate( endDate );
@@ -957,14 +1108,19 @@
                PeriodType periodType = periodService.getPeriodTypeByName( periodTypeLB );
                
                String values = orgUnit.getId() + ":"+ dataElement.getId() + ":"+ decoc.getId() + ":"  + periodType + ":" + tempStartDate + ":" + tempEndDate;
-               selectedValues.add(values);
+               selectedValues.add( values );
+               
+               String drillDownData = orgUnit.getId() + ":" + "0" + ":" + dataElement.getId() + ":"+ decoc.getId() + ":"  + periodTypeLB + ":" + tempStartDate + ":" + tempEndDate + ":" + drillDownPeriodName + ":" + deSelection + ":" + aggChecked;
+               //String drillDownData = orgUnit.getId() + ":" + "0" + ":" + dataElement.getId() + ":"+ decoc.getId() + ":"  + periodTypeLB + ":" + drillDownPeriodStartDate + ":" + drillDownPeriodEndDate + ":" + drillDownPeriodNames + ":" + deSelection + ":" + aggDataCB;
+               //selectedDrillDownData
+               selectedDrillDownData.add( drillDownData );
              //  System.out.println( "selectedValues Size  : " + selectedValues.size() );
                
                Double aggDataValue = 0.0;
                if( aggDataCB != null )
                {
                    aggDataValue = aggregationService.getAggregatedDataValue( dataElement, decoc, startDate, endDate, orgUnit );
-                   System.out.println( "start Date is   : " + startDate + " , End date is : " + endDate );
+                   //System.out.println( "start Date is   : " + startDate + " , End date is : " + endDate );
                    //System.out.println( "Agg data value before is  : " + aggDataValue );
                    if(aggDataValue == null ) aggDataValue = 0.0;
                    //System.out.println( "Agg data value after zero assign is  : " + aggDataValue );
@@ -972,8 +1128,8 @@
                else
                {
                  //  PeriodType periodType = periodService.getPeriodTypeByName( periodTypeLB );
-                   Collection<Period> periods = periodService.getPeriodsBetweenDates( periodType, startDate, endDate );
-                   
+                  // Collection<Period> periods = periodService.getPeriodsBetweenDates( periodType, startDate, endDate );
+                   Collection<Period> periods = periodService.getPeriodsBetweenDates( startDate, endDate );
                    for( Period period : periods )
                    {
                        DataValue dataValue = dataValueService.getDataValue( orgUnit, dataElement, period, decoc );
@@ -1070,20 +1226,29 @@
            {
                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 );
-                   PeriodType periodType = periodService.getPeriodTypeByName( periodTypeLB );
-                   Collection<Period> periods = periodService.getPeriodsBetweenDates( periodType, startDate, endDate );
-                   
-                   for( Period period : periods )
-                   {
+                  // PeriodType periodType = periodService.getPeriodTypeByName( periodTypeLB );
+                   //Collection<Period> periods = periodService.getPeriodsBetweenDates( periodType, startDate, endDate );
+                   Collection<Period> periods = periodService.getPeriodsBetweenDates( startDate, endDate );
+                   
+                   //String drillDownData = orgChild.getId() + ":" + "0" + ":" + dataElement.getId() + ":"+ decoc.getId() + ":"  + periodTypeLB + ":" + drillDownPeriodStartDate + ":" + drillDownPeriodEndDate + ":" + drillDownPeriodNames + ":" + deSelection + ":" + aggDataCB;
+                   
+                   //System.out.println( drillDownData );
+                   //selectedDrillDownData.add( drillDownData );
+                   
+                  // for( Period period : periods )
+                   //{
                        if( aggDataCB != null )
                        {
-                           Double tempAggDataValue = aggregationService.getAggregatedDataValue( dataElement, decoc, period.getStartDate(), period.getEndDate(), orgChild );
+                           Double tempAggDataValue = aggregationService.getAggregatedDataValue( dataElement, decoc, startDate, endDate, orgChild );
                           // System.out.println( "Agg data value before is  : " + aggDataValue );
                           
                            if(tempAggDataValue != null ) aggDataValue += tempAggDataValue;
@@ -1091,18 +1256,23 @@
                        }
                        else
                        {
-                           DataValue dataValue = dataValueService.getDataValue( orgChild, dataElement, period, decoc );
+                           for( Period period : periods )
+                           {
+                               DataValue dataValue = dataValueService.getDataValue( orgChild, dataElement, period, decoc );
+                               
+                               try
+                               {
+                                   aggDataValue += Double.parseDouble( dataValue.getValue() );
+                               }
+                               catch( Exception e )
+                               {
+                                   
+                               }
+                           }
                            
-                           try
-                           {
-                               aggDataValue += Double.parseDouble( dataValue.getValue() );
-                           }
-                           catch( Exception e )
-                           {
-                               
-                           }
+                          
                        }
-                   }
+                   //}
                    periodCount++;
                }
  
@@ -1180,20 +1350,24 @@
            {             
                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 );
-                   PeriodType periodType = periodService.getPeriodTypeByName( periodTypeLB );
-                   Collection<Period> periods = periodService.getPeriodsBetweenDates( periodType, startDate, endDate );
+                  // PeriodType periodType = periodService.getPeriodTypeByName( periodTypeLB );
+                   //Collection<Period> periods = periodService.getPeriodsBetweenDates( periodType, startDate, endDate );
+                   Collection<Period> periods = periodService.getPeriodsBetweenDates( startDate, endDate );
                    
-                   for( Period period : periods )
-                   {
+                   //for( Period period : periods )
+                   //{
                        if( aggDataCB != null )
                        {
-                           Double tempAggDataValue = aggregationService.getAggregatedDataValue( dataElement, decoc, period.getStartDate(), period.getEndDate(), orgunit );
+                           Double tempAggDataValue = aggregationService.getAggregatedDataValue( dataElement, decoc, startDate, endDate, orgunit );
                            //System.out.println( "Agg data value before is  : " + aggDataValue );
                           
                            if(tempAggDataValue != null ) aggDataValue += tempAggDataValue;
@@ -1201,18 +1375,22 @@
                        }
                        else
                        {
-                           DataValue dataValue = dataValueService.getDataValue( orgunit, dataElement, period, decoc );
-                           
-                           try
-                           {
-                               aggDataValue += Double.parseDouble( dataValue.getValue() );
-                           }
-                           catch( Exception e )
-                           {
+                          
+                           for( Period period : periods )
+                           {
+                               DataValue dataValue = dataValueService.getDataValue( orgunit, dataElement, period, decoc );
                                
+                               try
+                               {
+                                   aggDataValue += Double.parseDouble( dataValue.getValue() );
+                               }
+                               catch( Exception e )
+                               {
+                                   
+                               }
                            }
                        }
-                   }
+                  // }
                    periodCount++;
                }
  
@@ -1254,7 +1432,7 @@
        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()+ "(" + selOrgUnitGroup.getName() +  ")";
+       String chartTitle = "OrganisationUnit : " + selectedOrgUnit.getShortName()+ "( Group- " + selOrgUnitGroup.getName() +  " )";
        String xAxis_Title = "Time Line";
        String yAxis_Title = "Value";
        
@@ -1282,19 +1460,31 @@
                yseriesList.add( dataElement.getName() );
            }
                
-               Double aggDataValue = 0.0;
+               
               
                int periodCount = 0;
                for( Date startDate : selStartPeriodList )
                {
                    Date endDate = selEndPeriodList.get( periodCount );
                    categories[periodCount] = periodNames.get( periodCount );
-                   
-                   PeriodType periodType = periodService.getPeriodTypeByName( periodTypeLB );
-                   Collection<Period> periods = periodService.getPeriodsBetweenDates( periodType, startDate, endDate );
-  
-                   for( Period period : periods )
-                   {
+                   Double aggDataValue = 0.0;
+                   
+                 //format.formatDate( date )
+                   String tempStartDate = format.formatDate( startDate );
+                   String tempEndDate   = format.formatDate( endDate );
+                   String drillDownPeriodName = periodNames.get( periodCount );
+                   
+                  // PeriodType periodType = periodService.getPeriodTypeByName( periodTypeLB );
+                  // Collection<Period> periods = periodService.getPeriodsBetweenDates( periodType, startDate, endDate );
+                   
+                   Collection<Period> periods = periodService.getPeriodsBetweenDates( startDate, endDate );
+                  // String drillDownData = selectedOrgUnit.getId() + ":"+ selOrgUnitGroup.getId() + ":" + dataElement.getId() + ":"+ decoc.getId() + ":"  + periodTypeLB + ":" + drillDownPeriodStartDate + ":" + drillDownPeriodEndDate + ":" + drillDownPeriodNames + ":" + deSelection + ":" + aggDataCB;
+                   String drillDownData = selectedOrgUnit.getId() + ":"+ selOrgUnitGroup.getId() + ":" + dataElement.getId() + ":"+ decoc.getId() + ":"  + periodTypeLB + ":" + tempStartDate + ":" + tempEndDate + ":" + drillDownPeriodName + ":" + deSelection + ":" + aggChecked;
+                   //selectedDrillDownData
+                   selectedDrillDownData.add( drillDownData );
+                 
+                  // for( Period period : periods )
+                   //{
                        int orgGroupCount = 0;
                        
                        for( OrganisationUnit orgUnit : selOUGroupMemberList )
@@ -1302,29 +1492,33 @@
                            
                            if( aggDataCB != null )
                            {
-                               Double tempAggDataValue = aggregationService.getAggregatedDataValue( dataElement, decoc, period.getStartDate(), period.getEndDate(), orgUnit );
+                               Double tempAggDataValue = aggregationService.getAggregatedDataValue( dataElement, decoc, startDate, endDate, orgUnit );
                               // System.out.println( "Agg data value before is  : " + aggDataValue );
                               
-                               if(tempAggDataValue != null ) aggDataValue += tempAggDataValue;
+                               if(tempAggDataValue != null ) aggDataValue = tempAggDataValue;
                               // System.out.println( "Agg data value after zero assign is  : " + aggDataValue );
                            }
-                       else
-                       {
-                           DataValue dataValue = dataValueService.getDataValue( orgUnit, dataElement, period, decoc );
-                           
-                           try
-                           {
-                               aggDataValue += Double.parseDouble( dataValue.getValue() );
-                           }
-                           catch( Exception e )
-                           {
-                               
-                           }
-                       }
-                          orgGroupCount++;
+                           else
+                           {
+                               for( Period period : periods )
+                               {
+                                   DataValue dataValue = dataValueService.getDataValue( orgUnit, dataElement, period, decoc );
+                                   
+                                   try
+                                   {
+                                       aggDataValue += Double.parseDouble( dataValue.getValue() );
+                                   }
+                                   catch( Exception e )
+                                   {
+                                       
+                                   }
+                               }
+                              
+                           }
+                              orgGroupCount++;
                    }
                    
-               }
+              // }
    
                data[serviceCount][periodCount] = aggDataValue;
                
@@ -1392,66 +1586,77 @@
                
                yseriesList.add( dataElement.getName() );
            }
+   
+               int orgGroupCount = 0;
+              // int orgGroupCount1 = 0;
+          // Double aggDataValue = 0.0;
            
-                       int orgGroupCount = 0;
-                      // int orgGroupCount1 = 0;
-                      // Double aggDataValue = 0.0;
-                       
-                       for( OrganisationUnitGroup orgUnitGroup : orgUnitGroupMap.keySet() )
-                       {
-                          // Double aggDataValue = 0.0;
-                           Double aggDataValue = 0.0;
-                           
-                           categories[orgGroupCount] = orgUnitGroup.getName();
-                           
-                           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 )
-                           {
+           for( OrganisationUnitGroup orgUnitGroup : orgUnitGroupMap.keySet() )
+           {
+              // Double aggDataValue = 0.0;
+               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 );
+               
+               //String drillDownData = selectedOrgUnit.getId() + ":"+ selOrgUnitGroup.getId() + ":" + dataElement.getId() + ":"+ decoc.getId() + ":"  + periodTypeLB + ":" + tempStartDate + ":" + tempEndDate + ":" + deSelection + ":" + aggDataCB;
+               //selectedDrillDownData
+               //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 );
+                     
+                       //PeriodType periodType = periodService.getPeriodTypeByName( periodTypeLB );
+                       //Collection<Period> periods = periodService.getPeriodsBetweenDates( periodType, startDate, endDate );
+                       Collection<Period> periods = periodService.getPeriodsBetweenDates( startDate, endDate );                               
+                          //for( Period period : periods )
+                         // {
+                       if( aggDataCB != null )
+                       {
+                           Double tempAggDataValue = aggregationService.getAggregatedDataValue( dataElement, decoc, startDate, endDate, orgUnit );
+                         //  System.out.println( "Agg data value before is  : " + aggDataValue );
+                          
+                           if(tempAggDataValue != null ) aggDataValue += tempAggDataValue;
+                          // System.out.println( "Agg data value after zero assign is  : " + aggDataValue );
+                       }
+                       else
+                       {
+                           for( Period period : periods )
+                           {    
+                               DataValue dataValue = dataValueService.getDataValue( orgUnit, dataElement, period, decoc );
                                
-                               int periodCount = 0;
-                               for( Date startDate : selStartPeriodList )
-                               {
-                                   Date endDate = selEndPeriodList.get( periodCount );
-                                 
-                                   PeriodType periodType = periodService.getPeriodTypeByName( periodTypeLB );
-                                   Collection<Period> periods = periodService.getPeriodsBetweenDates( periodType, startDate, endDate );
-                                                                  
-                                      for( Period period : periods )
-                                      {
-                                           if( aggDataCB != null )
-                                           {
-                                               Double tempAggDataValue = aggregationService.getAggregatedDataValue( dataElement, decoc, period.getStartDate(), period.getEndDate(), orgUnit );
-                                             //  System.out.println( "Agg data value before is  : " + aggDataValue );
-                                              
-                                               if(tempAggDataValue != null ) aggDataValue += tempAggDataValue;
-                                              // System.out.println( "Agg data value after zero assign is  : " + aggDataValue );
-                                           }
-                                           else
-                                           {
-                                               DataValue dataValue = dataValueService.getDataValue( orgUnit, dataElement, period, decoc );
-                                               
-                                               try
-                                               {
-                                                   aggDataValue += Double.parseDouble( dataValue.getValue() );
-                                               }
-                                               catch( Exception e )
-                                               {
-                                                   
-                                               }
-                                           }
-                                      }
-                          periodCount++;  
-                 }  
+                               try
+                               {
+                                   aggDataValue += Double.parseDouble( dataValue.getValue() );
+                               }
+                               catch( Exception e )
+                               {
+                                   
+                               }
+                           }
+                       }
+                         // }
+                     periodCount++;  
+                   }  
                }
                data[serviceCount][orgGroupCount] = aggDataValue;
                

=== added file 'local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/ga/action/charts/GenerateDrillDownOrgUnitToPeriodChartDataElementResultAction.java'
--- local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/ga/action/charts/GenerateDrillDownOrgUnitToPeriodChartDataElementResultAction.java	1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/ga/action/charts/GenerateDrillDownOrgUnitToPeriodChartDataElementResultAction.java	2011-01-07 05:45:11 +0000
@@ -0,0 +1,389 @@
+/*
+ * Copyright (c) 2004-2010, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ *   list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ *   this list of conditions and the following disclaimer in the documentation
+ *   and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ *   be used to endorse or promote products derived from this software without
+ *   specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.hisp.dhis.dataanalyser.ga.action.charts;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSession;
+
+import org.amplecode.quick.StatementManager;
+import org.apache.struts2.ServletActionContext;
+import org.apache.velocity.tools.generic.ListTool;
+import org.hisp.dhis.dataanalyser.util.DashBoardService;
+import org.hisp.dhis.dataanalyser.util.DataElementChartResult;
+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.OrganisationUnitGroup;
+import org.hisp.dhis.organisationunit.OrganisationUnitGroupService;
+import org.hisp.dhis.organisationunit.OrganisationUnitService;
+
+import com.opensymphony.xwork2.Action;
+import com.opensymphony.xwork2.ActionContext;
+
+/**
+ * @author Mithilesh Kumar Thakur
+ *
+ * @version GenerateDrillDownOrgUnitToPeriodChartDataElementResultAction.java Jan 3, 2011 11:04:22 AM
+ */
+public class GenerateDrillDownOrgUnitToPeriodChartDataElementResultAction implements Action
+{
+    private final String PERIODWISE = "period";
+
+    //private final String CHILDREN = "children";
+
+    //private final String OPTIONCOMBO = "optioncombo";
+    //private final String SELECTED = "random";
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
+    
+    private StatementManager statementManager;
+
+    public void setStatementManager( StatementManager statementManager )
+    {
+        this.statementManager = statementManager;
+    }
+   
+    private DashBoardService dashBoardService;
+
+    public void setDashBoardService( DashBoardService dashBoardService )
+    {
+        this.dashBoardService = dashBoardService;
+    }
+
+    private DataElementService dataElementService;
+
+    public void setDataElementService( DataElementService dataElementService )
+    {
+        this.dataElementService = dataElementService;
+    }
+
+    private DataElementCategoryService dataElementCategoryService;
+
+    public void setDataElementCategoryService( DataElementCategoryService dataElementCategoryService )
+    {
+        this.dataElementCategoryService = dataElementCategoryService;
+    }
+    
+    private OrganisationUnitService organisationUnitService;
+
+    public OrganisationUnitService getOrganisationUnitService()
+    {
+        return organisationUnitService;
+    }
+
+    public void setOrganisationUnitService( OrganisationUnitService organisationUnitService )
+    {
+        this.organisationUnitService = organisationUnitService;
+    }
+    
+    private OrganisationUnitGroupService organisationUnitGroupService;
+    
+    public void setOrganisationUnitGroupService( OrganisationUnitGroupService organisationUnitGroupService )
+    {
+        this.organisationUnitGroupService = organisationUnitGroupService;
+    }
+
+    // -------------------------------------------------------------------------
+    // Input/output
+    // -------------------------------------------------------------------------
+    
+    private String categoryLB;
+
+    public void setCategoryLB( String categoryLB )
+    {
+        this.categoryLB = categoryLB;
+    }
+
+    public String getCategoryLB()
+    {
+        return categoryLB;
+    }
+
+    /* 
+    private String ougGroupSetCB;
+    
+    
+    public void setOugGroupSetCB( String ougGroupSetCB )
+    {
+        this.ougGroupSetCB = ougGroupSetCB;
+    }
+    */
+    private I18nFormat format;
+
+    public void setFormat( I18nFormat format )
+    {
+        this.format = format;
+    }
+    
+    private String selDrillDownData;
+    
+    public void setSelDrillDownData( String selDrillDownData )
+    {
+        this.selDrillDownData = selDrillDownData;
+    }
+
+    public String[] values;
+    
+    ListTool listTool;
+
+    public ListTool getListTool()
+    {
+        return listTool;
+    }
+    
+    private DataElementChartResult dataElementChartResult;
+    
+    public DataElementChartResult getDataElementChartResult()
+    {
+        return dataElementChartResult;
+    }
+    
+    private List<DataElementCategoryOptionCombo> selectedOptionComboList;
+    
+    private OrganisationUnit selectedOrgUnit;
+    
+    private OrganisationUnitGroup selectedOrgUnitGroup;
+
+    private DataElement dataElement;
+
+    //private DataElementCategoryOptionCombo categoryCombo;
+    
+    private HttpSession session;
+
+    public HttpSession getSession()
+    {
+        return session;
+    }
+    
+    private List<Date> selStartPeriodList;
+
+    private List<Date> selEndPeriodList;
+    
+    private String selectedButton;
+    
+    public String getSelectedButton()
+    {
+        return selectedButton;
+    }
+
+    public void setSelectedButton( String selectedButton )
+    {
+        this.selectedButton = selectedButton;
+    }
+   /*
+    private String aggDataCB;
+    
+    public void setAggDataCB( String aggDataCB )
+    {
+        this.aggDataCB = aggDataCB;
+    }
+    
+    public String getAggDataCB()
+    {
+        return aggDataCB;
+    }
+    */
+    public String[] startDateArray;
+    public String[] endDateArray;
+    public String[] priodNameArray;
+    
+    private  List<String> periodNames;
+    
+    private List<String> selectedDrillDownData;
+    
+    public List<String> getSelectedDrillDownData()
+    {
+        return selectedDrillDownData;
+    }
+    
+    //private String drillDownPeriodStartDate;
+    //private String drillDownPeriodEndDate;
+    private String drillDownPeriodNames;
+    
+    // -------------------------------------------------------------------------
+    // Action implements
+    // -------------------------------------------------------------------------
+    
+    public String execute()throws Exception
+    {
+        System.out.println( "Inside Generate DrillDown OrgUnit To Period Chart DataElement Result Action " );
+        
+        statementManager.initialise();
+        
+        selectedDrillDownData = new ArrayList<String>();//drillDown for periodWise
+        
+        selectedOptionComboList = new ArrayList<DataElementCategoryOptionCombo>();
+        
+        listTool = new ListTool();
+        
+        values = selDrillDownData.split( ":" );
+        
+        int orgunit =Integer.parseInt( values[0] );
+        int orgUnitGroup = Integer.parseInt( values[1]);
+        //System.out.println( " Group Id is " + orgUnitGroup );
+        if ( orgUnitGroup != 0 )
+        {
+            selectedOrgUnitGroup = organisationUnitGroupService.getOrganisationUnitGroup( orgUnitGroup );
+            //System.out.println( " Group Name is " + selectedOrgUnitGroup.getName() );
+        }
+        
+        selectedOrgUnit = organisationUnitService.getOrganisationUnit( orgunit );
+        
+        int dataElementid = Integer.parseInt( values[2] );
+        int optionComboid = Integer.parseInt( values[3] );
+        
+        dataElement = dataElementService.getDataElement( dataElementid );
+        //categoryCombo = dataElementCategoryOptionComboService.getDataElementCategoryOptionCombo( optionComboid );
+        DataElementCategoryOptionCombo categoryCombo = dataElementCategoryService.getDataElementCategoryOptionCombo( optionComboid );
+        
+        List<DataElement> dataElementList = new ArrayList<DataElement>();
+        dataElementList.add( dataElement ); 
+        
+        selectedOptionComboList.add( categoryCombo );
+        
+        String periodTypeLB = values[4];
+        
+        selStartPeriodList = new ArrayList<Date>();
+        selEndPeriodList = new ArrayList<Date>();
+        periodNames = new ArrayList<String>();
+        
+        //drillDownPeriodStartDate = values[5];
+        //drillDownPeriodEndDate = values[6];
+        drillDownPeriodNames = values[7];
+        
+        startDateArray = values[5].split( ";" );
+        //String startDateArray[] = startDateString.split(";");  
+        
+        for ( int i = 0 ; i < startDateArray.length ; i++ )
+        {
+            String startD = startDateArray[i];
+            selStartPeriodList.add( format.parseDate( startD ) );
+            //System.out.println( "Start date " + startD );
+        }
+        
+        //String endDateString = values[6];
+        endDateArray = values[6].split( ";" );
+        
+        for ( int i = 0 ; i < endDateArray.length ; i++ )
+        {
+            String startD = endDateArray[i];
+            selEndPeriodList.add( format.parseDate( startD ) );
+            //System.out.println( "End date " + startD );
+        }
+       // selStartPeriodList.add( format.parseDate( startD ) );
+        //selEndPeriodList.add( format.parseDate( endD ) );
+        
+        priodNameArray = values[7].split( ";" );
+        
+        for ( int i = 0 ; i < priodNameArray.length ; i++ )
+        {
+            String startD = priodNameArray[i];
+            periodNames.add( startD );
+        }
+        
+        
+        String deSelection = values[8];
+        String aggDataCB = values[9];
+        
+        //String drillDownData = orgUnit.getId() + ":"+ dataElement.getId() + ":"+ decoc.getId() + ":"  + periodType + ":" + tempStartDate + ":" + tempEndDate + ":" + deSelection + ":" + aggDataCB;
+        
+        System.out.println( selStartPeriodList + ":" + selEndPeriodList + ":" + periodTypeLB + ":" +  dataElementList+ ":" + deSelection + ":" + selectedOptionComboList +  ":" + selectedOrgUnit + ":" + aggDataCB );
+       // System.out.println( selStartPeriodList.size() + ":" + selEndPeriodList.size() );
+        System.out.println( "Chart Generation Start Time is for drillDown: \t" + new Date() );
+        
+        if( orgUnitGroup == 0 && ( categoryLB.equalsIgnoreCase( PERIODWISE )) ) 
+        {
+            int periodCount = 0;
+            for( Date startDate : selStartPeriodList )
+            {
+                Date endDate = selEndPeriodList.get( periodCount );
+                String tempStartDate = format.formatDate( startDate );
+                String tempEndDate   = format.formatDate( endDate );
+                String drillDownData = selectedOrgUnit.getId() + ":" + "0" + ":" + dataElement.getId() + ":"+ categoryCombo.getId() + ":"  + periodTypeLB + ":" + tempStartDate + ":" + tempEndDate + ":" + drillDownPeriodNames + ":" + deSelection + ":" + aggDataCB;
+                selectedDrillDownData.add( drillDownData );
+                periodCount++;
+            }
+            //System.out.println( "hhhiiiiiiiiiiiiii-------------hhhhhhhhhh" );
+            
+        }
+          
+        if( orgUnitGroup != 0 && ( categoryLB.equalsIgnoreCase( PERIODWISE )) ) 
+        {
+            int periodCount = 0;
+            for( Date startdate : selStartPeriodList )
+            {
+                Date endDate = selEndPeriodList.get( periodCount );
+                String tempStartDate = format.formatDate( startdate );
+                String tempEndDate   = format.formatDate( endDate );
+                String drillDownData = selectedOrgUnit.getId() + ":" + "0" + ":" + dataElement.getId() + ":"+ categoryCombo.getId() + ":"  + periodTypeLB + ":" + tempStartDate + ":" + tempEndDate + ":" + drillDownPeriodNames + ":" + deSelection + ":" + aggDataCB;
+                selectedDrillDownData.add( drillDownData );
+                periodCount++;
+            }
+        }
+        
+        
+        if( orgUnitGroup != 0 )
+        //if( orgUnitGroup != 0 && categoryLB.equalsIgnoreCase( SELECTED ) )
+        {
+            //System.out.println( "Inside the method when orgUnit view by selected and group checked" );
+            dataElementChartResult = dashBoardService.generateChartDataWithGroupToPeriodWise( selStartPeriodList, selEndPeriodList, periodNames ,periodTypeLB, dataElementList, deSelection, selectedOptionComboList, selectedOrgUnit, selectedOrgUnitGroup ,aggDataCB );
+        }
+        else
+        {
+            dataElementChartResult = dashBoardService.generateChartDataWithPeriodWise( selStartPeriodList, selEndPeriodList,periodNames, periodTypeLB, dataElementList, deSelection, selectedOptionComboList, selectedOrgUnit, aggDataCB );
+        }
+        
+        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 drillDown : \t" + new Date() );
+        
+        statementManager.destroy();
+        return SUCCESS;
+    }
+
+    
+}
+
+

=== added file 'local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/ga/action/charts/GenerateDrillDownPeriodToOrgChildChartDataElementResultAction.java'
--- local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/ga/action/charts/GenerateDrillDownPeriodToOrgChildChartDataElementResultAction.java	1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/ga/action/charts/GenerateDrillDownPeriodToOrgChildChartDataElementResultAction.java	2011-01-07 05:45:11 +0000
@@ -0,0 +1,394 @@
+/*
+ * Copyright (c) 2004-2010, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ *   list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ *   this list of conditions and the following disclaimer in the documentation
+ *   and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ *   be used to endorse or promote products derived from this software without
+ *   specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.hisp.dhis.dataanalyser.ga.action.charts;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSession;
+
+import org.amplecode.quick.StatementManager;
+import org.apache.struts2.ServletActionContext;
+import org.apache.velocity.tools.generic.ListTool;
+import org.hisp.dhis.dataanalyser.util.DashBoardService;
+import org.hisp.dhis.dataanalyser.util.DataElementChartResult;
+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.OrganisationUnitGroup;
+import org.hisp.dhis.organisationunit.OrganisationUnitGroupService;
+import org.hisp.dhis.organisationunit.OrganisationUnitService;
+
+import com.opensymphony.xwork2.Action;
+import com.opensymphony.xwork2.ActionContext;
+
+/**
+ * @author Mithilesh Kumar Thakur
+ *
+ * @version GenerateDrillDownPeriodToOrgChildChartDataElementResultAction.java Dec 30, 2010 1:07:30 PM
+ */
+public class GenerateDrillDownPeriodToOrgChildChartDataElementResultAction 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 )
+    {
+        this.statementManager = statementManager;
+    }
+    
+    private DashBoardService dashBoardService;
+
+    public void setDashBoardService( DashBoardService dashBoardService )
+    {
+        this.dashBoardService = dashBoardService;
+    }
+
+    private DataElementService dataElementService;
+
+    public void setDataElementService( DataElementService dataElementService )
+    {
+        this.dataElementService = dataElementService;
+    }
+
+    private DataElementCategoryService dataElementCategoryService;
+
+    public void setDataElementCategoryService( DataElementCategoryService dataElementCategoryService )
+    {
+        this.dataElementCategoryService = dataElementCategoryService;
+    }
+    
+    private OrganisationUnitService organisationUnitService;
+
+    public OrganisationUnitService getOrganisationUnitService()
+    {
+        return organisationUnitService;
+    }
+
+    public void setOrganisationUnitService( OrganisationUnitService organisationUnitService )
+    {
+        this.organisationUnitService = organisationUnitService;
+    }
+    
+    private OrganisationUnitGroupService organisationUnitGroupService;
+    
+    public void setOrganisationUnitGroupService( OrganisationUnitGroupService organisationUnitGroupService )
+    {
+        this.organisationUnitGroupService = organisationUnitGroupService;
+    }
+
+    // -------------------------------------------------------------------------
+    // Input/output
+    // -------------------------------------------------------------------------
+    
+
+    private I18nFormat format;
+
+    public void setFormat( I18nFormat format )
+    {
+        this.format = format;
+    }
+    
+    private String selDrillDownData;
+    
+    public void setSelDrillDownData( String selDrillDownData )
+    {
+        this.selDrillDownData = selDrillDownData;
+    }
+
+    public String[] values;
+    
+    ListTool listTool;
+
+    public ListTool getListTool()
+    {
+        return listTool;
+    }
+    
+    private DataElementChartResult dataElementChartResult;
+    
+    public DataElementChartResult getDataElementChartResult()
+    {
+        return dataElementChartResult;
+    }
+    
+    private List<DataElementCategoryOptionCombo> selectedOptionComboList;
+    
+    private OrganisationUnit selectedOrgUnit;
+    
+    private OrganisationUnitGroup selectedOrgUnitGroup;
+
+    private DataElement dataElement;
+
+    //private DataElementCategoryOptionCombo categoryCombo;
+    
+    private HttpSession session;
+
+    public HttpSession getSession()
+    {
+        return session;
+    }
+    
+    private List<Date> selStartPeriodList;
+
+    private List<Date> selEndPeriodList;
+    
+    private String selectedButton;
+    
+    public String getSelectedButton()
+    {
+        return selectedButton;
+    }
+
+    public void setSelectedButton( String selectedButton )
+    {
+        this.selectedButton = selectedButton;
+    }
+    
+    public String[] startDateArray;
+    public String[] endDateArray;
+    public String[] priodNameArray;
+    
+    private  List<String> periodNames;
+    
+    private String categoryLB;
+
+    public void setCategoryLB( String categoryLB )
+    {
+        this.categoryLB = categoryLB;
+    }
+
+    public String getCategoryLB()
+    {
+        return categoryLB;
+    }
+    private List<String> selectedDrillDownData;
+    
+    public List<String> getSelectedDrillDownData()
+    {
+        return selectedDrillDownData;
+    }
+    
+    private String drillDownPeriodStartDate;
+    private String drillDownPeriodEndDate;
+    private String drillDownPeriodNames;
+    
+    /*
+    private String aggDataCB;
+    
+    public void setAggDataCB( String aggDataCB )
+    {
+        this.aggDataCB = aggDataCB;
+    }
+    
+    public String getAggDataCB()
+    {
+        return aggDataCB;
+    }
+    */
+    
+    // -------------------------------------------------------------------------
+    // Action implements
+    // -------------------------------------------------------------------------
+    
+    public String execute()throws Exception
+    {
+        
+        statementManager.initialise();
+        
+        selectedDrillDownData = new ArrayList<String>();//drillDown for periodWise
+        
+        selectedOptionComboList = new ArrayList<DataElementCategoryOptionCombo>();
+        
+        listTool = new ListTool();
+        
+        
+        
+        values = selDrillDownData.split( ":" );
+        
+        int orgunit =Integer.parseInt( values[0] );
+        int orgUnitGroup = Integer.parseInt( values[1]);
+        //System.out.println( " Group Id is " + orgUnitGroup );
+        if ( orgUnitGroup != 0 )
+        {
+            selectedOrgUnitGroup = organisationUnitGroupService.getOrganisationUnitGroup( orgUnitGroup );
+            //System.out.println( " Group Name is " + selectedOrgUnitGroup.getName() );
+        }
+        
+        selectedOrgUnit = organisationUnitService.getOrganisationUnit( orgunit );
+        
+        int dataElementid = Integer.parseInt( values[2] );
+        int optionComboid = Integer.parseInt( values[3] );
+        
+        dataElement = dataElementService.getDataElement( dataElementid );
+        //categoryCombo = dataElementCategoryOptionComboService.getDataElementCategoryOptionCombo( optionComboid );
+        DataElementCategoryOptionCombo categoryCombo = dataElementCategoryService.getDataElementCategoryOptionCombo( optionComboid );
+        
+        List<DataElement> dataElementList = new ArrayList<DataElement>();
+        dataElementList.add( dataElement ); 
+        
+        selectedOptionComboList.add( categoryCombo );
+        
+        String periodTypeLB = values[4];
+       // String startD = values[5];
+        //String endD = values[6];
+        
+        selStartPeriodList = new ArrayList<Date>();
+        selEndPeriodList = new ArrayList<Date>();
+        periodNames = new ArrayList<String>();
+        
+        drillDownPeriodStartDate = values[5];
+        drillDownPeriodEndDate = values[6];
+        drillDownPeriodNames = values[7];
+        
+        
+        
+        startDateArray = values[5].split( ";" );
+        //String startDateArray[] = startDateString.split(";");  
+        
+        for ( int i = 0 ; i < startDateArray.length ; i++ )
+        {
+            String startD = startDateArray[i];
+            selStartPeriodList.add( format.parseDate( startD ) );
+           // System.out.println( "Start date " + startD );
+        }
+        
+        //String endDateString = values[6];
+        endDateArray = values[6].split( ";" );
+        
+        for ( int i = 0 ; i < endDateArray.length ; i++ )
+        {
+            String startD = endDateArray[i];
+            selEndPeriodList.add( format.parseDate( startD ) );
+           // System.out.println( "End date " + startD );
+        }
+       // selStartPeriodList.add( format.parseDate( startD ) );
+        //selEndPeriodList.add( format.parseDate( endD ) );
+        
+        priodNameArray = values[7].split( ";" );
+        
+        for ( int i = 0 ; i < priodNameArray.length ; i++ )
+        {
+            String periodName = priodNameArray[i];
+            periodNames.add( periodName );
+        }
+       // selStartPeriodList.add( format.parseDate( startD ) );
+        //selEndPeriodList.add( format.parseDate( endD ) );
+        
+        String deSelection = values[8];
+        String aggDataCB = values[9];
+        
+        //String drillDownData = orgUnit.getId() + ":"+ dataElement.getId() + ":"+ decoc.getId() + ":"  + periodType + ":" + tempStartDate + ":" + tempEndDate + ":" + deSelection + ":" + aggDataCB;
+        
+        System.out.println( selStartPeriodList + ":" + selEndPeriodList + ":" +periodTypeLB + ":" +  dataElementList+ ":" + deSelection + ":" + selectedOptionComboList +  ":" + selectedOrgUnit + ":" + aggDataCB );
+        System.out.println( "Chart Generation Start Time is for drillDown: \t" + new Date() );
+        
+        if( orgUnitGroup == 0 && ( categoryLB.equalsIgnoreCase( CHILDREN ) || ( categoryLB.equalsIgnoreCase( SELECTED )) )) 
+        {
+           List<OrganisationUnit> childOrgUnitList = new ArrayList<OrganisationUnit>();
+           childOrgUnitList = new ArrayList<OrganisationUnit>( selectedOrgUnit.getChildren());
+           
+           for( OrganisationUnit orgChild : childOrgUnitList )
+           {
+               String drillDownData = orgChild.getId() + ":" + "0" + ":" + dataElement.getId() + ":"+ categoryCombo.getId() + ":"  + periodTypeLB + ":" + drillDownPeriodStartDate + ":" + drillDownPeriodEndDate + ":" + drillDownPeriodNames + ":" + deSelection + ":" + aggDataCB;
+               selectedDrillDownData.add( drillDownData );
+           }
+        }
+       
+        if ( orgUnitGroup != 0 && ( categoryLB.equalsIgnoreCase( CHILDREN ) || ( categoryLB.equalsIgnoreCase( SELECTED )) )) 
+        {
+           // List<OrganisationUnit> childOrgUnitList = new ArrayList<OrganisationUnit>();
+            //childOrgUnitList = new ArrayList<OrganisationUnit>( selectedOrgUnit.getChildren());
+            
+            List<OrganisationUnit> selectedOUGroupMemberList = new ArrayList<OrganisationUnit>( selectedOrgUnitGroup.getMembers() );
+            
+            List<OrganisationUnit> childOrgUnitList = new ArrayList<OrganisationUnit>();
+            childOrgUnitList = new ArrayList<OrganisationUnit>( organisationUnitService.getOrganisationUnitWithChildren( selectedOrgUnit.getId() ) );
+           
+            selectedOUGroupMemberList.retainAll( childOrgUnitList );
+            
+           for( OrganisationUnit orgChild : selectedOUGroupMemberList )
+           {
+                String drillDownData = orgChild.getId() + ":" + selectedOrgUnitGroup.getId() + ":" + dataElement.getId() + ":"+ categoryCombo.getId() + ":"  + periodTypeLB + ":" + drillDownPeriodStartDate + ":" + drillDownPeriodEndDate + ":" + drillDownPeriodNames + ":" + deSelection + ":" + aggDataCB;
+                selectedDrillDownData.add( drillDownData );
+           }
+            
+        }
+/*
+        if ( orgUnitGroup != 0 &&  categoryLB.equals( SELECTED ) )
+           {
+               String drillDownData = selectedOrgUnit.getId() + ":" + selectedOrgUnitGroup.getId() + ":" + dataElement.getId() + ":"+ categoryCombo.getId() + ":"  + periodTypeLB + ":" + drillDownPeriodStartDate + ":" + drillDownPeriodEndDate + ":" + drillDownPeriodNames + ":" + deSelection + ":" + aggDataCB;
+               selectedDrillDownData.add( drillDownData );
+            
+           }
+            
+*/       
+        if ( orgUnitGroup != 0 )
+        {
+            dataElementChartResult = dashBoardService.generateChartDataWithGroupMemberWise( selStartPeriodList, selEndPeriodList, periodTypeLB, dataElementList, deSelection, selectedOptionComboList, selectedOrgUnit, selectedOrgUnitGroup ,aggDataCB );
+        }
+        else
+        {
+            dataElementChartResult = dashBoardService.generateChartDataWithChildrenWise( selStartPeriodList, selEndPeriodList, periodTypeLB, dataElementList, deSelection, selectedOptionComboList, selectedOrgUnit, aggDataCB );
+        }
+
+        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 drillDown : \t" + new Date() );
+        
+        statementManager.destroy();
+        return SUCCESS;
+    }
+
+    
+}

=== modified file 'local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/util/DashBoardService.java'
--- local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/util/DashBoardService.java	2010-12-29 16:17:28 +0000
+++ local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/util/DashBoardService.java	2011-01-07 05:45:11 +0000
@@ -37,8 +37,16 @@
 import java.util.List;
 import java.util.UUID;
 
+import org.hisp.dhis.aggregation.AggregationService;
+import org.hisp.dhis.dataelement.DataElement;
+import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
+import org.hisp.dhis.dataelement.DataElementCategoryService;
+import org.hisp.dhis.datavalue.DataValue;
+import org.hisp.dhis.datavalue.DataValueService;
 import org.hisp.dhis.indicator.Indicator;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.organisationunit.OrganisationUnitGroup;
+import org.hisp.dhis.organisationunit.OrganisationUnitService;
 import org.hisp.dhis.period.Period;
 import org.hisp.dhis.period.PeriodService;
 import org.hisp.dhis.period.PeriodType;
@@ -46,6 +54,8 @@
 
 public class DashBoardService
 {
+    private final String OPTIONCOMBO = "optioncombo";
+    
     // -------------------------------------------------------------------------
     // Dependencies
     // -------------------------------------------------------------------------
@@ -63,7 +73,34 @@
       {
           this.reportservice = reportservice;
       }
-
+    
+    private AggregationService aggregationService;
+
+    public void setAggregationService( AggregationService aggregationService )
+    {
+        this.aggregationService = aggregationService;
+    }
+
+    private DataValueService dataValueService;
+
+    public void setDataValueService( DataValueService dataValueService )
+    {
+        this.dataValueService = dataValueService;
+    }
+    
+    private DataElementCategoryService dataElementCategoryService;
+
+    public void setDataElementCategoryService( DataElementCategoryService dataElementCategoryService )
+    {
+        this.dataElementCategoryService = dataElementCategoryService;
+    }
+    private OrganisationUnitService organisationUnitService;
+
+    public void setOrganisationUnitService( OrganisationUnitService organisationUnitService )
+    {
+        this.organisationUnitService = organisationUnitService;
+    }
+    
     /*
     private DBConnection dbConnection;
 
@@ -726,4 +763,509 @@
         return aggregatedValue;
     }
 
+    // -------------------------------------------------------------------------
+    // Methods for getting Chart Data With Children Wise start ( this method is called when view by -> periodWise and group not selected )
+    // -------------------------------------------------------------------------
+        
+ 
+    public DataElementChartResult generateChartDataWithChildrenWise( List<Date> selStartPeriodList,List<Date> selEndPeriodList,String  periodTypeLB ,List<DataElement> dataElementList, String deSelection, List<DataElementCategoryOptionCombo> decocList, OrganisationUnit selectedOrgUnit , String aggDataCB ) throws Exception
+    {
+       System.out.println( "inside Dashboard Service generateChartDataWithChildrenWise " );
+        
+       DataElementChartResult dataElementChartResult;
+       
+       List<OrganisationUnit> childOrgUnitList = new ArrayList<OrganisationUnit>();
+       childOrgUnitList = new ArrayList<OrganisationUnit>( selectedOrgUnit.getChildren());
+       
+       
+       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 chartTitle = "OrganisationUnit : " + orgUnit.getShortName();
+       String xAxis_Title = "Facilities";
+       String yAxis_Title = "Value";
+    
+      // System.out.println("\n\n +++ \n decoc : " + decocList);
+       
+       int serviceCount = 0;     
+     
+       for( DataElement dataElement : dataElementList )
+       {
+           DataElementCategoryOptionCombo decoc;
+          
+           if ( deSelection.equalsIgnoreCase( OPTIONCOMBO ) )
+           
+          // if( dataElement.isMultiDimensional() )               
+           {
+               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();
+               
+               Double aggDataValue = 0.0;
+
+               int periodCount = 0;
+               for( Date startDate : selStartPeriodList )
+               {
+                   Date endDate = selEndPeriodList.get( periodCount );
+                   PeriodType periodType = periodService.getPeriodTypeByName( periodTypeLB );
+                   //Collection<Period> periods = periodService.getPeriodsBetweenDates( periodType, startDate, endDate );
+                   Collection<Period> periods = periodService.getPeriodsBetweenDates( startDate, endDate );
+                   
+                   System.out.println( periods.size() + ":" + periodType + ":" + startDate + ":" +  endDate );
+                   
+                  // for( Period period : periods )
+                  // {
+                      // System.out.println( dataElement + ":" + decoc + ":" +period.getStartDate() + ":" +  period.getEndDate()+ ":" + orgChild + ":" + aggDataCB );
+                       
+                      // if( aggDataCB != null )
+                       int aggChecked = Integer.parseInt( aggDataCB );
+                   
+                       if( aggChecked == 1 )
+                       {
+                           //System.out.println( "inside aggDataCB check  : " );
+                           Double tempAggDataValue = aggregationService.getAggregatedDataValue( dataElement, decoc, startDate, endDate, orgChild );
+                           //System.out.println( dataElement + ":" + decoc + ":" +period.getStartDate() + ":" +  period.getEndDate()+ ":" + orgChild );
+                          
+                           if( tempAggDataValue != null ) aggDataValue += tempAggDataValue;
+                           //System.out.println( "Agg data value after zero assign is aggDataCB check  : " + aggDataValue );
+                       }
+                       else
+                       {
+                           for( Period period : periods )
+                           {
+                               //System.out.println( "inside aggDataCB not check  : " );
+                               DataValue dataValue = dataValueService.getDataValue( orgChild, dataElement, period, decoc );
+                               
+                               try
+                               {
+                                   aggDataValue += Double.parseDouble( dataValue.getValue() );
+                               }
+                               catch( Exception e )
+                               {
+                                   
+                               }
+                               
+                           }
+                         
+                           //System.out.println( "Agg data value after zero assign is when aggDataCB not check  : " + aggDataValue );
+                       }
+                  // }
+                   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 Children Wise end
+    // -------------------------------------------------------------------------
+        
+    
+    
+    // -------------------------------------------------------------------------
+    // Methods for getting Chart Data With groupMember Wise start ( this method is called when view by -> periodWise and group  selected )
+    // -------------------------------------------------------------------------
+        
+ 
+    public DataElementChartResult generateChartDataWithGroupMemberWise( List<Date> selStartPeriodList,List<Date> selEndPeriodList,String  periodTypeLB ,List<DataElement> dataElementList, String deSelection, List<DataElementCategoryOptionCombo> decocList, OrganisationUnit selectedOrgUnit , OrganisationUnitGroup selectedOrgUnitGroup , String aggDataCB ) throws Exception
+    {
+        System.out.println( "inside Dashboard Service generateChartDataWithGroupMemberWise " );
+        
+        DataElementChartResult dataElementChartResult;
+        
+        //OrganisationUnitGroup selOrgUnitGroup = organisationUnitGroupService.getOrganisationUnitGroup(  selectedOrgUnitGroup  );
+        
+        List<OrganisationUnit> selectedOUGroupMemberList = new ArrayList<OrganisationUnit>( selectedOrgUnitGroup.getMembers() );
+       
+        List<OrganisationUnit> childOrgUnitList = new ArrayList<OrganisationUnit>();
+        childOrgUnitList = new ArrayList<OrganisationUnit>( organisationUnitService.getOrganisationUnitWithChildren( selectedOrgUnit.getId() ) );
+       
+        selectedOUGroupMemberList.retainAll( childOrgUnitList );
+        
+       
+        String[] series = new String[dataElementList.size()];
+        String[] categories = new String[selectedOUGroupMemberList.size()];
+        Double[][] data = new Double[dataElementList.size()][selectedOUGroupMemberList.size()];
+        //String chartTitle = "OrganisationUnit : " + selectedOrgUnit.getShortName();
+        String chartTitle = "OrganisationUnit : " + selectedOrgUnit.getShortName()+ "(" + selectedOrgUnitGroup.getName() +  ")";
+       
+      // String chartTitle = "OrganisationUnit : " + orgUnit.getShortName();
+        String xAxis_Title = "Facilities";
+        String yAxis_Title = "Value";
+    
+        //System.out.println("size of children : " +childOrgUnitList.size() + ", Size og GroupMember : " + selectedOUGroupMemberList.size()+ ", size of CommomGroupMember : " + selectedOUGroupMemberList.size());
+       
+       int serviceCount = 0;     
+     
+       for( DataElement dataElement : dataElementList )
+       {
+           DataElementCategoryOptionCombo decoc;
+          
+           if ( deSelection.equalsIgnoreCase( OPTIONCOMBO ) )
+           
+          // if( dataElement.isMultiDimensional() )               
+           {
+               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 GroupMemberCount = 0;
+           for( OrganisationUnit orgUnit : selectedOUGroupMemberList )
+           {
+               categories[GroupMemberCount] = orgUnit.getName();
+               
+               Double aggDataValue = 0.0;
+
+               int periodCount = 0;
+               for( Date startDate : selStartPeriodList )
+               {
+                   Date endDate = selEndPeriodList.get( periodCount );
+                   //PeriodType periodType = periodService.getPeriodTypeByName( periodTypeLB );
+                   //Collection<Period> periods = periodService.getPeriodsBetweenDates( periodType, startDate, endDate );
+                   Collection<Period> periods = periodService.getPeriodsBetweenDates( startDate, endDate );
+                   
+                   //System.out.println( periods.size() + ":" + periodType + ":" + startDate + ":" +  endDate );
+                   
+                  // for( Period period : periods )
+                  // {
+                      // System.out.println( dataElement + ":" + decoc + ":" +period.getStartDate() + ":" +  period.getEndDate()+ ":" + orgChild + ":" + aggDataCB );
+                       
+                       int aggChecked = Integer.parseInt( aggDataCB );
+                   
+                       if( aggChecked == 1 )
+                       {
+                           //System.out.println( "inside aggDataCB check  : " );
+                           Double tempAggDataValue = aggregationService.getAggregatedDataValue( dataElement, decoc, startDate, endDate, orgUnit );
+                           //System.out.println( dataElement + ":" + decoc + ":" +period.getStartDate() + ":" +  period.getEndDate()+ ":" + orgChild );
+                          
+                           if( tempAggDataValue != null ) aggDataValue += tempAggDataValue;
+                           //System.out.println( "Agg data value after zero assign is aggDataCB check  : " + aggDataValue );
+                       }
+                       else
+                       {
+                           for( Period period : periods )
+                           {
+                               //System.out.println( "inside aggDataCB not check  : " );
+                               DataValue dataValue = dataValueService.getDataValue( orgUnit, dataElement, period, decoc );
+                               
+                               try
+                               {
+                                   aggDataValue += Double.parseDouble( dataValue.getValue() );
+                               }
+                               catch( Exception e )
+                               {
+                                   
+                               }
+                               
+                           }
+                         
+                           //System.out.println( "Agg data value after zero assign is when aggDataCB not check  : " + aggDataValue );
+                       }
+                  // }
+                   periodCount++;
+               }
+ 
+               data[serviceCount][GroupMemberCount] = aggDataValue;
+               
+               if( dataElement.getType().equalsIgnoreCase( DataElement.VALUE_TYPE_INT ) )
+               {
+                  if ( dataElement.getNumberType().equalsIgnoreCase( DataElement.VALUE_TYPE_INT ) )
+                  {
+                      data[serviceCount][GroupMemberCount] = Math.round( data[serviceCount][GroupMemberCount] * Math.pow( 10, 0 ) ) / Math.pow( 10, 0 );
+                  }
+                  else
+                  {
+                      data[serviceCount][GroupMemberCount] = Math.round( data[serviceCount][GroupMemberCount] * Math.pow( 10, 1 ) ) / Math.pow( 10, 1 );
+                  }
+               }
+               GroupMemberCount++;
+           }
+           
+           serviceCount++;          
+       }
+    
+       dataElementChartResult = new DataElementChartResult( series, categories, data, chartTitle, xAxis_Title, yAxis_Title );
+       return dataElementChartResult;
+    }
+    // -------------------------------------------------------------------------
+    // Methods for getting Chart Data With groupMember Wise end
+    // -------------------------------------------------------------------------
+    
+    // -------------------------------------------------------------------------
+    // Methods for getting Chart Data only Period Wise start ( this method is called when view by ->Selected + children and  Group not selected,and view by -> children and group selected )
+    // -------------------------------------------------------------------------
+    
+    
+    public DataElementChartResult generateChartDataWithPeriodWise( List<Date> selStartPeriodList,List<Date> selEndPeriodList,List<String> periodNames,String  periodTypeLB ,List<DataElement> dataElementList, String deSelection, List<DataElementCategoryOptionCombo> decocList, OrganisationUnit selectedOrgUnit , String aggDataCB ) throws Exception
+    {
+       DataElementChartResult dataElementChartResult;
+       
+       System.out.println( "inside Dashboard Service generate Chart Data With Period Wise " );
+       
+       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();
+       String xAxis_Title = "Time Line";
+       String yAxis_Title = "Value";
+    
+      // System.out.println("\n\n +++ \n decoc : " + decocList);
+       
+       int serviceCount = 0;     
+     
+     
+       for( DataElement dataElement : dataElementList )
+       {
+           DataElementCategoryOptionCombo decoc;
+           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();
+               //System.out.println( "selectedStatus  : " + selectedStatus );
+               //yseriesList.add( dataElement.getName() );
+           }
+           
+           int periodCount = 0;
+           for( Date startDate : selStartPeriodList )
+           {
+               Date endDate = selEndPeriodList.get( periodCount );
+               
+               categories[periodCount] = periodNames.get( periodCount );
+               //PeriodType periodType = periodService.getPeriodTypeByName( periodTypeLB );
+               
+               Double aggDataValue = 0.0;
+               int aggChecked = Integer.parseInt( aggDataCB );
+               
+               if( aggChecked == 1 )
+               {
+                   //System.out.println( "inside aggDataCB check  : " );
+                   aggDataValue = aggregationService.getAggregatedDataValue( dataElement, decoc, startDate, endDate, selectedOrgUnit );
+                   //System.out.println( "start Date is   : " + startDate + " , End date is : " + endDate );
+                   //System.out.println( "Agg data value before is  : " + aggDataValue );
+                   if(aggDataValue == null ) aggDataValue = 0.0;
+                   //System.out.println( "Agg data value after zero assign is  : " + aggDataValue );
+                   //System.out.println( "Agg data value after zero assign is aggDataCB check  : " + aggDataValue );
+               }
+               else
+               {
+                   //System.out.println( "inside aggDataCB not check  : " );
+                 //  PeriodType periodType = periodService.getPeriodTypeByName( periodTypeLB );
+                  // Collection<Period> periods = periodService.getPeriodsBetweenDates( periodType, startDate, endDate );
+                   Collection<Period> periods = periodService.getPeriodsBetweenDates( startDate, endDate );
+                   
+                  // System.out.println( periods.size() + ":"  + startDate + ":" +  endDate );
+                   for( Period period : periods )
+                   {
+                       DataValue dataValue = dataValueService.getDataValue( selectedOrgUnit, dataElement, period, decoc );
+                      
+                      // String values = orgUnit.getId() + ":"+ dataElement.getId() + ":"+ decoc.getId() + ":" + period.getId();
+                      // selectedValues.add(values);
+                       
+                      // System.out.println( "selectedValues  : " + selectedValues );
+                       
+                       try
+                       {
+                           aggDataValue += Double.parseDouble( dataValue.getValue() );
+                       }
+                       catch( Exception e )
+                       {
+                           
+                       }
+                      // System.out.println( "Agg data value after zero assign is when aggDataCB not check  : " + aggDataValue );
+                   }
+               }
+               
+               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 only Period Wise end
+    // -------------------------------------------------------------------------
+    
+    
+    // -------------------------------------------------------------------------
+    // Methods for getting Chart Data OrgGroup Period Wise start
+    // -------------------------------------------------------------------------
+       
+    public DataElementChartResult generateChartDataWithGroupToPeriodWise( List<Date> selStartPeriodList,List<Date> selEndPeriodList,List<String> periodNames,String  periodTypeLB ,List<DataElement> dataElementList, String deSelection, List<DataElementCategoryOptionCombo> decocList, OrganisationUnit selectedOrgUnit , OrganisationUnitGroup selectedOrgUnitGroup , String aggDataCB ) throws Exception
+    {
+       DataElementChartResult dataElementChartResult;
+       
+       List<OrganisationUnit> selectedOUGroupMemberList = new ArrayList<OrganisationUnit>( selectedOrgUnitGroup.getMembers() );
+       
+       List<OrganisationUnit> childOrgUnitList = new ArrayList<OrganisationUnit>();
+       childOrgUnitList = new ArrayList<OrganisationUnit>( organisationUnitService.getOrganisationUnitWithChildren( selectedOrgUnit.getId() ) );
+      
+       selectedOUGroupMemberList.retainAll( childOrgUnitList );
+
+       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()+ "(" + selectedOrgUnitGroup.getName() +  ")";
+       String xAxis_Title = "Time Line";
+       String yAxis_Title = "Value";
+       
+       
+       int serviceCount = 0;     
+     
+       for( DataElement dataElement : dataElementList )
+       {
+           DataElementCategoryOptionCombo decoc;
+          
+           if ( deSelection.equalsIgnoreCase( OPTIONCOMBO ) )
+           
+          // if( dataElement.isMultiDimensional() )               
+           {
+               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;
+               Collection<Period> periods = periodService.getPeriodsBetweenDates( startDate, endDate );
+                  
+               int orgGroupCount = 0;
+                       
+               for( OrganisationUnit orgUnit : selectedOUGroupMemberList )
+               {
+                   int aggChecked = Integer.parseInt( aggDataCB );
+                   if( aggChecked == 1 )
+                   {
+                       Double tempAggDataValue = aggregationService.getAggregatedDataValue( dataElement, decoc, startDate, endDate, orgUnit );
+                      // System.out.println( "Agg data value before is  : " + aggDataValue );
+                      
+                       if(tempAggDataValue != null ) aggDataValue = tempAggDataValue;
+                      // System.out.println( "Agg data value after zero assign is  : " + aggDataValue );
+                   }
+                   else
+                   {
+                       for( Period period : periods )
+                       {
+                           DataValue dataValue = dataValueService.getDataValue( orgUnit, dataElement, period, decoc );
+                           
+                           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 Period Wise end 
+    // -------------------------------------------------------------------------
+    
 } // class end

=== modified file 'local/in/dhis-web-dashboard/src/main/resources/META-INF/dhis/beans.xml'
--- local/in/dhis-web-dashboard/src/main/resources/META-INF/dhis/beans.xml	2010-12-29 16:17:28 +0000
+++ local/in/dhis-web-dashboard/src/main/resources/META-INF/dhis/beans.xml	2011-01-07 05:45:11 +0000
@@ -83,6 +83,36 @@
         <property name="configurationService" ref="org.hisp.dhis.config.ConfigurationService">
         </property>
     </bean>
+	<!-- DrillDown periodToOrgUnit Child/GroupMember -->
+	<bean id="org.hisp.dhis.dataanalyser.ga.action.charts.GenerateDrillDownPeriodToOrgChildChartDataElementResultAction" class="org.hisp.dhis.dataanalyser.ga.action.charts.GenerateDrillDownPeriodToOrgChildChartDataElementResultAction" scope="prototype">
+		<property name="statementManager" ref="statementManager"/>
+		<property name="dashBoardService" ref="org.hisp.dhis.dataanalyser.util.DashBoardService">
+		</property>
+		<property name="dataElementService" ref="org.hisp.dhis.dataelement.DataElementService">
+		</property>
+		<property name="dataElementCategoryService" ref="org.hisp.dhis.dataelement.DataElementCategoryService">
+		</property>
+		<property name="organisationUnitService" ref="org.hisp.dhis.organisationunit.OrganisationUnitService">
+		</property>
+		<property name="organisationUnitGroupService" ref="org.hisp.dhis.organisationunit.OrganisationUnitGroupService">
+		</property>
+	</bean>
+	<!-- DrillDown OrgUnitToPeriod Child/GroupMember -->
+	<bean id="org.hisp.dhis.dataanalyser.ga.action.charts.GenerateDrillDownOrgUnitToPeriodChartDataElementResultAction" class="org.hisp.dhis.dataanalyser.ga.action.charts.GenerateDrillDownOrgUnitToPeriodChartDataElementResultAction" scope="prototype">
+		
+		<property name="statementManager" ref="statementManager"/>
+		<property name="dashBoardService" ref="org.hisp.dhis.dataanalyser.util.DashBoardService">
+        </property>
+        <property name="dataElementService" ref="org.hisp.dhis.dataelement.DataElementService">
+        </property>
+        <property name="dataElementCategoryService" ref="org.hisp.dhis.dataelement.DataElementCategoryService">
+        </property>
+        <property name="organisationUnitService" ref="org.hisp.dhis.organisationunit.OrganisationUnitService">
+        </property>
+        <property name="organisationUnitGroupService" ref="org.hisp.dhis.organisationunit.OrganisationUnitGroupService">
+        </property>
+	</bean>
+	
 	
 <!-- Graphical Analyser DataElements End -->
 		
@@ -1070,6 +1100,14 @@
         </property>
 		<property name="reportservice" ref="org.hisp.dhis.reports.ReportService">
 		</property>
+		<property name="aggregationService" ref="org.hisp.dhis.aggregation.AggregationService">
+		</property>
+		<property name="dataValueService" ref="org.hisp.dhis.datavalue.DataValueService">
+		</property>
+		<property name="dataElementCategoryService" ref="org.hisp.dhis.dataelement.DataElementCategoryService">
+		</property>
+		<property name="organisationUnitService" ref="org.hisp.dhis.organisationunit.OrganisationUnitService">
+		</property>
     </bean>
 	
 	<!-- DashBoard Utilities DataElementChartResult-->

=== modified file 'local/in/dhis-web-dashboard/src/main/resources/struts.xml'
--- local/in/dhis-web-dashboard/src/main/resources/struts.xml	2010-12-29 07:47:36 +0000
+++ local/in/dhis-web-dashboard/src/main/resources/struts.xml	2011-01-07 05:45:11 +0000
@@ -67,6 +67,29 @@
                 <param name="bufferSize">1024</param>
             </result>
         </action>
+		<!-- DrillDown periodToOrgUnit Child/GroupMember -->
+		<action name="generatedrillDownPeriodToOrgChildChartDataElement" class="org.hisp.dhis.dataanalyser.ga.action.charts.GenerateDrillDownPeriodToOrgChildChartDataElementResultAction">
+			<result name="success" type="velocity">/popup.vm</result>
+			<param name="page">/dhis-web-dashboard/graphicalAnalysisDataElementResult.vm</param>
+			<param name="javascripts">../dhis-web-commons/ouwt/ouwt.js,../dhis-web-commons/lists/lists.js,javascript/ga.js,javascript/hashtable.js,javascript/gadataelement.js</param>
+			<param name="stylesheets">css/StylesForTags.css</param>
+			<interceptor-ref name="organisationUnitTreeStack"/>
+		</action>
+		<!-- DrillDown OrgUnitToPeriod Child/GroupMember -->
+		<action name="generatedrillDownOurUnitToPeriodChartDataElement" class="org.hisp.dhis.dataanalyser.ga.action.charts.GenerateDrillDownOrgUnitToPeriodChartDataElementResultAction">
+			<result name="success" type="velocity">/popup.vm</result>
+            <param name="page">/dhis-web-dashboard/graphicalAnalysisDataElementResult.vm</param>
+            <param name="javascripts">../dhis-web-commons/ouwt/ouwt.js,../dhis-web-commons/lists/lists.js,javascript/ga.js,javascript/hashtable.js,javascript/gadataelement.js</param>
+            <param name="stylesheets">css/StylesForTags.css</param>
+            <interceptor-ref name="organisationUnitTreeStack"/>
+		</action>
+		
+		
+		
+		
+		
+		
+		
 <!-- GraphicalAnalyser  DataElements end   --> 	
 			
 <!-- GraphicalAnalyser  Indicators -->

=== modified file 'local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/graphicalAnalysisDataElementResult.vm'
--- local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/graphicalAnalysisDataElementResult.vm	2010-12-07 05:07:09 +0000
+++ local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/graphicalAnalysisDataElementResult.vm	2011-01-07 05:45:11 +0000
@@ -6,6 +6,152 @@
     evt.target.href = "drillDownResult.action?selectedValues="+selVal;
   }
     
+	function drillDownPeriodToOrgChildResult(evt, selDrillDownData )
+	{
+	   
+	    //var aggDataCB = '$aggDataCB';
+	    var deSelection = '$deSelection';
+	    var selectedButton  = '$selectedButton';
+	    
+	    var viewBy = 'children';
+	    
+	    //alert( deSelection + ":" + selectedButton );
+	   
+	    //alert( selDrillDownData );
+	    
+	    var arugDetails = selDrillDownData.split(":");
+	    var orgUnitId = arugDetails[0];
+	    var orgUnitGroupId = arugDetails[1];
+	    var dataElementId = arugDetails[2];
+	    var categoryCombo = arugDetails[3];
+	    var periodTypeName = arugDetails[4];
+	    var startDate = arugDetails[5];
+	    
+	    var periodLB = startDate.split("-");
+	    var year = periodLB[0];
+	    var month = periodLB[1]
+	    
+	    var endDate = arugDetails[6];
+	    
+	    var aggDataCB = arugDetails[9];
+	    //alert( aggDataCB );
+	    
+	    //alert( orgUnitId + ","  + dataElementId + "," + categoryCombo + "," + periodTypeName + "," + startDate + "," + endDate + "," + year + "," + month );
+	   
+	    evt.target.href = "generatedrillDownPeriodToOrgChildChartDataElement.action?selDrillDownData="+selDrillDownData + "&selectedButton=" + selectedButton + "&categoryLB=" + viewBy + "&aggDataCB=" + aggDataCB;
+	   
+	   //evt.target.href = "generatedrillDownPeriodToChildChartDataElement.action?orgUnitListCB="+orgUnitId+"&periodTypeLB="+periodTypeName+"&selStartPeriodList="+startDate+"&selectedDataElements="+ dataElementId + "&categoryLB=children";
+	}
+
+    function drillDownOrgUnitToPeriodResult(evt, selDrillDownData )
+    {
+       
+        //var aggDataCB = '$aggDataCB';
+        var deSelection = '$deSelection';
+        var selectedButton  = '$selectedButton';
+        
+        var viewBy = 'period';
+        
+        //alert( viewBy );
+        var orgGroupChecked = '$ougGroupSetCB';
+       // alert( viewBy + ":" + orgGroupChecked );
+        
+        //alert( deSelection + ":" + selectedButton );
+       
+        //alert( selDrillDownData );
+        var arugDetails = selDrillDownData.split(":");
+        var orgUnitId = arugDetails[0];
+        var orgUnitGroupId = arugDetails[1];
+        var dataElementId = arugDetails[2];
+        var categoryCombo = arugDetails[3];
+        var periodTypeName = arugDetails[4];
+        var startDate = arugDetails[5];
+        var endDate = arugDetails[6];
+        
+        var periodLB = startDate.split(";");
+        var year = periodLB[0];
+        var month = periodLB[1]
+        
+        var periodName = arugDetails[7];
+        
+        var aggDataCB = arugDetails[9];
+        //alert( aggDataCB );
+        //alert( orgUnitId + "," + orgUnitGroupId + ","  + dataElementId + "," + categoryCombo + "," + periodTypeName + "," + startDate + "," + endDate + "," + periodName );
+        
+       // var radioButton = document.getElementById("riRadio").value;
+       
+       // var radioButton = document.getElementById("riRadio");
+        
+       // var ouRadioVal = $( "input[name='riRadio']:checked" ).val();
+        
+       // alert( ouRadioVal );
+        //if( ouRadioVal == "periodWiseDrillDown" )
+        //{
+            evt.target.href = "generatedrillDownOurUnitToPeriodChartDataElement.action?selDrillDownData="+selDrillDownData + "&selectedButton=" + selectedButton + "&categoryLB=" + viewBy + "&aggDataCB=" + aggDataCB;
+        //}
+        //else
+        //{
+                //evt.target.href = "generatedrillDownPeriodToOrgChildChartDataElement.action?selDrillDownData="+selDrillDownData + "&selectedButton=" + selectedButton;
+        //}
+        //var periodName = arugDetails[7];
+       // alert( orgUnitId + "," + orgUnitGroupId + ","  + dataElementId + "," + categoryCombo + "," + periodTypeName + "," + startDate + "," + endDate + "," + periodName );
+        //evt.target.href = "generatedrillDownOurUnitToPeriodChartDataElement.action?selDrillDownData="+selDrillDownData + "&selectedButton=" + selectedButton;
+    }
+
+    function drillDownOrgUnitGroupToPeriodResult(evt, selDrillDownData )
+    {
+       
+       // var aggDataCB = '$aggDataCB';
+        var deSelection = '$deSelection';
+        var selectedButton  = '$selectedButton';
+        
+        var viewBy = '$categoryLB';
+        var viewBy = 'period';
+        var orgGroupChecked = '$ougGroupSetCB';
+        //alert( viewBy + ":" + orgGroupChecked );
+        
+       // alert( deSelection + ":" + selectedButton );
+       
+       // alert( selDrillDownData );
+        var arugDetails = selDrillDownData.split(":");
+        var orgUnitId = arugDetails[0];
+        var orgUnitGroupId = arugDetails[1];
+        var dataElementId = arugDetails[2];
+        var categoryCombo = arugDetails[3];
+        var periodTypeName = arugDetails[4];
+        var startDate = arugDetails[5];
+        var endDate = arugDetails[6];
+        
+        var periodLB = startDate.split(";");
+        var year = periodLB[0];
+        var month = periodLB[1]
+        
+        var periodName = arugDetails[7];
+        
+        var aggDataCB = arugDetails[9];
+        //alert( aggDataCB );
+        alert( orgUnitId + "," + orgUnitGroupId + ","  + dataElementId + "," + categoryCombo + "," + periodTypeName + "," + startDate + "," + endDate + "," + periodName );
+
+        //var ouRadioVal = $( "input[name='riRadio']:checked" ).val();
+        
+        //alert( ouRadioVal );
+        //if( ouRadioVal == "periodWiseDrillDown" )
+        //{
+            evt.target.href = "generatedrillDownOurUnitToPeriodChartDataElement.action?selDrillDownData="+selDrillDownData + "&selectedButton=" + selectedButton + "&categoryLB=" + viewBy + "&aggDataCB=" + aggDataCB;
+        //}
+        //else
+        //{
+            // evt.target.href = "generatedrillDownPeriodToOrgChildChartDataElement.action?selDrillDownData="+selDrillDownData + "&selectedButton=" + selectedButton;
+       // }
+        
+        
+        
+        //var periodName = arugDetails[7];
+        //alert( orgUnitId + "," + orgUnitGroupId + ","  + dataElementId + "," + categoryCombo + "," + periodTypeName + "," + startDate + "," + endDate + "," + periodName );
+        //evt.target.href = "generatedrillDownOurUnitToPeriodChartDataElement.action?selDrillDownData="+selDrillDownData + "&selectedButton=" + selectedButton + "&categoryLB=" + viewBy;
+    }
+
+
 // Chart Display Option change start
 
   function chartTypeOptionChange(evt)
@@ -120,9 +266,17 @@
 <div align="right" class="NormalB">
     <table>
         <tr>
-			<td class="NormalB">
-			   #if($selectedButton.equals("ViewSummary"))
-			          
+       
+	<td class="NormalB">
+	   #if($selectedButton.equals("ViewSummary"))
+			<!-- <td class="NormalB">
+                 #if(  !$categoryLB.equals( "period" ) )
+                    <input type="radio" id="riRadio" name="riRadio" value="periodWiseDrillDown" checked>Period Wise Drill Down
+                    &nbsp;&nbsp;&nbsp;
+                    <input type="radio" id="riRadio" name="riRadio" value="childrenWiseDrillDown" >Children Wise Drill Down
+                    &nbsp;&nbsp;&nbsp;
+               #end 
+              </td> -->  
 			  <td class="NormalB"><a id="exportExcelAnchor2" name="exportExcelAnchor2" href="#" onclick="javascript:exportToExcelFunction2('yes')" target="_blank">Export To WorkBook</a></td>
 			  <td class="NormalB">&nbsp;&nbsp;
 			            <select id="chartDisplayOption" name="chartDisplayOption" onchange="getSortedListForSummary()">
@@ -136,7 +290,15 @@
 			 </td>
      </tr>      
      #else    
-     <tr>        
+     <tr>     
+     	<!--<td class="NormalB">
+	        #if(  !$categoryLB.equals( "period" ) )
+	        <input type="radio" id="riRadio" name="riRadio" value="periodWiseDrillDown" onclick="" checked>Period Wise Drill Down
+	        &nbsp;&nbsp;&nbsp;
+	        <input type="radio" id="riRadio" name="riRadio" value="childrenWiseDrillDown" onclick="" >Children Wise Drill Down
+	        &nbsp;&nbsp;&nbsp;
+	       #end 
+        </td>   -->
 		<td class="NormalB"><a id="exportExcelAnchor1" name="exportExcelAnchor1" href="#" onclick="javascript:exportToExcelFunction1('no')" target="_blank">Export To Excel</a></td>
 		<td class="NormalB">&nbsp;&nbsp;<!--<font face="Arial, Helvetica, sans-serif" color="#000000">-->
 		            <select id="chartTypeOption" name="chartTypeOption" onchange="chartTypeOptionChange(event)">
@@ -168,12 +330,14 @@
 		        #end
 		    </tr>      
 			    #set($count1 = 0)
-			    #set( $count3 = 0 )                      
+			    #set( $count3 = 0 )
+			    #set( $count4 = 0 )                   
 			    #foreach($onedataList in $dataElementChartResult.data)  
 			    <!--	#set( $dataElementList = $dataElementChartResult.series )-->
 			     <!--    #set( $dataElementList = $dataElementChartResult.getSeries() )-->
 		      <tr>
-		        <td class="TableHeadingCellStyles" style="border-style: dotted; border-width: 1">$yseriesList.get($count1)</td>
+		        <!--<td class="TableHeadingCellStyles" style="border-style: dotted; border-width: 1">$yseriesList.get($count1)</td>-->
+		            <td class="TableHeadingCellStyles" style="border-style: dotted; border-width: 1">$listTool.get( $dataElementChartResult.series, $count1 )</td>  
 		          <!--  <td class="TableHeadingCellStyles" style="border-style: dotted; border-width: 1">$dataElementChartResult.series[$count1]</td>-->
 		           #foreach($data in $onedataList)
 		          <!--  #if( $categoryLB.equals( "period" ) && !$ougSetCB && $riRadio.equals( "dataElementsRadio" ) && $selectedStatus.get($count3).equals("yes") )
@@ -183,6 +347,22 @@
 		            #if( $categoryLB.equals( "period" ) && !$ougGroupSetCB && $selectedStatus.get($count1).equals("yes") )
                          <td class="TableDataCellStyles" align="center" style="border-style: dotted; border-width: 1"><a href="#" onclick="javascript:drillDownResult( event, '$selectedValues.get($count3)' )" target="_blank">$data</a></td>                                    
                     #set( $count3 = $count3 + 1 ) 
+                    #elseif( $categoryLB.equals( "period" ) && !$ougGroupSetCB )
+                        <td class="TableDataCellStyles" align="center" style="border-style: dotted; border-width: 1"><a href="#" onclick="javascript:drillDownPeriodToOrgChildResult( event, '$selectedDrillDownData.get($count4)' )">$data</a></td></td>
+                    #set( $count4 = $count4 + 1 )
+                    #elseif( $categoryLB.equals( "period" ) && $ougGroupSetCB )
+                        <td class="TableDataCellStyles" align="center" style="border-style: dotted; border-width: 1"><a href="#" onclick="javascript:drillDownPeriodToOrgChildResult( event, '$selectedDrillDownData.get($count4)' )">$data</a></td></td>
+                    #set( $count4 = $count4 + 1 )
+                    #elseif( ( $categoryLB.equals( "children" ) || $categoryLB.equals( "random" )) && !$ougGroupSetCB )
+                        <td class="TableDataCellStyles" align="center" style="border-style: dotted; border-width: 1"><a href="#" onclick="javascript:drillDownOrgUnitToPeriodResult( event, '$selectedDrillDownData.get($count4)' )">$data</a></td></td>
+                    #set( $count4 = $count4 + 1 )
+                    #elseif( $categoryLB.equals( "children" ) && $ougGroupSetCB )
+                        <td class="TableDataCellStyles" align="center" style="border-style: dotted; border-width: 1"><a href="#" onclick="javascript:drillDownOrgUnitToPeriodResult( event, '$selectedDrillDownData.get($count4)' )">$data</a></td></td>
+                    #set( $count4 = $count4 + 1 )
+                    #elseif( $categoryLB.equals( "random" ) && $ougGroupSetCB )
+                        <td class="TableDataCellStyles" align="center" style="border-style: dotted; border-width: 1"><a href="#" onclick="javascript:drillDownOrgUnitGroupToPeriodResult( event, '$selectedDrillDownData.get($count4)' )">$data</a></td></td>
+                    #set( $count4 = $count4 + 1 )
+                   
                     #else
 		                <td class="TableDataCellStyles" align="center" style="border-style: dotted; border-width: 1">$data</td>
 		            #end