← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 10963: Add an option into Case-based tabular report to display orgunit-code in result.

 

------------------------------------------------------------
revno: 10963
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2013-05-23 23:04:26 +0700
message:
  Add an option into Case-based tabular report to display orgunit-code in result.
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientreport/PatientTabularReport.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageInstanceService.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageInstanceStore.java
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramStageInstanceService.java
  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/resources/org/hisp/dhis/patientreport/hibernate/PatientTabularReport.hbm.xml
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/GenerateTabularReportAction.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/SaveTabularReportAction.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties
  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/i18n.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonTabularReport.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonTabularReportResult.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties


--
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-api/src/main/java/org/hisp/dhis/patientreport/PatientTabularReport.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientreport/PatientTabularReport.java	2013-05-19 08:24:25 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientreport/PatientTabularReport.java	2013-05-23 16:04:26 +0000
@@ -87,6 +87,8 @@
     private Boolean userOrganisationUnitChildren;
 
     private List<String> filterValues = new ArrayList<String>();
+    
+    private Boolean displayOrgunitCode;
 
     // -------------------------------------------------------------------------
     // Constructors
@@ -225,4 +227,14 @@
         this.programStage = programStage;
     }
 
+    public Boolean getDisplayOrgunitCode()
+    {
+        return displayOrgunitCode;
+    }
+
+    public void setDisplayOrgunitCode( Boolean displayOrgunitCode )
+    {
+        this.displayOrgunitCode = displayOrgunitCode;
+    }
+
 }

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageInstanceService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageInstanceService.java	2013-04-22 06:06:16 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageInstanceService.java	2013-05-23 16:04:26 +0000
@@ -91,11 +91,11 @@
 
     Grid getTabularReport( Boolean anonynousEntryForm, ProgramStage programStage, List<TabularReportColumn> columns,
         Collection<Integer> organisationUnits, int level, Date startDate, Date endDate, boolean descOrder,
-        Boolean completed, Boolean accessPrivateInfo, Integer min, Integer max, I18n i18n );
+        Boolean completed, Boolean accessPrivateInfo, Boolean displayOrgunitCode, Integer min, Integer max, I18n i18n );
 
     int getTabularReportCount( Boolean anonynousEntryForm, ProgramStage programStage,
         List<TabularReportColumn> columns, Collection<Integer> organisationUnits, int level, Boolean completed,
-        Date startDate, Date endDate );
+        Boolean displayOrgunitCode, Date startDate, Date endDate );
 
     List<Grid> getProgramStageInstancesReport( ProgramInstance programInstance, I18nFormat format, I18n i18n );
 

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageInstanceStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageInstanceStore.java	2013-04-22 06:06:16 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageInstanceStore.java	2013-05-23 16:04:26 +0000
@@ -85,11 +85,11 @@
     Grid getTabularReport( Boolean anonynousEntryForm, ProgramStage programStage,
         Map<Integer, OrganisationUnitLevel> orgUnitLevelMap, Collection<Integer> orgUnits,
         List<TabularReportColumn> columns, int level, int maxLevel, Date startDate, Date endDate, boolean descOrder,
-        Boolean completed, Boolean accessPrivateInfo, Integer min, Integer max, I18n i18n );
+        Boolean completed, Boolean accessPrivateInfo, Boolean displayOrgunitCode, Integer min, Integer max, I18n i18n );
 
     int getTabularReportCount( Boolean anonynousEntryForm, ProgramStage programStage,
         List<TabularReportColumn> columns, Collection<Integer> organisationUnits, int level, int maxLevel,
-        Date startDate, Date endDate, Boolean completed );
+        Date startDate, Date endDate, Boolean completed, Boolean displayOrgunitCode  );
 
     void removeEmptyEvents( ProgramStage programStage, OrganisationUnit organisationUnit );
 

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramStageInstanceService.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramStageInstanceService.java	2013-04-22 06:06:16 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramStageInstanceService.java	2013-05-23 16:04:26 +0000
@@ -178,23 +178,23 @@
 
     public Grid getTabularReport( Boolean anonynousEntryForm, ProgramStage programStage, List<TabularReportColumn> columns,
         Collection<Integer> organisationUnits, int level, Date startDate, Date endDate, boolean descOrder,
-        Boolean completed, Boolean accessPrivateInfo, Integer min, Integer max, I18n i18n )
+        Boolean completed, Boolean accessPrivateInfo, Boolean displayOrgunitCode, Integer min, Integer max, I18n i18n )
     {
         int maxLevel = organisationUnitService.getMaxOfOrganisationUnitLevels();
 
         Map<Integer, OrganisationUnitLevel> orgUnitLevelMap = organisationUnitService.getOrganisationUnitLevelMap();
 
         return programStageInstanceStore.getTabularReport( anonynousEntryForm, programStage, orgUnitLevelMap, organisationUnits, columns,
-            level, maxLevel, startDate, endDate, descOrder, completed, accessPrivateInfo, min, max, i18n );
+            level, maxLevel, startDate, endDate, descOrder, completed, accessPrivateInfo, displayOrgunitCode, min, max, i18n );
     }
 
     public int getTabularReportCount( Boolean anonynousEntryForm, ProgramStage programStage, List<TabularReportColumn> columns,
-        Collection<Integer> organisationUnits, int level, Boolean completed, Date startDate, Date endDate )
+        Collection<Integer> organisationUnits, int level, Boolean completed, Boolean displayOrgunitCode, Date startDate, Date endDate )
     {
         int maxLevel = organisationUnitService.getMaxOfOrganisationUnitLevels();
 
         return programStageInstanceStore.getTabularReportCount( anonynousEntryForm, programStage, columns, organisationUnits, level,
-            maxLevel, startDate, endDate, completed );
+            maxLevel, startDate, endDate, completed, displayOrgunitCode );
     }
 
     public List<Grid> getProgramStageInstancesReport( ProgramInstance programInstance, I18nFormat format, I18n i18n )

=== 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	2013-05-21 10:08:44 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramStageInstanceStore.java	2013-05-23 16:04:26 +0000
@@ -260,7 +260,7 @@
     public Grid getTabularReport( Boolean anonynousEntryForm, ProgramStage programStage,
         Map<Integer, OrganisationUnitLevel> orgUnitLevelMap, Collection<Integer> orgUnits,
         List<TabularReportColumn> columns, int level, int maxLevel, Date startDate, Date endDate, boolean descOrder,
-        Boolean completed, Boolean accessPrivateInfo, Integer min, Integer max, I18n i18n )
+        Boolean completed, Boolean accessPrivateInfo, Boolean displayOrgunitCode, Integer min, Integer max, I18n i18n )
     {
         // ---------------------------------------------------------------------
         // Headers cols
@@ -273,7 +273,7 @@
 
         grid.addHeader( new GridHeader( "id", true, true ) );
         grid.addHeader( new GridHeader( programStage.getReportDateDescription(), false, true ) );
-
+        
         if ( anonynousEntryForm == null || !anonynousEntryForm )
         {
             for ( int i = level; i <= maxLevel; i++ )
@@ -282,6 +282,11 @@
                 grid.addHeader( new GridHeader( name, false, true ) );
             }
         }
+       
+        if(displayOrgunitCode!=null && displayOrgunitCode)
+        {
+            grid.addHeader( new GridHeader( i18n.getString("orgunit_code"), false, true ) );
+        }
 
         Collection<String> deKeys = new HashSet<String>();
         for ( TabularReportColumn column : columns )
@@ -305,7 +310,7 @@
         // ---------------------------------------------------------------------
 
         String sql = getTabularReportSql( anonynousEntryForm, false, programStage, columns, orgUnits, level, maxLevel,
-            startDate, endDate, descOrder, completed, accessPrivateInfo, min, max );
+            startDate, endDate, descOrder, completed, accessPrivateInfo, displayOrgunitCode, min, max );
 
         SqlRowSet rowSet = jdbcTemplate.queryForRowSet( sql );
 
@@ -346,10 +351,10 @@
 
     public int getTabularReportCount( Boolean anonynousEntryForm, ProgramStage programStage,
         List<TabularReportColumn> columns, Collection<Integer> organisationUnits, int level, int maxLevel,
-        Date startDate, Date endDate, Boolean completed )
+        Date startDate, Date endDate, Boolean completed, Boolean displayOrgunitCode )
     {
         String sql = getTabularReportSql( anonynousEntryForm, true, programStage, columns, organisationUnits, level,
-            maxLevel, startDate, endDate, false, completed, null, null, null );
+            maxLevel, startDate, endDate, false, completed, null, displayOrgunitCode, null, null );
 
         return jdbcTemplate.queryForObject( sql, Integer.class );
     }
@@ -883,7 +888,7 @@
 
     private String getTabularReportSql( Boolean anonynousEntryForm, boolean count, ProgramStage programStage,
         List<TabularReportColumn> columns, Collection<Integer> orgUnits, int level, int maxLevel, Date startDate,
-        Date endDate, boolean descOrder, Boolean completed, Boolean accessPrivateInfo, Integer min, Integer max )
+        Date endDate, boolean descOrder, Boolean completed, Boolean accessPrivateInfo, Boolean displayOrgunitCode, Integer min, Integer max )
     {
         Set<String> deKeys = new HashSet<String>();
         String selector = count ? "count(*) " : "* ";
@@ -900,7 +905,12 @@
                     + i + ",";
             }
         }
-
+             
+        if( displayOrgunitCode!=null && displayOrgunitCode)
+        {
+            sql += "(select code from organisationunit where organisationunitid=psi.organisationunitid ) as code_,";
+        }
+        
         for ( TabularReportColumn column : columns )
         {
             if ( column.isFixedAttribute() )

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/patientreport/hibernate/PatientTabularReport.hbm.xml'
--- dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/patientreport/hibernate/PatientTabularReport.hbm.xml	2013-05-23 14:28:28 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/patientreport/hibernate/PatientTabularReport.hbm.xml	2013-05-23 16:04:26 +0000
@@ -49,6 +49,8 @@
       <element type="text" column="filtervalue" />
     </list>
     
+    <property name="displayOrgunitCode" />
+    
     <!-- Access properties -->
    
     <many-to-one name="user" class="org.hisp.dhis.user.User"

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/GenerateTabularReportAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/GenerateTabularReportAction.java	2013-05-19 08:24:25 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/GenerateTabularReportAction.java	2013-05-23 16:04:26 +0000
@@ -304,6 +304,13 @@
         return message;
     }
 
+    private Boolean displayOrgunitCode;
+
+    public void setDisplayOrgunitCode( Boolean displayOrgunitCode )
+    {
+        this.displayOrgunitCode = displayOrgunitCode;
+    }
+
     private boolean accessPrivateInfo = false;
 
     // -------------------------------------------------------------------------
@@ -404,22 +411,23 @@
         {
             if ( type == null ) // Tabular report
             {
-                totalRecords = programStageInstanceService.getTabularReportCount( anonynousEntryForm, programStage, columns,
-                    organisationUnits, level, useCompletedEvents, startValue, endValue );
+                totalRecords = programStageInstanceService.getTabularReportCount( anonynousEntryForm, programStage,
+                    columns, organisationUnits, level, useCompletedEvents, displayOrgunitCode, startValue, endValue );
 
                 total = getNumberOfPages( totalRecords );
 
                 this.paging = createPaging( totalRecords );
 
-                grid = programStageInstanceService.getTabularReport( anonynousEntryForm, programStage, columns, organisationUnits, level,
-                    startValue, endValue, !orderByOrgunitAsc, useCompletedEvents, accessPrivateInfo, getStartPos(),
-                    paging.getPageSize(), i18n );
+                grid = programStageInstanceService.getTabularReport( anonynousEntryForm, programStage, columns,
+                    organisationUnits, level, startValue, endValue, !orderByOrgunitAsc, useCompletedEvents,
+                    accessPrivateInfo, displayOrgunitCode, getStartPos(), paging.getPageSize(), i18n );
             }
             // Download as Excel
             else
             {
-                grid = programStageInstanceService.getTabularReport( anonynousEntryForm, programStage, columns, organisationUnits, level,
-                    startValue, endValue, !orderByOrgunitAsc, useCompletedEvents, accessPrivateInfo, null, null, i18n );
+                grid = programStageInstanceService.getTabularReport( anonynousEntryForm, programStage, columns,
+                    organisationUnits, level, startValue, endValue, !orderByOrgunitAsc, useCompletedEvents,
+                    accessPrivateInfo, displayOrgunitCode, null, null, i18n );
             }
         }
         catch ( SQLGrammarException ex )
@@ -469,7 +477,7 @@
                 column.setPrefix( prefix );
                 column.setIdentifier( values[1] );
                 column.setHidden( Boolean.parseBoolean( values[2] ) );
-                
+
                 column.setOperator( values.length == 5 ? TextUtils.lower( values[3] ) : null );
                 column.setQuery( values.length == 5 ? TextUtils.lower( values[4] ) : null );
 

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/SaveTabularReportAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/SaveTabularReportAction.java	2013-05-19 08:24:25 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/SaveTabularReportAction.java	2013-05-23 16:04:26 +0000
@@ -83,7 +83,7 @@
     {
         this.currentUserService = currentUserService;
     }
-    
+
     private I18nFormat format;
 
     public void setFormat( I18nFormat format )
@@ -119,6 +119,8 @@
 
     private Boolean userOrganisationUnitChildren;
 
+    private Boolean displayOrgunitCode;
+
     // -------------------------------------------------------------------------
     // Setters
     // -------------------------------------------------------------------------
@@ -153,6 +155,11 @@
         this.endDate = endDate;
     }
 
+    public void setDisplayOrgunitCode( Boolean displayOrgunitCode )
+    {
+        this.displayOrgunitCode = displayOrgunitCode;
+    }
+
     public void setStartDate( String startDate )
     {
         this.startDate = startDate;
@@ -193,10 +200,11 @@
     {
         userOrganisationUnit = (userOrganisationUnit == null) ? false : userOrganisationUnit;
         userOrganisationUnitChildren = (userOrganisationUnitChildren == null) ? false : userOrganisationUnitChildren;
-
+       displayOrgunitCode = (displayOrgunitCode == null) ? false : displayOrgunitCode;;
+       
         Set<OrganisationUnit> orgunits = new HashSet<OrganisationUnit>(
             organisationUnitService.getOrganisationUnits( orgunitIds ) );
-        
+
         ProgramStage programStage = programStageService.getProgramStage( programStageId );
 
         // ---------------------------------------------------------------------
@@ -211,6 +219,7 @@
         tabularReport.setFacilityLB( facilityLB );
         tabularReport.setSortedOrgunitAsc( orderByOrgunitAsc );
         tabularReport.setUser( currentUserService.getCurrentUser() );
+        tabularReport.setDisplayOrgunitCode( displayOrgunitCode );
 
         if ( useCompletedEvents != null )
         {
@@ -226,5 +235,4 @@
 
         return SUCCESS;
     }
-
 }

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties	2013-05-21 05:35:18 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties	2013-05-23 16:04:26 +0000
@@ -643,4 +643,7 @@
 orgunit_group = Organisation unit group
 validation_rules_are_being_processed_please_wait = Validation rules are being processed please wait ...
 events = Events
-list_events = List events
\ No newline at end of file
+list_events = List events
+orgunit_code = Code
+display_orgunit_code = Display orgunit code
+hide = Hide
\ No newline at end of file

=== 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	2013-05-23 14:28:28 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/app.js	2013-05-23 16:04:26 +0000
@@ -1092,6 +1092,7 @@
 								Ext.getCmp('userOrgunit').setValue( f.userOrganisationUnit );
 								Ext.getCmp('userOrgunitChildren').setValue( f.userOrganisationUnitChildren );								
 								Ext.getCmp('completedEventsOpt').setValue(f.useCompletedEvents);
+								Ext.getCmp('displayOrgunitCode').setValue(f.displayOrgunitCode);
 								
 								// Orgunits
 								
@@ -1131,7 +1132,25 @@
 										 storePatientProperty.load({params: {programId: f.programId}});
 									 }
 								 }
-                                                         
+                                        
+								// Program stage									
+								
+								var storeProgramStage = TR.store.programStage;
+								storeProgramStage.parent = f.programStageId;
+								storeProgramStage.isLoadFromFavorite = true;
+								
+								TR.cmp.params.organisationunit.treepanel.getSelectionModel().deselectAll();
+								
+								TR.store.programStage.removeAll();
+								for (var i = 0; i < f.programStages.length; i++)
+								{
+									TR.store.programStage.add(
+										{'id': f.programStages[i].id,'name': f.programStages[i].name}
+									);
+								}
+								Ext.getCmp('programStageCombobox').setValue( f.programStageId );
+								
+								
 								// Data element
 								
 								Ext.getCmp('filterPanel').removeAll();
@@ -1145,9 +1164,9 @@
 										var compulsory = f.dataElements[i].compulsory;
 										var valueType = f.dataElements[i].valueType;
 										TR.cmp.params.dataelement.objects.push({id: f.dataElements[i].id, name: name, compulsory: compulsory, valueType: valueType});
+										TR.store.dataelement.selected.add({id: f.dataElements[i].id, name: name, compulsory: compulsory, valueType: valueType});
 										TR.util.multiselect.addFilterField( 'filterPanel', f.dataElements[i].id, name, valueType, f.dataElements[i].filter );
 									}
-									TR.store.dataelement.selected.add(TR.cmp.params.dataelement.objects);
 									
 									if( f.singleEvent == 'false' )
 									{
@@ -1163,22 +1182,6 @@
 									}
 								}
 								
-								// Program stage									
-								
-								var storeProgramStage = TR.store.programStage;
-								storeProgramStage.parent = f.programStageId;
-								storeProgramStage.isLoadFromFavorite = true;
-								
-								TR.cmp.params.organisationunit.treepanel.getSelectionModel().deselectAll();
-								
-								TR.store.programStage.removeAll();
-								for (var i = 0; i < f.programStages.length; i++)
-								{
-									TR.store.programStage.add(
-										{'id': f.programStages[i].id,'name': f.programStages[i].name}
-									);
-								}
-								Ext.getCmp('programStageCombobox').setValue( f.programStageId );
 								
 								TR.exe.execute();
 								
@@ -1793,8 +1796,15 @@
 					{
 						completedEvent = "&completedEventsOpt=true";
 					}
+					
+					var displayOrgunitCode='';
+					if ( Ext.getCmp('displayOrgunitCode').getValue() == true )
+					{
+						displayOrgunitCode = "&displayOrgunitCode=true";
+					}
+					
   				    var exportForm = document.getElementById('exportForm');
-					exportForm.action = url + "?type=" + type + completedEvent;
+					exportForm.action = url + "?type=" + type + completedEvent + displayOrgunitCode;
 					exportForm.submit();
 				}
 				// Show report on grid
@@ -1864,6 +1874,11 @@
 					p.useCompletedEvents = Ext.getCmp('completedEventsOpt').getValue();
 				}
 				
+				if( Ext.getCmp('displayOrgunitCode').getValue()== true )
+				{
+					p.displayOrgunitCode = Ext.getCmp('displayOrgunitCode').getValue();
+				}
+				
 				// Get searching values
 				p.filterValues = [];
 				
@@ -1975,8 +1990,8 @@
 				
 				// Get searching values
 				
-				var filterValues = document.getElementById('filterValues');
-				TR.util.list.clearList(filterValues);				
+				var filterValueList = document.getElementById('filterValues');
+				TR.util.list.clearList(filterValueList);				
 				
 				// Patient properties
 				
@@ -1989,11 +2004,24 @@
 					for(var idx=0;idx<length;idx++)
 					{
 						var id = propId + '_' + idx;
-						var filterValue = Ext.getCmp('filter_' + id).rawValue;
+						var filterField = Ext.getCmp('filter_' + id);
+						var filterValue = "";
+						if( filterField.xtype == 'combobox' )
+						{
+							var values = Ext.getCmp('filter_' + id).getValue();
+							for( var i in values ){
+								filterValue += values[i] + ";";
+							}
+							filterValue = filterValue.substring(0,filterValue.length - 1  );
+						}
+						else{
+							filterValue = filterField.rawValue;
+						}
+						
 						var filter = propId + '_' + hidden 
-						if( filterValue!='' && filterValue!=TR.i18n.please_select ){
+						if( filterValue!=null && filterValue!=''){
 							var filterOpt = Ext.getCmp('filter_opt_' + id).rawValue;
-							filter += '_' + filterOpt + ' ';
+							filter += '_' + filterOpt + '_';
 							if( filterOpt == 'IN' )
 							{
 								var filterValues = filterValue.split(";");
@@ -2009,7 +2037,7 @@
 								filter += "'" + filterValue + "'";
 							}
 						}
-						TR.util.list.addOptionToList(filterValues, filter, '');
+						TR.util.list.addOptionToList(filterValueList, filter, '');
 					}
 				});
 				
@@ -2022,18 +2050,15 @@
 					for(var idx=0;idx<length;idx++)
 					{
 						var id = deId + '_' + idx;
-						var filterField = Ext.getCmp('filter_' + id);
-						var filterOpt = Ext.getCmp('filter_opt_' + id).rawValue;
+						
+						var filterOpt = Ext.getCmp('filter_opt_' + id).rawValue;						
 						var filterValue = Ext.getCmp('filter_' + id).rawValue;
-						
 						var filter = deId + '_' + hidden + '_';
 						if( Ext.getCmp('filter_' + id).getValue()!=null 
 							&& Ext.getCmp('filter_' + id).getValue()!=''){
 							
 							filterValue = filterValue.toLowerCase();
-							var filterOpt = Ext.getCmp('filter_opt_' + id).rawValue;
-							filter += filterOpt + ' ';
-						
+							filter += filterOpt + '_';
 							if( filterOpt == 'IN' )
 							{
 								var filterValues = filterValue.split(";");
@@ -2049,9 +2074,10 @@
 								filter += "'" + Ext.getCmp('filter_' + id).getValue() + "'";
 							}
 						}
-						TR.util.list.addOptionToList(filterValues, filter, '');
+						TR.util.list.addOptionToList(filterValueList, filter, '');
 					}
 				});
+				
 			},
 			isColHidden: function( colname ) {
 				var grid = TR.datatable.datatable;
@@ -2378,6 +2404,7 @@
 				else{
 					document.getElementById('deGroupBy').value = "";
 				}
+				
 				if( Ext.getCmp('limitOption').getValue() != null 
 					&& Ext.getCmp('limitOption').getValue() != '' ){
 					document.getElementById('limitRecords').value = Ext.getCmp('limitOption').getValue();
@@ -2806,7 +2833,7 @@
             return this.datatable;
             
         },
-		createColTable:function(){
+		createColTable: function(){
 			var cols = [];
 				
 			if(Ext.getCmp('reportTypeGroup').getValue().reportType=='true')
@@ -2857,6 +2884,20 @@
 					}
 				}
 				
+				if( Ext.getCmp('displayOrgunitCode').getValue()== true )
+				{
+					cols[++index] = {
+						header: TR.value.columns[index].name, 
+						dataIndex: 'col' + index,
+						height: TR.conf.layout.east_gridcolumn_height,
+						name: 'meta_' + index,
+						sortable: false,
+						draggable: false,
+						hideable: false,
+						menuDisabled: true
+					}
+				}
+				
 				// Patient properties columns
 			
 				TR.cmp.params.patientProperty.selected.store.each( function(r) {
@@ -4020,6 +4061,16 @@
 			labelWidth: 135
 		});
 		
+		var displayOrgunitCodeField = Ext.create('Ext.form.field.Checkbox', {
+			xtype: 'checkbox',
+			cls: 'tr-checkbox',
+			id: 'displayOrgunitCode',
+			style:'padding-left: 20px;',
+			boxLabel: TR.i18n.display_orgunit_code,
+			boxLabelAlign: 'before',
+			labelWidth: 135
+		});
+		
 		var facilityLBField = Ext.create('Ext.form.field.ComboBox', {
 			cls: 'tr-combo',
 			id: 'facilityLBCombobox',
@@ -4172,7 +4223,8 @@
 							bodyStyle: 'border-style:none; background-color:transparent;',
 							items:[
 								completedEventsField,
-								displayTotalsOptField
+								displayTotalsOptField,
+								displayOrgunitCodeField
 							]
 						},
 						facilityLBField,
@@ -4516,8 +4568,10 @@
 													Ext.getCmp('aggregateFavoriteBtn').setVisible(false);
 													Ext.getCmp('datePeriodRangeDiv').setVisible(false);
 													Ext.getCmp('deSumCbx').setVisible(false);
+													Ext.getCmp('displayTotalsOpt').setVisible(false);
 													Ext.getCmp('caseBasedFavoriteBtn').setVisible(true);
 													Ext.getCmp('levelCombobox').setVisible(true);
+													Ext.getCmp('displayOrgunitCode').setVisible(true);
 													var level = Ext.getCmp('levelCombobox').getValue();
 													if( level==null || level!='' ){
 														Ext.getCmp('levelCombobox').setValue('1');
@@ -4560,10 +4614,12 @@
 													Ext.getCmp('caseBasedFavoriteBtn').setVisible(false);
 													Ext.getCmp('btnSortBy').setVisible(false);
 													Ext.getCmp('patientPropertiesDiv').setVisible(false);
+													Ext.getCmp('displayOrgunitCode').setVisible(false);
 													
 													Ext.getCmp('datePeriodRangeDiv').setVisible(true);
 													Ext.getCmp('fixedPeriodsDiv').setVisible(true);
 													Ext.getCmp('relativePeriodsDiv').setVisible(true);
+													Ext.getCmp('displayTotalsOpt').setVisible(true);
 													Ext.getCmp('datePeriodRangeDiv').expand();
 													Ext.getCmp('filterPanel').setHeight(105);
 												}
@@ -6375,6 +6431,7 @@
 				Ext.getCmp('positionField').setVisible(false);
 				Ext.getCmp('aggregateFavoriteBtn').setVisible(false);
 				Ext.getCmp('datePeriodRangeDiv').setVisible(false);
+				Ext.getCmp('displayTotalsOpt').setVisible(false);
 				Ext.getCmp('caseBasedFavoriteBtn').setVisible(true);
 				Ext.getCmp('levelCombobox').setVisible(true);
 				Ext.getCmp('patientPropertiesDiv').setVisible(true);

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/i18n.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/i18n.vm	2013-05-23 14:28:28 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/i18n.vm	2013-05-23 16:04:26 +0000
@@ -192,5 +192,6 @@
 hide: '$encoder.jsEscape($i18n.getString( 'hide' ) , "'")',
 can_view: '$encoder.jsEscape($i18n.getString( 'can_view' ) , "'")',
 can_edit_and_view: '$encoder.jsEscape($i18n.getString( 'can_edit_and_view' ) , "'")',
-public_access: '$encoder.jsEscape($i18n.getString( 'public_access' ) , "'")'
+public_access: '$encoder.jsEscape($i18n.getString( 'public_access' ) , "'")',
+display_orgunit_code: '$encoder.jsEscape($i18n.getString( 'display_orgunit_code' ) , "'")'
 };
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonTabularReport.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonTabularReport.vm	2013-05-19 08:24:25 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonTabularReport.vm	2013-05-23 16:04:26 +0000
@@ -32,6 +32,7 @@
 	"level": "${tabularReport.level}",
 	"sortedOrgunitAsc": "${tabularReport.sortedOrgunitAsc}",
 	"facilityLB": "${tabularReport.facilityLB}",
+	"displayOrgunitCode": "$!tabularReport.displayOrgunitCode",
 	"useCompletedEvents": "$!tabularReport.useCompletedEvents",
 	"userOrganisationUnit": "$!tabularReport.userOrganisationUnit",
 	"userOrganisationUnitChildren": "$!tabularReport.userOrganisationUnitChildren",

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonTabularReportResult.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonTabularReportResult.vm	2013-03-13 14:52:25 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonTabularReportResult.vm	2013-05-23 16:04:26 +0000
@@ -1,4 +1,3 @@
-
 #set( $noRows = $grid.getRows().size() )
 {
 #set( $noHeader = $grid.getHeaders().size() )

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties	2013-05-23 05:47:24 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties	2013-05-23 16:04:26 +0000
@@ -406,5 +406,4 @@
 orgunit_group = Organisation unit group
 enrollement_date = Enrollement date
 days_since_incident_date = Days since incident date
-view_all = View all
-hide = Hide
\ No newline at end of file
+view_all = View all
\ No newline at end of file