← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 10890: Support to save filter-values of cased=based tabular report.

 

------------------------------------------------------------
revno: 10890
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Sun 2013-05-19 15:24:25 +0700
message:
  Support to save filter-values of cased=based tabular report.
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientreport/PatientTabularReport.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientreport/TabularReportColumn.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/GetTabularReportAction.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/META-INF/dhis/beans.xml
  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/index.html
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonTabularInitialize.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonTabularReport.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
=== 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-02-22 04:49:30 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientreport/PatientTabularReport.java	2013-05-19 08:24:25 +0000
@@ -27,17 +27,16 @@
 
 package org.hisp.dhis.patientreport;
 
-import org.hisp.dhis.common.BaseIdentifiableObject;
-import org.hisp.dhis.organisationunit.OrganisationUnit;
-import org.hisp.dhis.patient.PatientAttribute;
-import org.hisp.dhis.patient.PatientIdentifierType;
-import org.hisp.dhis.program.ProgramStageDataElement;
-
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
 import java.util.Set;
 
+import org.hisp.dhis.common.BaseIdentifiableObject;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.program.ProgramStage;
+import org.hisp.dhis.user.User;
+
 /**
  * @author Chau Thu Tran
  * @version $PatientTabularReport.java May 7, 2012 12:41:41 PM$
@@ -69,13 +68,7 @@
 
     private Date endDate;
 
-    private List<PatientIdentifierType> identifiers = new ArrayList<PatientIdentifierType>();
-
-    private List<PatientAttribute> attributes = new ArrayList<PatientAttribute>();
-
-    private List<String> fixedAttributes = new ArrayList<String>();
-
-    private List<ProgramStageDataElement> programStageDataElements = new ArrayList<ProgramStageDataElement>();
+    private ProgramStage programStage;
 
     private Set<OrganisationUnit> organisationUnits;
 
@@ -85,12 +78,16 @@
 
     private String facilityLB;
 
+    private User user;
+
     private Boolean useCompletedEvents;
 
     private Boolean userOrganisationUnit;
 
     private Boolean userOrganisationUnitChildren;
 
+    private List<String> filterValues = new ArrayList<String>();
+
     // -------------------------------------------------------------------------
     // Constructors
     // -------------------------------------------------------------------------
@@ -138,44 +135,14 @@
         this.organisationUnits = organisationUnits;
     }
 
-    public List<PatientIdentifierType> getIdentifiers()
-    {
-        return identifiers;
-    }
-
-    public void setIdentifiers( List<PatientIdentifierType> identifiers )
-    {
-        this.identifiers = identifiers;
-    }
-
-    public List<PatientAttribute> getAttributes()
-    {
-        return attributes;
-    }
-
-    public void setAttributes( List<PatientAttribute> attributes )
-    {
-        this.attributes = attributes;
-    }
-
-    public List<String> getFixedAttributes()
-    {
-        return fixedAttributes;
-    }
-
-    public void setFixedAttributes( List<String> fixedAttributes )
-    {
-        this.fixedAttributes = fixedAttributes;
-    }
-
-    public List<ProgramStageDataElement> getProgramStageDataElements()
-    {
-        return programStageDataElements;
-    }
-
-    public void setProgramStageDataElements( List<ProgramStageDataElement> programStageDataElements )
-    {
-        this.programStageDataElements = programStageDataElements;
+    public List<String> getFilterValues()
+    {
+        return filterValues;
+    }
+
+    public void setFilterValues( List<String> filterValues )
+    {
+        this.filterValues = filterValues;
     }
 
     public int getLevel()
@@ -238,4 +205,24 @@
         this.useCompletedEvents = useCompletedEvents;
     }
 
+    public User getUser()
+    {
+        return user;
+    }
+
+    public void setUser( User user )
+    {
+        this.user = user;
+    }
+
+    public ProgramStage getProgramStage()
+    {
+        return programStage;
+    }
+
+    public void setProgramStage( ProgramStage programStage )
+    {
+        this.programStage = programStage;
+    }
+
 }

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientreport/TabularReportColumn.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientreport/TabularReportColumn.java	2013-03-14 13:30:46 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientreport/TabularReportColumn.java	2013-05-19 08:24:25 +0000
@@ -17,6 +17,8 @@
     
     private String query;
     
+    private String operator;
+    
     private String name;
     
     private boolean dateType = false;
@@ -29,13 +31,14 @@
     {
     }
     
-    public TabularReportColumn( String prefix, String identifier, String name, boolean hidden, String query )
+    public TabularReportColumn( String prefix, String identifier, String name, boolean hidden, String operator, String query )
     {
         this.prefix = prefix;
         this.identifier = identifier;
         this.name = name;
         this.hidden = hidden;
         this.query = query;
+        this.operator = operator;
     }
 
     // -------------------------------------------------------------------------
@@ -145,4 +148,14 @@
     {
         this.dateType = dateType;
     }
+
+    public String getOperator()
+    {
+        return operator;
+    }
+
+    public void setOperator( String operator )
+    {
+        this.operator = operator;
+    }
 }

=== 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-15 03:40:15 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramStageInstanceStore.java	2013-05-19 08:24:25 +0000
@@ -911,11 +911,11 @@
                 {
                     if ( column.isDateType() )
                     {
-                        where += operator + column.getIdentifier() + " " + column.getQuery() + " ";
+                        where += operator + column.getIdentifier() + " " + column.getOperator() + " " + column.getQuery() + " ";
                     }
                     else
                     {
-                        where += operator + "lower(" + column.getIdentifier() + ") " + column.getQuery() + " ";
+                        where += operator + "lower(" + column.getIdentifier() + ") " + column.getOperator() + " " +  column.getQuery() + " ";
                     }
                     operator = "and ";
                 }
@@ -933,11 +933,11 @@
                 {
                     if ( column.isDateType() )
                     {
-                        where += operator + "identifier_" + column.getIdentifier() + " " + column.getQuery() + " ";
+                        where += operator + "identifier_" + column.getIdentifier() + " " + column.getOperator() + " " + column.getQuery() + " ";
                     }
                     else
                     {
-                        where += operator + "lower(identifier_" + column.getIdentifier() + ") " + column.getQuery()
+                        where += operator + "lower(identifier_" + column.getIdentifier() + ") " + column.getOperator() + " " + column.getQuery()
                             + " ";
                     }
                     operator = "and ";
@@ -956,11 +956,11 @@
                 {
                     if ( column.isDateType() )
                     {
-                        where += operator + "attribute_" + column.getIdentifier() + " " + column.getQuery() + " ";
+                        where += operator + "attribute_" + column.getIdentifier() + " " + column.getOperator() + " " + column.getQuery() + " ";
                     }
                     else
                     {
-                        where += operator + "lower(attribute_" + column.getIdentifier() + ") " + column.getQuery()
+                        where += operator + "lower(attribute_" + column.getIdentifier() + ") " + column.getOperator() + " " + column.getQuery()
                             + " ";
                     }
                     operator = "and ";
@@ -980,7 +980,7 @@
 
                 if ( column.hasQuery() )
                 {
-                    where += operator + "element_" + column.getIdentifier() + " " + column.getQuery() + " ";
+                    where += operator + "element_" + column.getIdentifier() + " " + column.getOperator() + " " + column.getQuery() + " ";
                     operator = "and ";
                 }
             }
@@ -998,11 +998,11 @@
                 {
                     if ( column.isDateType() )
                     {
-                        where += operator + "element_" + column.getIdentifier() + " " + column.getQuery() + " ";
+                        where += operator + "element_" + column.getIdentifier() + " " + column.getOperator() + " " + column.getQuery() + " ";
                     }
                     else
                     {
-                        where += operator + "lower(element_" + column.getIdentifier() + ") " + column.getQuery() + " ";
+                        where += operator + "lower(element_" + column.getIdentifier() + ") " + column.getOperator() + " " + column.getQuery() + " ";
                     }
                     operator = "and ";
                 }

=== 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-02-22 04:49:30 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/patientreport/hibernate/PatientTabularReport.hbm.xml	2013-05-19 08:24:25 +0000
@@ -16,37 +16,13 @@
 
     <property name="name" column="name" not-null="true" unique="true" length="230" />
 
+    <many-to-one name="programStage" class="org.hisp.dhis.program.ProgramStage"
+      column="programstageid" foreign-key="fk_patientaggregatereport_programstage" />
+
     <property name="startDate" />
 
     <property name="endDate" />
 
-    <list name="identifiers"
-      table="patienttabularreport_identifiers">
-      <key column="patienttabularreportid" />
-      <list-index column="sort_order" base="0" />
-      <many-to-many class="org.hisp.dhis.patient.PatientIdentifierType"
-        column="patientidentifiertypeid" foreign-key="patienttabularreport_indentifierid" />
-    </list>
-
-    <list name="attributes" table="patienttabularreport_attributes">
-      <key column="patienttabularreportid" />
-      <list-index column="sort_order" base="0" />
-      <many-to-many class="org.hisp.dhis.patient.PatientAttribute"
-        column="patientattributeid" foreign-key="patienttabularreport_attributeid" />
-    </list>
-
-    <list name="fixedAttributes" table="patienttabularreport_fixedattribute">
-      <key column="patienttabularreportid" foreign-key="patienttabularreport_fixedAttribute" />
-      <list-index column="sort_order" />
-      <element type="text" column="fixedAttribute" />
-    </list>
-
-    <list name="programStageDataElements" table="patienttabularreport_programstagedataelements">
-      <key column="patienttabularreportid" />
-      <list-index column="tabular_sort_order" base="1" />
-      <one-to-many class="org.hisp.dhis.program.ProgramStageDataElement" />
-    </list>
-
     <set name="organisationUnits" table="patienttabularreport_organisationUnits">
       <cache usage="read-write" />
       <key column="patienttabularreportid" foreign-key="fk_patienttabularreport_organisationUnitid" />
@@ -68,6 +44,13 @@
     <property name="userOrganisationUnit" />
 
     <property name="userOrganisationUnitChildren" />
+    
+     <list name="filterValues" table="patienttabularreport_filtervalues">
+      <key column="patientaggregatereportid"
+        foreign-key="fk_patienttabularreportid_filtervalues" />
+        <list-index column="sort_order" base="1" />
+      <element type="text" column="filtervalue" />
+    </list>
 
   </class>
 </hibernate-mapping>

=== 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-04-22 06:06:16 +0000
+++ 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
@@ -180,11 +180,11 @@
         return values;
     }
 
-    private List<String> searchingValues = new ArrayList<String>();
+    private List<String> filterValues = new ArrayList<String>();
 
-    public void setSearchingValues( List<String> searchingValues )
+    public void setFilterValues( List<String> filterValues )
     {
-        this.searchingValues = searchingValues;
+        this.filterValues = filterValues;
     }
 
     private boolean orderByOrgunitAsc;
@@ -457,9 +457,9 @@
 
         int index = 0;
 
-        for ( String searchValue : searchingValues )
+        for ( String filterValue : filterValues )
         {
-            String[] values = searchValue.split( "_" );
+            String[] values = filterValue.split( "_" );
 
             if ( values != null && values.length >= 3 )
             {
@@ -469,7 +469,9 @@
                 column.setPrefix( prefix );
                 column.setIdentifier( values[1] );
                 column.setHidden( Boolean.parseBoolean( values[2] ) );
-                column.setQuery( values.length == 4 ? TextUtils.lower( values[3] ) : null );
+                
+                column.setOperator( values.length == 5 ? TextUtils.lower( values[3] ) : null );
+                column.setQuery( values.length == 5 ? TextUtils.lower( values[4] ) : null );
 
                 if ( PREFIX_FIXED_ATTRIBUTE.equals( prefix ) )
                 {

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/GetTabularReportAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/GetTabularReportAction.java	2012-06-12 03:38:24 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/GetTabularReportAction.java	2013-05-19 08:24:25 +0000
@@ -27,6 +27,15 @@
 
 package org.hisp.dhis.caseentry.action.report;
 
+import java.util.ArrayList;
+import java.util.List;
+
+import org.hisp.dhis.dataelement.DataElement;
+import org.hisp.dhis.dataelement.DataElementService;
+import org.hisp.dhis.patient.PatientAttribute;
+import org.hisp.dhis.patient.PatientAttributeService;
+import org.hisp.dhis.patient.PatientIdentifierType;
+import org.hisp.dhis.patient.PatientIdentifierTypeService;
 import org.hisp.dhis.patientreport.PatientTabularReport;
 import org.hisp.dhis.patientreport.PatientTabularReportService;
 import org.hisp.dhis.program.ProgramStage;
@@ -52,6 +61,27 @@
         this.tabularReportService = tabularReportService;
     }
 
+    private DataElementService dataElementService;
+
+    public void setDataElementService( DataElementService dataElementService )
+    {
+        this.dataElementService = dataElementService;
+    }
+
+    private PatientIdentifierTypeService patientIdentifierTypeService;
+
+    public void setPatientIdentifierTypeService( PatientIdentifierTypeService patientIdentifierTypeService )
+    {
+        this.patientIdentifierTypeService = patientIdentifierTypeService;
+    }
+
+    private PatientAttributeService patientAttributeService;
+
+    public void setPatientAttributeService( PatientAttributeService patientAttributeService )
+    {
+        this.patientAttributeService = patientAttributeService;
+    }
+
     // -------------------------------------------------------------------------
     // Input
     // -------------------------------------------------------------------------
@@ -77,6 +107,62 @@
         return programStage;
     }
 
+    private List<String> selectedFixedAttributes = new ArrayList<String>();
+
+    public List<String> getSelectedFixedAttributes()
+    {
+        return selectedFixedAttributes;
+    }
+
+    private List<DataElement> selectedDataElements = new ArrayList<DataElement>();
+
+    public List<DataElement> getSelectedDataElements()
+    {
+        return selectedDataElements;
+    }
+
+    private List<PatientAttribute> selectedAttributes = new ArrayList<PatientAttribute>();
+
+    public List<PatientAttribute> getSelectedAttributes()
+    {
+        return selectedAttributes;
+    }
+
+    private List<PatientIdentifierType> selectedIdentifierTypes = new ArrayList<PatientIdentifierType>();
+
+    public List<PatientIdentifierType> getSelectedIdentifierTypes()
+    {
+        return selectedIdentifierTypes;
+    }
+
+    private List<String> fixedAttributeFilters = new ArrayList<String>();
+
+    public List<String> getFixedAttributeFilters()
+    {
+        return fixedAttributeFilters;
+    }
+
+    private List<String> patientAttributeFilters = new ArrayList<String>();
+
+    public List<String> getPatientAttributeFilters()
+    {
+        return patientAttributeFilters;
+    }
+
+    private List<String> identifierTypeFilters = new ArrayList<String>();
+
+    public List<String> getIdentifierTypeFilters()
+    {
+        return identifierTypeFilters;
+    }
+
+    private List<String> dataelementFilters = new ArrayList<String>();
+
+    public List<String> getDataelementFilters()
+    {
+        return dataelementFilters;
+    }
+
     // -------------------------------------------------------------------------
     // Action implementation
     // -------------------------------------------------------------------------
@@ -87,10 +173,42 @@
     {
         tabularReport = tabularReportService.getPatientTabularReport( id );
 
-        if ( tabularReport.getProgramStageDataElements() != null
-            && tabularReport.getProgramStageDataElements().size() > 0 )
+        programStage = tabularReport.getProgramStage();
+
+        for ( String filterValue : tabularReport.getFilterValues() )
         {
-            programStage = tabularReport.getProgramStageDataElements().get( 0 ).getProgramStage();
+            String[] values = filterValue.split( "_" );
+            String filter = "";
+            if ( values.length == 5 )
+            {
+                filter =  values[3] + "_" + values[4].trim().substring( 1, values[4].length() - 1 );
+            }
+
+            if ( values[0].equals( PatientTabularReport.PREFIX_FIXED_ATTRIBUTE ) )
+            {
+                selectedFixedAttributes.add( values[1] );
+                fixedAttributeFilters.add( filter );
+            }
+            else
+            {
+                int id = Integer.parseInt( values[1] );
+
+                if ( values[0].equals( PatientTabularReport.PREFIX_IDENTIFIER_TYPE ) )
+                {
+                    selectedIdentifierTypes.add( patientIdentifierTypeService.getPatientIdentifierType( id ) );
+                    identifierTypeFilters.add( filter );
+                }
+                else if ( values[0].equals( PatientTabularReport.PREFIX_PATIENT_ATTRIBUTE ) )
+                {
+                    selectedAttributes.add( patientAttributeService.getPatientAttribute( id ) );
+                    patientAttributeFilters.add( filter );
+                }
+                else if ( values[0].equals( PatientTabularReport.PREFIX_DATA_ELEMENT ) )
+                {
+                    selectedDataElements.add( dataElementService.getDataElement( id ) );
+                    dataelementFilters.add( filter );
+                }
+            }
         }
 
         return SUCCESS;

=== 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-02-28 04:34:35 +0000
+++ 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
@@ -27,31 +27,18 @@
 
 package org.hisp.dhis.caseentry.action.report;
 
-import static org.hisp.dhis.patientreport.PatientTabularReport.PREFIX_DATA_ELEMENT;
-import static org.hisp.dhis.patientreport.PatientTabularReport.PREFIX_FIXED_ATTRIBUTE;
-import static org.hisp.dhis.patientreport.PatientTabularReport.PREFIX_IDENTIFIER_TYPE;
-import static org.hisp.dhis.patientreport.PatientTabularReport.PREFIX_PATIENT_ATTRIBUTE;
-
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
 
-import org.hisp.dhis.dataelement.DataElement;
-import org.hisp.dhis.dataelement.DataElementService;
 import org.hisp.dhis.i18n.I18nFormat;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.organisationunit.OrganisationUnitService;
-import org.hisp.dhis.patient.PatientAttribute;
-import org.hisp.dhis.patient.PatientAttributeService;
-import org.hisp.dhis.patient.PatientIdentifierType;
-import org.hisp.dhis.patient.PatientIdentifierTypeService;
 import org.hisp.dhis.patientreport.PatientTabularReport;
 import org.hisp.dhis.patientreport.PatientTabularReportService;
 import org.hisp.dhis.program.ProgramStage;
-import org.hisp.dhis.program.ProgramStageDataElement;
-import org.hisp.dhis.program.ProgramStageDataElementService;
 import org.hisp.dhis.program.ProgramStageService;
 import org.hisp.dhis.user.CurrentUserService;
 
@@ -90,41 +77,13 @@
         this.programStageService = programStageService;
     }
 
-    private DataElementService dataElementService;
-
-    public void setDataElementService( DataElementService dataElementService )
-    {
-        this.dataElementService = dataElementService;
-    }
-
-    private PatientIdentifierTypeService identifierTypeService;
-
-    public void setIdentifierTypeService( PatientIdentifierTypeService identifierTypeService )
-    {
-        this.identifierTypeService = identifierTypeService;
-    }
-
-    private PatientAttributeService patientAttributeService;
-
-    public void setPatientAttributeService( PatientAttributeService patientAttributeService )
-    {
-        this.patientAttributeService = patientAttributeService;
-    }
-
     private CurrentUserService currentUserService;
 
     public void setCurrentUserService( CurrentUserService currentUserService )
     {
         this.currentUserService = currentUserService;
     }
-
-    private ProgramStageDataElementService programStageDataElementService;
-
-    public void setProgramStageDataElementService( ProgramStageDataElementService programStageDataElementService )
-    {
-        this.programStageDataElementService = programStageDataElementService;
-    }
-
+    
     private I18nFormat format;
 
     public void setFormat( I18nFormat format )
@@ -144,7 +103,7 @@
 
     private Integer programStageId;
 
-    private List<String> searchingValues = new ArrayList<String>();
+    private List<String> filterValues = new ArrayList<String>();
 
     private Collection<Integer> orgunitIds;
 
@@ -174,9 +133,9 @@
         this.level = level;
     }
 
-    public void setSearchingValues( List<String> searchingValues )
+    public void setFilterValues( List<String> filterValues )
     {
-        this.searchingValues = searchingValues;
+        this.filterValues = filterValues;
     }
 
     public void setFacilityLB( String facilityLB )
@@ -237,6 +196,7 @@
 
         Set<OrganisationUnit> orgunits = new HashSet<OrganisationUnit>(
             organisationUnitService.getOrganisationUnits( orgunitIds ) );
+        
         ProgramStage programStage = programStageService.getProgramStage( programStageId );
 
         // ---------------------------------------------------------------------
@@ -259,49 +219,8 @@
 
         tabularReport.setUserOrganisationUnit( userOrganisationUnit );
         tabularReport.setUserOrganisationUnitChildren( userOrganisationUnitChildren );
-
-        // ---------------------------------------------------------------------
-        // Get searching-keys
-        // ---------------------------------------------------------------------
-
-        List<PatientIdentifierType> identifiers = new ArrayList<PatientIdentifierType>();
-
-        List<PatientAttribute> attributes = new ArrayList<PatientAttribute>();
-
-        List<ProgramStageDataElement> programStageDataElements = new ArrayList<ProgramStageDataElement>();
-        List<String> fixedAttributes = new ArrayList<String>();
-
-        for ( String searchingValue : searchingValues )
-        {
-            String[] infor = searchingValue.split( "_" );
-            String objectType = infor[0];
-
-            if ( objectType.equals( PREFIX_IDENTIFIER_TYPE ) )
-            {
-                int objectId = Integer.parseInt( infor[1] );
-                identifiers.add( identifierTypeService.getPatientIdentifierType( objectId ) );
-            }
-            else if ( objectType.equals( PREFIX_FIXED_ATTRIBUTE ) )
-            {
-                fixedAttributes.add( infor[1] );
-            }
-            else if ( objectType.equals( PREFIX_PATIENT_ATTRIBUTE ) )
-            {
-                int objectId = Integer.parseInt( infor[1] );
-                attributes.add( patientAttributeService.getPatientAttribute( objectId ) );
-            }
-            else if ( objectType.equals( PREFIX_DATA_ELEMENT ) )
-            {
-                int objectId = Integer.parseInt( infor[1] );
-                DataElement dataElement = dataElementService.getDataElement( objectId );
-                programStageDataElements.add( programStageDataElementService.get( programStage, dataElement ) );
-            }
-        }
-
-        tabularReport.setFixedAttributes( fixedAttributes );
-        tabularReport.setIdentifiers( identifiers );
-        tabularReport.setAttributes( attributes );
-        tabularReport.setProgramStageDataElements( programStageDataElements );
+        tabularReport.setFilterValues( filterValues );
+        tabularReport.setProgramStage( programStage );
 
         tabularReportService.saveOrUpdate( tabularReport );
 

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml	2013-05-15 09:14:57 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml	2013-05-19 08:24:25 +0000
@@ -43,14 +43,19 @@
 		<property name="programService" ref="org.hisp.dhis.program.ProgramService" />
 	</bean>
 
-	<bean id="org.hisp.dhis.caseentry.action.caseentry.SaveExecutionDateAction"
-		class="org.hisp.dhis.caseentry.action.caseentry.SaveExecutionDateAction" scope="prototype">
-		<property name="programStageInstanceService" ref="org.hisp.dhis.program.ProgramStageInstanceService" />
+	<bean
+		id="org.hisp.dhis.caseentry.action.caseentry.SaveExecutionDateAction"
+		class="org.hisp.dhis.caseentry.action.caseentry.SaveExecutionDateAction"
+		scope="prototype">
+		<property name="programStageInstanceService"
+			ref="org.hisp.dhis.program.ProgramStageInstanceService" />
 		<property name="programService" ref="org.hisp.dhis.program.ProgramService" />
 		<property name="programInstanceService" ref="org.hisp.dhis.program.ProgramInstanceService" />
 		<property name="patientService" ref="org.hisp.dhis.patient.PatientService" />
-    <property name="organisationUnitService" ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
-		<property name="selectedStateManager" ref="org.hisp.dhis.caseentry.state.SelectedStateManager" />
+		<property name="organisationUnitService"
+			ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
+		<property name="selectedStateManager"
+			ref="org.hisp.dhis.caseentry.state.SelectedStateManager" />
 	</bean>
 
 	<bean id="org.hisp.dhis.caseentry.action.caseentry.SaveValueAction"
@@ -87,18 +92,26 @@
 			ref="org.hisp.dhis.caseentry.state.SelectedStateManager" />
 	</bean>
 
-  <bean id="org.hisp.dhis.caseentry.action.caseentry.LoadDataEntryAction"
-    class="org.hisp.dhis.caseentry.action.caseentry.LoadDataEntryAction" scope="prototype">
-    <property name="programDataEntryService" ref="org.hisp.dhis.program.ProgramDataEntryService" />
-    <property name="patientDataValueService" ref="org.hisp.dhis.patientdatavalue.PatientDataValueService" />
-    <property name="programStageService" ref="org.hisp.dhis.program.ProgramStageService" />
-    <property name="programStageInstanceService" ref="org.hisp.dhis.program.ProgramStageInstanceService" />
-    <property name="selectedStateManager" ref="org.hisp.dhis.caseentry.state.SelectedStateManager" />
-    <property name="programStageSectionService" ref="org.hisp.dhis.program.ProgramStageSectionService" />
-    <property name="organisationUnitService" ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
-  </bean>
+	<bean id="org.hisp.dhis.caseentry.action.caseentry.LoadDataEntryAction"
+		class="org.hisp.dhis.caseentry.action.caseentry.LoadDataEntryAction"
+		scope="prototype">
+		<property name="programDataEntryService"
+			ref="org.hisp.dhis.program.ProgramDataEntryService" />
+		<property name="patientDataValueService"
+			ref="org.hisp.dhis.patientdatavalue.PatientDataValueService" />
+		<property name="programStageService" ref="org.hisp.dhis.program.ProgramStageService" />
+		<property name="programStageInstanceService"
+			ref="org.hisp.dhis.program.ProgramStageInstanceService" />
+		<property name="selectedStateManager"
+			ref="org.hisp.dhis.caseentry.state.SelectedStateManager" />
+		<property name="programStageSectionService"
+			ref="org.hisp.dhis.program.ProgramStageSectionService" />
+		<property name="organisationUnitService"
+			ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
+	</bean>
 
-    <bean id="org.hisp.dhis.caseentry.action.caseentry.CompleteDataEntryAction"
+	<bean
+		id="org.hisp.dhis.caseentry.action.caseentry.CompleteDataEntryAction"
 		class="org.hisp.dhis.caseentry.action.caseentry.CompleteDataEntryAction"
 		scope="prototype">
 		<property name="programStageInstanceService"
@@ -152,19 +165,17 @@
 	<bean id="org.hisp.dhis.caseentry.action.caseentry.MarkForFollowupAction"
 		class="org.hisp.dhis.caseentry.action.caseentry.MarkForFollowupAction"
 		scope="prototype">
-		<property name="programInstanceService"
-			ref="org.hisp.dhis.program.ProgramInstanceService" />
+		<property name="programInstanceService" ref="org.hisp.dhis.program.ProgramInstanceService" />
 	</bean>
-	
-	<bean id="org.hisp.dhis.caseentry.action.caseentry.SaveProgramInstanceCommentAction"
+
+	<bean
+		id="org.hisp.dhis.caseentry.action.caseentry.SaveProgramInstanceCommentAction"
 		class="org.hisp.dhis.caseentry.action.caseentry.SaveProgramInstanceCommentAction"
 		scope="prototype">
-		<property name="programInstanceService"
-			ref="org.hisp.dhis.program.ProgramInstanceService" />
-		<property name="currentUserService"
-			ref="org.hisp.dhis.user.CurrentUserService" />
+		<property name="programInstanceService" ref="org.hisp.dhis.program.ProgramInstanceService" />
+		<property name="currentUserService" ref="org.hisp.dhis.user.CurrentUserService" />
 	</bean>
-	
+
 	<!-- Multi DataEntry -->
 
 	<bean
@@ -186,9 +197,8 @@
 		<property name="selectedStateManager"
 			ref="org.hisp.dhis.caseentry.state.SelectedStateManager" />
 	</bean>
-	
-	<bean
-		id="org.hisp.dhis.caseentry.action.caseentry.GetAllProgramsAction"
+
+	<bean id="org.hisp.dhis.caseentry.action.caseentry.GetAllProgramsAction"
 		class="org.hisp.dhis.caseentry.action.caseentry.GetAllProgramsAction"
 		scope="prototype">
 		<property name="programService" ref="org.hisp.dhis.program.ProgramService" />
@@ -679,7 +689,8 @@
 		scope="prototype">
 		<property name="patientService" ref="org.hisp.dhis.patient.PatientService" />
 		<property name="programInstanceService" ref="org.hisp.dhis.program.ProgramInstanceService" />
-		<property name="programStageInstanceService" ref="org.hisp.dhis.program.ProgramStageInstanceService" />
+		<property name="programStageInstanceService"
+			ref="org.hisp.dhis.program.ProgramStageInstanceService" />
 	</bean>
 
 	<bean id="org.hisp.dhis.caseentry.action.patient.GetProgramAction"
@@ -919,17 +930,10 @@
 		scope="prototype">
 		<property name="tabularReportService"
 			ref="org.hisp.dhis.patientreport.PatientTabularReportService" />
-		<property name="currentUserService" ref="org.hisp.dhis.user.CurrentUserService" />
-		<property name="programStageService" ref="org.hisp.dhis.program.ProgramStageService" />
-		<property name="dataElementService" ref="org.hisp.dhis.dataelement.DataElementService" />
 		<property name="organisationUnitService"
 			ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
-		<property name="identifierTypeService"
-			ref="org.hisp.dhis.patient.PatientIdentifierTypeService" />
-		<property name="patientAttributeService"
-			ref="org.hisp.dhis.patient.PatientAttributeService" />
-		<property name="programStageDataElementService"
-			ref="org.hisp.dhis.program.ProgramStageDataElementService" />
+		<property name="programStageService" ref="org.hisp.dhis.program.ProgramStageService" />
+		<property name="currentUserService" ref="org.hisp.dhis.user.CurrentUserService" />
 	</bean>
 
 	<bean id="org.hisp.dhis.caseentry.action.report.GetTabularReportAction"
@@ -937,6 +941,11 @@
 		scope="prototype">
 		<property name="tabularReportService"
 			ref="org.hisp.dhis.patientreport.PatientTabularReportService" />
+		<property name="dataElementService" ref="org.hisp.dhis.dataelement.DataElementService" />
+		<property name="patientIdentifierTypeService"
+			ref="org.hisp.dhis.patient.PatientIdentifierTypeService" />
+		<property name="patientAttributeService"
+			ref="org.hisp.dhis.patient.PatientAttributeService" />
 	</bean>
 
 	<bean
@@ -1088,7 +1097,8 @@
 		<property name="patientAuditService" ref="org.hisp.dhis.patient.PatientAuditService" />
 		<property name="currentUserService" ref="org.hisp.dhis.user.CurrentUserService" />
 		<property name="programService" ref="org.hisp.dhis.program.ProgramService" />
-		<property name="programIndicatorService" ref="org.hisp.dhis.program.ProgramIndicatorService" />
+		<property name="programIndicatorService"
+			ref="org.hisp.dhis.program.ProgramIndicatorService" />
 	</bean>
 
 	<bean
@@ -1118,33 +1128,41 @@
 			ref="org.hisp.dhis.program.ProgramStageInstanceService" />
 	</bean>
 
-  <bean id="org.hisp.dhis.caseentry.action.caseentry.GetProgramStageInstanceAction"
-    class="org.hisp.dhis.caseentry.action.caseentry.GetProgramStageInstanceAction"
-    scope="prototype">
-    <property name="programStageInstanceService" ref="org.hisp.dhis.program.ProgramStageInstanceService" />
-    <property name="currentUserService" ref="org.hisp.dhis.user.CurrentUserService" />
-    <property name="patientDataValueService" ref="org.hisp.dhis.patientdatavalue.PatientDataValueService" />
-  </bean>
-  
-  <!-- Program-stage-completeness -->
-  
-  <bean id="org.hisp.dhis.caseentry.action.caseentry.ProgramStageInstanceCompletenessAction"
-    class="org.hisp.dhis.caseentry.action.caseentry.ProgramStageInstanceCompletenessAction"
-    scope="prototype">
-    <property name="selectionManager" ref="org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager" />
-    <property name="programService" ref="org.hisp.dhis.program.ProgramService" />
-    <property name="programStageInstanceService" ref="org.hisp.dhis.program.ProgramStageInstanceService" />
-  </bean>
-
-  <bean id="org.hisp.dhis.caseentry.action.caseentry.UploadAnonymousEventAction"
-    class="org.hisp.dhis.caseentry.action.caseentry.UploadAnonymousEventAction" scope="prototype">
-  </bean>
-
-  <bean id="org.hisp.dhis.caseentry.action.GetOptionSetAction"
-    class="org.hisp.dhis.caseentry.action.GetOptionSetAction" scope="prototype">
-  </bean>
-
-  <bean id="org.hisp.dhis.caseentry.action.GetUsernamesAction"
-    class="org.hisp.dhis.caseentry.action.GetUsernamesAction" scope="prototype">
-  </bean>
+	<bean
+		id="org.hisp.dhis.caseentry.action.caseentry.GetProgramStageInstanceAction"
+		class="org.hisp.dhis.caseentry.action.caseentry.GetProgramStageInstanceAction"
+		scope="prototype">
+		<property name="programStageInstanceService"
+			ref="org.hisp.dhis.program.ProgramStageInstanceService" />
+		<property name="currentUserService" ref="org.hisp.dhis.user.CurrentUserService" />
+		<property name="patientDataValueService"
+			ref="org.hisp.dhis.patientdatavalue.PatientDataValueService" />
+	</bean>
+
+	<!-- Program-stage-completeness -->
+
+	<bean
+		id="org.hisp.dhis.caseentry.action.caseentry.ProgramStageInstanceCompletenessAction"
+		class="org.hisp.dhis.caseentry.action.caseentry.ProgramStageInstanceCompletenessAction"
+		scope="prototype">
+		<property name="selectionManager"
+			ref="org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager" />
+		<property name="programService" ref="org.hisp.dhis.program.ProgramService" />
+		<property name="programStageInstanceService"
+			ref="org.hisp.dhis.program.ProgramStageInstanceService" />
+	</bean>
+
+	<bean
+		id="org.hisp.dhis.caseentry.action.caseentry.UploadAnonymousEventAction"
+		class="org.hisp.dhis.caseentry.action.caseentry.UploadAnonymousEventAction"
+		scope="prototype">
+	</bean>
+
+	<bean id="org.hisp.dhis.caseentry.action.GetOptionSetAction"
+		class="org.hisp.dhis.caseentry.action.GetOptionSetAction" scope="prototype">
+	</bean>
+
+	<bean id="org.hisp.dhis.caseentry.action.GetUsernamesAction"
+		class="org.hisp.dhis.caseentry.action.GetUsernamesAction" scope="prototype">
+	</bean>
 </beans>

=== 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-18 07:02:39 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/app.js	2013-05-19 08:24:25 +0000
@@ -415,7 +415,7 @@
 					ms[i].setHeight(panel.getHeight() - 49);
 				}
 			},
-			addFilterField: function( p, id, name, valueType ){
+			addFilterField: function( p, id, name, valueType, filterValue ){
 				var panelid = p + '_' + id;
 				var idx = 0;
 				var subPanel = Ext.getCmp(panelid);
@@ -446,8 +446,17 @@
 					text:name,
 					width:(TR.conf.layout.west_fieldset_width - TR.conf.layout.west_width_subtractor) / 2 - 60
 				};
-				items[1] = this.createOperatorField(valueType, fieldid);
-				items[2] = this.createFilterField( valueType, fieldid );
+				
+				var opt = "";
+				var filter = "";
+				if( filterValue!=undefined && filterValue != "" )
+				{
+					var arrFilter = filterValue.split("_");
+					opt = arrFilter[0];
+					filter = arrFilter[1];
+				}
+				items[1] = this.createOperatorField(valueType, fieldid, opt);
+				items[2] = this.createFilterField(valueType, fieldid, filter);
 				if( idx == 0 ){
 					items[3] = this.addFieldBtn( p, id, name, valueType, idx );
 				}
@@ -462,7 +471,7 @@
 				var e1 = Ext.getCmp( p + '_' + id );
 				Ext.getCmp(p).remove(e1);
 			},
-			createOperatorField: function( valueType, id ){
+			createOperatorField: function( valueType, id, filterOperator ){
 				var params = {};
 				params.xtype = 'combobox';
 				params.id = 'filter_opt_' + id;
@@ -471,7 +480,14 @@
 				params.valueField = 'value';
 				params.displayField = 'name';
 				params.editable = false;
-				params.value = '=';
+				if( filterOperator != undefined || filterOperator!= '')
+				{
+					params.value = filterOperator;
+				}
+				else
+				{
+					params.value = '=';
+				}
 				
 				if(valueType == 'string' || valueType == 'list' || valueType == 'username' ){
 					var fixedId = id.substring(0, id.lastIndexOf('_') );
@@ -527,7 +543,7 @@
 				
 				return params;
 			},
-			createFilterField: function( valueType, id ){
+			createFilterField: function( valueType, id, filterValue ){
 				var params = {};
 				var xtype = TR.value.covertXType(valueType);
 				params.xtype = xtype;
@@ -642,7 +658,14 @@
 						});
 					}					
 				}
-				params.value = '';
+				if( filterValue != undefined )
+				{
+					params.value = filterValue;
+				}
+				else
+				{
+					params.value = '';
+				}
 				return params;
 			},
 			addFieldBtn: function( p, id, name, valueType, idx ){
@@ -1091,8 +1114,9 @@
 									 for (var i = 0; i < f.patientProperties.length; i++) {
 										var name = TR.util.string.getEncodedString(f.patientProperties[i].name);
 										TR.cmp.params.patientProperty.objects.push({id: f.patientProperties[i].id, name: name});
-										TR.util.multiselect.addFilterField( 'filterPropPanel', f.patientProperties[i].id, name, f.patientProperties[i].valueType );
+										TR.util.multiselect.addFilterField( 'filterPropPanel', f.patientProperties[i].id, name, f.patientProperties[i].valueType, f.patientProperties[i].filter );
 									 }
+
 									 TR.store.patientProperty.selected.add(TR.cmp.params.patientProperty.objects);
 							 
 									 var storePatientProperty = TR.store.patientProperty.available;
@@ -1119,7 +1143,7 @@
 										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.util.multiselect.addFilterField( 'filterPanel', f.dataElements[i].id, name, 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);
 									
@@ -1138,15 +1162,24 @@
 								}
 								
 								// Program stage									
+								
 								var storeProgramStage = TR.store.programStage;
 								storeProgramStage.parent = f.programStageId;
 								storeProgramStage.isLoadFromFavorite = true;
-								storeProgramStage.load({params: {programId: f.programId}});
 								
-								Ext.getCmp('programStageCombobox').setValue( f.programStageId );
 								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();
+								
 							}
 						});
 					}				
@@ -1830,7 +1863,7 @@
 				}
 				
 				// Get searching values
-				p.searchingValues = [];
+				p.filterValues = [];
 				
 				// Patient properties
 				
@@ -1860,7 +1893,7 @@
 						var filter = propId + '_' + hidden 
 						if( filterValue!=null && filterValue!=''){
 							var filterOpt = Ext.getCmp('filter_opt_' + id).rawValue;
-							filter += '_' + filterOpt + ' ';
+							filter += '_' + filterOpt + '_';
 							if( filterOpt == 'IN' )
 							{
 								var filterValues = filterValue.split(";");
@@ -1876,7 +1909,7 @@
 								filter += "'" + filterValue + "'";
 							}
 						}
-						p.searchingValues.push( filter );
+						p.filterValues.push( filter );
 					}
 				});
 				
@@ -1893,13 +1926,12 @@
 						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();
-							filter += filterOpt + ' ';
-							if( Ext.getCmp('filter_' + id).getValue()!=null 
-								&& Ext.getCmp('filter_' + id).getValue()!='')
+							filter += filterOpt + '_';
+							if( filterOpt == 'IN' )
 							{
 								var filterValues = filterValue.split(";");
 								filter +="(";
@@ -1914,7 +1946,7 @@
 								filter += "'" + Ext.getCmp('filter_' + id).getValue() + "'";
 							}
 						}
-						p.searchingValues.push( filter );
+						p.filterValues.push( filter );
 					}
 				});
 					
@@ -1941,8 +1973,8 @@
 				
 				// Get searching values
 				
-				var searchingValues = document.getElementById('searchingValues');
-				TR.util.list.clearList(searchingValues);				
+				var filterValues = document.getElementById('filterValues');
+				TR.util.list.clearList(filterValues);				
 				
 				// Patient properties
 				
@@ -1975,7 +2007,7 @@
 								filter += "'" + filterValue + "'";
 							}
 						}
-						TR.util.list.addOptionToList(searchingValues, filter, '');
+						TR.util.list.addOptionToList(filterValues, filter, '');
 					}
 				});
 				
@@ -2015,7 +2047,7 @@
 								filter += "'" + Ext.getCmp('filter_' + id).getValue() + "'";
 							}
 						}
-						TR.util.list.addOptionToList(searchingValues, filter, '');
+						TR.util.list.addOptionToList(filterValues, filter, '');
 					}
 				});
 			},

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/index.html'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/index.html	2013-03-15 07:28:55 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/index.html	2013-05-19 08:24:25 +0000
@@ -27,7 +27,7 @@
 		<input type="hidden" id="level" name="level" >
 		<input type="hidden" id="orderByOrgunitAsc" name="orderByOrgunitAsc" >
 		<input type="hidden" id="orderByExecutionDateByAsc" name="orderByExecutionDateByAsc" >
-		<select multiple id="searchingValues" name="searchingValues" class="hidden"></select>
+		<select multiple id="filterValues" name="filterValues" class="hidden"></select>
     </form>
 	
     <script type="text/javascript">TR = {};</script>

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonTabularInitialize.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonTabularInitialize.vm	2013-05-05 16:56:00 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonTabularInitialize.vm	2013-05-19 08:24:25 +0000
@@ -2,6 +2,7 @@
 	"user":
 	{
 		"id":"$!currentUser.id",
+		"accessPatientAttributes":$auth.hasAccess( "dhis-web-caseentry", "accessPatientAttributes" ),
 		"isAdmin":$!currentUser.userCredentials.isSuper(),
 		"ous":[
 			#foreach( $orgunit in $currentUser.organisationUnits )

=== 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-02-28 04:34:35 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonTabularReport.vm	2013-05-19 08:24:25 +0000
@@ -16,6 +16,17 @@
 	"type": "${programStage.program.type}",
 	"programStageId": "${programStage.id}",
 	"programStageName": "$!encoder.jsonEncode( ${programStage.displayName} )",
+	"programStages": [
+		#set( $programStages = $programStage.program.programStages )
+		#set( $size = $programStages.size() )
+		#foreach( ${programStage} in $!{programStages} )
+			{
+				"id": "$programStage.id",
+				"name": "$programStage.name"
+			}
+			#if( $velocityCount < $size ),#end
+		#end
+	],
 	"startDate": "$!format.formatDate( $tabularReport.startDate )",
 	"endDate": "$!format.formatDate( ${tabularReport.endDate} )",
 	"level": "${tabularReport.level}",
@@ -37,46 +48,57 @@
 		#end
 	],
 	"patientProperties": [
-		#set( $fixedAttributes = ${tabularReport.fixedAttributes} )
-		#foreach( ${fixedAttribute} in $!{fixedAttributes} )
+		#set($idx=0)
+		#foreach( ${fixedAttribute} in $!{selectedFixedAttributes} )
 			{	
 				#set( $attr = $i18n.getString($fixedAttribute) )
 				"id": "fixedAttr_${fixedAttribute}",
-				"name": "$attr"
+				"name": "$attr",
+				"filter": "$fixedAttributeFilters.get($idx)"
 			},
+			#set($idx=$idx+1)
 		#end
-		#set( $identifiers = ${tabularReport.identifiers} )
-		#foreach( ${identifier} in $!{identifiers} )
+		
+		#set($idx=0)
+		#set( $size = ${selectedIdentifierTypes.size()} )		
+		#foreach( ${identifier} in $!{selectedIdentifierTypes} )
 			{
 				"id": "iden_${identifier.id}",
-				"name": "${identifier.displayName}"
-			},
+				"name": "${identifier.displayName}",
+				"filter": "$identifierTypeFilters.get($idx)"
+			}#if( $velocityCount < $size ),#end
+			#set($idx=$idx+1)
 		#end
-		#set( $size = ${tabularReport.attributes.size()} )
-		#set( $attributes = ${tabularReport.attributes} )
-		#foreach( ${attribute} in $!{attributes} )
+		
+		#set($idx=0)
+		#set( $size = ${selectedAttributes.size()} )		
+		#foreach( ${attribute} in $!{selectedAttributes} )
 			{
 				"id": "attr_${attribute.id}",
-				"name": "${attribute.displayName}"
+				"name": "${attribute.displayName}",
+				"filter": "$patientAttributeFilters.get($idx)"
 			}
 			#if( $velocityCount < $size ),#end
+			#set($idx=$idx+1)
 		#end
 	],
 	"dataElements": [
-		#set( $size = ${tabularReport.programStageDataElements.size()} )
-		#set( $programStageDataElements = ${tabularReport.programStageDataElements} )
-		#foreach( ${programStageDataElement} in $!{programStageDataElements} )
+		#set($idx=0)
+		#set( $size = ${selectedDataElements.size()} )
+		#foreach( ${dataElement} in $!{selectedDataElements} )
 			{
-				"id": "de_${programStageDataElement.dataElement.id}",
-				"name": "${programStageDataElement.dataElement.name}",
-				"compulsory": "${programStageDataElement.compulsory}",
-				"valueType": #if( $programStageDataElement.dataElement.optionSet )
+				"id": "de_${dataElement.id}",
+				"name": "${dataElement.name}",
+				"compulsory": "",
+				"valueType": #if( $dataElement.optionSet )
 								"list"
 							 #else
-								"${programStageDataElement.dataElement.type}"
-							 #end
+								"${dataElement.type}"
+							 #end,
+				"filter": "$dataelementFilters.get($idx)"
 			}
 			#if( $velocityCount < $size ),#end
+			#set($idx=$idx+1)
 		#end
 	]
 }
\ No newline at end of file