← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 3006: Applied patch from Tran. Implements data set reports for section and default forms. Great work.

 

------------------------------------------------------------
revno: 3006
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2011-03-11 13:35:11 +0100
message:
  Applied patch from Tran. Implements data set reports for section and default forms. Great work.
added:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/comparator/DataElementCategoryOptionComboNameComparator.java
  dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/dataset/action/GenerateDataSetReportAction.java
  dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/dataset/action/GenerateDefaultDataSetReportAction.java
  dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/dataset/action/GenerateSectionDataSetReportAction.java
  dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/previewDefaultDataSetReportForm.vm
  dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/previewSectionDataSetReportForm.vm
modified:
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/dataset/action/GenerateCustomDataSetReportAction.java
  dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/dataset/action/GetDataSetReportOptionsAction.java
  dhis-2/dhis-web/dhis-web-reporting/src/main/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-web/dhis-web-reporting/src/main/resources/struts.xml
  dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/dataSetReportForm.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
=== added file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/comparator/DataElementCategoryOptionComboNameComparator.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/comparator/DataElementCategoryOptionComboNameComparator.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/comparator/DataElementCategoryOptionComboNameComparator.java	2011-03-11 12:35:11 +0000
@@ -0,0 +1,45 @@
+package org.hisp.dhis.dataelement.comparator;
+
+/*
+ * 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.
+ */
+
+import java.util.Comparator;
+
+import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
+
+/**
+ * @author Chau Thu Tran
+ * @version $Id$
+ */
+public class DataElementCategoryOptionComboNameComparator
+    implements Comparator<DataElementCategoryOptionCombo>
+{
+    public int compare( DataElementCategoryOptionCombo categoryOptionCombo1, DataElementCategoryOptionCombo categoryOptionCombo2 )
+    {
+        return categoryOptionCombo1.getName().compareToIgnoreCase( categoryOptionCombo2.getName() );
+    }
+}

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/resources/META-INF/dhis/beans.xml	2011-03-03 06:16:22 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/resources/META-INF/dhis/beans.xml	2011-03-11 12:35:11 +0000
@@ -317,7 +317,6 @@
 			<ref bean="org.hisp.dhis.user.UserSettingService"/>
 		</property>
 		<property name="editorManager" ref="editorManager"/>
-					
 	</bean>
 	
 	<bean id="org.hisp.dhis.dataset.action.dataentryform.SaveDataEntryFormAction"

=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/dataset/action/GenerateCustomDataSetReportAction.java'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/dataset/action/GenerateCustomDataSetReportAction.java	2010-08-31 14:34:31 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/dataset/action/GenerateCustomDataSetReportAction.java	2011-03-11 12:35:11 +0000
@@ -31,13 +31,10 @@
 
 import org.hisp.dhis.dataentryform.DataEntryForm;
 import org.hisp.dhis.dataset.DataSet;
-import org.hisp.dhis.dataset.DataSetService;
 import org.hisp.dhis.datasetreport.DataSetReportService;
 import org.hisp.dhis.i18n.I18nFormat;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
-import org.hisp.dhis.oust.manager.SelectionTreeManager;
 import org.hisp.dhis.period.Period;
-import org.hisp.dhis.period.PeriodService;
 
 import com.opensymphony.xwork2.Action;
 
@@ -51,120 +48,101 @@
     // -------------------------------------------------------------------------
     // Dependencies
     // -------------------------------------------------------------------------
-            
+
     private DataSetReportService dataSetReportService;
 
-    public void setDataSetReportService( DataSetReportService dataSetReportService )
-    {
-        this.dataSetReportService = dataSetReportService;
-    }
-
-    private DataSetService dataSetService;
-
-    public void setDataSetService( DataSetService dataSetService )
-    {
-        this.dataSetService = dataSetService;
-    }
-
-    private PeriodService periodService;
-
-    public void setPeriodService( PeriodService periodService )
-    {
-        this.periodService = periodService;
-    }
-    
-    private SelectionTreeManager selectionTreeManager;
-
-    public void setSelectionTreeManager( SelectionTreeManager selectionTreeManager )
-    {
-        this.selectionTreeManager = selectionTreeManager;
-    }
-
     private I18nFormat format;
 
-    public void setFormat( I18nFormat format )
-    {
-        this.format = format;
-    }
-
     // -------------------------------------------------------------------------
     // Input
-    // -------------------------------------------------------------------------      
-    
-    private Integer dataSetId;
-    
-    public void setDataSetId( Integer dataSetId )
-    {
-        this.dataSetId = dataSetId;
-    }
-
-    private String periodId;
-
-    public void setPeriodId( String periodId )
-    {
-        this.periodId = periodId;
-    }
+    // -------------------------------------------------------------------------
+
+    private OrganisationUnit selectedOrgunit;
+
+    private DataSet selectedDataSet;
+
+    private Period selectedPeriod;
 
     private boolean selectedUnitOnly;
-    
-    public void setSelectedUnitOnly( boolean selectedUnitOnly )
-    {
-        this.selectedUnitOnly = selectedUnitOnly;
-    }
-    
+
     // -------------------------------------------------------------------------
     // Output
-    // -------------------------------------------------------------------------      
-    
+    // -------------------------------------------------------------------------
+
     private String customDataEntryFormCode;
 
+    private String reportingUnit;
+
+    private String reportingPeriod;
+
+    // -----------------------------------------------------------------------
+    // Getters && Setters
+    // -----------------------------------------------------------------------
+    
+    public void setDataSetReportService( DataSetReportService dataSetReportService )
+    {
+        this.dataSetReportService = dataSetReportService;
+    }
+
+    public void setFormat( I18nFormat format )
+    {
+        this.format = format;
+    }
+
     public String getCustomDataEntryFormCode()
     {
-        return this.customDataEntryFormCode;
+        return customDataEntryFormCode;
     }
-    
-    private String reportingUnit;
-    
+
     public String getReportingUnit()
     {
-    	return this.reportingUnit;
+        return reportingUnit;
     }
-    
-    private String reportingPeriod;
-    
+
     public String getReportingPeriod()
     {
-    	return this.reportingPeriod;
-    }  
-   
+        return reportingPeriod;
+    }
+
+    public void setSelectedOrgunit( OrganisationUnit selectedOrgunit )
+    {
+        this.selectedOrgunit = selectedOrgunit;
+    }
+
+    public void setSelectedDataSet( DataSet selectedDataSet )
+    {
+        this.selectedDataSet = selectedDataSet;
+    }
+
+    public void setSelectedPeriod( Period selectedPeriod )
+    {
+        this.selectedPeriod = selectedPeriod;
+    }
+
+    public void setSelectedUnitOnly( boolean selectedUnitOnly )
+    {
+        this.selectedUnitOnly = selectedUnitOnly;
+    }
+
     // -----------------------------------------------------------------------
     // Action implementation
     // -----------------------------------------------------------------------
-    
+
     public String execute()
         throws Exception
-    {        
-        OrganisationUnit unit = selectionTreeManager.getSelectedOrganisationUnit();
-        
-        DataSet dataSet = dataSetService.getDataSet( dataSetId );
-
-        Period period = periodService.getPeriodByExternalId( periodId );
-        
-        if ( unit != null && dataSet != null && period != null )
-        {
-            Map<String, String> aggregatedDataValueMap = dataSetReportService.getAggregatedValueMap( dataSet, unit, period, selectedUnitOnly );
-            
-            DataEntryForm dataEntryForm = dataSet.getDataEntryForm();
-            
-            customDataEntryFormCode = dataSetReportService.prepareReportContent( dataEntryForm.getHtmlCode(), aggregatedDataValueMap );
-            
-            reportingUnit = unit.getName();
-            
-            reportingPeriod = format.formatPeriod( period );
-           
-            return SUCCESS;           	
-        }
-        
-        return ERROR;
+    {
+        Map<String, String> aggregatedDataValueMap = dataSetReportService.getAggregatedValueMap( selectedDataSet, selectedOrgunit, selectedPeriod,
+            selectedUnitOnly );
+
+        DataEntryForm dataEntryForm = selectedDataSet.getDataEntryForm();
+
+        customDataEntryFormCode = dataSetReportService.prepareReportContent( dataEntryForm.getHtmlCode(),
+            aggregatedDataValueMap );
+
+        reportingUnit = selectedOrgunit.getName();
+
+        reportingPeriod = format.formatPeriod( selectedPeriod );
+
+        return SUCCESS;
     }
 }

=== added file 'dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/dataset/action/GenerateDataSetReportAction.java'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/dataset/action/GenerateDataSetReportAction.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/dataset/action/GenerateDataSetReportAction.java	2011-03-11 12:35:11 +0000
@@ -0,0 +1,166 @@
+/*
+ * 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.reporting.dataset.action;
+
+import org.hisp.dhis.dataset.DataSet;
+import org.hisp.dhis.dataset.DataSetService;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.oust.manager.SelectionTreeManager;
+import org.hisp.dhis.period.Period;
+import org.hisp.dhis.period.PeriodService;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Chau Thu Tran
+ * @version $Id GenerateDataSetReportAction.java Mar 09, 2011 9:02:43 AM $
+ */
+public class GenerateDataSetReportAction
+    implements Action
+{
+    private final static String RESULT_CUSTOM = "customDataSetReport";
+    private final static String RESULT_SECTION = "sectionDataSetReport";
+    private final static String RESULT_DEFAULT = "defaultDataSetReport";
+    
+    // -------------------------------------------------------------------------
+    // Dependency
+    // -------------------------------------------------------------------------
+
+    private SelectionTreeManager selectionTreeManager;
+
+    private DataSetService dataSetService;
+
+    private PeriodService periodService;
+
+    // -------------------------------------------------------------------------
+    // Input
+    // -------------------------------------------------------------------------
+
+    private Integer dataSetId;
+
+    private String periodId;
+
+    private boolean selectedUnitOnly;
+
+    // -------------------------------------------------------------------------
+    // Output
+    // -------------------------------------------------------------------------
+
+    private OrganisationUnit selectedOrgunit;
+
+    private DataSet selectedDataSet;
+
+    private Period selectedPeriod;
+
+    // -------------------------------------------------------------------------
+    // Getters && Setters
+    // -------------------------------------------------------------------------
+
+    public Integer getDataSetId()
+    {
+        return dataSetId;
+    }
+
+    public boolean isSelectedUnitOnly()
+    {
+        return selectedUnitOnly;
+    }
+
+    public void setSelectedUnitOnly( boolean selectedUnitOnly )
+    {
+        this.selectedUnitOnly = selectedUnitOnly;
+    }
+
+    public void setSelectionTreeManager( SelectionTreeManager selectionTreeManager )
+    {
+        this.selectionTreeManager = selectionTreeManager;
+    }
+
+    public void setPeriodService( PeriodService periodService )
+    {
+        this.periodService = periodService;
+    }
+
+    public OrganisationUnit getSelectedOrgunit()
+    {
+        return selectedOrgunit;
+    }
+
+    public DataSet getSelectedDataSet()
+    {
+        return selectedDataSet;
+    }
+
+    public Period getSelectedPeriod()
+    {
+        return selectedPeriod;
+    }
+
+    public void setPeriodId( String periodId )
+    {
+        this.periodId = periodId;
+    }
+
+    public void setDataSetId( Integer dataSetId )
+    {
+        this.dataSetId = dataSetId;
+    }
+
+    public void setDataSetService( DataSetService dataSetService )
+    {
+        this.dataSetService = dataSetService;
+    }
+
+    // -------------------------------------------------------------------------
+    // Action implementation
+    // -------------------------------------------------------------------------
+
+    @Override
+    public String execute()
+        throws Exception
+    {
+        selectedOrgunit = selectionTreeManager.getSelectedOrganisationUnit();
+
+        if ( dataSetId == null || periodId == null || selectedOrgunit == null )
+        {
+            return ERROR;
+        }
+
+        selectedDataSet = dataSetService.getDataSet( dataSetId );
+
+        selectedPeriod = periodService.getPeriodByExternalId( periodId );
+
+        if ( selectedDataSet.hasDataEntryForm() )
+        {
+            return RESULT_CUSTOM;
+        }
+
+        return selectedDataSet.hasSections() ? RESULT_SECTION : RESULT_DEFAULT;
+
+    }
+}

=== added file 'dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/dataset/action/GenerateDefaultDataSetReportAction.java'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/dataset/action/GenerateDefaultDataSetReportAction.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/dataset/action/GenerateDefaultDataSetReportAction.java	2011-03-11 12:35:11 +0000
@@ -0,0 +1,286 @@
+package org.hisp.dhis.reporting.dataset.action;
+
+/*
+ * 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.
+ */
+
+import static org.hisp.dhis.options.SystemSettingManager.AGGREGATION_STRATEGY_REAL_TIME;
+import static org.hisp.dhis.options.SystemSettingManager.DEFAULT_AGGREGATION_STRATEGY;
+import static org.hisp.dhis.options.SystemSettingManager.KEY_AGGREGATION_STRATEGY;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.hisp.dhis.aggregation.AggregatedDataValueService;
+import org.hisp.dhis.aggregation.AggregationService;
+import org.hisp.dhis.common.Grid;
+import org.hisp.dhis.common.GridHeader;
+import org.hisp.dhis.dataelement.DataElement;
+import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
+import org.hisp.dhis.dataelement.comparator.DataElementCategoryOptionComboNameComparator;
+import org.hisp.dhis.dataset.DataSet;
+import org.hisp.dhis.datavalue.DataValue;
+import org.hisp.dhis.datavalue.DataValueService;
+import org.hisp.dhis.i18n.I18n;
+import org.hisp.dhis.i18n.I18nFormat;
+import org.hisp.dhis.options.SystemSettingManager;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.period.Period;
+import org.hisp.dhis.system.filter.AggregatableDataElementFilter;
+import org.hisp.dhis.system.grid.ListGrid;
+import org.hisp.dhis.system.util.FilterUtils;
+import org.hisp.dhis.system.util.MathUtils;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Chau Thu Tran
+ */
+public class GenerateDefaultDataSetReportAction
+    implements Action
+{
+    private static final String DEFAULT_HEADER = "Value";
+    
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
+
+    private DataValueService dataValueService;
+
+    private SystemSettingManager systemSettingManager;
+
+    private AggregatedDataValueService aggregatedDataValueService;
+
+    private AggregationService aggregationService;
+
+    // -------------------------------------------------------------------------
+    // Comparator
+    // -------------------------------------------------------------------------
+
+    private Comparator<DataElement> dataElementComparator;
+
+    public void setDataElementComparator( Comparator<DataElement> dataElementComparator )
+    {
+        this.dataElementComparator = dataElementComparator;
+    }
+
+    // -------------------------------------------------------------------------
+    // Input
+    // -------------------------------------------------------------------------
+
+    private OrganisationUnit selectedOrgunit;
+
+    private DataSet selectedDataSet;
+
+    private Period selectedPeriod;
+
+    private boolean selectedUnitOnly;
+
+    private I18nFormat format;
+
+    private I18n i18n;
+
+    // -------------------------------------------------------------------------
+    // Output
+    // -------------------------------------------------------------------------
+    
+    private Grid grid;
+
+    private String reportingUnit;
+
+    private String reportingPeriod;
+
+    // -------------------------------------------------------------------------
+    // Getters && Setters
+    // -------------------------------------------------------------------------
+
+    public void setAggregationService( AggregationService aggregationService )
+    {
+        this.aggregationService = aggregationService;
+    }
+
+    public void setSelectedOrgunit( OrganisationUnit selectedOrgunit )
+    {
+        this.selectedOrgunit = selectedOrgunit;
+    }
+
+    public void setSelectedDataSet( DataSet selectedDataSet )
+    {
+        this.selectedDataSet = selectedDataSet;
+    }
+
+    public void setSelectedPeriod( Period selectedPeriod )
+    {
+        this.selectedPeriod = selectedPeriod;
+    }
+
+    public String getReportingUnit()
+    {
+        return reportingUnit;
+    }
+
+    public String getReportingPeriod()
+    {
+        return reportingPeriod;
+    }
+
+    public void setI18n( I18n i18n )
+    {
+        this.i18n = i18n;
+    }
+
+    public void setFormat( I18nFormat format )
+    {
+        this.format = format;
+    }
+
+    public Grid getGrid()
+    {
+        return grid;
+    }
+
+    public void setAggregatedDataValueService( AggregatedDataValueService aggregatedDataValueService )
+    {
+        this.aggregatedDataValueService = aggregatedDataValueService;
+    }
+
+    public void setSystemSettingManager( SystemSettingManager systemSettingManager )
+    {
+        this.systemSettingManager = systemSettingManager;
+    }
+
+    public void setDataValueService( DataValueService dataValueService )
+    {
+        this.dataValueService = dataValueService;
+    }
+
+    public void setSelectedUnitOnly( boolean selectedUnitOnly )
+    {
+        this.selectedUnitOnly = selectedUnitOnly;
+    }
+
+    // -------------------------------------------------------------------------
+    // Action implementation
+    // -------------------------------------------------------------------------
+
+    public String execute()
+        throws Exception
+    {
+        List<DataElement> dataElements = new ArrayList<DataElement>( selectedDataSet.getDataElements() );
+
+        if ( dataElements.size() == 0 )
+        {
+            return SUCCESS;
+        }
+
+        Collections.sort( dataElements, dataElementComparator );
+        FilterUtils.filter( dataElements, new AggregatableDataElementFilter() );
+
+        String aggregationStrategy = (String) systemSettingManager.getSystemSetting( KEY_AGGREGATION_STRATEGY,
+            DEFAULT_AGGREGATION_STRATEGY );
+
+        // ---------------------------------------------------------------------
+        // Get the category-option-combos
+        // ---------------------------------------------------------------------
+
+        Set<DataElementCategoryOptionCombo> optionCombos = new HashSet<DataElementCategoryOptionCombo>();
+
+        for ( DataElement dataElement : dataElements )
+        {
+            optionCombos.addAll( dataElement.getCategoryCombo().getOptionCombos() );
+        }
+
+        List<DataElementCategoryOptionCombo> orderedOptionCombos = new ArrayList<DataElementCategoryOptionCombo>(
+            optionCombos );
+
+        Collections.sort( orderedOptionCombos, new DataElementCategoryOptionComboNameComparator() );
+
+        // ---------------------------------------------------------------------
+        // Create a GRID
+        // ---------------------------------------------------------------------
+
+        grid = new ListGrid().setTitle( selectedDataSet.getName() );
+        grid.setSubtitle( format.formatPeriod( selectedPeriod ) );
+
+        // ---------------------------------------------------------------------
+        // Headers for GRID
+        // ---------------------------------------------------------------------
+
+        grid.addHeader( new GridHeader( i18n.getString( "dataelement" ), false, true ) );
+         
+        for ( DataElementCategoryOptionCombo optionCombo : orderedOptionCombos )
+        {
+            grid.addHeader( new GridHeader( optionCombo.isDefault() ? DEFAULT_HEADER : optionCombo.getName(), false, false ) );
+        }
+
+        // ---------------------------------------------------------------------
+        // Values for GRID
+        // ---------------------------------------------------------------------
+
+        for ( DataElement dataElement : dataElements )
+        {
+            grid.addRow();
+
+            grid.addValue( dataElement.getName() );
+
+            for ( DataElementCategoryOptionCombo optionCombo : orderedOptionCombos )
+            {
+                String value = "";
+
+                if ( selectedUnitOnly )
+                {
+                    DataValue dataValue = dataValueService.getDataValue( selectedOrgunit, dataElement,
+                        selectedPeriod, optionCombo );
+                    value = (dataValue != null) ? dataValue.getValue() : null;
+                }
+                else
+                {
+                    Double aggregatedValue = aggregationStrategy.equals( AGGREGATION_STRATEGY_REAL_TIME ) ? aggregationService
+                        .getAggregatedDataValue( dataElement, optionCombo, selectedPeriod.getStartDate(),
+                            selectedPeriod.getEndDate(), selectedOrgunit )
+                        : aggregatedDataValueService.getAggregatedValue( dataElement, optionCombo, selectedPeriod,
+                            selectedOrgunit );
+
+                    value = (aggregatedValue != null) ? String.valueOf( MathUtils.getRounded( aggregatedValue, 0 ) )
+                        : null;
+                }
+
+                grid.addValue( value );
+
+            }
+        }
+
+        reportingUnit = selectedOrgunit.getName();
+
+        reportingPeriod = format.formatPeriod( selectedPeriod );
+
+        return SUCCESS;
+    }
+}

=== added file 'dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/dataset/action/GenerateSectionDataSetReportAction.java'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/dataset/action/GenerateSectionDataSetReportAction.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/dataset/action/GenerateSectionDataSetReportAction.java	2011-03-11 12:35:11 +0000
@@ -0,0 +1,292 @@
+package org.hisp.dhis.reporting.dataset.action;
+
+/*
+ * 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.
+ */
+
+import static org.hisp.dhis.options.SystemSettingManager.AGGREGATION_STRATEGY_REAL_TIME;
+import static org.hisp.dhis.options.SystemSettingManager.DEFAULT_AGGREGATION_STRATEGY;
+import static org.hisp.dhis.options.SystemSettingManager.KEY_AGGREGATION_STRATEGY;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.hisp.dhis.aggregation.AggregatedDataValueService;
+import org.hisp.dhis.aggregation.AggregationService;
+import org.hisp.dhis.common.Grid;
+import org.hisp.dhis.common.GridHeader;
+import org.hisp.dhis.dataelement.DataElement;
+import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
+import org.hisp.dhis.dataelement.comparator.DataElementCategoryOptionComboNameComparator;
+import org.hisp.dhis.dataset.DataSet;
+import org.hisp.dhis.dataset.Section;
+import org.hisp.dhis.dataset.comparator.SectionOrderComparator;
+import org.hisp.dhis.datavalue.DataValue;
+import org.hisp.dhis.datavalue.DataValueService;
+import org.hisp.dhis.i18n.I18n;
+import org.hisp.dhis.i18n.I18nFormat;
+import org.hisp.dhis.options.SystemSettingManager;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.period.Period;
+import org.hisp.dhis.system.filter.AggregatableDataElementFilter;
+import org.hisp.dhis.system.grid.ListGrid;
+import org.hisp.dhis.system.util.FilterUtils;
+import org.hisp.dhis.system.util.MathUtils;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Chau Thu Tran
+ */
+public class GenerateSectionDataSetReportAction
+    implements Action
+{
+    private static final String DEFAULT_HEADER = "Value";
+    
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
+
+    private DataValueService dataValueService;
+
+    private SystemSettingManager systemSettingManager;
+
+    private AggregatedDataValueService aggregatedDataValueService;
+
+    private AggregationService aggregationService;
+
+    // -------------------------------------------------------------------------
+    // Input
+    // -------------------------------------------------------------------------
+
+    private OrganisationUnit selectedOrgunit;
+
+    private DataSet selectedDataSet;
+
+    private Period selectedPeriod;
+
+    private boolean selectedUnitOnly;
+
+    private I18nFormat format;
+
+    private I18n i18n;
+
+    // -------------------------------------------------------------------------
+    // Output
+    // -------------------------------------------------------------------------
+    
+    private List<Grid> grids;
+
+    private String reportingUnit;
+
+    private String reportingPeriod;
+
+    // -------------------------------------------------------------------------
+    // Comparator
+    // -------------------------------------------------------------------------
+
+    private Comparator<DataElement> dataElementComparator;
+
+    public void setDataElementComparator( Comparator<DataElement> dataElementComparator )
+    {
+        this.dataElementComparator = dataElementComparator;
+    }
+
+    // -------------------------------------------------------------------------
+    // Getters && Setters
+    // -------------------------------------------------------------------------
+
+    public void setAggregationService( AggregationService aggregationService )
+    {
+        this.aggregationService = aggregationService;
+    }
+
+    public String getReportingUnit()
+    {
+        return reportingUnit;
+    }
+
+    public String getReportingPeriod()
+    {
+        return reportingPeriod;
+    }
+
+    public List<Grid> getGrids()
+    {
+        return grids;
+    }
+
+    public void setI18n( I18n i18n )
+    {
+        this.i18n = i18n;
+    }
+
+    public void setFormat( I18nFormat format )
+    {
+        this.format = format;
+    }
+
+    public void setAggregatedDataValueService( AggregatedDataValueService aggregatedDataValueService )
+    {
+        this.aggregatedDataValueService = aggregatedDataValueService;
+    }
+
+    public void setSystemSettingManager( SystemSettingManager systemSettingManager )
+    {
+        this.systemSettingManager = systemSettingManager;
+    }
+
+    public void setSelectedOrgunit( OrganisationUnit selectedOrgunit )
+    {
+        this.selectedOrgunit = selectedOrgunit;
+    }
+
+    public void setSelectedDataSet( DataSet selectedDataSet )
+    {
+        this.selectedDataSet = selectedDataSet;
+    }
+
+    public void setSelectedPeriod( Period selectedPeriod )
+    {
+        this.selectedPeriod = selectedPeriod;
+    }
+
+    public void setDataValueService( DataValueService dataValueService )
+    {
+        this.dataValueService = dataValueService;
+    }
+    
+    public void setSelectedUnitOnly( boolean selectedUnitOnly )
+    {
+        this.selectedUnitOnly = selectedUnitOnly;
+    }
+
+    // -------------------------------------------------------------------------
+    // Action implementation
+    // -------------------------------------------------------------------------
+
+    public String execute()
+        throws Exception
+    {
+        String aggregationStrategy = (String) systemSettingManager.getSystemSetting( KEY_AGGREGATION_STRATEGY,
+            DEFAULT_AGGREGATION_STRATEGY );
+
+        // ---------------------------------------------------------------------
+        // Get option-combo by sectionId
+        // ---------------------------------------------------------------------
+
+        List<Section> sections = new ArrayList<Section>( selectedDataSet.getSections() );
+
+        Collections.sort( sections, new SectionOrderComparator() );
+
+        Map<Integer, List<DataElementCategoryOptionCombo>> optionCombosMap = new HashMap<Integer, List<DataElementCategoryOptionCombo>>();
+
+        for ( Section section : sections )
+        {
+            List<DataElementCategoryOptionCombo> optionCombos = new ArrayList<DataElementCategoryOptionCombo>( section
+                .getDataElements().iterator().next().getCategoryCombo().getOptionCombos() );
+
+            Collections.sort( optionCombos, new DataElementCategoryOptionComboNameComparator() );
+
+            optionCombosMap.put( section.getId(), optionCombos );
+        }
+
+        // ---------------------------------------------------------------------
+        // Create a grid for each section
+        // ---------------------------------------------------------------------
+
+        grids = new ArrayList<Grid>();
+
+        for ( Section section : sections )
+        {
+            Grid grid = new ListGrid().setTitle( section.getName() );
+
+            List<DataElementCategoryOptionCombo> optionComnbos = optionCombosMap.get( section.getId() );
+
+            // ---------------------------------------------------------------------
+            // Headers for GRID
+            // ---------------------------------------------------------------------
+
+            grid.addHeader( new GridHeader( i18n.getString( "dataelement" ), false, true ) );
+
+            for ( DataElementCategoryOptionCombo optionCombo : optionComnbos )
+            {
+                grid.addHeader( new GridHeader( optionCombo.isDefault() ? DEFAULT_HEADER : optionCombo.getName(), false, false ) );
+            }
+
+            // ---------------------------------------------------------------------
+            // Values for GRID
+            // ---------------------------------------------------------------------
+
+            List<DataElement> dataElements = new ArrayList<DataElement>( section.getDataElements() );
+            Collections.sort( dataElements, dataElementComparator );
+            FilterUtils.filter( dataElements, new AggregatableDataElementFilter() );
+
+            for ( DataElement dataElement : dataElements )
+            {
+                grid.addRow();
+                grid.addValue( dataElement.getName() );
+
+                for ( DataElementCategoryOptionCombo optionCombo : optionComnbos )
+                {
+                    String value = "";
+
+                    if ( selectedUnitOnly )
+                    {
+                        DataValue dataValue = dataValueService.getDataValue( selectedOrgunit, dataElement,
+                            selectedPeriod, optionCombo );
+                        value = (dataValue != null) ? dataValue.getValue() : null;
+                    }
+                    else
+                    {
+                        Double aggregatedValue = aggregationStrategy.equals( AGGREGATION_STRATEGY_REAL_TIME ) ? aggregationService
+                            .getAggregatedDataValue( dataElement, optionCombo, selectedPeriod.getStartDate(),
+                                selectedPeriod.getEndDate(), selectedOrgunit )
+                            : aggregatedDataValueService.getAggregatedValue( dataElement, optionCombo,
+                                selectedPeriod, selectedOrgunit );
+
+                        value = (aggregatedValue != null) ? String.valueOf( MathUtils.getRounded( aggregatedValue,
+                            0 ) ) : null;
+                    }
+                    
+                    grid.addValue( value );
+                }
+            }
+
+            grids.add( grid );
+        }
+
+        reportingUnit = selectedOrgunit.getName();
+
+        reportingPeriod = format.formatPeriod( selectedPeriod );
+
+        return SUCCESS;
+    }
+}

=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/dataset/action/GetDataSetReportOptionsAction.java'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/dataset/action/GetDataSetReportOptionsAction.java	2011-01-18 08:27:37 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/dataset/action/GetDataSetReportOptionsAction.java	2011-03-11 12:35:11 +0000
@@ -35,8 +35,6 @@
 import org.hisp.dhis.dataset.DataSetService;
 import org.hisp.dhis.dataset.comparator.DataSetNameComparator;
 import org.hisp.dhis.period.PeriodType;
-import org.hisp.dhis.system.util.Filter;
-import org.hisp.dhis.system.util.FilterUtils;
 
 import com.opensymphony.xwork2.Action;
 
@@ -70,14 +68,6 @@
     public String execute()
     {
         dataSets = new ArrayList<DataSet>( dataSetService.getAllDataSets() );
-
-        FilterUtils.filter( dataSets, new Filter<DataSet>() // Temporary hack until dataset report supports section and default forms
-        {
-            public boolean retain( DataSet dataSet )
-            {
-                return dataSet != null && dataSet.getDataEntryForm() != null;
-            }            
-        });
         
         Collections.sort( dataSets, new DataSetNameComparator() );
         

=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/resources/META-INF/dhis/beans.xml	2011-02-23 19:20:08 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/resources/META-INF/dhis/beans.xml	2011-03-11 12:35:11 +0000
@@ -376,19 +376,58 @@
 	  ref="org.hisp.dhis.dataset.DataSetService"/>
   </bean>
     
+  <bean id="org.hisp.dhis.reporting.dataset.action.GenerateDataSetReportAction" 
+    class="org.hisp.dhis.reporting.dataset.action.GenerateDataSetReportAction" 
+    scope="prototype">
+    <property name="selectionTreeManager"
+      ref="org.hisp.dhis.oust.manager.SelectionTreeManager"/>	
+    <property name="dataSetService"
+      ref="org.hisp.dhis.dataset.DataSetService"/>
+	<property name="periodService"
+	  ref="org.hisp.dhis.period.PeriodService"/>
+  </bean>
+  
   <bean id="org.hisp.dhis.reporting.dataset.action.GenerateCustomDataSetReportAction" 
     class="org.hisp.dhis.reporting.dataset.action.GenerateCustomDataSetReportAction" 
     scope="prototype">
 	<property name="dataSetReportService"
 	  ref="org.hisp.dhis.datasetreport.DataSetReportService"/>
-    <property name="dataSetService"
-      ref="org.hisp.dhis.dataset.DataSetService"/>
-	<property name="periodService"
-	  ref="org.hisp.dhis.period.PeriodService"/>
-    <property name="selectionTreeManager"
-      ref="org.hisp.dhis.oust.manager.SelectionTreeManager"/>		
   </bean>
     
+  <bean id="org.hisp.dhis.reporting.dataset.action.GenerateSectionDataSetReportAction" 
+    class="org.hisp.dhis.reporting.dataset.action.GenerateSectionDataSetReportAction" 
+    scope="prototype">
+	<property name="dataValueService" 
+	  ref="org.hisp.dhis.datavalue.DataValueService"/>
+	 <property name="systemSettingManager"
+	  ref="org.hisp.dhis.options.SystemSettingManager"/>
+	<property name="aggregatedDataValueService"
+	  ref="org.hisp.dhis.aggregation.AggregatedDataValueService"/>
+	<property name="aggregationService"
+	  ref="org.hisp.dhis.aggregation.AggregationService"/>
+  </bean>
+  
+  <bean id="org.hisp.dhis.reporting.dataset.action.GenerateDefaultDataSetReportAction" 
+    class="org.hisp.dhis.reporting.dataset.action.GenerateDefaultDataSetReportAction" 
+    scope="prototype">
+	<property name="dataValueService" 
+	  ref="org.hisp.dhis.datavalue.DataValueService"/>
+	 <property name="systemSettingManager"
+	  ref="org.hisp.dhis.options.SystemSettingManager"/>
+	<property name="aggregatedDataValueService"
+	  ref="org.hisp.dhis.aggregation.AggregatedDataValueService"/>
+	<property name="aggregationService"
+	  ref="org.hisp.dhis.aggregation.AggregationService"/>
+  </bean>
+  
+  <bean id="org.hisp.dhis.de.action.SectionFormAction" class="org.hisp.dhis.de.action.SectionFormAction" scope="prototype">
+	<property name="dataValueService" ref="org.hisp.dhis.datavalue.DataValueService"/>
+	<property name="standardCommentsManager" ref="org.hisp.dhis.de.comments.StandardCommentsManager"/>
+	<property name="minMaxDataElementService" ref="org.hisp.dhis.minmax.MinMaxDataElementService"/>
+	<property name="selectedStateManager" ref="org.hisp.dhis.de.state.SelectedStateManager"/>
+	<property name="categoryService" ref="org.hisp.dhis.dataelement.DataElementCategoryService"/>
+  </bean>
+	
   <!-- Data completeness -->
   
   <bean id="org.hisp.dhis.reporting.completeness.action.GetDataCompletenessOptionsAction"

=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/resources/struts.xml	2011-02-27 21:14:25 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/resources/struts.xml	2011-03-11 12:35:11 +0000
@@ -295,12 +295,35 @@
       <interceptor-ref name="organisationUnitTreeStack"/>       
     </action>	   
         
+    <action name="generateDataSetReport" class="org.hisp.dhis.reporting.dataset.action.GenerateDataSetReportAction">
+     <result name="customDataSetReport" type="chain">generateCustomDataSetReport</result>
+     <result name="sectionDataSetReport" type="chain">generateSectionDataSetReport</result>
+     <result name="defaultDataSetReport" type="chain">generateDefaultDataSetReport</result>
+     <result name="error" type="chain">showDataSetReportForm</result>
+    </action> 
+    
     <action name="generateCustomDataSetReport" class="org.hisp.dhis.reporting.dataset.action.GenerateCustomDataSetReportAction">
       <result name="success" type="velocity">/popup.vm</result>
       <result name="error" type="chain">showDataSetReportForm</result>
       <param name="page">/dhis-web-reporting/previewCustomDataSetReportForm.vm</param>
       <param name="javascripts">../dhis-web-commons/util/jquery.jqprint.0.3.js</param>
       <interceptor-ref name="organisationUnitTreeStack"/>
+    </action>  
+    
+    <action name="generateSectionDataSetReport" class="org.hisp.dhis.reporting.dataset.action.GenerateSectionDataSetReportAction">
+      <result name="success" type="velocity">/popup.vm</result>
+      <result name="error" type="chain">showDataSetReportForm</result>
+      <param name="page">/dhis-web-reporting/previewSectionDataSetReportForm.vm</param>
+      <param name="javascripts">../dhis-web-commons/util/jquery.jqprint.0.3.js</param>
+      <interceptor-ref name="organisationUnitTreeStack"/>
+    </action> 
+    
+    <action name="generateDefaultDataSetReport" class="org.hisp.dhis.reporting.dataset.action.GenerateDefaultDataSetReportAction">
+      <result name="success" type="velocity">/popup.vm</result>
+      <result name="error" type="chain">showDataSetReportForm</result>
+      <param name="page">/dhis-web-reporting/previewDefaultDataSetReportForm.vm</param>
+      <param name="javascripts">../dhis-web-commons/util/jquery.jqprint.0.3.js</param>
+      <interceptor-ref name="organisationUnitTreeStack"/>
     </action>   
       
     <!-- Tally Sheet Forms Generator -->

=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/dataSetReportForm.vm'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/dataSetReportForm.vm	2011-01-24 17:01:24 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/dataSetReportForm.vm	2011-03-11 12:35:11 +0000
@@ -1,7 +1,7 @@
 
 <h3>$i18n.getString( "dataset_report" )</h3>
 
-<form id="reportForm" name="reportForm" action="generateCustomDataSetReport.action" method="post">	
+<form id="reportForm" name="reportForm" action="generateDataSetReport.action" method="post">	
 
 <table>
 	<tr>

=== added file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/previewDefaultDataSetReportForm.vm'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/previewDefaultDataSetReportForm.vm	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/previewDefaultDataSetReportForm.vm	2011-03-11 12:35:11 +0000
@@ -0,0 +1,15 @@
+
+<h3>$i18n.getString('reporting_unit'): $reportingUnit &nbsp; $i18n.getString('reporting_period'): $reportingPeriod</h3>
+<p><input type="button" value="$i18n.getString( 'back' )" style="width:100px" onclick="javascript:window.location.href='showDataSetReportForm.action'"/></p>
+
+<div id="printDateSetPreviewDiv">
+#parse( "dhis-web-commons/ajax/htmlGrid.vm" )
+</div>
+
+<script>	
+function printDateSetReportPreview()
+{
+	var o = $("div#printDateSetPreviewDiv");
+	o.jqprint(); 
+}
+</script>

=== added file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/previewSectionDataSetReportForm.vm'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/previewSectionDataSetReportForm.vm	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/previewSectionDataSetReportForm.vm	2011-03-11 12:35:11 +0000
@@ -0,0 +1,41 @@
+<h3>$i18n.getString('reporting_unit'): $reportingUnit &nbsp; $i18n.getString('reporting_period'): $reportingPeriod</h3>
+<p><input type="button" value="$i18n.getString( 'back' )" style="width:100px" onclick="javascript:window.location.href='showDataSetReportForm.action'"/></p>
+
+<div id="printDateSetPreviewDiv">
+#foreach( $grid in $grids )
+
+<h3>$!encoder.htmlEncode( $grid.title )</h3>
+<h5>$!encoder.htmlEncode( $grid.subtitle )</h5>
+
+	<table class="listTable gridTable">
+	<thead>
+		<tr>
+			#foreach( $header in $grid.getVisibleHeaders() )
+				<th #if( $header.meta )style="text-align:left"#end>$!encoder.htmlEncode( $header.name )</th>
+			#end
+		</tr>
+	</thead>
+
+	<tbody>
+	#set( $mark = false )       
+	#foreach( $row in $grid.getVisibleRows() )
+		<tr #alternate( $mark )>
+			#foreach( $col in $row )
+				#set( $index = ( $velocityCount - 1 ) )
+				<td #if( $grid.getVisibleHeaders().get( $index ).meta )style="text-align:left"#end>$!encoder.htmlEncode( $col )</td>
+			#end
+		</tr>
+		 #set( $mark = !$mark )
+	#end
+	</tbody>
+	</table>
+#end
+</div>
+
+<script>	
+function printDateSetReportPreview()
+{
+	var o = $("div#printDateSetPreviewDiv");
+	o.jqprint(); 
+}
+</script>
\ No newline at end of file