← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 7529: local vn - Apply the filter by "Chapter" into entry hospital form.

 

------------------------------------------------------------
revno: 7529
committer: Hieu <hieu.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Sat 2012-07-07 02:43:15 +0700
message:
  local vn - Apply the filter by "Chapter" into entry hospital form.
added:
  local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/avgroup/action/GetAttributeValuesByChapterAction.java
modified:
  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/de/action/ShowICDReportAction.java
  local/vn/dhis-web-dataentry-hospital/src/main/resources/org/hisp/dhis/de/i18n_module.properties
  local/vn/dhis-web-dataentry-hospital/src/main/resources/org/hisp/dhis/de/i18n_module_vi_VN.properties
  local/vn/dhis-web-dataentry-hospital/src/main/webapp/dhis-web-dataentry-hospital/htmlGrid.vm
  local/vn/dhis-web-dataentry-hospital/src/main/webapp/dhis-web-dataentry-hospital/javascript/form.js
  local/vn/dhis-web-dataentry-hospital/src/main/webapp/dhis-web-dataentry-hospital/select.vm
  local/vn/dhis-web-spreadsheet-reporting/src/main/resources/META-INF/dhis/beans.xml
  local/vn/dhis-web-spreadsheet-reporting/src/main/resources/struts.xml


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

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'local/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-05-12 09:41:20 +0000
+++ local/vn/dhis-service-vn/src/main/java/org/hisp/dhis/attribute/hibernate/HibernateLocalAttributeValueStore.java	2012-07-06 19:43:15 +0000
@@ -79,8 +79,7 @@
         String sql = "select count(*) from datasetmembers dsm "
             + "inner join dataelementattributevalues deav on deav.dataelementid = dsm.dataelementid "
             + "inner join attributevalue av on av.attributevalueid = deav.attributevalueid "
-            + "inner join attribute att on att.attributeid = av.attributeid " + "where dsm.datasetid = "
-            + dataSet.getId();
+            + "where dsm.datasetid = " + dataSet.getId();
 
         return (statementManager.getHolder().queryForInteger( sql ) > 0) ? true : false;
     }
@@ -93,8 +92,7 @@
             String sql = "select distinct(av.value) from datasetmembers dsm "
                 + "inner join dataelementattributevalues deav on deav.dataelementid = dsm.dataelementid "
                 + "inner join attributevalue av on av.attributevalueid = deav.attributevalueid "
-                + "inner join attribute att on att.attributeid = av.attributeid " + "where dsm.datasetid = "
-                + dataSet.getId();
+                + "where dsm.datasetid = " + dataSet.getId();
 
             ResultSet resultSet = statementManager.getHolder().getStatement().executeQuery( sql );
 
@@ -114,6 +112,5 @@
         {
             statementManager.getHolder().close();
         }
-
     }
 }

=== modified file 'local/vn/dhis-web-dataentry-hospital/src/main/java/org/hisp/dhis/de/action/ShowICDReportAction.java'
--- local/vn/dhis-web-dataentry-hospital/src/main/java/org/hisp/dhis/de/action/ShowICDReportAction.java	2012-06-29 03:08:25 +0000
+++ local/vn/dhis-web-dataentry-hospital/src/main/java/org/hisp/dhis/de/action/ShowICDReportAction.java	2012-07-06 19:43:15 +0000
@@ -27,8 +27,6 @@
 
 package org.hisp.dhis.de.action;
 
-import java.io.BufferedWriter;
-import java.io.FileWriter;
 import java.sql.Connection;
 import java.sql.ResultSet;
 import java.sql.SQLException;
@@ -41,12 +39,11 @@
 import org.hisp.dhis.common.Grid;
 import org.hisp.dhis.common.GridHeader;
 import org.hisp.dhis.i18n.I18n;
-import org.hisp.dhis.system.grid.ListGrid;
-import org.hisp.dhis.util.SessionUtils;
 import org.hisp.dhis.period.Period;
 import org.hisp.dhis.period.PeriodStore;
 import org.hisp.dhis.period.PeriodType;
-
+import org.hisp.dhis.system.grid.ListGrid;
+import org.hisp.dhis.util.SessionUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 
 import com.opensymphony.xwork2.Action;
@@ -181,8 +178,8 @@
         sqlsb.append( "WHERE datasetid = " + this.dataSetId + " " );
         sqlsb.append( "AND periodid = " + this.periodId + " " );
         sqlsb.append( "AND sourceid = " + this.sourceId + " " );
-        sqlsb.append( "AND av.value IN (SELECT attributevalue FROM reportexcel_attributevalueorders " );
-        sqlsb.append( this.chapterId != null ? "WHERE id = " + this.chapterId + ") " : ") " );
+        sqlsb.append( "AND av.value IN (SELECT attributevalue FROM attributevaluegrouporder_attributevalues " );
+        sqlsb.append( (this.chapterId != null && this.chapterId != -1 ) ? "WHERE attributevaluegrouporderid = " + this.chapterId + ") " : ") " );
         sqlsb.append( "ORDER BY (av.value, sorted_de.column_index)" );
 
         fillUpData( grid, sqlsb, statementManager );
@@ -216,8 +213,6 @@
         {
             ResultSet rs = getScrollableResult( sqlsb.toString(), holder );
 
-            writeFile( sqlsb );
-
             while ( rs.next() )
             {
                 rowKey = rs.getString( 2 );
@@ -269,21 +264,4 @@
 
         return stm.getResultSet();
     }
-
-    private void writeFile( StringBuffer sb )
-    {
-        try
-        {
-            // Create file
-            FileWriter fstream = new FileWriter( "C:\\Users\\hieu\\Desktop\\out.sql" );
-            BufferedWriter out = new BufferedWriter( fstream );
-            out.write( sb.toString() );
-            // Close the output stream
-            out.close();
-        }
-        catch ( Exception e )
-        {// Catch exception if any
-            System.err.println( "Error: " + e.getMessage() );
-        }
-    }
 }

=== modified file 'local/vn/dhis-web-dataentry-hospital/src/main/resources/org/hisp/dhis/de/i18n_module.properties'
--- local/vn/dhis-web-dataentry-hospital/src/main/resources/org/hisp/dhis/de/i18n_module.properties	2012-06-28 08:17:52 +0000
+++ local/vn/dhis-web-dataentry-hospital/src/main/resources/org/hisp/dhis/de/i18n_module.properties	2012-07-06 19:43:15 +0000
@@ -110,4 +110,27 @@
 show_icd_report = Show ICD report
 get_report_as_csv = Get report as CSV
 get_report_as_xls = Get report as XLS
-get_report_as_pdf = Get report as PDF
\ No newline at end of file
+get_report_as_pdf = Get report as PDF
+
+# attribute_column_index is the name of an concrete attribute in database 		#
+# This key is needed to declare in one properties file only    			  		#
+attribute_column_index = Classify data
+#-------------------------------------------------------------------------------#
+
+icd_element_1 = Total outpatient
+icd_element_2 = Female outpatient
+icd_element_3 = Children outpatient <15
+icd_element_4 = Death outpatient
+icd_element_5 = Total inpatient
+icd_element_6 = Female inpatient
+icd_element_7 = Death inpatient
+icd_element_8 = Female Death inpatient
+icd_element_9 = Children <15y inpatient infected
+icd_element_10 = Children <5y inpatient infected
+icd_element_11 = Children <15y inpatient Death
+icd_element_12 = Children <5y inpatient death
+
+chapter = Chapter
+select_chapter = Select chapter
+explore_icd_report_result = Explore ICD report result
+collapse_icd_report_result = Collapse ICD report result
\ No newline at end of file

=== modified file 'local/vn/dhis-web-dataentry-hospital/src/main/resources/org/hisp/dhis/de/i18n_module_vi_VN.properties'
--- local/vn/dhis-web-dataentry-hospital/src/main/resources/org/hisp/dhis/de/i18n_module_vi_VN.properties	2012-06-29 03:08:25 +0000
+++ local/vn/dhis-web-dataentry-hospital/src/main/resources/org/hisp/dhis/de/i18n_module_vi_VN.properties	2012-07-06 19:43:15 +0000
@@ -134,4 +134,9 @@
 icd_element_9 = T\u1ed5ng s\u1ed1 tr\u1ebb < 15t m\u1eafc b\u1ec7nh (\u0110TNT)
 icd_element_10 = S\u1ed1 tr\u1ebb < 5t m\u1eafc b\u1ec7nh (\u0110TNT)
 icd_element_11 = T\u1ed5ng s\u1ed1 tr\u1ebb < 15t t\u1eed vong (\u0110TNT)
-icd_element_12 = S\u1ed1 tr\u1ebb < 5t t\u1eed vong (\u0110TNT)
\ No newline at end of file
+icd_element_12 = S\u1ed1 tr\u1ebb < 5t t\u1eed vong (\u0110TNT)
+
+chapter = Ch\u01b0\u01a1ng
+select_chapter = Ch\u1ecdn ch\u01b0\u01a1ng
+explore_icd_report_result = Hi\u1ec3n th\u1ecb k\u1ebft qu\u1ea3 b\u00e1o c\u00e1o ICD
+collapse_icd_report_result = Thu nh\u1ecf k\u1ebft qu\u1ea3 b\u00e1o c\u00e1o ICD
\ No newline at end of file

=== modified file 'local/vn/dhis-web-dataentry-hospital/src/main/webapp/dhis-web-dataentry-hospital/htmlGrid.vm'
--- local/vn/dhis-web-dataentry-hospital/src/main/webapp/dhis-web-dataentry-hospital/htmlGrid.vm	2012-06-28 08:17:52 +0000
+++ local/vn/dhis-web-dataentry-hospital/src/main/webapp/dhis-web-dataentry-hospital/htmlGrid.vm	2012-07-06 19:43:15 +0000
@@ -7,20 +7,21 @@
 	}
 </style>
 
+<br/>
+
 <div style="margin-bottom:15px">
 	<input type="button" value="$i18n.getString( 'get_report_as_csv' )" onclick="exportICDReport( 'csv' )" />
 	<input type="button" value="$i18n.getString( 'get_report_as_xls' )" onclick="exportICDReport( 'xls' )" />
 	<input type="button" value="$i18n.getString( 'get_report_as_pdf' )" onclick="exportICDReport( 'pdf' )" />
 </div>
 
-<br/>
-
 <h3>$!encoder.htmlEncode( $grid.title )</h3>
 
 <h5>$!encoder.htmlEncode( $grid.subtitle )</h5>
 
-<table class="listTable gridTable">
-
+<table class="listTable gridTable" border="1">
+<col width="20%"/>
+<col/>
 <thead>
 	<tr>
 		#foreach( $header in $grid.getVisibleHeaders() )

=== modified file 'local/vn/dhis-web-dataentry-hospital/src/main/webapp/dhis-web-dataentry-hospital/javascript/form.js'
--- local/vn/dhis-web-dataentry-hospital/src/main/webapp/dhis-web-dataentry-hospital/javascript/form.js	2012-06-28 08:17:52 +0000
+++ local/vn/dhis-web-dataentry-hospital/src/main/webapp/dhis-web-dataentry-hospital/javascript/form.js	2012-07-06 19:43:15 +0000
@@ -231,6 +231,7 @@
 		if ( textStatus == "error" ) {
 			hideLoader();
 			hideById( 'showReportButton' );
+			hideById( 'ICDButtonDiv' );
 			clearEntryForm();
 			setHeaderDelayMessage( i18n_disconnect_server );
 			return;
@@ -325,8 +326,6 @@
 
     clearListById( 'selectedPeriodId' );
 
-    //addOptionById( 'selectedPeriodId', '-1', '[ ' + i18n_select_period + ' ]' );
-
     for ( i in periods )
     {
         addOptionById( 'selectedPeriodId', periods[i].id, periods[i].name );
@@ -344,8 +343,6 @@
 	clearListById( 'selectedPeriodId' );
 	hideById('attributeDiv');
 	
-	$( '#valueInput' ).unbind( 'change' );
-	$( '#value' ).unbind( 'select' );
 	$( '#selectedPeriodId' ).unbind( 'change' );
 	$( '#selectedPeriodId' ).removeAttr( 'disabled' );
     $( '#prevButton' ).removeAttr( 'disabled' );
@@ -359,8 +356,6 @@
 
     if ( dataSetId != -1 )
     {
-        //addOptionById( 'selectedPeriodId', '-1', '[ ' + i18n_select_period + ' ]' );
-
         for ( i in periods )
         {
             addOptionById( 'selectedPeriodId', periods[i].id, periods[i].name );
@@ -379,50 +374,53 @@
 
         currentDataSetId = dataSetId;
 		
-		loadSubDataSets(dataSetId);
+		loadSubDataSets( dataSetId );
     }
 }
 
 function loadSubDataSets( dataSetId )
 {
 	$.getJSON( 'loadDepartments.action',
-		{
-			dataSetId: dataSetId
-		},
-		function( json ) 
-		{
-			clearListById( 'subDataSetId' );
-		
-			if ( json.department.length > 0 )
-			{
-				$('#subDataSetId').append('<option value=-1>' + i18n_please_select_department + '</option>');
-				for ( i in json.department ) 
-				{ 
-					$('#subDataSetId').append('<option value=' + json.department[i].id + '>' + json.department[i].name + '</option>');
-				}
-				
-				byId( 'inputCriteria' ).style.width = '840px';
-				showById( 'departmentTitleDiv' );
-				showById( 'departmentDiv' );
-				
-				jQuery( '#valueInput' ).unbind( 'change' );
-				jQuery( '#value' ).unbind( 'select' );
-			}
-			else 
-			{
-				loadAttributeValues( dataSetId );
-				
-				byId( 'inputCriteria' ).style.width = '620px';
-				hideById('departmentTitleDiv');
-				hideById('departmentDiv');
-			}
-
-			jQuery( '#selectedPeriodId' ).bind( 'change', periodSelected );
-		} );
+	{
+		dataSetId: dataSetId
+	},
+	function( json ) 
+	{
+		var departmentList = jQuery( '#subDataSetId' );
+		departmentList.empty();
+	
+		if ( json.department.length > 0 )
+		{
+			departmentList.append('<option value=-1>' + i18n_select_department + '</option>');
+
+			for ( i in json.department ) 
+			{ 
+				departmentList.append('<option value=' + json.department[i].id + '>' + json.department[i].name + '</option>');
+			}
+			
+			byId( 'inputCriteria' ).style.width = '900px';
+			byId( 'inputCriteria' ).style.height = '250px';
+			showById( 'departmentTitleDiv' );
+			showById( 'departmentDiv' );
+			
+			jQuery( '#valueInput' ).unbind( 'change' );
+			jQuery( '#value' ).unbind( 'select' );
+		}
+		else 
+		{
+			loadAttributeValues( dataSetId );
+		}
+
+		jQuery( '#selectedPeriodId' ).bind( 'change', periodSelected );
+	} );
 }
 
+var arrAttributeValues = new Array();
+
 function loadAttributeValues( dataSetId )
 {
+	jQuery( '#chapterId > option' ).first().attr( 'selected', true );
+
 	$.getJSON( 'loadAttribueValues.action',
 	{
 		dataSetId: dataSetId
@@ -431,30 +429,79 @@
 	{
 		clearListById( 'value' );
 	
-		if( json.attributeValues.length > 0 )
+		if ( json.attributeValues.length > 0 )
 		{
-			for ( i in json.attributeValues ) 
-			{ 
-				jQuery( '#value' ).append( '<option value="' + json.attributeValues[i] + '">' + json.attributeValues[i] + '</option>' );
-			}
+			arrAttributeValues = [];
+		
+			jQuery.each( json.attributeValues, function( i, item )
+			{
+				arrAttributeValues.push( item );
+				jQuery( '#value' ).append( '<option value="' + item + '">' + item + '</option>' );
+			} );
 
 			autoCompletedField();
 
-			jQuery( '#valueInput' ).bind( 'change', periodSelected() );
-			jQuery( '#value' ).bind( 'select', periodSelected() );
-			
+			byId( 'inputCriteria' ).style.width = '670px';
+			byId( 'inputCriteria' ).style.height = '320px';
+
+			hideById( 'departmentTitleDiv' );
+			hideById( 'departmentDiv' );
 			showById( 'attributeDiv' );
 		}
 		else
 		{
-			jQuery( '#valueInput' ).unbind( 'change' );
-			jQuery( '#value' ).unbind( 'select' );
-
+			byId( 'inputCriteria' ).style.width = '640px';
+			byId( 'inputCriteria' ).style.height = '250px';
+			
 			hideById( 'attributeDiv' );
 		}
 	} );
 }
 
+function loadAttributeValuesByChapter( chapterId )
+{
+	clearListById( 'value' );
+
+	if ( chapterId && chapterId != -1 )
+	{
+		$.getJSON( '../dhis-web-spreadsheet-reporting/loadAttributeValuesByChapter.action',
+		{
+			chapterId: chapterId
+		}
+		, function( json )
+		{			
+			var tempArray = [];
+		
+			if ( json.values.length > 0 )
+			{
+				jQuery.each( json.values, function( i, item )
+				{
+					if ( jQuery.inArray( item.value, arrAttributeValues ) != -1 )
+					{						
+						tempArray.push( item.value );
+					}
+				} );
+
+				jQuery.each( tempArray, function( i, item )
+				{
+					jQuery( '#value' ).append( '<option value="' + item + '">' + item + '</option>' );
+				} );
+				
+				setFieldValue( 'valueInput', jQuery( '#value > option:first' ).val() );
+			}
+		} );
+	}
+	else
+	{
+		jQuery.each( arrAttributeValues, function( i, item )
+		{
+			jQuery( '#value' ).append( '<option value="' + item + '">' + item + '</option>' );
+		} );
+
+		setFieldValue( 'valueInput', jQuery( '#value > option:first' ).val() );
+	}
+}
+
 // -----------------------------------------------------------------------------
 // Period Selection
 // -----------------------------------------------------------------------------
@@ -1542,7 +1589,7 @@
 	$.getJSON( '../dhis-web-commons-ajax-json/getAttributes.action',{}
 	, function( json ) 
 	{
-		addOptionById( 'attributeId', '', i18n_please_select_attribute );
+		addOptionById( 'attributeId', '', i18n_select_attribute );
 		
 		for ( i in json.attributes ) 
 		{ 
@@ -1560,7 +1607,7 @@
 		}
 		, function( json ) 
 		{
-			addOptionById( 'value', '', i18n_please_select_attribute );
+			addOptionById( 'value', '', i18n_select_attribute );
 			
 			for ( i in json.attributeValues ) 
 			{ 
@@ -1655,11 +1702,12 @@
 	{
 		dataSetId: getFieldValue( 'selectedDataSetId' ),
 		periodId: getFieldValue( 'selectedPeriodId' ),
-		sourceId: currentOrganisationUnitId
+		sourceId: currentOrganisationUnitId,
+		chapterId: getFieldValue( 'chapterId' )
 	}
 	, function(){
-
-	}).dialog({
+		showById( 'ICDButtonDiv' );
+	})/*.dialog({
 		title: 'ICD REPORTING FORM',
 		maximize: true, 
 		closable: true,
@@ -1667,5 +1715,18 @@
 		overlay:{background:'#000000', opacity:0.1},
 		width: 1160,
 		height: 520
-	});
+	})*/;
+}
+
+function toggleICDReportDiv()
+{
+	openICD = !openICD;
+
+	if ( openICD ) {
+		showById( 'showReportDiv' );
+		setFieldValue( 'ICDResultButton', i18n_collpase_icd_report_result );
+	} else {
+		hideById( 'showReportDiv' );
+		setFieldValue( 'ICDResultButton', i18n_explore_icd_report_result );
+	}
 }
\ No newline at end of file

=== modified file 'local/vn/dhis-web-dataentry-hospital/src/main/webapp/dhis-web-dataentry-hospital/select.vm'
--- local/vn/dhis-web-dataentry-hospital/src/main/webapp/dhis-web-dataentry-hospital/select.vm	2012-06-28 08:17:52 +0000
+++ local/vn/dhis-web-dataentry-hospital/src/main/webapp/dhis-web-dataentry-hospital/select.vm	2012-07-06 19:43:15 +0000
@@ -1,47 +1,17 @@
 <script type="text/javascript">
-leftBar.hideAnimated();
-var i18n_select_data_set = '$encoder.jsEscape( $i18n.getString( "select_data_set" ) , "'")';
-var i18n_select_period = '$encoder.jsEscape( $i18n.getString( "select_period" ) , "'")';
-var i18n_register_complete_dataset_success = '$encoder.jsEscape( $i18n.getString( "register_complete_dataset_success" ) , "'")';
-var i18n_register_complete_dataset_failed = '$encoder.jsEscape( $i18n.getString( "register_complete_dataset_failed" ) , "'")';
-var i18n_undo_register_complete_dataset_success = '$encoder.jsEscape( $i18n.getString( "undo_register_complete_dataset_success" ) , "'")';
-var i18n_value_of_data_element_less = '$encoder.jsEscape( $i18n.getString( "value_of_data_element_less" ) , "'")';
-var i18n_value_of_data_element_greater = '$encoder.jsEscape( $i18n.getString( "value_of_data_element_greater" ) , "'")';
-var i18n_value_too_long = '$encoder.jsEscape( $i18n.getString( "value_is_too_long" ) , "'")';
-var i18n_value_must_integer = '$encoder.jsEscape( $i18n.getString( "value_must_integer" ) , "'")';
-var i18n_value_must_number = '$encoder.jsEscape( $i18n.getString( "value_must_number" ) , "'")';
-var i18n_value_must_positive_integer = '$encoder.jsEscape( $i18n.getString( "value_must_positive_integer" ) , "'")';
-var i18n_value_must_negative_integer = '$encoder.jsEscape( $i18n.getString( "value_must_negative_integer" ) , "'")';
-var i18n_field_unallowed_save_zero = '$encoder.jsEscape( $i18n.getString( "field_unallowed_save_zero" ) , "'")';
-var i18n_saving_value_failed_status_code = '$encoder.jsEscape( $i18n.getString( "saving_value_failed_status_code" ) , "'")';
-var i18n_saving_value_failed_dataset_is_locked = '$encoder.jsEscape( $i18n.getString( "saving_value_failed_dataset_is_locked" ) , "'")';
-var i18n_saving_comment_failed_status_code = '$encoder.jsEscape( $i18n.getString( "saving_comment_failed_status_code" ) , "'")';
-var i18n_saving_minmax_failed_error_code = '$encoder.jsEscape( $i18n.getString( "saving_minmax_failed_error_code" ) , "'")';
-var i18n_confirm_complete = '$encoder.jsEscape( $i18n.getString( "confirm_complete" ) , "'")';
-var i18n_confirm_undo = '$encoder.jsEscape( $i18n.getString( "confirm_undo" ) , "'")';
-var i18n_no_response_from_server = '$encoder.jsEscape( $i18n.getString( "no_response_from_server" ) , "'")';
-var i18n_enter_digits = '$encoder.jsEscape( $i18n.getString( "enter_digits" ) , "'")';
-var i18n_max_must_be_greater_than_min = '$encoder.jsEscape( $i18n.getString( "max_must_be_greater_than_min" ) , "'")';
-var i18n_mark_value_for_followup = '$encoder.jsEscape( $i18n.getString( "mark_value_for_followup" ) , "'")';
-var i18n_unmark_value_for_followup = '$encoder.jsEscape( $i18n.getString( "unmark_value_for_followup" ) , "'")';
-var i18n_operation_not_available_offline = '$encoder.jsEscape( $i18n.getString( "operation_not_available_offline" ) , "'")';
-var i18n_online_notification = '$encoder.jsEscape( $i18n.getString( "online_notification" ) , "'")';
-var i18n_offline_notification = '$encoder.jsEscape( $i18n.getString( "offline_notification" ) , "'")';
-var i18n_disconnect_server = '$encoder.jsEscape( $i18n.getString( "disconnect_server" ) , "'")';
-var i18n_need_to_sync_notification = '$encoder.jsEscape( $i18n.getString( "need_to_sync_notification" ) , "'")';
-var i18n_sync_now = '$encoder.jsEscape( $i18n.getString( "sync_now" ) , "'")';
-var i18n_sync_success = '$encoder.jsEscape( $i18n.getString( "sync_success" ) , "'")';
-var i18n_sync_failed = '$encoder.jsEscape( $i18n.getString( "sync_failed" ) , "'")';
-var i18n_uploading_data_notification = '$encoder.jsEscape( $i18n.getString( "uploading_data_notification" ) , "'")';
-var i18n_ajax_login_failed = '$encoder.jsEscape( $i18n.getString( "ajax_login_failed" ) , "'")';
-var i18n_no_dataelement_selected = '$encoder.jsEscape( $i18n.getString( "no_dataelement_selected" ) , "'")';
-var i18n_dataset_is_locked = '$encoder.jsEscape( $i18n.getString( "dataset_is_locked" ) , "'")';
-var i18n_register_complete_failed_dataset_is_locked = '$encoder.jsEscape( $i18n.getString( "register_complete_failed_dataset_is_locked" ) , "'")';
-var i18n_unregister_complete_failed_dataset_is_locked = '$encoder.jsEscape( $i18n.getString( "unregister_complete_failed_dataset_is_locked" ) , "'")';
-var i18n_please_select_attribute = "[ " + '$encoder.jsEscape( $i18n.getString( "please_select_attribute" ) , "'")' + " ]";
-var i18n_show_all_items = '$encoder.jsEscape( $i18n.getString( "show_all_items" ) , "'")';
-var i18n_please_select_department = "[ " + '$encoder.jsEscape( $i18n.getString( "please_select_department" ) , "'")' + " ]";
-var i18n_please_select_unit = "[ " + '$encoder.jsEscape( $i18n.getString( "please_select_organisation_unit" ) , "'")' + " ]";
+	jQuery(document).ready( function() {
+		jQuery.get( '../dhis-web-spreadsheet-reporting/getAttributeValueGroupOrders.action',
+		{}, function( json ) {
+				var target = jQuery( '#chapterId' );
+				target.empty();
+				target.append( '<option value="-1">' + i18n_select_chapter + '</option>' );
+
+				jQuery.each( json.attributeValueGroupOrders, function( i, item )
+				{
+					target.append( '<option value="' + item.id + '">' + item.name + '</option>' );
+				} );
+		} );
+	} );
 </script>
 
 <h3>$i18n.getString( "data_entry" ) #openHelp( "dataEntry" )</h3>
@@ -62,8 +32,8 @@
 
 <br/>
 
-<div class="inputCriteria" id='inputCriteria' style="width:620px;height:270px;">
-<input type='hidden' id='dataSetId' name='dataSetId'>
+<div class="inputCriteria" id='inputCriteria' style="width:640px;height:250px;">
+<input type='hidden' id='dataSetId' name='dataSetId'/>
 <table>
 	<tr>
 		<td><label class='bold' for="selectedOrganisationUnit">$i18n.getString( "organisation_unit" )</label>
@@ -85,7 +55,7 @@
 		<td><select id="selectedDataSetId" name="selectedDataSetId" size='10' style="width:371px" onchange="dataSetSelected()" disabled="disabled"></select>
 			<span id="loaderSpan" style="display:none"><img src='../images/ajax-loader-bar.gif'/></span>
 		</td>
-		<td><select id="selectedPeriodId" name="selectedPeriodId" size='9' style="width:230px" disabled="disabled"></select>
+		<td><select id="selectedPeriodId" name="selectedPeriodId" size='9' style="width:230px" disabled="disabled"></select><br/>
 			<input type="button" id="prevButton" style="width:75px" value="$i18n.getString( 'prev_year' )" title="$i18n.getString('earlier_periods')" onclick="previousPeriodsSelected()" disabled="disabled"/>
 			<input type="button" id="nextButton" style="width:75px" value="$i18n.getString( 'next_year' )" title="$i18n.getString('later_periods')" onclick="nextPeriodsSelected()" disabled="disabled"/>
 		</td>
@@ -96,12 +66,14 @@
 	
 	<tr id='attributeDiv' style='display:none;'>
 		<td>
+			<br/><label class='bold' for="chapterId">$i18n.getString( "chapter" )</label>
+			<select id='chapterId' name='chapterId' style="width:330px" onchange="loadAttributeValuesByChapter( this.value );"></select><br/>
 			<label class='bold' for="attributeId">$i18n.getString( "attribute" )</label>
 			<select id='value' name='value' style='display:none;' ></select>
 			<input type="text" id="valueInput" style="width:330px" name="valueInput" />
 			<button type='button' id='valueButton' class='small-button' >&nbsp;</button>
 		</td>
-		<td><br/>
+		<td><br/><br/>
 			<input type="button" id="showReportButton" value="$i18n.getString( 'show_icd_report' )"
 				style="display:none" onclick="showICDReport();"/>
 		</td>
@@ -119,6 +91,12 @@
 
 #parse( "dhis-web-commons/loader/loader.vm" )
 
+<div id="ICDButtonDiv" style="display:none">
+	<input type="button" id="ICDResultButton" onclick="toggleICDReportDiv();" value="$i18n.getString( 'collapse_icd_report_result' )"/>
+</div>
+
+<div id="showReportDiv"></div><br/>
+
 <div id="contentDiv" class="page" style="margin-left:2px;margin-bottom:8px;"></div>
 
 <div id="historyDiv" class="page"></div>
@@ -164,4 +142,55 @@
 </table>
 </div>
 
-<div id="showReportDiv"></div>
+<script type="text/javascript">
+
+leftBar.hideAnimated();
+
+var openICD = true;
+
+var i18n_select_data_set = '$encoder.jsEscape( $i18n.getString( "select_data_set" ) , "'")';
+var i18n_select_period = '$encoder.jsEscape( $i18n.getString( "select_period" ) , "'")';
+var i18n_register_complete_dataset_success = '$encoder.jsEscape( $i18n.getString( "register_complete_dataset_success" ) , "'")';
+var i18n_register_complete_dataset_failed = '$encoder.jsEscape( $i18n.getString( "register_complete_dataset_failed" ) , "'")';
+var i18n_undo_register_complete_dataset_success = '$encoder.jsEscape( $i18n.getString( "undo_register_complete_dataset_success" ) , "'")';
+var i18n_value_of_data_element_less = '$encoder.jsEscape( $i18n.getString( "value_of_data_element_less" ) , "'")';
+var i18n_value_of_data_element_greater = '$encoder.jsEscape( $i18n.getString( "value_of_data_element_greater" ) , "'")';
+var i18n_value_too_long = '$encoder.jsEscape( $i18n.getString( "value_is_too_long" ) , "'")';
+var i18n_value_must_integer = '$encoder.jsEscape( $i18n.getString( "value_must_integer" ) , "'")';
+var i18n_value_must_number = '$encoder.jsEscape( $i18n.getString( "value_must_number" ) , "'")';
+var i18n_value_must_positive_integer = '$encoder.jsEscape( $i18n.getString( "value_must_positive_integer" ) , "'")';
+var i18n_value_must_negative_integer = '$encoder.jsEscape( $i18n.getString( "value_must_negative_integer" ) , "'")';
+var i18n_field_unallowed_save_zero = '$encoder.jsEscape( $i18n.getString( "field_unallowed_save_zero" ) , "'")';
+var i18n_saving_value_failed_status_code = '$encoder.jsEscape( $i18n.getString( "saving_value_failed_status_code" ) , "'")';
+var i18n_saving_value_failed_dataset_is_locked = '$encoder.jsEscape( $i18n.getString( "saving_value_failed_dataset_is_locked" ) , "'")';
+var i18n_saving_comment_failed_status_code = '$encoder.jsEscape( $i18n.getString( "saving_comment_failed_status_code" ) , "'")';
+var i18n_saving_minmax_failed_error_code = '$encoder.jsEscape( $i18n.getString( "saving_minmax_failed_error_code" ) , "'")';
+var i18n_confirm_complete = '$encoder.jsEscape( $i18n.getString( "confirm_complete" ) , "'")';
+var i18n_confirm_undo = '$encoder.jsEscape( $i18n.getString( "confirm_undo" ) , "'")';
+var i18n_no_response_from_server = '$encoder.jsEscape( $i18n.getString( "no_response_from_server" ) , "'")';
+var i18n_enter_digits = '$encoder.jsEscape( $i18n.getString( "enter_digits" ) , "'")';
+var i18n_max_must_be_greater_than_min = '$encoder.jsEscape( $i18n.getString( "max_must_be_greater_than_min" ) , "'")';
+var i18n_mark_value_for_followup = '$encoder.jsEscape( $i18n.getString( "mark_value_for_followup" ) , "'")';
+var i18n_unmark_value_for_followup = '$encoder.jsEscape( $i18n.getString( "unmark_value_for_followup" ) , "'")';
+var i18n_operation_not_available_offline = '$encoder.jsEscape( $i18n.getString( "operation_not_available_offline" ) , "'")';
+var i18n_online_notification = '$encoder.jsEscape( $i18n.getString( "online_notification" ) , "'")';
+var i18n_offline_notification = '$encoder.jsEscape( $i18n.getString( "offline_notification" ) , "'")';
+var i18n_disconnect_server = '$encoder.jsEscape( $i18n.getString( "disconnect_server" ) , "'")';
+var i18n_need_to_sync_notification = '$encoder.jsEscape( $i18n.getString( "need_to_sync_notification" ) , "'")';
+var i18n_sync_now = '$encoder.jsEscape( $i18n.getString( "sync_now" ) , "'")';
+var i18n_sync_success = '$encoder.jsEscape( $i18n.getString( "sync_success" ) , "'")';
+var i18n_sync_failed = '$encoder.jsEscape( $i18n.getString( "sync_failed" ) , "'")';
+var i18n_uploading_data_notification = '$encoder.jsEscape( $i18n.getString( "uploading_data_notification" ) , "'")';
+var i18n_ajax_login_failed = '$encoder.jsEscape( $i18n.getString( "ajax_login_failed" ) , "'")';
+var i18n_no_dataelement_selected = '$encoder.jsEscape( $i18n.getString( "no_dataelement_selected" ) , "'")';
+var i18n_dataset_is_locked = '$encoder.jsEscape( $i18n.getString( "dataset_is_locked" ) , "'")';
+var i18n_register_complete_failed_dataset_is_locked = '$encoder.jsEscape( $i18n.getString( "register_complete_failed_dataset_is_locked" ) , "'")';
+var i18n_unregister_complete_failed_dataset_is_locked = '$encoder.jsEscape( $i18n.getString( "unregister_complete_failed_dataset_is_locked" ) , "'")';
+var i18n_select_attribute = "[ " + '$encoder.jsEscape( $i18n.getString( "select_attribute" ) , "'")' + " ]";
+var i18n_show_all_items = '$encoder.jsEscape( $i18n.getString( "show_all_items" ) , "'")';
+var i18n_select_department = "[ " + '$encoder.jsEscape( $i18n.getString( "please_select_department" ) , "'")' + " ]";
+var i18n_please_select_unit = "[ " + '$encoder.jsEscape( $i18n.getString( "please_select_organisation_unit" ) , "'")' + " ]";
+var i18n_select_chapter = "[ " + '$encoder.jsEscape( $i18n.getString( "select_chapter" ) , "'")' + " ]";
+var i18n_explore_icd_report_result = '$encoder.jsEscape( $i18n.getString( "explore_icd_report_result" ) , "'")';
+var i18n_collpase_icd_report_result = '$encoder.jsEscape( $i18n.getString( "collapse_icd_report_result" ) , "'")';
+</script>
\ No newline at end of file

=== added file 'local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/avgroup/action/GetAttributeValuesByChapterAction.java'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/avgroup/action/GetAttributeValuesByChapterAction.java	1970-01-01 00:00:00 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/avgroup/action/GetAttributeValuesByChapterAction.java	2012-07-06 19:43:15 +0000
@@ -0,0 +1,91 @@
+/*
+ * 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.reportsheet.AttributeValueGroupOrder;
+import org.hisp.dhis.reportsheet.AttributeValueGroupOrderService;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Dang Duy Hieu
+ * @version $Id$
+ */
+public class GetAttributeValuesByChapterAction
+    implements Action
+{
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
+
+    private AttributeValueGroupOrderService attributeValueGroupOrderService;
+
+    public void setAttributeValueGroupOrderService( AttributeValueGroupOrderService attributeValueGroupOrderService )
+    {
+        this.attributeValueGroupOrderService = attributeValueGroupOrderService;
+    }
+
+    // -------------------------------------------------------------------------
+    // Input && Output
+    // -------------------------------------------------------------------------
+
+    private Integer chapterId;
+
+    public void setChapterId( Integer chapterId )
+    {
+        this.chapterId = chapterId;
+    }
+
+    private Collection<String> values = new ArrayList<String>();
+
+    public Collection<String> getValues()
+    {
+        return values;
+    }
+
+    // -------------------------------------------------------------------------
+    // Action implementation
+    // -------------------------------------------------------------------------
+
+    @Override
+    public String execute()
+        throws Exception
+    {
+        AttributeValueGroupOrder group = attributeValueGroupOrderService.getAttributeValueGroupOrder( chapterId );
+
+        if ( group != null )
+        {
+            values = group.getAttributeValues();
+        }
+
+        return SUCCESS;
+    }
+}

=== 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-07-04 10:12:19 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/resources/META-INF/dhis/beans.xml	2012-07-06 19:43:15 +0000
@@ -384,6 +384,13 @@
 	</bean>
 	
 	<bean
+		id="org.hisp.dhis.reportsheet.avgroup.action.GetAttributeValuesByChapterAction"
+		class="org.hisp.dhis.reportsheet.avgroup.action.GetAttributeValuesByChapterAction"
+		scope="prototype">
+		<property name="attributeValueGroupOrderService" ref="org.hisp.dhis.reportsheet.AttributeValueGroupOrderService" />
+	</bean>
+	
+	<bean
 		id="org.hisp.dhis.reportsheet.avgroup.action.ListAttributeValueGroupOrdersAction"
 		class="org.hisp.dhis.reportsheet.avgroup.action.ListAttributeValueGroupOrdersAction"
 		scope="prototype">

=== 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-07-04 10:12:19 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/resources/struts.xml	2012-07-06 19:43:15 +0000
@@ -514,6 +514,13 @@
 				/dhis-web-spreadsheet-reporting/jsonAttributeValues.vm</result>
 			<param name="onExceptionReturn">plainTextError</param>
 		</action>
+	
+		<action name="loadAttributeValuesByChapter" 
+			class="org.hisp.dhis.reportsheet.avgroup.action.GetAttributeValuesByChapterAction">
+			<result name="success" type="velocity-json">
+				/dhis-web-spreadsheet-reporting/jsonAttributeValues.vm</result>
+			<param name="onExceptionReturn">plainTextError</param>
+		</action>
 
 		<action name="updateAttributeValueGroupOrderForReport"
 			class="org.hisp.dhis.reportsheet.avgroup.action.UpdateAttributeValueGroupOrderForReportAction">