← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 8537: Don't export XLS file in tabular report function.

 

------------------------------------------------------------
revno: 8537
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2012-10-16 16:52:43 +0700
message:
  Don't export XLS file in tabular report function.
modified:
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramStageInstanceStore.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/app.js


--
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 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramStageInstanceStore.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramStageInstanceStore.java	2012-10-16 08:33:54 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramStageInstanceStore.java	2012-10-16 09:52:43 +0000
@@ -207,13 +207,21 @@
         for ( int i = level; i <= maxLevel; i++ )
         {
             String name = orgUnitLevelMap.containsKey( i ) ? orgUnitLevelMap.get( i ).getName() : "Level " + i;
-
             grid.addHeader( new GridHeader( name, false, true ) );
         }
 
+        Collection<String> deKeys = new HashSet<String>();
         for ( TabularReportColumn column : columns )
         {
-            grid.addHeader( new GridHeader( column.getName(), column.isHidden(), true ) );
+            if ( !column.isMeta() )
+            {
+                String deKey = "element_" + column.getIdentifier();
+                if ( !deKeys.contains( deKey ) )
+                {
+                    grid.addHeader( new GridHeader( column.getName(), column.isHidden(), true ) );
+                    deKeys.add( deKey );
+                }
+            }
         }
 
         // ---------------------------------------------------------------------
@@ -398,7 +406,7 @@
                         + column.getIdentifier() + ") as element_" + column.getIdentifier() + ",";
                     deKeys.add( deKey );
                 }
-                
+
                 if ( column.hasQuery() )
                 {
                     where += operator + "element_" + column.getIdentifier() + " " + column.getQuery() + " ";
@@ -414,7 +422,7 @@
                         + column.getIdentifier() + ") as element_" + column.getIdentifier() + ",";
                     deKeys.add( deKey );
                 }
-                
+
                 if ( column.hasQuery() )
                 {
                     where += operator + "lower(element_" + column.getIdentifier() + ") " + column.getQuery() + " ";
@@ -460,7 +468,7 @@
         sql += where; // filters
         sql = sql.substring( 0, sql.length() - 1 ) + " "; // Remove last comma
         sql += (min != null && max != null) ? statementBuilder.limitRecord( min, max ) : "";
-        
+
         return sql;
     }
 }

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/app.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/app.js	2012-10-16 08:33:54 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/app.js	2012-10-16 09:52:43 +0000
@@ -752,14 +752,11 @@
 							// Get fields
 							var fields = [];
 							fields[0] = 'id';
-							var record = new Array();
 							for( var index=1; index < TR.value.columns.length; index++ )
 							{
 								fields[index] = 'col' + index;
-								record.push('');
 							}
 							TR.value.fields = fields;
-							TR.value.values.unshift(record);
 							
 							// Set data for grid
 							TR.store.getDataTableStore();
@@ -790,7 +787,6 @@
 			TR.util.notification.ok();
 		},
 		filterReport: function() {
-			TR.state.getFilterValues();
 			TR.util.mask.showMask(TR.cmp.region.center, TR.i18n.loading);
 			var url = TR.conf.finals.ajax.path_root + TR.conf.finals.ajax.generatetabularreport_get;
 			Ext.Ajax.request({
@@ -801,12 +797,6 @@
 				success: function(r) {
 					var json = Ext.JSON.decode(r.responseText);
 					TR.value.values = json.items;
-					var record = new Array();
-					for( var index=1; index < TR.value.columns.length; index++ ){
-						record.push('');
-					}
-					TR.value.values.unshift(record);
-					
 					TR.store.datatable.loadData(TR.value.values,false);
 					if ( json.items.length > 1 )
 					{
@@ -830,27 +820,6 @@
 				}
 			})
 		},
-		getFilterValues: function()
-		{
-			var grid = TR.datatable.datatable;
-			
-			var filters = grid.filters.getFilterData();
-			var value = "";
-			for( var i=0; i<filters.length; i++ )
-			{
-				var filter = filters[i];
-				
-				var compare = '=';
-				if( filter.data.comparison == 'lt')
-					compare = '<' ;
-				else if( filter.data.comparison == 'gt' )
-					compare = '>' ;
-					
-				value = compare + "'"+ filter.data.value + "'";
-				//var record = grid.getView().getRecord( grid.getView().getNode(0) );
-				//record.set(filter.field, value.toLowerCase());
-			}
-		},
 		getParams: function() {
 			var p = {};
             p.startDate = TR.cmp.settings.startDate.rawValue;
@@ -876,7 +845,7 @@
 				for( var k in cols )
 				{
 					var col = cols[k];
-					if( col.name && col.name.indexOf('meta_')!=-1 )
+					if( col.name )
 					{
 						var params = TR.state.getFilterValueByColumn(col.name);
 						for(var i in params){
@@ -884,19 +853,6 @@
 						}
 					}
 				}
-				var colNames = new Array();
-				TR.cmp.params.patientProperty.selected.store.each( function(r) {
-					var params = TR.state.getFilterValueByColumn(r.data.id);
-					for(var i in params){
-						p.searchingValues.push(params[i]);
-					}
-				});
-				TR.cmp.params.dataelement.selected.store.each( function(r) {
-					var params = TR.state.getFilterValueByColumn(r.data.id);
-					for(var i in params){
-						p.searchingValues.push(params[i]);
-					}
-				});
 			}
 			else
 			{
@@ -929,23 +885,16 @@
 			
 			if( !TR.state.paramChanged() )
 			{
-				var colNames = new Array();
-				TR.cmp.params.patientProperty.selected.store.each( function(r) {
-					var param = TR.state.getFilterValueByColumn(r.data.id);
-					p += "&searchingValues=" + param;
-				});
-				TR.cmp.params.dataelement.selected.store.each( function(r) {
-					var param = TR.state.getFilterValueByColumn(r.data.id);
-					p += "&searchingValues=" + param;
-				});
 				var cols = TR.datatable.datatable.columns;
-				for( var i=0; i<cols.length; i++ )
+				for( var k in cols )
 				{
-					var col = cols[i];
-					if( col.name && col.name.indexOf('meta_')!=-1 )
+					var col = cols[k];
+					if( col.name )
 					{
-						var param = TR.state.getFilterValueByColumn(col.name);
-						p += "&searchingValues=" + param;
+						var params = TR.state.getFilterValueByColumn(col.name);
+						for(var i in params){
+							p += "&searchingValues=" + params[i];
+						}
 					}
 				}
 			}
@@ -995,11 +944,6 @@
 							params.push(p);
 						}
 					}
-					
-					//if(editor.data[col.dataIndex]!=undefined){
-					//	value = editor.data[col.dataIndex].toLowerCase();
-					//}
-					
 					if (value=='')
 					{
 						p = colname + '_' + col.hidden + "_";
@@ -1323,15 +1267,6 @@
 					},
 					filters: []
 				}],
-				viewConfig: {
-					getRowClass: function(record, rowIndex, rp, ds){ 
-						if(rowIndex == 0){
-							return 'filter-row hidden';
-						} else {
-						   return '';
-						}
-					}
-				},
 				bbar: [
 					{
 						xtype: 'button',