← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 6588: local vn - Implemented new type of report named "ATTRIBUTE". In process...

 

------------------------------------------------------------
revno: 6588
committer: Hieu <hieu.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2012-04-16 10:00:30 +0700
message:
  local vn - Implemented new type of report named "ATTRIBUTE". In process...
removed:
  local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/ExportReportOganiztionGroupListing.java
added:
  local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/AttributeValueGroupOrder.java
  local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/AttributeValueGroupOrderService.java
  local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/AttributeValueGroupOrderStore.java
  local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/ExportReportAttribute.java
  local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/ExportReportOrganizationGroupListing.java
  local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/hibernate/HibernateAttributeValueGroupOrderStore.java
  local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/impl/DefaultAttributeValueGroupOrderService.java
  local/vn/dhis-service-spreadsheet-reporting/src/main/resources/org/hisp/dhis/reportsheet/hibernate/AttributeGroupOrder.hbm.xml
  local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/avgroup/
  local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/avgroup/action/
  local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/avgroup/action/DeleteAttributeValueGroupOrderAction.java
  local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/avgroup/action/GetAttributeValueGroupOrderAction.java
  local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/avgroup/action/GetAttributeValuesByAttributeAction.java
  local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/avgroup/action/SaveAttributeValueGroupOrderAction.java
  local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/avgroup/action/UpdateAttributeValueGroupOrderAction.java
  local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/avgroup/action/UpdateSortedAttributeValueAction.java
  local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/avgroup/action/UpdateSortedAttributeValueGroupOrderAction.java
  local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/avgroup/action/ValidateAttributeValueGroupOrderAction.java
  local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/javascript/attribute.ajax.js
  local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/javascript/attributeValueGroupOrder.js
  local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/jsonAttributeValueGroupOrder.vm
  local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/jsonAttributeValues.vm
  local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/listAttributeValueGroupOrder.vm
  local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/sortAttributeValues.vm
modified:
  local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/ExportReport.java
  local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/ExportReportCategory.java
  local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/ExportReportNormal.java
  local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/ExportReportPeriodColumnListing.java
  local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/hibernate/HibernateExportReportStore.java
  local/vn/dhis-service-spreadsheet-reporting/src/main/resources/META-INF/dhis/beans.xml
  local/vn/dhis-service-spreadsheet-reporting/src/main/resources/org/hisp/dhis/reportsheet/hibernate/ExportReport.hbm.xml
  local/vn/dhis-service-spreadsheet-reporting/src/main/resources/org/hisp/dhis/reportsheet/importitem/hibernate/ImportReport.hbm.xml
  local/vn/dhis-service-vn/src/main/java/org/hisp/dhis/attribute/DefaultLocalAttributeValueService.java
  local/vn/dhis-service-vn/src/main/java/org/hisp/dhis/attribute/LocalAttributeValueService.java
  local/vn/dhis-service-vn/src/main/java/org/hisp/dhis/attribute/LocalAttributeValueStore.java
  local/vn/dhis-service-vn/src/main/java/org/hisp/dhis/attribute/hibernate/HibernateLocalAttributeValueStore.java
  local/vn/dhis-web-dataentry-hospital/src/main/java/org/hisp/dhis/dataelement/LoadFormAction.java
  local/vn/dhis-web-spreadsheet-reporting/pom.xml
  local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exporting/GenerateExcelReportGeneric.java
  local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exporting/action/GenerateReportOrgGroupListingAction.java
  local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exporting/advance/action/GenerateAdvancedReportOrgGroupListingAction.java
  local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exportreport/action/AddExportReportAction.java
  local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exportreport/action/GetExportReportAction.java
  local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/orgunitgrouplisting/action/ListOrgUnitGroupAtLevelAction.java
  local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/orgunitgrouplisting/action/OpenUpdateOrgUnitGroupAction.java
  local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/orgunitgrouplisting/action/UpdateOrgUnitGroupAction.java
  local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/orgunitgrouplisting/action/UpdateOrgUnitGroupAtLevelAction.java
  local/vn/dhis-web-spreadsheet-reporting/src/main/resources/META-INF/dhis/beans.xml
  local/vn/dhis-web-spreadsheet-reporting/src/main/resources/org/hisp/dhis/reportsheet/i18n_module.properties
  local/vn/dhis-web-spreadsheet-reporting/src/main/resources/org/hisp/dhis/reportsheet/i18n_module_vi_VN.properties
  local/vn/dhis-web-spreadsheet-reporting/src/main/resources/struts.xml
  local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/report/addExportReportForm.vm
  local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/report/exportReports.vm
  local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/viewAdministrator.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 'local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/AttributeValueGroupOrder.java'
--- local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/AttributeValueGroupOrder.java	1970-01-01 00:00:00 +0000
+++ local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/AttributeValueGroupOrder.java	2012-04-16 03:00:30 +0000
@@ -0,0 +1,132 @@
+package org.hisp.dhis.reportsheet;
+
+/*
+ * Copyright (c) 2004-2012, 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.List;
+
+import org.hisp.dhis.attribute.Attribute;
+
+/**
+ * @author Dang Duy Hieu
+ * @version $Id$
+ */
+public class AttributeValueGroupOrder
+{
+    private int id;
+
+    private String name;
+
+    private Attribute attribute;
+
+    private List<String> attributeValues;
+
+    // -------------------------------------------------------------------------
+    // Constructors
+    // -------------------------------------------------------------------------
+
+    public AttributeValueGroupOrder()
+    {
+    }
+
+    public AttributeValueGroupOrder( String name )
+    {
+        this.name = name;
+    }
+
+    // -------------------------------------------------------------------------
+    // Getters and setters
+    // -------------------------------------------------------------------------
+
+    public int getId()
+    {
+        return id;
+    }
+
+    public void setId( int id )
+    {
+        this.id = id;
+    }
+
+    public String getName()
+    {
+        return name;
+    }
+
+    public void setName( String name )
+    {
+        this.name = name;
+    }
+
+    public Attribute getAttribute()
+    {
+        return attribute;
+    }
+
+    public void setAttribute( Attribute attribute )
+    {
+        this.attribute = attribute;
+    }
+
+    public List<String> getAttributeValues()
+    {
+        return attributeValues;
+    }
+
+    public void setAttributeValues( List<String> attributeValues )
+    {
+        this.attributeValues = attributeValues;
+    }
+
+    // -------------------------------------------------------------------------
+    // hashCode and equals
+    // -------------------------------------------------------------------------
+
+    @Override
+    public int hashCode()
+    {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + id;
+        return result;
+    }
+
+    @Override
+    public boolean equals( Object obj )
+    {
+        if ( this == obj )
+            return true;
+        if ( obj == null )
+            return false;
+        if ( getClass() != obj.getClass() )
+            return false;
+        AttributeValueGroupOrder other = (AttributeValueGroupOrder) obj;
+        if ( id != other.id )
+            return false;
+        return true;
+    }
+}

=== added file 'local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/AttributeValueGroupOrderService.java'
--- local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/AttributeValueGroupOrderService.java	1970-01-01 00:00:00 +0000
+++ local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/AttributeValueGroupOrderService.java	2012-04-16 03:00:30 +0000
@@ -0,0 +1,50 @@
+package org.hisp.dhis.reportsheet;
+
+/*
+ * Copyright (c) 2004-2012, 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.
+ */
+
+/**
+ * @author Dang Duy Hieu
+ * @version $Id$
+ */
+public interface AttributeValueGroupOrderService
+{
+    String ID = AttributeValueGroupOrderService.class.getName();
+
+    // -------------------------------------------------------------------------
+    // Attribute Value Group Order
+    // -------------------------------------------------------------------------
+
+    public AttributeValueGroupOrder getAttributeValueGroupOrder( Integer id );
+    
+    public AttributeValueGroupOrder getAttributeValueGroupOrder( String name, String clazzName, Integer reportId );
+
+    public void updateAttributeValueGroupOrder( AttributeValueGroupOrder attributeValueGroupOrder );
+
+    public void deleteAttributeValueGroupOrder( Integer id );
+
+}
\ No newline at end of file

=== added file 'local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/AttributeValueGroupOrderStore.java'
--- local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/AttributeValueGroupOrderStore.java	1970-01-01 00:00:00 +0000
+++ local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/AttributeValueGroupOrderStore.java	2012-04-16 03:00:30 +0000
@@ -0,0 +1,50 @@
+package org.hisp.dhis.reportsheet;
+
+/*
+ * Copyright (c) 2004-2012, 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.
+ */
+
+/**
+ * @author Dang Duy Hieu
+ * @version $Id$
+ */
+public interface AttributeValueGroupOrderStore
+{
+    String ID = AttributeValueGroupOrderStore.class.getName();
+
+    // -------------------------------------------------------------------------
+    // Attribute Value Group Order
+    // -------------------------------------------------------------------------
+
+    public AttributeValueGroupOrder getAttributeValueGroupOrder( Integer id );
+
+    public AttributeValueGroupOrder getAttributeValueGroupOrder( String name, String clazzName, Integer reportId );
+
+    public void updateAttributeValueGroupOrder( AttributeValueGroupOrder attributeValueGroupOrder );
+
+    public void deleteAttributeValueGroupOrder( Integer id );
+
+}

=== modified file 'local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/ExportReport.java'
--- local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/ExportReport.java	2012-02-29 02:50:11 +0000
+++ local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/ExportReport.java	2012-04-16 03:00:30 +0000
@@ -87,6 +87,8 @@
         return results;
     }
 
+    public abstract boolean isAttribute();
+    
     public abstract boolean isCategory();
 
     public abstract boolean isOrgUnitGroupListing();
@@ -112,6 +114,8 @@
         public static final String NORMAL = "NORMAL";
 
         public static final String CATEGORY = "CATEGORY";
+        
+        public static final String ATTRIBUTE = "ATTRIBUTE";
 
         public static final String PERIOD_COLUMN_LISTING = "PERIOD_COLUMN_LISTING";
 

=== added file 'local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/ExportReportAttribute.java'
--- local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/ExportReportAttribute.java	1970-01-01 00:00:00 +0000
+++ local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/ExportReportAttribute.java	2012-04-16 03:00:30 +0000
@@ -0,0 +1,111 @@
+package org.hisp.dhis.reportsheet;
+
+/*
+ * Copyright (c) 2004-2011, 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.ArrayList;
+import java.util.List;
+
+/**
+ * @author Dang Duy Hieu
+ * @version $Id$
+ */
+public class ExportReportAttribute
+    extends ExportReport
+{
+    private List<AttributeValueGroupOrder> attributeValueOrders;
+
+    // -------------------------------------------------------------------------
+    // Constructors
+    // -------------------------------------------------------------------------
+
+    public ExportReportAttribute()
+    {
+        super();
+    }
+
+    // -------------------------------------------------------------------------
+    // Getters and setters
+    // -------------------------------------------------------------------------
+
+    public List<AttributeValueGroupOrder> getAttributeValueOrders()
+    {
+        return attributeValueOrders;
+    }
+
+    public void setAttributeValueOrders( List<AttributeValueGroupOrder> attributeValueOrders )
+    {
+        this.attributeValueOrders = attributeValueOrders;
+    }
+
+    @Override
+    public String getReportType()
+    {
+        return ExportReport.TYPE.ATTRIBUTE;
+    }
+
+    @Override
+    public boolean isAttribute()
+    {
+        return true;
+    }
+
+    @Override
+    public boolean isCategory()
+    {
+        return false;
+    }
+
+    @Override
+    public boolean isNormal()
+    {
+        return false;
+    }
+
+    @Override
+    public boolean isOrgUnitGroupListing()
+    {
+        return false;
+    }
+
+    @Override
+    public boolean isPeriodColumnListing()
+    {
+        return false;
+    }
+
+    @Override
+    public List<String> getItemTypes()
+    {
+        List<String> types = new ArrayList<String>();
+        types.add( ExportItem.TYPE.DATAELEMENT );
+        types.add( ExportItem.TYPE.DATAELEMENT_CODE );
+        types.add( ExportItem.TYPE.DATAELEMENT_NAME );
+        types.add( ExportItem.TYPE.SERIAL );
+
+        return types;
+    }
+}

=== modified file 'local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/ExportReportCategory.java'
--- local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/ExportReportCategory.java	2011-11-03 04:26:28 +0000
+++ local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/ExportReportCategory.java	2012-04-16 03:00:30 +0000
@@ -68,6 +68,12 @@
     }
 
     @Override
+    public boolean isAttribute()
+    {
+        return false;
+    }
+
+    @Override
     public boolean isCategory()
     {
         return true;

=== modified file 'local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/ExportReportNormal.java'
--- local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/ExportReportNormal.java	2011-07-28 09:50:39 +0000
+++ local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/ExportReportNormal.java	2012-04-16 03:00:30 +0000
@@ -52,6 +52,12 @@
     }
 
     @Override
+    public boolean isAttribute()
+    {
+        return false;
+    }
+
+    @Override
     public boolean isCategory()
     {
         return false;

=== removed file 'local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/ExportReportOganiztionGroupListing.java'
--- local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/ExportReportOganiztionGroupListing.java	2011-11-03 04:26:28 +0000
+++ local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/ExportReportOganiztionGroupListing.java	1970-01-01 00:00:00 +0000
@@ -1,123 +0,0 @@
-package org.hisp.dhis.reportsheet;
-
-/*
- * Copyright (c) 2004-2011, 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.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-import org.hisp.dhis.organisationunit.OrganisationUnitGroup;
-import org.hisp.dhis.organisationunit.OrganisationUnitLevel;
-
-/**
- * @author Chau Thu Tran
- * @version $Id$
- */
-
-public class ExportReportOganiztionGroupListing
-    extends ExportReport
-{
-    private List<OrganisationUnitGroup> organisationUnitGroups;
-
-    private Map<OrganisationUnitGroup, OrganisationUnitLevel> organisationUnitLevels;
-
-    // -------------------------------------------------------------------------
-    // Constructors
-    // -------------------------------------------------------------------------
-
-    public ExportReportOganiztionGroupListing()
-    {
-        super();
-    }
-
-    // -------------------------------------------------------------------------
-    // Getters and setters
-    // -------------------------------------------------------------------------
-
-    public List<OrganisationUnitGroup> getOrganisationUnitGroups()
-    {
-        return organisationUnitGroups;
-    }
-
-    public Map<OrganisationUnitGroup, OrganisationUnitLevel> getOrganisationUnitLevels()
-    {
-        return organisationUnitLevels;
-    }
-
-    public void setOrganisationUnitLevels( Map<OrganisationUnitGroup, OrganisationUnitLevel> organisationUnitLevels )
-    {
-        this.organisationUnitLevels = organisationUnitLevels;
-    }
-
-    public void setOrganisationUnitGroups( List<OrganisationUnitGroup> organisationUnitGroups )
-    {
-        this.organisationUnitGroups = organisationUnitGroups;
-    }
-
-    @Override
-    public String getReportType()
-    {
-        return ExportReport.TYPE.ORGANIZATION_GROUP_LISTING;
-    }
-
-    @Override
-    public boolean isCategory()
-    {
-        return false;
-    }
-
-    @Override
-    public boolean isNormal()
-    {
-        return false;
-    }
-
-    @Override
-    public boolean isOrgUnitGroupListing()
-    {
-        return true;
-    }
-
-    @Override
-    public boolean isPeriodColumnListing()
-    {
-        return false;
-    }
-
-    @Override
-    public List<String> getItemTypes()
-    {
-        List<String> types = new ArrayList<String>();
-        types.add( ExportItem.TYPE.DATAELEMENT );
-        types.add( ExportItem.TYPE.ORGANISATION );
-        types.add( ExportItem.TYPE.INDICATOR );
-        types.add( ExportItem.TYPE.FORMULA_EXCEL );
-        types.add( ExportItem.TYPE.SERIAL );
-
-        return types;
-    }
-}

=== added file 'local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/ExportReportOrganizationGroupListing.java'
--- local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/ExportReportOrganizationGroupListing.java	1970-01-01 00:00:00 +0000
+++ local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/ExportReportOrganizationGroupListing.java	2012-04-16 03:00:30 +0000
@@ -0,0 +1,129 @@
+package org.hisp.dhis.reportsheet;
+
+/*
+ * Copyright (c) 2004-2011, 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.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import org.hisp.dhis.organisationunit.OrganisationUnitGroup;
+import org.hisp.dhis.organisationunit.OrganisationUnitLevel;
+
+/**
+ * @author Chau Thu Tran
+ * @version $Id$
+ */
+
+public class ExportReportOrganizationGroupListing
+    extends ExportReport
+{
+    private List<OrganisationUnitGroup> organisationUnitGroups;
+
+    private Map<OrganisationUnitGroup, OrganisationUnitLevel> organisationUnitLevels;
+
+    // -------------------------------------------------------------------------
+    // Constructors
+    // -------------------------------------------------------------------------
+
+    public ExportReportOrganizationGroupListing()
+    {
+        super();
+    }
+
+    // -------------------------------------------------------------------------
+    // Getters and setters
+    // -------------------------------------------------------------------------
+
+    public List<OrganisationUnitGroup> getOrganisationUnitGroups()
+    {
+        return organisationUnitGroups;
+    }
+
+    public Map<OrganisationUnitGroup, OrganisationUnitLevel> getOrganisationUnitLevels()
+    {
+        return organisationUnitLevels;
+    }
+
+    public void setOrganisationUnitLevels( Map<OrganisationUnitGroup, OrganisationUnitLevel> organisationUnitLevels )
+    {
+        this.organisationUnitLevels = organisationUnitLevels;
+    }
+
+    public void setOrganisationUnitGroups( List<OrganisationUnitGroup> organisationUnitGroups )
+    {
+        this.organisationUnitGroups = organisationUnitGroups;
+    }
+
+    @Override
+    public String getReportType()
+    {
+        return ExportReport.TYPE.ORGANIZATION_GROUP_LISTING;
+    }
+
+    @Override
+    public boolean isAttribute()
+    {
+        return false;
+    }
+
+    @Override
+    public boolean isCategory()
+    {
+        return false;
+    }
+
+    @Override
+    public boolean isNormal()
+    {
+        return false;
+    }
+
+    @Override
+    public boolean isOrgUnitGroupListing()
+    {
+        return true;
+    }
+
+    @Override
+    public boolean isPeriodColumnListing()
+    {
+        return false;
+    }
+
+    @Override
+    public List<String> getItemTypes()
+    {
+        List<String> types = new ArrayList<String>();
+        types.add( ExportItem.TYPE.DATAELEMENT );
+        types.add( ExportItem.TYPE.ORGANISATION );
+        types.add( ExportItem.TYPE.INDICATOR );
+        types.add( ExportItem.TYPE.FORMULA_EXCEL );
+        types.add( ExportItem.TYPE.SERIAL );
+
+        return types;
+    }
+}

=== modified file 'local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/ExportReportPeriodColumnListing.java'
--- local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/ExportReportPeriodColumnListing.java	2011-11-03 04:26:28 +0000
+++ local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/ExportReportPeriodColumnListing.java	2012-04-16 03:00:30 +0000
@@ -78,6 +78,12 @@
     }
 
     @Override
+    public boolean isAttribute()
+    {
+        return false;
+    }
+
+    @Override
     public boolean isCategory()
     {
         return false;

=== added file 'local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/hibernate/HibernateAttributeValueGroupOrderStore.java'
--- local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/hibernate/HibernateAttributeValueGroupOrderStore.java	1970-01-01 00:00:00 +0000
+++ local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/hibernate/HibernateAttributeValueGroupOrderStore.java	2012-04-16 03:00:30 +0000
@@ -0,0 +1,102 @@
+package org.hisp.dhis.reportsheet.hibernate;
+
+/*
+ * Copyright (c) 2004-2012, 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 org.hibernate.SQLQuery;
+import org.hibernate.Session;
+import org.hibernate.SessionFactory;
+import org.hisp.dhis.reportsheet.AttributeValueGroupOrder;
+import org.hisp.dhis.reportsheet.AttributeValueGroupOrderStore;
+import org.hisp.dhis.reportsheet.ExportReport;
+import org.springframework.transaction.annotation.Transactional;
+
+/**
+ * @author Dang Duy Hieu
+ * @version $Id$
+ */
+
+@Transactional
+public class HibernateAttributeValueGroupOrderStore
+    implements AttributeValueGroupOrderStore
+{
+    // -------------------------------------------------------------------------
+    // Dependency
+    // -------------------------------------------------------------------------
+
+    private SessionFactory sessionFactory;
+
+    public void setSessionFactory( SessionFactory sessionFactory )
+    {
+        this.sessionFactory = sessionFactory;
+    }
+
+    // -------------------------------------------------------------------------
+    // Data Element Group Order
+    // -------------------------------------------------------------------------
+
+    public AttributeValueGroupOrder getAttributeValueGroupOrder( Integer id )
+    {
+        Session session = sessionFactory.getCurrentSession();
+        return (AttributeValueGroupOrder) session.get( AttributeValueGroupOrder.class, id );
+    }
+
+    public AttributeValueGroupOrder getAttributeValueGroupOrder( String name, String clazzName, Integer reportId )
+    {
+        Session session = sessionFactory.getCurrentSession();
+
+        String sql = "SELECT * FROM reportexcel_attributevaluegrouporders WHERE lower(name) = :name";
+
+        if ( clazzName.equals( ExportReport.class.getSimpleName() ) )
+        {
+            sql += " AND reportexcelid = :reportId";
+        }
+        else
+        {
+            sql += " AND excelitemgroupid = :reportId";
+        }
+
+        SQLQuery query = session.createSQLQuery( sql );
+
+        query.addEntity( AttributeValueGroupOrder.class );
+        query.setString( "name", name.toLowerCase() ).setInteger( "reportId", reportId );
+
+        return (AttributeValueGroupOrder) query.uniqueResult();
+    }
+
+    public void updateAttributeValueGroupOrder( AttributeValueGroupOrder attributeValueGroupOrder )
+    {
+        Session session = sessionFactory.getCurrentSession();
+        session.update( attributeValueGroupOrder );
+    }
+
+    public void deleteAttributeValueGroupOrder( Integer id )
+    {
+        Session session = sessionFactory.getCurrentSession();
+        session.delete( this.getAttributeValueGroupOrder( id ) );
+    }
+}

=== modified file 'local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/hibernate/HibernateExportReportStore.java'
--- local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/hibernate/HibernateExportReportStore.java	2012-02-06 05:31:55 +0000
+++ local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/hibernate/HibernateExportReportStore.java	2012-04-16 03:00:30 +0000
@@ -43,7 +43,7 @@
 import org.hisp.dhis.reportsheet.ExportReport;
 import org.hisp.dhis.reportsheet.ExportReportCategory;
 import org.hisp.dhis.reportsheet.ExportReportNormal;
-import org.hisp.dhis.reportsheet.ExportReportOganiztionGroupListing;
+import org.hisp.dhis.reportsheet.ExportReportOrganizationGroupListing;
 import org.hisp.dhis.reportsheet.ExportReportPeriodColumnListing;
 import org.hisp.dhis.reportsheet.ExportReportStore;
 import org.hisp.dhis.reportsheet.PeriodColumn;
@@ -203,7 +203,7 @@
         }
         else if ( reportType.equals( ExportReport.TYPE.ORGANIZATION_GROUP_LISTING ) )
         {
-            clazz = ExportReportOganiztionGroupListing.class;
+            clazz = ExportReportOrganizationGroupListing.class;
         }
         else
         {

=== added file 'local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/impl/DefaultAttributeValueGroupOrderService.java'
--- local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/impl/DefaultAttributeValueGroupOrderService.java	1970-01-01 00:00:00 +0000
+++ local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/impl/DefaultAttributeValueGroupOrderService.java	2012-04-16 03:00:30 +0000
@@ -0,0 +1,77 @@
+package org.hisp.dhis.reportsheet.impl;
+
+/*
+ * Copyright (c) 2004-2012, 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 org.hisp.dhis.reportsheet.AttributeValueGroupOrder;
+import org.hisp.dhis.reportsheet.AttributeValueGroupOrderService;
+import org.hisp.dhis.reportsheet.AttributeValueGroupOrderStore;
+import org.springframework.transaction.annotation.Transactional;
+
+/**
+ * @author Dang Duy Hieu
+ * @version $Id$
+ */
+@Transactional
+public class DefaultAttributeValueGroupOrderService
+    implements AttributeValueGroupOrderService
+{
+    // -------------------------------------------------------------------------
+    // Dependency
+    // -------------------------------------------------------------------------
+
+    private AttributeValueGroupOrderStore attributeValueGroupOrderStore;
+
+    public void setAttributeValueGroupOrderStore( AttributeValueGroupOrderStore attributeValueGroupOrderStore )
+    {
+        this.attributeValueGroupOrderStore = attributeValueGroupOrderStore;
+    }
+
+    // -------------------------------------------------------------------------
+    // Data Element Group Order
+    // -------------------------------------------------------------------------
+
+    public AttributeValueGroupOrder getAttributeValueGroupOrder( Integer id )
+    {
+        return attributeValueGroupOrderStore.getAttributeValueGroupOrder( id );
+    }
+
+    public void updateAttributeValueGroupOrder( AttributeValueGroupOrder attributeValueGroupOrder )
+    {
+        attributeValueGroupOrderStore.updateAttributeValueGroupOrder( attributeValueGroupOrder );
+    }
+
+    public void deleteAttributeValueGroupOrder( Integer id )
+    {
+        attributeValueGroupOrderStore.deleteAttributeValueGroupOrder( id );
+    }
+
+    public AttributeValueGroupOrder getAttributeValueGroupOrder( String name, String clazzName, Integer reportId )
+    {
+        return attributeValueGroupOrderStore.getAttributeValueGroupOrder( name, clazzName, reportId );
+    }
+}

=== modified file 'local/vn/dhis-service-spreadsheet-reporting/src/main/resources/META-INF/dhis/beans.xml'
--- local/vn/dhis-service-spreadsheet-reporting/src/main/resources/META-INF/dhis/beans.xml	2012-03-12 07:07:30 +0000
+++ local/vn/dhis-service-spreadsheet-reporting/src/main/resources/META-INF/dhis/beans.xml	2012-04-16 03:00:30 +0000
@@ -43,7 +43,7 @@
 	</bean>
 	
 	<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
-	<!-- DATAELEMENTGROUPORDER STORE / SERVICE                         -->
+	<!-- DATAELEMENT-GROUP-ORDER STORE / SERVICE                         -->
 	<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
 	
 	<bean id="org.hisp.dhis.reportsheet.DataElementGroupOrderStore"
@@ -57,6 +57,21 @@
 			ref="org.hisp.dhis.reportsheet.DataElementGroupOrderStore" />
 	</bean>
 	
+	<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
+	<!-- ATTRIBUTEVALUE-GROUP-ORDER STORE / SERVICE                    -->
+	<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
+	
+	<bean id="org.hisp.dhis.reportsheet.AttributeValueGroupOrderStore"
+		class="org.hisp.dhis.reportsheet.hibernate.HibernateAttributeValueGroupOrderStore">
+		<property name="sessionFactory" ref="sessionFactory"/>
+	</bean>
+	
+	<bean id="org.hisp.dhis.reportsheet.AttributeValueGroupOrderService"
+		class="org.hisp.dhis.reportsheet.impl.DefaultAttributeValueGroupOrderService">
+		<property name="attributeValueGroupOrderStore"
+			ref="org.hisp.dhis.reportsheet.AttributeValueGroupOrderStore" />
+	</bean>
+	
 	<!-- Report Location Manager -->
 
 	<bean id="org.hisp.dhis.reportsheet.ReportLocationManager"

=== added file 'local/vn/dhis-service-spreadsheet-reporting/src/main/resources/org/hisp/dhis/reportsheet/hibernate/AttributeGroupOrder.hbm.xml'
--- local/vn/dhis-service-spreadsheet-reporting/src/main/resources/org/hisp/dhis/reportsheet/hibernate/AttributeGroupOrder.hbm.xml	1970-01-01 00:00:00 +0000
+++ local/vn/dhis-service-spreadsheet-reporting/src/main/resources/org/hisp/dhis/reportsheet/hibernate/AttributeGroupOrder.hbm.xml	2012-04-16 03:00:30 +0000
@@ -0,0 +1,22 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC
+	"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+	"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd";>
+<hibernate-mapping>
+  <class name="org.hisp.dhis.reportsheet.AttributeValueGroupOrder" table="reportexcel_attributevaluegrouporders">
+  	    <id name="id" column="id">
+			<generator class="native" />
+		</id>
+
+		<property name="name" column="name" />
+
+		<many-to-one name="attribute" class="org.hisp.dhis.attribute.Attribute" column="attributeid"
+			foreign-key="fk_attributevalue_attributeid" not-null="true" />
+
+		<list name="attributeValues" table="reportexcel_attributevalueorders" lazy="false">
+			<key column="id" foreign-key="fk_attributevalueorders_attributevaluegrouporderid" />
+			<list-index base="0" column="attributevalueorder" />
+			<element type="string" column="attributevalue" />
+		</list>
+  </class>
+</hibernate-mapping>
\ No newline at end of file

=== modified file 'local/vn/dhis-service-spreadsheet-reporting/src/main/resources/org/hisp/dhis/reportsheet/hibernate/ExportReport.hbm.xml'
--- local/vn/dhis-service-spreadsheet-reporting/src/main/resources/org/hisp/dhis/reportsheet/hibernate/ExportReport.hbm.xml	2011-07-28 09:50:39 +0000
+++ local/vn/dhis-service-spreadsheet-reporting/src/main/resources/org/hisp/dhis/reportsheet/hibernate/ExportReport.hbm.xml	2012-04-16 03:00:30 +0000
@@ -39,7 +39,7 @@
 		
 		<joined-subclass name="org.hisp.dhis.reportsheet.ExportReportPeriodColumnListing" table="reportexcels_periodcolumnlisting">
 			<key column="reportexcelid" />		
-			<set name="periodColumns" cascade="all" table="reportexcel_periodcolumns" lazy="false">
+			<set name="periodColumns" table="reportexcel_periodcolumns" cascade="all" lazy="false">
 				<key column="reportexcelid"/>
 				<one-to-many class="org.hisp.dhis.reportsheet.PeriodColumn"/>
 			</set>	
@@ -47,14 +47,23 @@
 		
 		<joined-subclass name="org.hisp.dhis.reportsheet.ExportReportCategory" table="reportexcels_category">
 			<key column="reportexcelid"/>
-			<list name="dataElementOrders" table="reportexcel_dataelementgrouporder" cascade="all" lazy="false">
+			<list name="dataElementOrders" table="reportexcel_dataelementgrouporders" cascade="all" lazy="false">
 				<key column="reportexcelid"/>
 				<list-index base="0" column="dataelementgrouporder"/>
 				<one-to-many class="org.hisp.dhis.reportsheet.DataElementGroupOrder"/>
 		    </list>				
 		</joined-subclass>
 		
-		<joined-subclass name="org.hisp.dhis.reportsheet.ExportReportOganiztionGroupListing" table="reportexcels_organizationgrouplisting">			
+		<joined-subclass name="org.hisp.dhis.reportsheet.ExportReportAttribute" table="reportexcels_attribute">
+			<key column="reportexcelid"/>
+			<list name="attributeValueOrders" table="reportexcel_attributevaluegrouporders" cascade="all" lazy="false">
+				<key column="reportexcelid"/>
+				<list-index base="0" column="attributevaluegrouporder"/>
+				<one-to-many class="org.hisp.dhis.reportsheet.AttributeValueGroupOrder"/>
+		    </list>				
+		</joined-subclass>
+		
+		<joined-subclass name="org.hisp.dhis.reportsheet.ExportReportOrganizationGroupListing" table="reportexcels_organizationgrouplisting">			
 			<key column="reportexcelid"/>			
 			<list  name="organisationUnitGroups" table="reportexcel_organisationgroup">
 				<key column="reportexcelid" />

=== modified file 'local/vn/dhis-service-spreadsheet-reporting/src/main/resources/org/hisp/dhis/reportsheet/importitem/hibernate/ImportReport.hbm.xml'
--- local/vn/dhis-service-spreadsheet-reporting/src/main/resources/org/hisp/dhis/reportsheet/importitem/hibernate/ImportReport.hbm.xml	2011-07-28 09:50:39 +0000
+++ local/vn/dhis-service-spreadsheet-reporting/src/main/resources/org/hisp/dhis/reportsheet/importitem/hibernate/ImportReport.hbm.xml	2012-04-16 03:00:30 +0000
@@ -37,8 +37,7 @@
 				column="oganisationunitgroupid" foreign-key="fk_excelitemgroup_organisationgroup" />
 		</list>
 
-		<list name="dataElementOrders" table="excelitemgroup_dataelementgrouporder"
-			cascade="all" lazy="false">
+		<list name="dataElementOrders" table="excelitemgroup_dataelementgrouporders" cascade="all" lazy="false">
 			<key column="excelitemgroupid" />
 			<list-index base="0" column="dataelementgrouporder" />
 			<one-to-many class="org.hisp.dhis.reportsheet.DataElementGroupOrder" />

=== modified file 'local/vn/dhis-service-vn/src/main/java/org/hisp/dhis/attribute/DefaultLocalAttributeValueService.java'
--- local/vn/dhis-service-vn/src/main/java/org/hisp/dhis/attribute/DefaultLocalAttributeValueService.java	2012-03-26 02:41:46 +0000
+++ local/vn/dhis-service-vn/src/main/java/org/hisp/dhis/attribute/DefaultLocalAttributeValueService.java	2012-04-16 03:00:30 +0000
@@ -61,4 +61,9 @@
     {
         return localAttributeValueStore.getByAttribute( attribute );
     }
+
+    public Collection<String> getDistinctValuesByAttribute( Attribute attribute )
+    {
+        return localAttributeValueStore.getDistinctValuesByAttribute( attribute );
+    }
 }

=== modified file 'local/vn/dhis-service-vn/src/main/java/org/hisp/dhis/attribute/LocalAttributeValueService.java'
--- local/vn/dhis-service-vn/src/main/java/org/hisp/dhis/attribute/LocalAttributeValueService.java	2012-03-26 02:41:46 +0000
+++ local/vn/dhis-service-vn/src/main/java/org/hisp/dhis/attribute/LocalAttributeValueService.java	2012-04-16 03:00:30 +0000
@@ -40,4 +40,6 @@
 public interface LocalAttributeValueService
 {
     Collection<AttributeValue> getAttributeValuesByAttribute( Attribute attribute );
+    
+    Collection<String> getDistinctValuesByAttribute( Attribute attribute );
 }

=== modified file 'local/vn/dhis-service-vn/src/main/java/org/hisp/dhis/attribute/LocalAttributeValueStore.java'
--- local/vn/dhis-service-vn/src/main/java/org/hisp/dhis/attribute/LocalAttributeValueStore.java	2012-03-26 02:41:46 +0000
+++ local/vn/dhis-service-vn/src/main/java/org/hisp/dhis/attribute/LocalAttributeValueStore.java	2012-04-16 03:00:30 +0000
@@ -40,4 +40,6 @@
 public interface LocalAttributeValueStore
 {
     Collection<AttributeValue> getByAttribute( Attribute attribute );
+
+    Collection<String> getDistinctValuesByAttribute( Attribute attribute );
 }

=== modified file 'local/vn/dhis-service-vn/src/main/java/org/hisp/dhis/attribute/hibernate/HibernateLocalAttributeValueStore.java'
--- local/vn/dhis-service-vn/src/main/java/org/hisp/dhis/attribute/hibernate/HibernateLocalAttributeValueStore.java	2012-03-26 02:41:46 +0000
+++ local/vn/dhis-service-vn/src/main/java/org/hisp/dhis/attribute/hibernate/HibernateLocalAttributeValueStore.java	2012-04-16 03:00:30 +0000
@@ -29,6 +29,7 @@
 
 import java.util.Collection;
 
+import org.hibernate.criterion.Projections;
 import org.hibernate.criterion.Restrictions;
 import org.hisp.dhis.attribute.Attribute;
 import org.hisp.dhis.attribute.AttributeValue;
@@ -44,10 +45,18 @@
     extends HibernateGenericStore<AttributeValue>
     implements LocalAttributeValueStore
 {
-    @SuppressWarnings("unchecked")
+    @SuppressWarnings( "unchecked" )
     @Override
     public Collection<AttributeValue> getByAttribute( Attribute attribute )
     {
         return getCriteria().add( Restrictions.eq( "attribute", attribute ) ).list();
     }
+
+    @SuppressWarnings( "unchecked" )
+    @Override
+    public Collection<String> getDistinctValuesByAttribute( Attribute attribute )
+    {
+        return getCriteria().add( Restrictions.eq( "attribute", attribute ) ).add( Restrictions.ne( "value", "" ) )
+            .setProjection( Projections.distinct( Projections.property( "value" ) ) ).list();
+    }
 }

=== modified file 'local/vn/dhis-web-dataentry-hospital/src/main/java/org/hisp/dhis/dataelement/LoadFormAction.java'
--- local/vn/dhis-web-dataentry-hospital/src/main/java/org/hisp/dhis/dataelement/LoadFormAction.java	2012-03-30 04:49:55 +0000
+++ local/vn/dhis-web-dataentry-hospital/src/main/java/org/hisp/dhis/dataelement/LoadFormAction.java	2012-04-16 03:00:30 +0000
@@ -218,8 +218,6 @@
 
         List<DataElement> dataElements = new ArrayList<DataElement>( dataSet.getDataElements() );
 
-        Collections.sort( dataElements, new DataElementFormNameComparator() );
-        
         if ( dataElements.isEmpty() )
         {
             return INPUT;
@@ -235,7 +233,7 @@
             dataElements.retainAll( dataElementsByAttr );
         }
 
-//        Collections.sort( dataElements, dataElementComparator );
+        Collections.sort( dataElements, dataElementComparator );
 
         orderedDataElements = dataElementService.getGroupedDataElementsByCategoryCombo( dataElements );
 

=== modified file 'local/vn/dhis-web-spreadsheet-reporting/pom.xml'
--- local/vn/dhis-web-spreadsheet-reporting/pom.xml	2012-02-29 02:50:11 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/pom.xml	2012-04-16 03:00:30 +0000
@@ -35,6 +35,11 @@
       <artifactId>dhis-service-spreadsheet-reporting</artifactId>
 	  <version>${project.version}</version>
     </dependency>
+    <dependency>
+      <groupId>org.hisp.dhis</groupId>
+      <artifactId>dhis-service-vn</artifactId>
+	  <version>${project.version}</version>
+    </dependency>
 	<dependency>
       <groupId>org.hisp.dhis</groupId>
       <artifactId>dhis-service-datamart-default</artifactId>

=== added directory 'local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/avgroup'
=== added directory 'local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/avgroup/action'
=== added file 'local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/avgroup/action/DeleteAttributeValueGroupOrderAction.java'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/avgroup/action/DeleteAttributeValueGroupOrderAction.java	1970-01-01 00:00:00 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/avgroup/action/DeleteAttributeValueGroupOrderAction.java	2012-04-16 03:00:30 +0000
@@ -0,0 +1,74 @@
+package org.hisp.dhis.reportsheet.avgroup.action;
+
+/*
+ * Copyright (c) 2004-2012, 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 org.hisp.dhis.reportsheet.AttributeValueGroupOrderService;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Dang Duy Hieu
+ * @version $Id$
+ */
+public class DeleteAttributeValueGroupOrderAction
+    implements Action
+{
+    // -------------------------------------------------------------------------
+    // Dependency
+    // -------------------------------------------------------------------------
+
+    private AttributeValueGroupOrderService attributeValueGroupOrderService;
+
+    public void setAttributeValueGroupOrderService( AttributeValueGroupOrderService attributeValueGroupOrderService )
+    {
+        this.attributeValueGroupOrderService = attributeValueGroupOrderService;
+    }
+
+    // -------------------------------------------------------------------------
+    // Input & Output
+    // -------------------------------------------------------------------------
+
+    private Integer id;
+
+    public void setId( Integer id )
+    {
+        this.id = id;
+    }
+
+    // -------------------------------------------------------------------------
+    // Action implementation
+    // -------------------------------------------------------------------------
+
+    public String execute()
+        throws Exception
+    {
+        attributeValueGroupOrderService.deleteAttributeValueGroupOrder( id );
+
+        return SUCCESS;
+    }
+}

=== added file 'local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/avgroup/action/GetAttributeValueGroupOrderAction.java'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/avgroup/action/GetAttributeValueGroupOrderAction.java	1970-01-01 00:00:00 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/avgroup/action/GetAttributeValueGroupOrderAction.java	2012-04-16 03:00:30 +0000
@@ -0,0 +1,107 @@
+package org.hisp.dhis.reportsheet.avgroup.action;
+
+/*
+ * Copyright (c) 2004-2012, 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 org.hisp.dhis.reportsheet.AttributeValueGroupOrder;
+import org.hisp.dhis.reportsheet.AttributeValueGroupOrderService;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Dang Duy Hieu
+ * @version $Id$
+ */
+public class GetAttributeValueGroupOrderAction
+    implements Action
+{
+    // -------------------------------------------------------------------------
+    // Dependency
+    // -------------------------------------------------------------------------
+
+    private AttributeValueGroupOrderService attributeValueGroupOrderService;
+
+    public void setAttributeValueGroupOrderService( AttributeValueGroupOrderService attributeValueGroupOrderService )
+    {
+        this.attributeValueGroupOrderService = attributeValueGroupOrderService;
+    }
+
+    // -------------------------------------------------------------------------
+    // Input & Output
+    // -------------------------------------------------------------------------
+
+    private Integer id;
+
+    public void setId( Integer id )
+    {
+        this.id = id;
+    }
+
+    private Integer reportId;
+
+    public Integer getReportId()
+    {
+        return reportId;
+    }
+
+    public void setReportId( Integer reportId )
+    {
+        this.reportId = reportId;
+    }
+
+    private String clazzName;
+
+    public void setClazzName( String clazzName )
+    {
+        this.clazzName = clazzName;
+    }
+
+    public String getClazzName()
+    {
+        return clazzName;
+    }
+
+    private AttributeValueGroupOrder attributeValueGroupOrder;
+
+    public AttributeValueGroupOrder getAttributeValueGroupOrder()
+    {
+        return attributeValueGroupOrder;
+    }
+
+    // -------------------------------------------------------------------------
+    // Action implementation
+    // -------------------------------------------------------------------------
+
+    public String execute()
+        throws Exception
+    {
+        attributeValueGroupOrder = attributeValueGroupOrderService.getAttributeValueGroupOrder( id );
+
+        return SUCCESS;
+    }
+
+}

=== added file 'local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/avgroup/action/GetAttributeValuesByAttributeAction.java'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/avgroup/action/GetAttributeValuesByAttributeAction.java	1970-01-01 00:00:00 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/avgroup/action/GetAttributeValuesByAttributeAction.java	2012-04-16 03:00:30 +0000
@@ -0,0 +1,99 @@
+/*
+ * Copyright (c) 2004-2012, 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.reportsheet.avgroup.action;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.hisp.dhis.attribute.Attribute;
+import org.hisp.dhis.attribute.AttributeService;
+import org.hisp.dhis.attribute.LocalAttributeValueService;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Dang Duy Hieu
+ * @version $Id$
+ */
+public class GetAttributeValuesByAttributeAction
+    implements Action
+{
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
+
+    private AttributeService attributeService;
+
+    public void setAttributeService( AttributeService attributeService )
+    {
+        this.attributeService = attributeService;
+    }
+
+    private LocalAttributeValueService localAttributeValueService;
+
+    public void setLocalAttributeValueService( LocalAttributeValueService localAttributeValueService )
+    {
+        this.localAttributeValueService = localAttributeValueService;
+    }
+
+    // -------------------------------------------------------------------------
+    // Input && Output
+    // -------------------------------------------------------------------------
+
+    private Integer attributeId;
+
+    public void setAttributeId( Integer attributeId )
+    {
+        this.attributeId = attributeId;
+    }
+
+    private Collection<String> values = new ArrayList<String>();
+
+    public Collection<String> getValues()
+    {
+        return values;
+    }
+
+    // -------------------------------------------------------------------------
+    // Action implementation
+    // -------------------------------------------------------------------------
+
+    @Override
+    public String execute()
+        throws Exception
+    {
+        Attribute attribute = attributeService.getAttribute( attributeId );
+
+        if ( attribute != null )
+        {
+            values = localAttributeValueService.getDistinctValuesByAttribute( attribute );
+        }
+
+        return SUCCESS;
+    }
+}

=== added file 'local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/avgroup/action/SaveAttributeValueGroupOrderAction.java'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/avgroup/action/SaveAttributeValueGroupOrderAction.java	1970-01-01 00:00:00 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/avgroup/action/SaveAttributeValueGroupOrderAction.java	2012-04-16 03:00:30 +0000
@@ -0,0 +1,165 @@
+package org.hisp.dhis.reportsheet.avgroup.action;
+
+/*
+ * Copyright (c) 2004-2012, 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.ArrayList;
+import java.util.List;
+
+import org.hisp.dhis.attribute.Attribute;
+import org.hisp.dhis.attribute.AttributeService;
+import org.hisp.dhis.reportsheet.AttributeValueGroupOrder;
+import org.hisp.dhis.reportsheet.ExportReport;
+import org.hisp.dhis.reportsheet.ExportReportAttribute;
+import org.hisp.dhis.reportsheet.ExportReportService;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Dang Duy Hieu
+ * @version $Id$
+ */
+
+public class SaveAttributeValueGroupOrderAction
+    implements Action
+{
+    // -------------------------------------------------------------------------
+    // Dependency
+    // -------------------------------------------------------------------------
+
+    private AttributeService attributeService;
+
+    public void setAttributeService( AttributeService attributeService )
+    {
+        this.attributeService = attributeService;
+    }
+
+    private ExportReportService exportReportService;
+
+    public void setExportReportService( ExportReportService exportReportService )
+    {
+        this.exportReportService = exportReportService;
+    }
+
+    // -------------------------------------------------------------------------
+    // Input
+    // -------------------------------------------------------------------------
+
+    private Integer id;
+
+    private Integer attributeId;
+
+    private String name;
+
+    private String clazzName;
+
+    private List<String> attributeValues = new ArrayList<String>();
+
+    // -------------------------------------------------------------------------
+    // Getter & Setter
+    // -------------------------------------------------------------------------
+
+    public void setName( String name )
+    {
+        this.name = name;
+    }
+
+    public void setId( Integer id )
+    {
+        this.id = id;
+    }
+
+    public Integer getId()
+    {
+        return id;
+    }
+
+    public void setAttributeId( Integer attributeId )
+    {
+        this.attributeId = attributeId;
+    }
+
+    public void setClazzName( String clazzName )
+    {
+        this.clazzName = clazzName;
+    }
+
+    public void setAttributeValues( List<String> attributeValues )
+    {
+        this.attributeValues = attributeValues;
+    }
+
+    // -------------------------------------------------------------------------
+    // Action implementation
+    // -------------------------------------------------------------------------
+
+    @SuppressWarnings("unchecked")
+    public String execute()
+        throws Exception
+    {
+        AttributeValueGroupOrder attributeValueGroupOrder = new AttributeValueGroupOrder( name );
+
+        Attribute attribute = attributeService.getAttribute( attributeId );
+
+        attributeValueGroupOrder.setAttribute( attribute );
+
+        List<String> finalList = new ArrayList<String>();
+        
+        removeDuplicatedItems( attributeValues, finalList );
+        
+        attributeValueGroupOrder.setAttributeValues( finalList );
+
+        if ( clazzName.equals( ExportReport.class.getSimpleName() ) )
+        {
+            ExportReportAttribute exportReportAttribute = (ExportReportAttribute) exportReportService
+                .getExportReport( id );
+
+            List<AttributeValueGroupOrder> attributeValueGroupOrders = exportReportAttribute.getAttributeValueOrders();
+
+            attributeValueGroupOrders.add( attributeValueGroupOrder );
+
+            exportReportAttribute.setAttributeValueOrders( attributeValueGroupOrders );
+
+            exportReportService.updateExportReport( exportReportAttribute );
+        }
+
+        attributeValues = null;
+        
+        return SUCCESS;
+    }
+    
+    private static void removeDuplicatedItems( List<String> a, List<String> b )
+    {
+        for ( String s1 : a )
+        {
+            if ( !b.contains( s1 ) )
+            {
+                b.add( s1 );
+            }
+        }
+    }
+}

=== added file 'local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/avgroup/action/UpdateAttributeValueGroupOrderAction.java'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/avgroup/action/UpdateAttributeValueGroupOrderAction.java	1970-01-01 00:00:00 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/avgroup/action/UpdateAttributeValueGroupOrderAction.java	2012-04-16 03:00:30 +0000
@@ -0,0 +1,150 @@
+package org.hisp.dhis.reportsheet.avgroup.action;
+
+/*
+ * Copyright (c) 2004-2012, 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.ArrayList;
+import java.util.List;
+
+import org.hisp.dhis.attribute.Attribute;
+import org.hisp.dhis.attribute.AttributeService;
+import org.hisp.dhis.reportsheet.AttributeValueGroupOrder;
+import org.hisp.dhis.reportsheet.AttributeValueGroupOrderService;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Dang Duy Hieu
+ * @version $Id$
+ */
+public class UpdateAttributeValueGroupOrderAction
+    implements Action
+{
+    // -------------------------------------------------------------------------
+    // Dependency
+    // -------------------------------------------------------------------------
+
+    private AttributeService attributeService;
+
+    public void setAttributeService( AttributeService attributeService )
+    {
+        this.attributeService = attributeService;
+    }
+
+    private AttributeValueGroupOrderService attributeValueGroupOrderService;
+
+    public void setAttributeValueGroupOrderService( AttributeValueGroupOrderService attributeValueGroupOrderService )
+    {
+        this.attributeValueGroupOrderService = attributeValueGroupOrderService;
+    }
+
+    // -------------------------------------------------------------------------
+    // Input
+    // -------------------------------------------------------------------------
+
+    private Integer id;
+
+    private Integer attributeId;
+
+    private Integer attributeValueGroupOrderId;
+
+    private String name;
+
+    private List<String> attributeValues = new ArrayList<String>();
+
+    // -------------------------------------------------------------------------
+    // Getter & Setter
+    // -------------------------------------------------------------------------
+
+    public void setAttributeValueGroupOrderId( Integer attributeValueGroupOrderId )
+    {
+        this.attributeValueGroupOrderId = attributeValueGroupOrderId;
+    }
+
+    public void setName( String name )
+    {
+        this.name = name;
+    }
+
+    public Integer getId()
+    {
+        return id;
+    }
+
+    public void setId( Integer id )
+    {
+        this.id = id;
+    }
+
+    public void setAttributeId( Integer attributeId )
+    {
+        this.attributeId = attributeId;
+    }
+
+    public void setAttributeValues( List<String> attributeValues )
+    {
+        this.attributeValues = attributeValues;
+    }
+
+    // -------------------------------------------------------------------------
+    // Action implementation
+    // -------------------------------------------------------------------------
+
+    public String execute()
+        throws Exception
+    {
+        AttributeValueGroupOrder attributeValueGroupOrder = attributeValueGroupOrderService
+            .getAttributeValueGroupOrder( attributeValueGroupOrderId );
+
+        Attribute attribute = attributeService.getAttribute( attributeId );
+
+        attributeValueGroupOrder.setName( name );
+
+        attributeValueGroupOrder.setAttribute( attribute );
+
+        List<String> finalList = new ArrayList<String>();
+
+        removeDuplicatedItems( attributeValues, finalList );
+
+        attributeValueGroupOrder.setAttributeValues( finalList );
+
+        attributeValueGroupOrderService.updateAttributeValueGroupOrder( attributeValueGroupOrder );
+
+        return SUCCESS;
+    }
+
+    private static void removeDuplicatedItems( List<String> a, List<String> b )
+    {
+        for ( String s1 : a )
+        {
+            if ( !b.contains( s1 ) )
+            {
+                b.add( s1 );
+            }
+        }
+    }
+}

=== added file 'local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/avgroup/action/UpdateSortedAttributeValueAction.java'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/avgroup/action/UpdateSortedAttributeValueAction.java	1970-01-01 00:00:00 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/avgroup/action/UpdateSortedAttributeValueAction.java	2012-04-16 03:00:30 +0000
@@ -0,0 +1,127 @@
+package org.hisp.dhis.reportsheet.avgroup.action;
+
+/*
+ * Copyright (c) 2004-2012, 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.ArrayList;
+import java.util.List;
+
+import org.hisp.dhis.i18n.I18n;
+import org.hisp.dhis.reportsheet.AttributeValueGroupOrder;
+import org.hisp.dhis.reportsheet.AttributeValueGroupOrderService;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Dang Duy Hieu
+ * @version $Id$
+ */
+public class UpdateSortedAttributeValueAction
+    implements Action
+{
+    // -------------------------------------------------------------------------
+    // Dependency
+    // -------------------------------------------------------------------------
+
+    private AttributeValueGroupOrderService attributeValueGroupOrderService;
+
+    public void setAttributeValueGroupOrderService( AttributeValueGroupOrderService attributeValueGroupOrderService )
+    {
+        this.attributeValueGroupOrderService = attributeValueGroupOrderService;
+    }
+
+    public void setI18n( I18n i18n )
+    {
+        this.i18n = i18n;
+    }
+
+    // -------------------------------------------------------------------------
+    // Input & Output
+    // -------------------------------------------------------------------------
+
+    private Integer id;
+
+    private Integer reportId;
+
+    private List<String> attributeValues = new ArrayList<String>();
+
+    public String message;
+
+    public I18n i18n;
+
+    // -------------------------------------------------------------------------
+    // Getter & Setter
+    // -------------------------------------------------------------------------
+
+    public String getMessage()
+    {
+        return message;
+    }
+
+    public void setReportId( Integer reportId )
+    {
+        this.reportId = reportId;
+    }
+
+    public Integer getReportId()
+    {
+        return reportId;
+    }
+
+    public void setId( Integer id )
+    {
+        this.id = id;
+    }
+
+    public Integer getId()
+    {
+        return id;
+    }
+
+    public void setAttributeValues( List<String> attributeValues )
+    {
+        this.attributeValues = attributeValues;
+    }
+
+    // -------------------------------------------------------------------------
+    // Action implementation
+    // -------------------------------------------------------------------------
+
+    public String execute()
+        throws Exception
+    {
+        AttributeValueGroupOrder attributeValueGroupOrder = attributeValueGroupOrderService.getAttributeValueGroupOrder( id );
+
+        attributeValueGroupOrder.setAttributeValues( attributeValues );
+
+        message = i18n.getString( "update_sort_attributevalue_success" );
+
+        attributeValueGroupOrderService.updateAttributeValueGroupOrder( attributeValueGroupOrder );
+
+        return SUCCESS;
+    }
+}

=== added file 'local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/avgroup/action/UpdateSortedAttributeValueGroupOrderAction.java'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/avgroup/action/UpdateSortedAttributeValueGroupOrderAction.java	1970-01-01 00:00:00 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/avgroup/action/UpdateSortedAttributeValueGroupOrderAction.java	2012-04-16 03:00:30 +0000
@@ -0,0 +1,127 @@
+package org.hisp.dhis.reportsheet.avgroup.action;
+
+/*
+ * Copyright (c) 2004-2011, 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.ArrayList;
+import java.util.List;
+
+import org.hisp.dhis.reportsheet.AttributeValueGroupOrder;
+import org.hisp.dhis.reportsheet.AttributeValueGroupOrderService;
+import org.hisp.dhis.reportsheet.ExportReport;
+import org.hisp.dhis.reportsheet.ExportReportAttribute;
+import org.hisp.dhis.reportsheet.ExportReportService;
+import org.hisp.dhis.reportsheet.action.ActionSupport;
+
+/**
+ * @author Dang Duy Hieu
+ * @version $Id$
+ */
+public class UpdateSortedAttributeValueGroupOrderAction
+    extends ActionSupport
+{
+    // -------------------------------------------------------------------------
+    // Dependency
+    // -------------------------------------------------------------------------
+
+    private AttributeValueGroupOrderService attributeValueGroupOrderService;
+
+    public void setAttributeValueGroupOrderService( AttributeValueGroupOrderService attributeValueGroupOrderService )
+    {
+        this.attributeValueGroupOrderService = attributeValueGroupOrderService;
+    }
+
+    private ExportReportService exportReportService;
+
+    public void setExportReportService( ExportReportService exportReportService )
+    {
+        this.exportReportService = exportReportService;
+    }
+
+    // -------------------------------------------------------------------------
+    // Input & Output
+    // -------------------------------------------------------------------------
+
+    private Integer reportId;
+
+    public Integer getReportId()
+    {
+        return reportId;
+    }
+
+    public void setReportId( Integer reportId )
+    {
+        this.reportId = reportId;
+    }
+
+    private String clazzName;
+
+    public void setClazzName( String clazzName )
+    {
+        this.clazzName = clazzName;
+    }
+
+    private List<String> attributeValueGroupOrderId = new ArrayList<String>();
+
+    public void setAttributeValueGroupOrderId( List<String> attributeValueGroupOrderId )
+    {
+        this.attributeValueGroupOrderId = attributeValueGroupOrderId;
+    }
+
+    // -------------------------------------------------------------------------
+    // Action implementation
+    // -------------------------------------------------------------------------
+
+    public String execute()
+        throws Exception
+    {
+        List<AttributeValueGroupOrder> attributeValueGroupOrders = new ArrayList<AttributeValueGroupOrder>();
+
+        for ( String id : this.attributeValueGroupOrderId )
+        {
+            AttributeValueGroupOrder daElementGroupOrder = attributeValueGroupOrderService
+                .getAttributeValueGroupOrder( Integer.parseInt( id ) );
+
+            attributeValueGroupOrders.add( daElementGroupOrder );
+        }
+
+        if ( clazzName.equals( ExportReport.class.getSimpleName() ) )
+        {
+            ExportReportAttribute exportReportAttribute = (ExportReportAttribute) exportReportService
+                .getExportReport( reportId );
+
+            exportReportAttribute.setAttributeValueOrders( attributeValueGroupOrders );
+
+            exportReportService.updateExportReport( exportReportAttribute );
+        }
+
+        message = i18n.getString( "update_successful" );
+
+        return SUCCESS;
+    }
+
+}

=== added file 'local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/avgroup/action/ValidateAttributeValueGroupOrderAction.java'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/avgroup/action/ValidateAttributeValueGroupOrderAction.java	1970-01-01 00:00:00 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/avgroup/action/ValidateAttributeValueGroupOrderAction.java	2012-04-16 03:00:30 +0000
@@ -0,0 +1,103 @@
+package org.hisp.dhis.reportsheet.avgroup.action;
+
+/*
+ * Copyright (c) 2004-2011, 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 org.hisp.dhis.reportsheet.AttributeValueGroupOrder;
+import org.hisp.dhis.reportsheet.AttributeValueGroupOrderService;
+import org.hisp.dhis.reportsheet.action.ActionSupport;
+
+/**
+ * @author Dang Duy Hieu
+ * @version $Id$
+ */
+public class ValidateAttributeValueGroupOrderAction
+    extends ActionSupport
+{
+    // -------------------------------------------------------------------------
+    // Dependency
+    // -------------------------------------------------------------------------
+
+    private AttributeValueGroupOrderService attributeValueGroupOrderService;
+
+    public void setAttributeValueGroupOrderService( AttributeValueGroupOrderService attributeValueGroupOrderService )
+    {
+        this.attributeValueGroupOrderService = attributeValueGroupOrderService;
+    }
+
+    // -------------------------------------------------------------------------
+    // Input & Output
+    // -------------------------------------------------------------------------
+
+    private Integer id;
+
+    public void setId( Integer id )
+    {
+        this.id = id;
+    }
+
+    private Integer reportId;
+
+    public void setReportId( Integer reportId )
+    {
+        this.reportId = reportId;
+    }
+
+    private String clazzName;
+
+    public void setClazzName( String clazzName )
+    {
+        this.clazzName = clazzName;
+    }
+
+    private String name;
+
+    public void setName( String name )
+    {
+        this.name = name;
+    }
+
+    // -------------------------------------------------------------------------
+    // Input & Output
+    // -------------------------------------------------------------------------
+
+    public String execute()
+        throws Exception
+    {
+        AttributeValueGroupOrder match = attributeValueGroupOrderService.getAttributeValueGroupOrder( name, clazzName,
+            reportId );
+
+        if ( match != null && (id == null || match.getId() != id) )
+        {
+            message = i18n.getString( "name_ready_exist" );
+
+            return ERROR;
+        }
+
+        return SUCCESS;
+    }
+}

=== modified file 'local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exporting/GenerateExcelReportGeneric.java'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exporting/GenerateExcelReportGeneric.java	2011-10-13 03:03:58 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exporting/GenerateExcelReportGeneric.java	2012-04-16 03:00:30 +0000
@@ -47,6 +47,7 @@
 import org.apache.poi.ss.usermodel.Sheet;
 import org.apache.poi.ss.usermodel.Workbook;
 import org.apache.poi.xssf.usermodel.XSSFWorkbook;
+import org.hisp.dhis.aggregation.AggregatedDataValueService;
 import org.hisp.dhis.aggregation.AggregationService;
 import org.hisp.dhis.dataelement.DataElementCategoryService;
 import org.hisp.dhis.dataelement.DataElementService;
@@ -97,6 +98,8 @@
 
     protected AggregationService aggregationService;
 
+    protected AggregatedDataValueService aggregatedDataValueService;
+
     protected DataElementCategoryService categoryService;
 
     protected DataElementService dataElementService;
@@ -144,7 +147,7 @@
     protected Date endDate;
 
     protected Date firstDayOfMonth;
-    
+
     protected Date firstDayOfYear;
 
     protected Date last3MonthStartDate;
@@ -259,6 +262,11 @@
         this.aggregationService = aggregationService;
     }
 
+    public void setAggregatedDataValueService( AggregatedDataValueService aggregatedDataValueService )
+    {
+        this.aggregatedDataValueService = aggregatedDataValueService;
+    }
+
     public void setFormat( I18nFormat format )
     {
         this.format = format;

=== modified file 'local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exporting/action/GenerateReportOrgGroupListingAction.java'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exporting/action/GenerateReportOrgGroupListingAction.java	2012-02-03 08:38:42 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exporting/action/GenerateReportOrgGroupListingAction.java	2012-04-16 03:00:30 +0000
@@ -43,7 +43,7 @@
 import org.hisp.dhis.period.Period;
 import org.hisp.dhis.reportsheet.ExportItem;
 import org.hisp.dhis.reportsheet.ExportReport;
-import org.hisp.dhis.reportsheet.ExportReportOganiztionGroupListing;
+import org.hisp.dhis.reportsheet.ExportReportOrganizationGroupListing;
 import org.hisp.dhis.reportsheet.exporting.AbstractGenerateExcelReportSupport;
 import org.hisp.dhis.reportsheet.utils.ExcelUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -76,7 +76,7 @@
     {
         OrganisationUnit organisationUnit = organisationUnitSelectionManager.getSelectedOrganisationUnit();
 
-        ExportReportOganiztionGroupListing exportReportInstance = (ExportReportOganiztionGroupListing) exportReport;
+        ExportReportOrganizationGroupListing exportReportInstance = (ExportReportOrganizationGroupListing) exportReport;
 
         Map<OrganisationUnitGroup, OrganisationUnitLevel> orgUniGroupAtLevels = new HashMap<OrganisationUnitGroup, OrganisationUnitLevel>(
             exportReportInstance.getOrganisationUnitLevels() );
@@ -97,7 +97,7 @@
     // Supportive method
     // -------------------------------------------------------------------------
 
-    private void generateOutPutFile( ExportReportOganiztionGroupListing exportReport,
+    private void generateOutPutFile( ExportReportOrganizationGroupListing exportReport,
         Map<OrganisationUnitGroup, OrganisationUnitLevel> orgUniGroupAtLevels,
         Collection<ExportItem> exportReportItems, OrganisationUnit organisationUnit, Sheet sheet )
     {

=== modified file 'local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exporting/advance/action/GenerateAdvancedReportOrgGroupListingAction.java'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exporting/advance/action/GenerateAdvancedReportOrgGroupListingAction.java	2012-02-03 08:38:42 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exporting/advance/action/GenerateAdvancedReportOrgGroupListingAction.java	2012-04-16 03:00:30 +0000
@@ -40,7 +40,7 @@
 import org.hisp.dhis.period.Period;
 import org.hisp.dhis.reportsheet.ExportItem;
 import org.hisp.dhis.reportsheet.ExportReport;
-import org.hisp.dhis.reportsheet.ExportReportOganiztionGroupListing;
+import org.hisp.dhis.reportsheet.ExportReportOrganizationGroupListing;
 import org.hisp.dhis.reportsheet.exporting.AbstractGenerateExcelReportSupport;
 import org.hisp.dhis.reportsheet.utils.ExcelUtils;
 
@@ -85,7 +85,7 @@
         OrganisationUnitGroup organisationUnitGroup = organisationUnitGroupService
             .getOrganisationUnitGroup( organisationGroupId );
 
-        ExportReportOganiztionGroupListing exportReportInstance = (ExportReportOganiztionGroupListing) exportReport;
+        ExportReportOrganizationGroupListing exportReportInstance = (ExportReportOrganizationGroupListing) exportReport;
 
         this.installReadTemplateFile( exportReportInstance, period, organisationUnitGroup );
 

=== modified file 'local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exportreport/action/AddExportReportAction.java'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exportreport/action/AddExportReportAction.java	2011-08-04 08:39:55 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exportreport/action/AddExportReportAction.java	2012-04-16 03:00:30 +0000
@@ -1,7 +1,7 @@
 package org.hisp.dhis.reportsheet.exportreport.action;
 
 /*
- * Copyright (c) 2004-2011, University of Oslo
+ * Copyright (c) 2004-2012, University of Oslo
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -26,11 +26,12 @@
  * (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 org.hisp.dhis.reportsheet.ExportReportAttribute;
 import org.hisp.dhis.reportsheet.ExportReportService;
 import org.hisp.dhis.reportsheet.ExportReport;
 import org.hisp.dhis.reportsheet.ExportReportCategory;
 import org.hisp.dhis.reportsheet.ExportReportNormal;
-import org.hisp.dhis.reportsheet.ExportReportOganiztionGroupListing;
+import org.hisp.dhis.reportsheet.ExportReportOrganizationGroupListing;
 import org.hisp.dhis.reportsheet.ExportReportPeriodColumnListing;
 
 import com.opensymphony.xwork2.Action;
@@ -49,6 +50,11 @@
 
     private ExportReportService exportReportService;
 
+    public void setExportReportService( ExportReportService exportReportService )
+    {
+        this.exportReportService = exportReportService;
+    }
+
     // -------------------------------------------------------------------------
     // Input & Output
     // -------------------------------------------------------------------------
@@ -75,11 +81,6 @@
     // Getter & Setter
     // -------------------------------------------------------------------------
 
-    public void setExportReportService( ExportReportService exportReportService )
-    {
-        this.exportReportService = exportReportService;
-    }
-
     public void setGroup( String group )
     {
         this.group = group;
@@ -133,15 +134,19 @@
             exportReport = new ExportReportNormal();
         }
 
-        if ( exportReportType.equalsIgnoreCase( ExportReport.TYPE.ORGANIZATION_GROUP_LISTING ) )
+        if ( exportReportType.equalsIgnoreCase( ExportReport.TYPE.ATTRIBUTE ) )
         {
-            exportReport = new ExportReportOganiztionGroupListing();
+            exportReport = new ExportReportAttribute();
         }
 
         if ( exportReportType.equalsIgnoreCase( ExportReport.TYPE.CATEGORY ) )
         {
             exportReport = new ExportReportCategory();
+        }
 
+        if ( exportReportType.equalsIgnoreCase( ExportReport.TYPE.ORGANIZATION_GROUP_LISTING ) )
+        {
+            exportReport = new ExportReportOrganizationGroupListing();
         }
 
         if ( exportReportType.equalsIgnoreCase( ExportReport.TYPE.PERIOD_COLUMN_LISTING ) )

=== modified file 'local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exportreport/action/GetExportReportAction.java'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exportreport/action/GetExportReportAction.java	2011-08-03 08:38:38 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exportreport/action/GetExportReportAction.java	2012-04-16 03:00:30 +0000
@@ -102,16 +102,16 @@
     public String execute()
         throws Exception
     {
-        if ( id != null )
+        if ( id == null )
+        {
+            return ERROR;
+        }
+        else
         {
             selectionManager.setSelectedReportId( id );
 
             report = exportReportService.getExportReport( id );
         }
-        else
-        {
-            return ERROR;
-        }
 
         return SUCCESS;
     }

=== modified file 'local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/orgunitgrouplisting/action/ListOrgUnitGroupAtLevelAction.java'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/orgunitgrouplisting/action/ListOrgUnitGroupAtLevelAction.java	2011-08-04 08:39:55 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/orgunitgrouplisting/action/ListOrgUnitGroupAtLevelAction.java	2012-04-16 03:00:30 +0000
@@ -33,7 +33,7 @@
 import org.hisp.dhis.organisationunit.OrganisationUnitLevel;
 import org.hisp.dhis.organisationunit.OrganisationUnitService;
 import org.hisp.dhis.reportsheet.ExportReportService;
-import org.hisp.dhis.reportsheet.ExportReportOganiztionGroupListing;
+import org.hisp.dhis.reportsheet.ExportReportOrganizationGroupListing;
 
 import com.opensymphony.xwork2.Action;
 
@@ -94,9 +94,9 @@
         return organisationUnitLevel;
     }
 
-    private ExportReportOganiztionGroupListing exportReport;
+    private ExportReportOrganizationGroupListing exportReport;
 
-    public ExportReportOganiztionGroupListing getExportReport()
+    public ExportReportOrganizationGroupListing getExportReport()
     {
         return exportReport;
     }
@@ -110,7 +110,7 @@
     {
         organisationUnitLevel = organisationUnitService.getOrganisationUnitLevels();
 
-        exportReport = (ExportReportOganiztionGroupListing) exportReportService.getExportReport( id );
+        exportReport = (ExportReportOrganizationGroupListing) exportReportService.getExportReport( id );
 
         availableOrganisationUnitGroups = exportReport.getOrganisationUnitGroups();
         

=== modified file 'local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/orgunitgrouplisting/action/OpenUpdateOrgUnitGroupAction.java'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/orgunitgrouplisting/action/OpenUpdateOrgUnitGroupAction.java	2012-02-03 08:38:42 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/orgunitgrouplisting/action/OpenUpdateOrgUnitGroupAction.java	2012-04-16 03:00:30 +0000
@@ -33,7 +33,7 @@
 import org.hisp.dhis.common.comparator.IdentifiableObjectNameComparator;
 import org.hisp.dhis.organisationunit.OrganisationUnitGroup;
 import org.hisp.dhis.organisationunit.OrganisationUnitGroupService;
-import org.hisp.dhis.reportsheet.ExportReportOganiztionGroupListing;
+import org.hisp.dhis.reportsheet.ExportReportOrganizationGroupListing;
 import org.hisp.dhis.reportsheet.ExportReportService;
 
 import com.opensymphony.xwork2.Action;
@@ -73,13 +73,13 @@
 
     private List<OrganisationUnitGroup> selectedOrganisationUnitGroups;
 
-    private ExportReportOganiztionGroupListing exportReportOrgUnitGroupListing;
+    private ExportReportOrganizationGroupListing exportReportOrgUnitGroupListing;
 
     // -------------------------------------------------------------------------
     // Getter & Setter
     // -------------------------------------------------------------------------
 
-    public ExportReportOganiztionGroupListing getExportReportOrgUnitGroupListing()
+    public ExportReportOrganizationGroupListing getExportReportOrgUnitGroupListing()
     {
         return exportReportOrgUnitGroupListing;
     }
@@ -106,7 +106,7 @@
     public String execute()
         throws Exception
     {
-        exportReportOrgUnitGroupListing = (ExportReportOganiztionGroupListing) exportReportService.getExportReport( id );
+        exportReportOrgUnitGroupListing = (ExportReportOrganizationGroupListing) exportReportService.getExportReport( id );
 
         availableOrganisationUnitGroups = new ArrayList<OrganisationUnitGroup>( organisationUnitGroupService
             .getAllOrganisationUnitGroups() );

=== modified file 'local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/orgunitgrouplisting/action/UpdateOrgUnitGroupAction.java'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/orgunitgrouplisting/action/UpdateOrgUnitGroupAction.java	2011-08-04 08:39:55 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/orgunitgrouplisting/action/UpdateOrgUnitGroupAction.java	2012-04-16 03:00:30 +0000
@@ -31,7 +31,7 @@
 
 import org.hisp.dhis.organisationunit.OrganisationUnitGroup;
 import org.hisp.dhis.organisationunit.OrganisationUnitGroupService;
-import org.hisp.dhis.reportsheet.ExportReportOganiztionGroupListing;
+import org.hisp.dhis.reportsheet.ExportReportOrganizationGroupListing;
 import org.hisp.dhis.reportsheet.ExportReportService;
 
 import com.opensymphony.xwork2.Action;
@@ -86,7 +86,7 @@
     public String execute()
         throws Exception
     {
-        ExportReportOganiztionGroupListing exportReport = (ExportReportOganiztionGroupListing) exportReportService
+        ExportReportOrganizationGroupListing exportReport = (ExportReportOrganizationGroupListing) exportReportService
             .getExportReport( id );
 
         List<OrganisationUnitGroup> organisationUnitGroups = new ArrayList<OrganisationUnitGroup>();

=== modified file 'local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/orgunitgrouplisting/action/UpdateOrgUnitGroupAtLevelAction.java'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/orgunitgrouplisting/action/UpdateOrgUnitGroupAtLevelAction.java	2011-11-03 04:26:28 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/orgunitgrouplisting/action/UpdateOrgUnitGroupAtLevelAction.java	2012-04-16 03:00:30 +0000
@@ -34,7 +34,7 @@
 import org.hisp.dhis.organisationunit.OrganisationUnitLevel;
 import org.hisp.dhis.organisationunit.OrganisationUnitService;
 import org.hisp.dhis.reportsheet.ExportReportService;
-import org.hisp.dhis.reportsheet.ExportReportOganiztionGroupListing;
+import org.hisp.dhis.reportsheet.ExportReportOrganizationGroupListing;
 
 import com.opensymphony.xwork2.Action;
 
@@ -102,7 +102,7 @@
     public String execute()
         throws Exception
     {
-        ExportReportOganiztionGroupListing exportReport = (ExportReportOganiztionGroupListing) exportReportService
+        ExportReportOrganizationGroupListing exportReport = (ExportReportOrganizationGroupListing) exportReportService
             .getExportReport( exportReportId );
 
         Map<OrganisationUnitGroup, OrganisationUnitLevel> orgUniGroupAtLevels = new HashMap<OrganisationUnitGroup, OrganisationUnitLevel>(

=== modified file 'local/vn/dhis-web-spreadsheet-reporting/src/main/resources/META-INF/dhis/beans.xml'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/resources/META-INF/dhis/beans.xml	2012-03-24 01:29:01 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/resources/META-INF/dhis/beans.xml	2012-04-16 03:00:30 +0000
@@ -259,6 +259,68 @@
 		<property name="dataElementGroupOrderService" ref="org.hisp.dhis.reportsheet.DataElementGroupOrderService" />
 	</bean>
 
+	<!-- REPORT EXCEL ATTRIBUTE BEAN -->
+
+	<bean
+		id="org.hisp.dhis.reportsheet.avgroup.action.ValidateAttributeValueGroupOrderAction"
+		class="org.hisp.dhis.reportsheet.avgroup.action.ValidateAttributeValueGroupOrderAction"
+		scope="prototype">
+		<property name="attributeValueGroupOrderService" ref="org.hisp.dhis.reportsheet.AttributeValueGroupOrderService" />
+	</bean>
+	
+	<bean
+		id="org.hisp.dhis.reportsheet.avgroup.action.SaveAttributeValueGroupOrderAction"
+		class="org.hisp.dhis.reportsheet.avgroup.action.SaveAttributeValueGroupOrderAction"
+		scope="prototype">
+		<property name="attributeService" ref="org.hisp.dhis.attribute.AttributeService" />
+		<property name="exportReportService" ref="org.hisp.dhis.reportsheet.ExportReportService" />
+	</bean>
+
+	<bean
+		id="org.hisp.dhis.reportsheet.avgroup.action.UpdateAttributeValueGroupOrderAction"
+		class="org.hisp.dhis.reportsheet.avgroup.action.UpdateAttributeValueGroupOrderAction"
+		scope="prototype">
+		<property name="attributeService" ref="org.hisp.dhis.attribute.AttributeService" />
+		<property name="attributeValueGroupOrderService" ref="org.hisp.dhis.reportsheet.AttributeValueGroupOrderService" />
+	</bean>
+
+	<bean
+		id="org.hisp.dhis.reportsheet.avgroup.action.DeleteAttributeValueGroupOrderAction"
+		class="org.hisp.dhis.reportsheet.avgroup.action.DeleteAttributeValueGroupOrderAction"
+		scope="prototype">
+		<property name="attributeValueGroupOrderService" ref="org.hisp.dhis.reportsheet.AttributeValueGroupOrderService" />
+	</bean>
+
+	<bean
+		id="org.hisp.dhis.reportsheet.avgroup.action.GetAttributeValueGroupOrderAction"
+		class="org.hisp.dhis.reportsheet.avgroup.action.GetAttributeValueGroupOrderAction"
+		scope="prototype">
+		<property name="attributeValueGroupOrderService" ref="org.hisp.dhis.reportsheet.AttributeValueGroupOrderService" />
+	</bean>
+
+	<bean
+		id="org.hisp.dhis.reportsheet.avgroup.action.UpdateSortedAttributeValueGroupOrderAction"
+		class="org.hisp.dhis.reportsheet.avgroup.action.UpdateSortedAttributeValueGroupOrderAction"
+		scope="prototype">
+		<property name="attributeValueGroupOrderService" ref="org.hisp.dhis.reportsheet.AttributeValueGroupOrderService" />
+		<property name="exportReportService" ref="org.hisp.dhis.reportsheet.ExportReportService" />
+	</bean>
+	
+	<bean
+		id="org.hisp.dhis.reportsheet.avgroup.action.UpdateSortedAttributeValueAction"
+		class="org.hisp.dhis.reportsheet.avgroup.action.UpdateSortedAttributeValueAction"
+		scope="prototype">
+		<property name="attributeValueGroupOrderService" ref="org.hisp.dhis.reportsheet.AttributeValueGroupOrderService" />
+	</bean>
+	
+	<bean
+		id="org.hisp.dhis.reportsheet.avgroup.action.GetAttributeValuesByAttributeAction"
+		class="org.hisp.dhis.reportsheet.avgroup.action.GetAttributeValuesByAttributeAction"
+		scope="prototype">
+		<property name="attributeService" ref="org.hisp.dhis.attribute.AttributeService" />
+		<property name="localAttributeValueService" ref="org.hisp.dhis.attribute.LocalAttributeValueService" />
+	</bean>
+
 	<!-- REPORT ORGANISATION UNIT GROUP LISTING BEAN -->
 
 	<bean

=== modified file 'local/vn/dhis-web-spreadsheet-reporting/src/main/resources/org/hisp/dhis/reportsheet/i18n_module.properties'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/resources/org/hisp/dhis/reportsheet/i18n_module.properties	2012-02-20 09:02:21 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/resources/org/hisp/dhis/reportsheet/i18n_module.properties	2012-04-16 03:00:30 +0000
@@ -9,6 +9,7 @@
 ORGANIZATION_GROUP_LISTING  = Organization Unit Listing
 NORMAL						= Normal
 CATEGORY					= Category
+ATTRIBUTE					= Attribute
 export_items				= Export Items
 period_postion_row			= Period Position Row
 period_postion_column		= Period Position Column
@@ -288,6 +289,8 @@
 there_is_no_import_report	= There is no Import Report/Import Item in system
 export_reports				= Export Reports
 import_reports				= Import Reports
+design_export_reports		= Design export reports
+design_import_reports		= Design import reports
 generate_export_report		= Generate export report
 set_organisationunit_group_level = Set up Organisation unit group level
 import_unsuccessfully		= Import unsuccessfully
@@ -307,4 +310,11 @@
 dataelement_with_id			= Dataelement with id
 cate_option_combo_with_id	= Option combo with id
 does_not_exist				= does not exist
-period_columns				= Period columns
\ No newline at end of file
+period_columns				= Period columns
+please_select_attribute		= Please select an attribute
+attributevalue_groups		= Attribute Value Groups
+select_attribute			= Select an attribute
+available_attributevalues	= Available attribute value
+selected_attributevalues	= Selected attribute value
+sort_attributevalue			= Sort attribute value
+selected_list_should_not_empty = The selected list should not empty
\ No newline at end of file

=== modified file 'local/vn/dhis-web-spreadsheet-reporting/src/main/resources/org/hisp/dhis/reportsheet/i18n_module_vi_VN.properties'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/resources/org/hisp/dhis/reportsheet/i18n_module_vi_VN.properties	2012-03-08 08:28:22 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/resources/org/hisp/dhis/reportsheet/i18n_module_vi_VN.properties	2012-04-16 03:00:30 +0000
@@ -8,6 +8,7 @@
 period_postion_=\u0111\u1ecbnh v\u1ecb th\u1eddi gian
 top=Tr\u00ean
 ORGANIZATION_GROUP_LISTING=Li\u1ec7t k\u00ea \u0111\u01a1n v\u1ecb
+ATTRIBUTE=Li\u1ec7t k\u00ea theo thu\u1ed9c t\u00ednh
 category_option_combo=Danh s\u00e1ch t\u1eadp ph\u00e2n lo\u1ea1i
 period_=theo th\u1eddi gian
 6_month=H\u1eb1ng 6 th\u00e1ng
@@ -218,7 +219,8 @@
 update_sorted_dataelement=C\u1eadp nh\u1eadt th\u1ee9 t\u1ef1 d\u1eef li\u1ec7u
 last_6_month=6 th\u00e1ng g\u1ea7n nh\u1ea5t
 organisation_chart=Bi\u1ec3u \u0111\u1ed3 \u0111\u01a1n v\u1ecb
-intro_export_reports=T\u1ea1o m\u1edbi, c\u1eadp nh\u1eadt, xem v\u00e0 x\u00f3a c\u00e1c b\u00e1o c\u00e1o b\u1ea3ngl. M\u1ed9t b\u00e1o c\u00e1o b\u1ea3ngl ch\u1ee9a nhi\u1ec1u ph\u1ea7n t\u1eed. B\u00e1o c\u00e1o b\u1ea3ng c\u00f3 th\u1ec3 thu\u1ed9c nhi\u1ec1u lo\u1ea1i b\u00e1o c\u00e1o kh\u00e1c nhau. Cho ph\u00e9p g\u00e1n b\u00e1o c\u00e1o cho m\u1ed9t hay nhi\u1ec1u \u0111\u01a1n v\u1ecb ho\u1eb7c nh\u00f3m \u0111\u01a1n v\u1ecb v\u00e0 m\u1ed9t s\u1ed1 t\u00f9y ch\u1ecdn kh\u00e1c.
+intro_design_export_reports=T\u1ea1o m\u1edbi, c\u1eadp nh\u1eadt, xem v\u00e0 x\u00f3a c\u00e1c b\u00e1o c\u00e1o b\u1ea3ng. M\u1ed9t b\u00e1o c\u00e1o b\u1ea3ng ch\u1ee9a nhi\u1ec1u ph\u1ea7n t\u1eed. B\u00e1o c\u00e1o b\u1ea3ng c\u00f3 th\u1ec3 thu\u1ed9c nhi\u1ec1u lo\u1ea1i b\u00e1o c\u00e1o kh\u00e1c nhau. Cho ph\u00e9p g\u00e1n b\u00e1o c\u00e1o cho m\u1ed9t hay nhi\u1ec1u \u0111\u01a1n v\u1ecb ho\u1eb7c nh\u00f3m \u0111\u01a1n v\u1ecb v\u00e0 m\u1ed9t s\u1ed1 t\u00f9y ch\u1ecdn kh\u00e1c.
+intro_design_import_reports=T\u1ea1o m\u1edbi, c\u1eadp nh\u1eadt, x\u00f3a v\u00e0 xem c\u00e1c ph\u1ea7n t\u1eed \u0111\u1ec3 t\u00edch h\u1ee3p d\u1eef li\u1ec7u t\u1eeb c\u00e1c t\u1eadp tin b\u1ea3ng. C\u00e1c ph\u1ea7n t\u1eed n\u00e0y t\u01b0\u01a1ng \u0111\u01b0\u01a1ng v\u1edbi c\u00e1c ph\u1ea7n t\u1eed b\u00e1o c\u00e1o.
 subtitle=Ph\u1ee5 \u0111\u1ec1
 import_type=Lo\u1ea1i t\u00edch h\u1ee3p
 expression_not_well_formed=Bi\u1ec3u th\u1ee9c sai \u0111\u1ecbnh d\u1ea1ng
@@ -229,13 +231,14 @@
 the_specified_report_is_not_exist=C\u1ea3nh b\u00e1o! B\u00e1o c\u00e1o n\u00e0y hi\u1ec7n t\u1ea1i kh\u00f4ng c\u00f2n hi\u1ec7u l\u1ef1c/t\u1ed3n t\u1ea1i.
 yealy=H\u1eb1ng n\u0103m
 export_reports=B\u00e1o c\u00e1o Xu\u1ea5t
+design_export_reports	= Thi\u1ebft k\u1ebf b\u00e1o c\u00e1o Xu\u1ea5t
+design_import_reports	= Thi\u1ebft k\u1ebf b\u00e1o c\u00e1o Nh\u1eadp
 excel_importing=\u0110ang t\u00edch h\u1ee3p b\u1ea3ng
 organisationunit_is_null=Vui l\u00f2ng ch\u1ecdn \u0111\u01a1n v\u1ecb!
 intro_chart=T\u1ea1o m\u1edbi, thay \u0111\u1ed5i, x\u00f3a, v\u00e0 xem bi\u1ec3u \u0111\u1ed3
 cleanup_success=\u0110\u00e3 x\u00f3a th\u01b0 m\u1ee5c t\u1ea1m
 LOAD_PERIOD_AUTO=T\u1ea3i th\u1eddi \u0111i\u1ec3m t\u1ef1 \u0111\u1ed9ng t\u00ednh \u0111\u1ebfn nay
 sheet_no=S\u1ed1 b\u1ea3ng
-intro_import_reports=T\u1ea1o m\u1edbi, c\u1eadp nh\u1eadt, x\u00f3a v\u00e0 xem c\u00e1c ph\u1ea7n t\u1eed \u0111\u1ec3 t\u00edch h\u1ee3p d\u1eef li\u1ec7u t\u1eeb c\u00e1c t\u1eadp tin b\u1ea3ng. C\u00e1c ph\u1ea7n t\u1eed n\u00e0y t\u01b0\u01a1ng \u0111\u01b0\u01a1ng v\u1edbi c\u00e1c ph\u1ea7n t\u1eed b\u00e1o c\u00e1o.
 filter_by_group=L\u1ecdc theo Nh\u00f3m ph\u1ea7n t\u1eed d\u1eef li\u1ec7u
 size=K\u00edch th\u01b0\u1edbc
 middle=Gi\u1eefa
@@ -341,3 +344,10 @@
 does_not_exist=kh\u00f4ng t\u1ed3n t\u1ea1i
 Period_columns=C\u1ed9t th\u1eddi \u0111i\u1ec3m
 period_columns=Period columns
+please_select_attribute=H\u00e3y ch\u1ecdn m\u1ed9t thu\u1ed9c t\u00ednh
+attributevalue_groups		= Danh s\u00e1ch nh\u00f3m c\u00e1c gi\u00e1 tr\u1ecb thu\u1ed9c t\u00ednh
+select_attribute			= Ch\u1ecdn m\u1ed9t thu\u1ed9c t\u00ednh
+available_attributevalues	= Gi\u00e1 tr\u1ecb thu\u1ed9c t\u00ednh hi\u1ec7n t\u1ea1i
+selected_attributevalues	= Gi\u00e1 tr\u1ecb thu\u1ed9c t\u00ednh \u0111\u00e3 ch\u1ecdn
+sort_attributevalue			= S\u1eafp x\u1ebfp th\u1ee9 t\u1ef1 c\u00e1c gi\u00e1 tr\u1ecb thu\u1ed9c t\u00ednh
+selected_list_should_not_empty = Danh s\u00e1ch n\u00e0y kh\u00f4ng n\u00ean r\u1ed7ng
\ No newline at end of file

=== modified file 'local/vn/dhis-web-spreadsheet-reporting/src/main/resources/struts.xml'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/resources/struts.xml	2012-03-24 01:29:01 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/resources/struts.xml	2012-04-16 03:00:30 +0000
@@ -284,6 +284,108 @@
 				listDataElementGroupOrderForImportReport.action?id=${reportId}</result>
 		</action>
 
+		<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
+		<!-- ATTRIBUTEVALUE GROUP ORDER FOR ATTRIBUTE VALUE 			   -->
+		<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
+
+		<action name="listAttributeValueGroupOrderForExportReport"
+			class="org.hisp.dhis.reportsheet.exportreport.action.GetExportReportAction">
+			<result name="success" type="velocity">/main.vm</result>
+			<param name="page">/dhis-web-spreadsheet-reporting/listAttributeValueGroupOrder.vm</param>
+			<param name="menu">/dhis-web-spreadsheet-reporting/menu.vm</param>
+			<param name="javascripts">javascript/attribute.ajax.js,javascript/attributeValueGroupOrder.js</param>
+			<param name="stylesheets">style/basic.css,style/style.css</param>
+		</action>
+		
+		<action name="listAttributeValueGroupOrderForImportReport"
+			class="org.hisp.dhis.reportsheet.importreport.action.GetImportReportAction">
+			<result name="success" type="velocity">/main.vm</result>
+			<param name="page">/dhis-web-spreadsheet-reporting/listAttributeValueGroupOrder.vm</param>
+			<param name="menu">/dhis-web-spreadsheet-reporting/menu.vm</param>
+			<param name="javascripts">javascript/attribute.ajax.js,javascript/attributeValueGroupOrder.js</param>
+			<param name="stylesheets">style/basic.css, style/style.css</param>
+		</action>	
+		
+		<action name="validateAttributeValueGroupOrder"
+			class="org.hisp.dhis.reportsheet.avgroup.action.ValidateAttributeValueGroupOrderAction">
+			<result name="success" type="velocity-json">
+				/dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
+			<result name="error" type="velocity-json">
+				/dhis-web-commons/ajax/jsonResponseError.vm</result>
+		</action>
+		
+		<action name="addAttributeValueGroupOrderForExportReport"
+			class="org.hisp.dhis.reportsheet.avgroup.action.SaveAttributeValueGroupOrderAction">
+			<result name="success" type="redirect">
+				listAttributeValueGroupOrderForExportReport.action?id=${id}</result>
+		</action>
+		
+		<action name="addAttributeValueGroupOrderForImportReport"
+			class="org.hisp.dhis.reportsheet.avgroup.action.SaveAttributeValueGroupOrderAction">
+			<result name="success" type="redirect">
+				listAttributeValueGroupOrderForImportReport.action?id=${id}
+			</result>
+		</action>
+
+		<action name="updateAttributeValueGroupOrderForExportReport"
+			class="org.hisp.dhis.reportsheet.avgroup.action.UpdateAttributeValueGroupOrderAction">
+			<result name="success" type="redirect">
+				listAttributeValueGroupOrderForExportReport.action?id=${id}</result>
+		</action>
+		
+		<action name="updateAttributeValueGroupOrderForImportReport"
+			class="org.hisp.dhis.reportsheet.avgroup.action.UpdateAttributeValueGroupOrderAction">
+			<result name="success" type="redirect">
+				listAttributeValueGroupOrderForImportReport.action?id=${id}
+			</result>
+		</action>
+		
+		<action name="deleteAttributeValueGroupOrder"
+			class="org.hisp.dhis.reportsheet.avgroup.action.DeleteAttributeValueGroupOrderAction">
+			<result name="success" type="velocity-json">
+				/dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
+		</action>
+		
+		<action name="updateSortAttributeValueGroupOrder"
+			class="org.hisp.dhis.reportsheet.avgroup.action.UpdateSortedAttributeValueGroupOrderAction">
+			<result name="success" type="velocity-json">
+				/dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
+		</action>
+		
+		<action name="getAttributeValueGroupOrder"
+			class="org.hisp.dhis.reportsheet.avgroup.action.GetAttributeValueGroupOrderAction">
+			<result name="success" type="velocity-json">
+				/dhis-web-spreadsheet-reporting/jsonAttributeValueGroupOrder.vm</result>
+		</action>
+		
+		<action name="openSortAttributeValue"
+			class="org.hisp.dhis.reportsheet.avgroup.action.GetAttributeValueGroupOrderAction">
+			<result name="success" type="velocity">/main.vm</result>
+			<param name="page">/dhis-web-spreadsheet-reporting/sortAttributeValues.vm</param>
+			<param name="menu">/dhis-web-spreadsheet-reporting/menu.vm</param>
+			<param name="javascripts">javascript/attributeValueGroupOrder.js</param>
+			<param name="stylesheets">style/basic.css</param>
+		</action>
+
+		<action name="updateSortedAttributeValuesForExportReport"
+			class="org.hisp.dhis.reportsheet.avgroup.action.UpdateSortedAttributeValueAction">
+			<result name="success" type="redirect">
+				listAttributeValueGroupOrderForExportReport.action?id=${reportId}</result>
+		</action>
+		
+		<action name="updateSortedAttributeValuesForImportReport"
+			class="org.hisp.dhis.reportsheet.avgroup.action.UpdateSortedAttributeValueAction">
+			<result name="success" type="redirect">
+				listAttributeValueGroupOrderForImportReport.action?id=${reportId}</result>
+		</action>		
+
+		<action name="getAttributeValuesByAttribute"
+			class="org.hisp.dhis.reportsheet.avgroup.action.GetAttributeValuesByAttributeAction">
+			<result name="success" type="velocity-json">
+				/dhis-web-spreadsheet-reporting/jsonAttributeValues.vm</result>
+			<param name="onExceptionReturn">plainTextError</param>
+		</action>
+
 		<!-- REPORT ORGANISATION UNIT GROUP LISTING ACTION -->
 
 		<action name="openUpdateOrgUnitGroupListingReport"

=== added file 'local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/javascript/attribute.ajax.js'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/javascript/attribute.ajax.js	1970-01-01 00:00:00 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/javascript/attribute.ajax.js	2012-04-16 03:00:30 +0000
@@ -0,0 +1,128 @@
+
+function AttributeLib()
+{
+	var attributeMap = new Array();
+	var attributeValueMap = new Array();
+	
+	this.loadAttributes = function( elementId, id )
+	{
+		var target = jQuery( "#" + elementId );
+		target.children().remove();
+
+		if ( attributeMap.length == 0 )
+		{	
+			jQuery.getJSON( '../dhis-web-commons-ajax-json/getAttributes.action', function( json )
+			{
+				attributeMap.push( new Attribute( -1, '[ ' + i18n_label + ' ]' ) );
+				target.append( '<option value="-1">[ ' + i18n_label + ' ]</option>' );
+				
+				jQuery.each( json.attributes, function( i, item )
+				{
+					if ( id && item.id == id ) {
+						target.append( '<option value="' + item.id + '" selected="true">' + item.name + '</option>' );
+					}
+					else {
+						target.append( '<option value="' + item.id + '">' + item.name + '</option>' );
+					}
+					
+					attributeMap.push( new Attribute( item.id, item.name ) );
+				} );
+			} );
+		}
+		else
+		{
+			jQuery.each( attributeMap, function( i, item )
+			{
+				if ( id && item.id == id ) {
+					target.append( '<option value="' + item.id + '" selected="true">' + item.name + '</option>' );
+				}
+				else {
+					target.append( '<option value="' + item.id + '">' + item.name + '</option>' );
+				}
+			} );
+		}
+	};
+
+	this.loadAttributeValuesByAttribute = function( id, curItems, sourceList, destList, isFirstLoad )
+	{
+		var target = jQuery( "#" + sourceList );
+		var dest = jQuery( "#" + destList );
+		target.empty();
+
+		if ( !isFirstLoad )
+		{
+			dest.empty();
+		}
+
+		var valueList = attributeValueMap[ id ];
+
+		if ( valueList == null )
+		{
+			valueList = new Array();
+
+			jQuery.getJSON( 'getAttributeValuesByAttribute.action', {
+				attributeId : id
+			}, function( json )
+			{
+				jQuery.each( json.values, function( i, item )
+				{
+					valueList.push( new AttributeValue( item.value ) );
+					target.append( '<option value="' + item.value + '">' + item.value + '</option>' );
+				} );
+				
+				attributeValueMap[ id ] = valueList;
+			} );
+		}
+		else
+		{
+			jQuery.each( valueList, function( i, item )
+			{
+				target.append( '<option value="' + item.value + '">' + item.value + '</option>' );
+			} );
+		}
+
+		if ( curItems )
+		{
+			jQuery.each( curItems, function( i, item )
+			{
+				dest.append( '<option value="' + item.value + '">' + item.value + '</option>' );
+			} );
+		}
+		
+		this.removeDuplicatedItem( sourceList, destList );
+	};
+	
+	this.removeDuplicatedItem = function( availableList, selectedList )
+	{
+		var $list1 = jQuery('#' + availableList);
+		var $list2 = jQuery('#' + selectedList);
+		
+		if ( $list1 && $list2 )
+		{
+			jQuery.each( $list2.children(), function( i, item )
+			{
+				$list1.find( "option[value='" + item.value + "']" ).remove();
+			} );
+		}		
+	};
+
+	this.resetParams = function()
+	{
+		this.attributeMap = new Array();
+		this.attributeValueMap = new Array();
+	}
+}
+
+
+function Attribute( _id, _name )
+{
+	this.id = _id;
+	this.name = _name;
+}
+
+function AttributeValue( _value )
+{
+	this.value = _value;
+}
+
+var attributeLib = new AttributeLib();
\ No newline at end of file

=== added file 'local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/javascript/attributeValueGroupOrder.js'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/javascript/attributeValueGroupOrder.js	1970-01-01 00:00:00 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/javascript/attributeValueGroupOrder.js	2012-04-16 03:00:30 +0000
@@ -0,0 +1,188 @@
+var selectedAttributeValueMap = new Array();
+
+function addOptionToListWithToolTip( list, optionValue, optionText )
+{
+    var option = document.createElement( "option" );
+    option.value = optionValue;
+    option.text = optionText;
+	option.onmousemove = function(e) {
+		showToolTip(e, optionText);
+	}
+    list.add( option, null );
+}
+
+function showAttributeValueGroupOrderDetails( id )
+{
+	jQuery.post( 'getAttributeValueGroupOrder.action',  { id: id }, function( json ) {
+		
+		setInnerHTML( 'nameField', json.attributeValueGroupOrder.name );
+		setInnerHTML( 'memberCountField', json.attributeValueGroupOrder.memberCount );
+
+		showDetails();
+	});
+}
+
+function resetForm()
+{
+	setFieldValue( "name", "" );
+	setFieldValue( "attributeValueGroupOrderId", "" );
+
+	var availableList = jQuery( '#availableAttributeValues' );
+	availableList.empty();
+	var selectedList = jQuery( '#attributeValues' );
+	selectedList.empty();
+}
+
+/*
+* 	Open Add Attribute Value Group Order 
+*/
+function openAddAttributeValueGroupOrder()
+{
+	resetForm();
+	validator.resetForm();
+
+	attributeLib.loadAttributes( "attributeId" );
+
+	dialog.dialog("open");
+	
+	jQuery( "#attributeValueGroupsForm" ).attr( "action", "addAttributeValueGroupOrderFor" + clazzName + ".action?clazzName=" + clazzName );
+}
+
+/*
+* 	Open Update Data Element Order
+*/
+
+function openUpdateAttributeValueGroupOrder( id )
+{
+	validator.resetForm();
+	setFieldValue("attributeValueGroupOrderId", id );
+	
+	jQuery.post( 'getAttributeValueGroupOrder.action', { id: id }, function( json )
+	{
+		var attributeId = json.attributeValueGroupOrder.attributeId;
+		var values = json.attributeValueGroupOrder.attributeValues;
+		var list = jQuery( "#attributeValues" );
+		list.empty();
+		selectedAttributeValueMap = [];
+		var items = [];
+		
+		setFieldValue( "name", json.attributeValueGroupOrder.name );
+		attributeLib.loadAttributes( "attributeId", attributeId );
+		attributeLib.loadAttributeValuesByAttribute( attributeId, items, "availableAttributeValues", "attributeValues", true );
+		
+		for ( var i = 0 ; i < values.length ; i++ )
+		{
+			items.push( new AttributeValue( values[ i ].value ) );
+			list.append( '<option value="' + values[ i ].value + '">' + values[ i ].value + '</option>' );
+		}
+
+		selectedAttributeValueMap[ id + "-" + attributeId ] = items;
+
+		attributeLib.removeDuplicatedItem( "availableAttributeValues", "attributeValues" );
+
+		jQuery( "#attributeValueGroupsForm" ).attr( "action", "updateAttributeValueGroupOrderFor" + clazzName + ".action" );
+		dialog.dialog( "open" );
+	} );
+}
+
+function validateAttributeValueGroupOrder( _form )
+{
+	var attributeId = getFieldValue( "attributeId" );
+
+	if ( attributeId && attributeId != -1 )
+	{
+		jQuery.postUTF8( "validateAttributeValueGroupOrder.action", {
+			name: getFieldValue( 'name' ),
+			id: getFieldValue( 'attributeValueGroupOrderId' ),
+			reportId: reportId,
+			clazzName: clazzName
+		}, function( json )
+		{
+			if ( json.response == "success" )
+			{
+				if ( hasElements( 'attributeValues' ) )
+				{
+					selectAllById( 'attributeValues' );
+					_form.submit();
+				}
+				else { markInvalid( "attributeValues", i18n_selected_list_empty ); }
+			}
+			else { markInvalid( "name", json.message ); }
+		} );
+	} else { markInvalid( "attributeId", i18n_verify_attribute ); }
+}
+
+/*
+* 	Delete Attribute Value Group Order
+*/
+function deleteAttributeValueGroupOrder( id, name )
+{
+	removeItem( id, name, i18n_confirm_delete, 'deleteAttributeValueGroupOrder.action', function(){ window.location.reload(); } );
+}
+
+/*
+*	Update Attribute Value Group Order
+*/
+function updateSortAttributeValueGroupOrder()
+{
+	var attributeValueGroups = document.getElementsByName( 'attributeValueGroupOrder' );
+	var url = "updateSortAttributeValueGroupOrder.action?reportId=" + reportId;
+	url += "&clazzName=" + clazzName;
+	
+	for ( var i = 0 ; i < attributeValueGroups.length ; i++ )
+	{
+		url += "&attributeValueGroupOrderId=" + attributeValueGroups.item(i).value;
+	}
+	
+	jQuery.postJSON( url, {}, function( json ) {
+		showSuccessMessage( json.message );
+	});
+}
+
+function openSortAttributeValueForGroupOrder( id )
+{
+	window.location = "openSortAttributeValue.action?id="+id+"&reportId="+reportId+"&clazzName="+clazzName;
+}
+
+/*
+* 	Update Sorted Attribute Value
+*/
+function updateSortedAttributeValue()
+{	
+	moveAllById( 'availableList', 'selectedList' );
+	selectAllById( 'selectedList' );
+	document.forms[0].submit();
+}
+
+/*
+*	Tooltip
+*/
+function showToolTip( e, value)
+{	
+	var tooltipDiv = byId( 'tooltip' );
+	tooltipDiv.style.display = 'block';
+	
+	var posx = 0;
+    var posy = 0;
+	
+    if (!e) var e = window.event;
+    if (e.pageX || e.pageY)
+    {
+        posx = e.pageX;
+        posy = e.pageY;
+    }
+    else if (e.clientX || e.clientY)
+    {
+        posx = e.clientX;
+        posy = e.clientY;
+    }
+	
+	tooltipDiv.style.left= posx  + 8 + 'px';
+	tooltipDiv.style.top = posy  + 8 + 'px';
+	tooltipDiv.innerHTML = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" +   value;
+}
+
+function hideToolTip()
+{
+	byId('tooltip').style.display = 'none';
+}
\ No newline at end of file

=== added file 'local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/jsonAttributeValueGroupOrder.vm'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/jsonAttributeValueGroupOrder.vm	1970-01-01 00:00:00 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/jsonAttributeValueGroupOrder.vm	2012-04-16 03:00:30 +0000
@@ -0,0 +1,18 @@
+{ "attributeValueGroupOrder":
+  {
+    "name": "$!encoder.jsonEncode( ${attributeValueGroupOrder.name} )",
+	
+	"attributeId": "$!{attributeValueGroupOrder.attribute.id}",
+	
+	#set( $size = ${attributeValueGroupOrder.attributeValues.size()} )
+	"memberCount": "${size}",
+	
+	"attributeValues": [
+	#foreach( $value in $!attributeValueGroupOrder.attributeValues )
+	{
+	  "value": "$!encoder.jsonEncode( ${value} )"
+	}#if( $velocityCount < $size ),#end
+	#end
+	]
+  }
+}
\ No newline at end of file

=== added file 'local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/jsonAttributeValues.vm'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/jsonAttributeValues.vm	1970-01-01 00:00:00 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/jsonAttributeValues.vm	2012-04-16 03:00:30 +0000
@@ -0,0 +1,9 @@
+#set( $size = $!values.size() )
+{ "values": [
+	#foreach( $value in $!values )
+	{
+	  "value": "$!encoder.jsonEncode( ${value} )"
+	}#if( $velocityCount < $size ),#end
+	#end
+  ]
+}
\ No newline at end of file

=== added file 'local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/listAttributeValueGroupOrder.vm'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/listAttributeValueGroupOrder.vm	1970-01-01 00:00:00 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/listAttributeValueGroupOrder.vm	2012-04-16 03:00:30 +0000
@@ -0,0 +1,135 @@
+<script type="text/javascript" src="javascript/attribute.ajax.js"></script>
+<script type="text/javascript">
+	var validator = null;
+	
+	jQuery(document).ready( function()
+	{
+		validator = validation( "attributeValueGroupsForm", function( form ) { validateAttributeValueGroupOrder( form ); });
+	} );
+</script>
+<h3>$i18n.getString( 'attributevalue_groups' )</h3>
+<h4><font color="green">$!encoder.htmlEncode( $!report.displayName )</font></h4>
+<table width="800px">
+	<tr>
+		<td colspan=2>
+			<input type="button" onclick="javascript:openAddAttributeValueGroupOrder();" value="$i18n.getString('add')" style="width:100px"/>
+			<input type="button" value="$i18n.getString( 'cancel' )" onclick="window.location='listAll${clazzSimpleName}.action'" style="width:100px"/>
+		</td>
+		<td width="100px">
+			<input type="button" value="$i18n.getString( 'update_order' )" onclick="javascript:updateSortAttributeValueGroupOrder();" style="width:150px"/>
+		</td>
+	</tr>
+	<tr>
+		<th colspan=2>$i18n.getString('name')</th>
+		<th width="100px">$i18n.getString('operations')</th>		
+	</tr>	
+</table>
+
+<table align="right">
+	<tr>
+		<td style="width:20em; padding-left:2em; vertical-align:top">
+			<div id="detailsArea" style="display:none">
+				<div style="float:right">
+					<a href="javascript:hideDetails()" title="$i18n.getString( 'hide_details' )"><img src="../images/close.png" alt="$i18n.getString( 'hide_details' )"/></a>
+				</div>				
+				<p><label>$i18n.getString( "name" ):</label><br/><span id="nameField"></span></p>
+				<p><label>$i18n.getString( "number_of_members" ):</label><br/><span id="memberCountField"></span></p>
+			</div>
+
+			<div id="warningArea" style="position:fixed;right:10px;top:200px;display:none">
+				<div style="float:right">
+					<a href="javascript:hideWarning()" title="$i18n.getString( 'hide_warning' )"><img src="../images/close.png" alt="$i18n.getString( 'hide_warning' )"/></a>
+				</div>
+				<p><span id="warningField"></span></p>
+			</div>
+		</td>
+	</tr>
+</table>
+
+<ul id="sortable"> 
+#foreach( $group in $!report.attributeValueOrders )
+	<li class="ui-state-default" name="attributeValueGroupOrder" value="$group.id" title="$i18n.getString( 'sort_order_help' )">		
+		<table cellspacing="0" cellpadding="0" width="100%">
+			<tr>
+				<td width="625px">$!encoder.htmlEncode( $group.name )</td>
+				<td>
+					<a href="javascript:deleteAttributeValueGroupOrder( '$group.id', '$group.name' );" title="$i18n.getString( 'remove' )"><img src="../images/delete.png" alt="$i18n.getString( 'remove' )"/></a>
+					<a href="javascript:openUpdateAttributeValueGroupOrder( '$group.id' );" title="$i18n.getString( 'edit' )"><img src="../images/edit.png" alt="$i18n.getString( 'edit' )"/></a>
+					<a href="javascript:openSortAttributeValueForGroupOrder( '$group.id' );" title="$i18n.getString( 'sort_attributevalue' )"><img src="../images/sort.png" border="1px"/></a>
+					<a href="javascript:showAttributeValueGroupOrderDetails( '$group.id' );" title="$i18n.getString( 'show_details' )"><img src="../images/information.png" border="1px" alt="$i18n.getString( 'show_details' )"/></a>
+				</td>
+			</tr>
+		</table>
+	</li> 	
+#end
+</ul>
+
+<div id="attributeValueGroups">
+	<form name="attributeValueGroupsForm" id="attributeValueGroupsForm" method="POST">
+		<input type="hidden" name="id" value="$report.id"/>
+		<input type="hidden" name="attributeValueGroupOrderId" id="attributeValueGroupOrderId"/>
+		<table>
+			<tr>
+				<td>$i18n.getString('name')</td>
+				<td><input type="text" style="width:400px" id="name" name="name" class="{validate:{required:true}}"/></td>
+			</tr>
+		</table>		
+		<br/>		
+		<table width="100%">		
+			<tr>
+				<td colspan="4">
+					<select id="attributeId" name="attributeId" 
+					onchange="javascript:attributeLib.loadAttributeValuesByAttribute( this.value , selectedAttributeValueMap[ byId( 'attributeValueGroupOrderId' ).value + '-' + this.value ], 'availableAttributeValues', 'attributeValues', false );"
+					style="width:300px"></select>
+				</td>
+			</tr>
+			<tr>
+				<td width="23%">
+					<select id="availableAttributeValues" name="availableAttributeValues" multiple="true" size="13" style="width:300px" ondblclick="javascript:moveSelectedById('availableAttributeValues','attributeValues');"></select>
+				</td>
+				<td width="7%" align="center">
+					<input type="button" value="&gt;" onclick="javascript:moveSelectedById('availableAttributeValues','attributeValues');" style="width:50px"/><br/>
+					<input type="button" value="&lt;" onclick="javascript:moveSelectedById('attributeValues' , 'availableAttributeValues' );" style="width:50px"/><br/>
+					<input type="button" value="&gt;&gt;" onclick="javascript:moveAllById('availableAttributeValues' , 'attributeValues' );" style="width:50px"/><br/>
+					<input type="button" value="&lt;&lt;" onclick="javascript:moveAllById('attributeValues' , 'availableAttributeValues' );" style="width:50px"/>
+				</td>
+				<td width="23%">
+					<select id="attributeValues" name="attributeValues" multiple="true" size="13" style="width:300px" ondblclick="moveSelectedById('attributeValues', 'availableAttributeValues' )"></select>
+				</td>
+				<td width="47%"><a href="javascript:moveSelectedOptionToTop( 'attributeValues' );"><img src="../images/move_top.png" style="cursor: pointer; width: 20px;" align="absmiddle"/></a><br/><br/>
+					<a href="javascript:moveUpSelectedOption( 'attributeValues' );"><img src="../images/move_up.png" style="cursor: pointer; width: 20px;" align="absmiddle"/></a><br/><br/>
+					<a href="javascript:moveDownSelectedOption( 'attributeValues' );"><img src="../images/move_down.png" style="cursor: pointer; width: 20px;" align="absmiddle"/></a><br/><br/>
+					<a href="javascript:moveSelectedOptionToBottom( 'attributeValues' );"><img src="../images/move_bottom.png" style="cursor: pointer; width: 20px;" align="absmiddle"/></a>
+				</td>
+			</tr>
+		</table>
+
+	<p align="center">
+	<input type="submit" value="$i18n.getString( 'save' )" style="width:130px"/>		
+	<input type="button" value="$i18n.getString( 'cancel' )" style="width:130px" onclick="dialog.dialog('close')"/>		
+	</p>
+	</form>
+</div>
+
+<div id="tooltip"></div>
+
+<script>
+	var i18n_confirm_delete = '$encoder.jsEscape($i18n.getString( 'confirm_delete' ) , "'")';
+	var i18n_name_is_null = '$encoder.jsEscape($i18n.getString( 'i18n_name_is_null' ) , "'")';
+	var i18n_label = '$encoder.jsEscape($i18n.getString( 'select_attribute' ) , "'")';
+	var i18n_verify_attribute = '$encoder.jsEscape($i18n.getString( 'please_select_attribute' ) , "'")';
+	var i18n_selected_list_empty = '$encoder.jsEscape($i18n.getString( 'selected_list_should_not_empty' ) , "'")';
+
+	var reportId = ${report.id};
+	var clazzName = '${clazzSimpleName}';
+	
+	$(function() {
+		$("#sortable").sortable({
+			placeholder: 'ui-state-highlight'
+		});
+		$("#sortable").disableSelection();
+		
+	});
+	
+	var dialog = jQuery("#attributeValueGroups").dialog( { modal:true,autoOpen:false,width:720,title:"$i18n.getString('attributevalue_groups')" } );
+</script>
\ No newline at end of file

=== modified file 'local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/report/addExportReportForm.vm'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/report/addExportReportForm.vm	2012-02-28 08:50:46 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/report/addExportReportForm.vm	2012-04-16 03:00:30 +0000
@@ -47,6 +47,7 @@
 			<td>
 				<select name="exportReportType" style="min-width:20em">
 					<option value='NORMAL'>$i18n.getString('NORMAL')</option>					
+					<option value='ATTRIBUTE'>$i18n.getString('ATTRIBUTE')</option>					
 					<option value='CATEGORY'>$i18n.getString('CATEGORY')</option>					
 					<option value='PERIOD_COLUMN_LISTING'>$i18n.getString('PERIOD_COLUMN_LISTING')</option>	
 					<option value='ORGANIZATION_GROUP_LISTING'>$i18n.getString('ORGANIZATION_GROUP_LISTING')</option>									

=== modified file 'local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/report/exportReports.vm'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/report/exportReports.vm	2012-04-06 08:44:30 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/report/exportReports.vm	2012-04-16 03:00:30 +0000
@@ -44,6 +44,8 @@
 				#if( $exportReport.isOrgUnitGroupListing() )
 				<a href="openUpdateOrgUnitGroupListingReport.action?id=$exportReport.id" title="$i18n.getString( 'organisation_unit_group' )"><img src="images/group_1.jpg"/></a>
 				<a href="organisationUnitAtLevels.action?id=$exportReport.id" title="$i18n.getString( 'set_organisationunit_group_level' )"><img src="images/organisationunitlevel.png" alt="$i18n.getString( 'set_organisationunit_group_level' )"/></a>				
+				#elseif( $exportReport.isAttribute() )
+				<a href="listAttributeValueGroupOrderForExportReport.action?id=$exportReport.id" title="$i18n.getString( 'attributevalue_groups' )"><img src="images/group.jpg" alt="$i18n.getString( 'attributevalue_groups' )"/></a>				
 				#elseif( $exportReport.isCategory() )
 				<a href="listDataElementGroupOrderForExportReport.action?id=$exportReport.id" title="$i18n.getString( 'dataelement_groups' )"><img src="images/group.jpg" alt="$i18n.getString( 'dataelement_groups' )"/></a>				
 				#elseif( $exportReport.isPeriodColumnListing() )

=== added file 'local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/sortAttributeValues.vm'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/sortAttributeValues.vm	1970-01-01 00:00:00 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/sortAttributeValues.vm	2012-04-16 03:00:30 +0000
@@ -0,0 +1,44 @@
+<h3>$i18n.getString( "sort_attributevalue" )</h3>
+<form action="updateSortedAttributeValuesFor${clazzName}.action" method="POST">
+<input type="hidden" value="$!attributeValueGroupOrder.id" name="id"/>
+<input type="hidden" value="$!reportId" name="reportId"/>
+<table>
+	<tr>
+  		<th>$i18n.getString( "available_attributevalues" )</th>
+  		<td></td>
+  		<th>$i18n.getString( "selected_attributevalues" )</th>
+		<td></td>
+	</tr>
+	<tr>		
+		<td>
+			<select multiple size="30" id="availableList" name="availableList" style="min-width:300px;" ondblclick="moveSelectedById( 'availableList', 'selectedList' );">
+				#foreach( $attributeValue in $!attributeValueGroupOrder.attributeValues )
+    				<option value="$!attributeValue">$!attributeValue</option>
+    			#end
+			</select>
+		</td>
+		<td style="text-align:center">
+			<input type="button" value="&gt;" title="$i18n.getString('move_selected')" style="width:50px" onclick="moveSelectedById( 'availableList', 'selectedList' );"/><br/>
+			<input type="button" value="&lt;" title="$i18n.getString('move_all')" style="width:50px" onclick="moveSelectedById( 'selectedList', 'availableList' );"/><br/>		
+			<input type="button" value="&gt;&gt;" title="$i18n.getString('remove_selected')" style="width:50px" onclick="moveAllById( 'availableList', 'selectedList' );"/><br/>
+			<input type="button" value="&lt;&lt;" title="$i18n.getString('remove_all')" style="width:50px" onclick="moveAllById( 'selectedList', 'availableList' );"/>
+		</td>
+		<td>
+			<select type="text" multiple size="30" id="selectedList" name="attributeValues" style="min-width:300px;" ondblclick="moveSelectedById('selectedList','availableList');">
+			</select>
+		</td>	
+		<td>
+			<a href="javascript:moveSelectedOptionToTop( 'selectedList' );"><img align="absmiddle" src="../images/move_top.png" style="cursor:pointer;width:20px;"/></a><br/><br/>
+			<a href="javascript:moveUpSelectedOption( 'selectedList' );"><img align="absmiddle" src="../images/move_up.png" style="cursor:pointer;width:20px;"/></a><br/><br/>
+			<a href="javascript:moveDownSelectedOption( 'selectedList' );"><img align="absmiddle" src="../images/move_down.png" style="cursor:pointer;width:20px;"/></a><br/><br/>
+			<a href="javascript:moveSelectedOptionToBottom( 'selectedList' );"><img align="absmiddle" src="../images/move_bottom.png" style="cursor:pointer;width:20px;"/></a>
+		</td>
+	</tr>
+</table>
+
+<p>
+	<input type="button" value="$i18n.getString( 'ok' )" onclick="updateSortedAttributeValue();"/>
+	<input type="button" value="$i18n.getString( 'cancel' )" onclick="history.go(-1);"/>
+</p>
+
+<span id="message" style="top:100px;right:5px;position:fixed;width:200px;z-index:10002" onclick="javascript:hideById(this.id);"></span>
\ No newline at end of file

=== modified file 'local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/viewAdministrator.vm'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/viewAdministrator.vm	2012-04-04 07:20:49 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/viewAdministrator.vm	2012-04-16 03:00:30 +0000
@@ -2,8 +2,8 @@
 
 <ul class="introList">
     #introListImgItem( "getConfiguration.action" "configuration" "systemsettings")
-    #introListImgItem( "listAllExportReport.action" "export_reports" "export")
-	#introListImgItem( "listAllImportReport.action" "import_reports" "import" )
+    #introListImgItem( "listAllExportReport.action" "design_export_reports" "export")
+	#introListImgItem( "listAllImportReport.action" "design_import_reports" "import" )
     #introListImgItem( "listDataEntryStatus.action" "data_status_management" "validationcriteria")
     #introListImgItem( "listAllExcelTemplates.action" "excel_template_management" "excel")
 	#introListImgItem( "javascript: cleanUp();" "clean_up" "clean-up")