← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 12528: Remove the dobType option in design registation form. When to load this registration form, the sy...

 

------------------------------------------------------------
revno: 12528
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2013-10-09 18:26:54 +0700
message:
  Remove the dobType option in design registation form. When to load this registration form, the system will check if there are both birthdate and age, then put dobType field in previous birthdate/age field; fix bug in anonymous program.
added:
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/GenerateTabularReportAction.java
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientRegistrationFormService.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientreport/PatientTabularReport.java
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientRegistrationFormService.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/resources/struts.xml
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/viewPatientRegistationForm.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/patient/PatientRegistrationFormService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientRegistrationFormService.java	2013-09-27 11:10:25 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientRegistrationFormService.java	2013-10-09 11:26:54 +0000
@@ -62,6 +62,8 @@
     final Pattern SUGGESTED_VALUE_PATTERN = Pattern.compile( "suggested=('|\")(\\w*)('|\")" );
     
     final Pattern CLASS_PATTERN = Pattern.compile( "class='(\\w*)'" );
+    
+    final Pattern STYLE_PATTERN = Pattern.compile( "style=\"([\\w|\\d\\:\\;]+)\"" );
 
     // --------------------------------------------------------------------------
     // ProgramDataEntryService

=== 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-10-08 03:23:55 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientreport/PatientTabularReport.java	2013-10-09 11:26:54 +0000
@@ -61,6 +61,12 @@
 
     public static String AGGREGATE_REPORT = "aggregateReport";
 
+    public static String PREFIX_DATA_ELEMENT = "de";
+
+    public static String VALUE_TYPE_OPTION_SET = "optionSet";
+
+    public static String PREFIX_NUMBER_DATA_ELEMENT = "numberDe";
+
     private Program program;
 
     private ProgramStage programStage;

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientRegistrationFormService.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientRegistrationFormService.java	2013-09-27 11:10:25 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientRegistrationFormService.java	2013-10-09 11:26:54 +0000
@@ -59,6 +59,8 @@
 
     private static final String PROGRAM_ENROLLMENT_DATE = "enrollmentDate";
 
+    private static final String DOB_FIELD = "@DOB_FIELD";
+
     // -------------------------------------------------------------------------
     // Dependencies
     // -------------------------------------------------------------------------
@@ -154,6 +156,9 @@
 
         Matcher inputMatcher = INPUT_PATTERN.matcher( htmlCode );
 
+        boolean hasBirthdate = false;
+        boolean hasAge = false;
+
         while ( inputMatcher.find() )
         {
             // -----------------------------------------------------------------
@@ -166,9 +171,22 @@
             Matcher dynamicAttrMatcher = DYNAMIC_ATTRIBUTE_PATTERN.matcher( inputHtml );
             Matcher programMatcher = PROGRAM_PATTERN.matcher( inputHtml );
             Matcher suggestedMarcher = SUGGESTED_VALUE_PATTERN.matcher( inputHtml );
+
+            index++;
+
+            String hidden = "";
+            String style = "";
             Matcher classMarcher = CLASS_PATTERN.matcher( inputHtml );
+            if ( classMarcher.find() )
+            {
+                hidden = classMarcher.group( 1 );
+            }
 
-            index++;
+            Matcher styleMarcher = STYLE_PATTERN.matcher( inputHtml );
+            if ( styleMarcher.find() )
+            {
+                style = styleMarcher.group( 1 );
+            }
 
             if ( fixedAttrMatcher.find() && fixedAttrMatcher.groupCount() > 0 )
             {
@@ -176,7 +194,6 @@
 
                 // Get value
                 String value = "";
-                String hidden = "";
                 if ( patient != null )
                 {
                     Object object = getValueFromPatient( fixedAttr, patient );
@@ -201,13 +218,20 @@
                     value = suggestedMarcher.group( 2 );
                 }
 
-                if ( classMarcher.find() )
-                {
-                    hidden = classMarcher.group( 1 );
+                String dobType = "";
+                if ( fixedAttr.equals( PatientRegistrationForm.FIXED_ATTRIBUTE_BIRTHDATE ) )
+                {
+                    hasBirthdate = true;
+                    dobType = DOB_FIELD;
+                }
+                else if ( fixedAttr.equals( PatientRegistrationForm.FIXED_ATTRIBUTE_AGE ) )
+                {
+                    hasAge = true;
+                    dobType = DOB_FIELD;
                 }
 
-                inputHtml = getFixedAttributeField( inputHtml, fixedAttr, value.toString(), hidden, healthWorkers,
-                    i18n, index );
+                inputHtml = dobType + getFixedAttributeField( inputHtml, fixedAttr, value.toString(), healthWorkers, i18n,
+                    index, hidden, style );
             }
             else if ( identifierMatcher.find() && identifierMatcher.groupCount() > 0 )
             {
@@ -235,9 +259,9 @@
                     }
 
                     inputHtml = "<input id=\"iden" + id + "\" name=\"iden" + id + "\" tabindex=\"" + index
-                        + "\" value=\"" + value + "\" ";
+                        + "\" value=\"" + value + "\" style=\"" + style + "\"";
 
-                    inputHtml += "class=\"{validate:{required:" + identifierType.isMandatory() + ",";
+                    inputHtml += "class=\"" + hidden + " {validate:{required:" + identifierType.isMandatory() + ",";
                     if ( identifierType.getNoChars() != null )
                     {
                         inputHtml += "maxlength:" + identifierType.getNoChars() + ",";
@@ -278,7 +302,7 @@
                         }
                     }
 
-                    inputHtml = getAttributeField( inputHtml, attribute, value, i18n, index );
+                    inputHtml = getAttributeField( inputHtml, attribute, value, i18n, index, hidden, style );
                 }
 
             }
@@ -325,19 +349,42 @@
 
         inputMatcher.appendTail( sb );
 
-        return sb.toString();
+        String entryForm = sb.toString();
+        String dobType = "";
+        if ( hasBirthdate && hasAge )
+        {
+            dobType = "<select id=\'dobType\' name=\"dobType\" style=\'width:120px\' onchange=\'dobTypeOnChange(\"patientForm\")\' >";
+            dobType += "     <option value=\"V\" >" + i18n.getString( "verified" ) + "</option>";
+            dobType += "     <option value=\"D\" >" + i18n.getString( "declared" ) + "</option>";
+            dobType += "     <option value=\"A\" >" + i18n.getString( "approximated" ) + "</option>";
+            dobType += "</select>";
+        }
+        else if ( hasBirthdate )
+        {
+            dobType = "<input type=\'hidden\' id=\'dobType\' name=\"dobType\" value=\'V\'>";
+        }
+        else if ( hasAge )
+        {
+            dobType = "<input type=\'hidden\' id=\'dobType\' name=\"dobType\" value=\'A\'>";
+        }
+        
+        entryForm = entryForm.replaceFirst( DOB_FIELD, dobType );
+        entryForm = entryForm.replaceAll( DOB_FIELD, "" );
+
+        return entryForm;
     }
 
     // -------------------------------------------------------------------------
     // Supportive methods
     // -------------------------------------------------------------------------
 
-    private String getAttributeField( String inputHtml, PatientAttribute attribute, String value, I18n i18n, int index )
+    private String getAttributeField( String inputHtml, PatientAttribute attribute, String value, I18n i18n, int index,
+        String hidden, String style )
     {
         inputHtml = TAG_OPEN + "input id=\"attr" + attribute.getId() + "\" name=\"attr" + attribute.getId()
-            + "\" tabindex=\"" + index + "\" ";
+            + "\" tabindex=\"" + index + "\" style=\"" + style + "\"";
 
-        inputHtml += "\" class=\"{validate:{required:" + attribute.isMandatory();
+        inputHtml += "\" class=\"" + hidden + " {validate:{required:" + attribute.isMandatory();
         if ( PatientAttribute.TYPE_INT.equals( attribute.getValueType() ) )
         {
             inputHtml += ",number:true";
@@ -405,11 +452,12 @@
         return inputHtml;
     }
 
-    private String getFixedAttributeField( String inputHtml, String fixedAttr, String value, String hidden,
-        Collection<User> healthWorkers, I18n i18n, int index )
+    private String getFixedAttributeField( String inputHtml, String fixedAttr, String value,
+        Collection<User> healthWorkers, I18n i18n, int index, String hidden, String style )
     {
+       
         inputHtml = TAG_OPEN + "input id=\"" + fixedAttr + "\" name=\"" + fixedAttr + "\" tabindex=\"" + index
-            + "\" value=\"" + value + "\" ";
+            + "\" value=\"" + value + "\"  style=\"" + style + "\"";
 
         // Fullname fields
         if ( fixedAttr.equals( PatientRegistrationForm.FIXED_ATTRIBUTE_FULLNAME ) )

=== added 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	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/GenerateTabularReportAction.java	2013-10-09 11:26:54 +0000
@@ -0,0 +1,539 @@
+/*
+ * 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.caseentry.action.report;
+
+import static org.hisp.dhis.patientreport.PatientTabularReport.PREFIX_DATA_ELEMENT;
+import static org.hisp.dhis.patientreport.PatientTabularReport.PREFIX_NUMBER_DATA_ELEMENT;
+import static org.hisp.dhis.patientreport.PatientTabularReport.VALUE_TYPE_OPTION_SET;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.hibernate.exception.SQLGrammarException;
+import org.hisp.dhis.common.Grid;
+import org.hisp.dhis.dataelement.DataElement;
+import org.hisp.dhis.dataelement.DataElementService;
+import org.hisp.dhis.i18n.I18n;
+import org.hisp.dhis.i18n.I18nFormat;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.organisationunit.OrganisationUnitService;
+import org.hisp.dhis.paging.ActionPagingSupport;
+import org.hisp.dhis.patient.PatientAttribute;
+import org.hisp.dhis.patient.PatientIdentifierType;
+import org.hisp.dhis.patientreport.TabularReportColumn;
+import org.hisp.dhis.program.ProgramStage;
+import org.hisp.dhis.program.ProgramStageInstance;
+import org.hisp.dhis.program.ProgramStageInstanceService;
+import org.hisp.dhis.program.ProgramStageService;
+import org.hisp.dhis.system.util.TextUtils;
+import org.hisp.dhis.user.CurrentUserService;
+
+/**
+ * @author Chau Thu Tran
+ * @version $GenerateTabularReportAction.java Feb 29, 2012 10:15:05 AM$
+ */
+public class GenerateTabularReportAction
+    extends ActionPagingSupport<ProgramStageInstance>
+{
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
+
+    private OrganisationUnitService organisationUnitService;
+
+    public void setOrganisationUnitService( OrganisationUnitService organisationUnitService )
+    {
+        this.organisationUnitService = organisationUnitService;
+    }
+
+    private ProgramStageService programStageService;
+
+    public void setProgramStageService( ProgramStageService programStageService )
+    {
+        this.programStageService = programStageService;
+    }
+
+    private DataElementService dataElementService;
+
+    public void setDataElementService( DataElementService dataElementService )
+    {
+        this.dataElementService = dataElementService;
+    }
+
+    private ProgramStageInstanceService programStageInstanceService;
+
+    public void setProgramStageInstanceService( ProgramStageInstanceService programStageInstanceService )
+    {
+        this.programStageInstanceService = programStageInstanceService;
+    }
+
+    private CurrentUserService currentUserService;
+
+    public void setCurrentUserService( CurrentUserService currentUserService )
+    {
+        this.currentUserService = currentUserService;
+    }
+
+    // -------------------------------------------------------------------------
+    // Input/Output
+    // -------------------------------------------------------------------------
+
+    private List<PatientIdentifierType> identifierTypes = new ArrayList<PatientIdentifierType>();
+
+    public List<PatientIdentifierType> getIdentifierTypes()
+    {
+        return identifierTypes;
+    }
+
+    private Boolean anonynousEntryForm;
+
+    public void setAnonynousEntryForm( Boolean anonynousEntryForm )
+    {
+        this.anonynousEntryForm = anonynousEntryForm;
+    }
+
+    private List<PatientAttribute> patientAttributes = new ArrayList<PatientAttribute>();
+
+    public List<PatientAttribute> getPatientAttributes()
+    {
+        return patientAttributes;
+    }
+
+    private Collection<Integer> orgunitIds = new HashSet<Integer>();
+
+    public void setOrgunitIds( Collection<Integer> orgunitIds )
+    {
+        this.orgunitIds = orgunitIds;
+    }
+
+    private Integer programStageId;
+
+    public void setProgramStageId( Integer programStageId )
+    {
+        this.programStageId = programStageId;
+    }
+
+    private String startDate;
+
+    public void setStartDate( String startDate )
+    {
+        this.startDate = startDate;
+    }
+
+    private String endDate;
+
+    public void setEndDate( String endDate )
+    {
+        this.endDate = endDate;
+    }
+
+    private List<String> values = new ArrayList<String>();
+
+    public List<String> getValues()
+    {
+        return values;
+    }
+
+    private List<String> filterValues = new ArrayList<String>();
+
+    public void setFilterValues( List<String> filterValues )
+    {
+        this.filterValues = filterValues;
+    }
+
+    private boolean orderByOrgunitAsc;
+
+    public void setOrderByOrgunitAsc( boolean orderByOrgunitAsc )
+    {
+        this.orderByOrgunitAsc = orderByOrgunitAsc;
+    }
+
+    private Integer level;
+
+    public void setLevel( Integer level )
+    {
+        this.level = level;
+    }
+
+    private Boolean userOrganisationUnit;
+
+    public void setUserOrganisationUnit( Boolean userOrganisationUnit )
+    {
+        this.userOrganisationUnit = userOrganisationUnit;
+    }
+
+    private Boolean userOrganisationUnitChildren;
+
+    public void setUserOrganisationUnitChildren( Boolean userOrganisationUnitChildren )
+    {
+        this.userOrganisationUnitChildren = userOrganisationUnitChildren;
+    }
+
+	private Integer pageSize;
+  
+    public void setPageSize( Integer pageSize )
+    {
+         this.pageSize = pageSize;
+    }
+ 
+    private Grid grid;
+
+    public Grid getGrid()
+    {
+        return grid;
+    }
+
+    private int totalRecords;
+
+    public int getTotalRecords()
+    {
+        return totalRecords;
+    }
+
+    private Integer total;
+	
+    public void setTotal( Integer total )
+    {
+        this.total = total;
+    }
+
+    public Integer getTotal()
+    {
+        return total;
+    }
+
+    private I18n i18n;
+
+    public void setI18n( I18n i18n )
+    {
+        this.i18n = i18n;
+    }
+
+    private I18nFormat format;
+
+    public void setFormat( I18nFormat format )
+    {
+        this.format = format;
+    }
+
+    private Boolean useCompletedEvents;
+
+    public void setUseCompletedEvents( Boolean useCompletedEvents )
+    {
+        this.useCompletedEvents = useCompletedEvents;
+    }
+
+    private List<DataElement> dataElements = new ArrayList<DataElement>();
+
+    public List<DataElement> getDataElements()
+    {
+        return dataElements;
+    }
+
+    private String type;
+
+    public void setType( String type )
+    {
+        this.type = type;
+    }
+
+    private String facilityLB; // All, children, current
+
+    public void setFacilityLB( String facilityLB )
+    {
+        this.facilityLB = facilityLB;
+    }
+
+    private List<String> valueTypes = new ArrayList<String>();
+
+    public List<String> getValueTypes()
+    {
+        return valueTypes;
+    }
+
+    private Map<Integer, List<String>> mapSuggestedValues = new HashMap<Integer, List<String>>();
+
+    public Map<Integer, List<String>> getMapSuggestedValues()
+    {
+        return mapSuggestedValues;
+    }
+
+    private String message;
+
+    public String getMessage()
+    {
+        return message;
+    }
+
+    private Boolean displayOrgunitCode;
+
+    public void setDisplayOrgunitCode( Boolean displayOrgunitCode )
+    {
+        this.displayOrgunitCode = displayOrgunitCode;
+    }
+
+    private Boolean useFormNameDataElement;
+
+    public void setUseFormNameDataElement( Boolean useFormNameDataElement )
+    {
+        this.useFormNameDataElement = useFormNameDataElement;
+    }
+
+    private boolean accessPrivateInfo = false;
+
+    // -------------------------------------------------------------------------
+    // Implementation Action
+    // -------------------------------------------------------------------------
+
+    public String execute()
+        throws Exception
+    {
+        if ( programStageId == null )
+        {
+            return INPUT;
+        }
+
+        // ---------------------------------------------------------------------
+        // Get user orgunits
+        // ---------------------------------------------------------------------
+
+        if ( userOrganisationUnit || userOrganisationUnitChildren )
+        {
+            Collection<OrganisationUnit> userOrgunits = currentUserService.getCurrentUser().getOrganisationUnits();
+            orgunitIds = new HashSet<Integer>();
+
+            if ( userOrganisationUnit )
+            {
+                for ( OrganisationUnit userOrgunit : userOrgunits )
+                {
+                    orgunitIds.add( userOrgunit.getId() );
+                }
+            }
+
+            if ( userOrganisationUnitChildren )
+            {
+                for ( OrganisationUnit userOrgunit : userOrgunits )
+                {
+                    if ( userOrgunit.hasChild() )
+                    {
+                        for ( OrganisationUnit childOrgunit : userOrgunit.getSortedChildren() )
+                        {
+                            orgunitIds.add( childOrgunit.getId() );
+                        }
+                    }
+                }
+            }
+        }
+
+        // ---------------------------------------------------------------------
+        // Get orgunitIds
+        // ---------------------------------------------------------------------
+
+        Set<Integer> organisationUnits = new HashSet<Integer>();
+
+        if ( facilityLB.equals( "selected" ) )
+        {
+            organisationUnits.addAll( orgunitIds );
+        }
+        else if ( facilityLB.equals( "childrenOnly" ) )
+        {
+            for ( Integer orgunitId : orgunitIds )
+            {
+                OrganisationUnit selectedOrgunit = organisationUnitService.getOrganisationUnit( orgunitId );
+                organisationUnits.addAll( organisationUnitService.getOrganisationUnitHierarchy()
+                    .getChildren( orgunitId ) );
+                organisationUnits.remove( selectedOrgunit );
+            }
+        }
+        else
+        {
+            for ( Integer orgunitId : orgunitIds )
+            {
+                organisationUnits.addAll( organisationUnitService.getOrganisationUnitHierarchy()
+                    .getChildren( orgunitId ) );
+            }
+        }
+
+        // ---------------------------------------------------------------------
+        // Get program-stage, start-date, end-date
+        // ---------------------------------------------------------------------
+
+        if ( level == 0 )
+        {
+            level = organisationUnitService.getMaxOfOrganisationUnitLevels();
+        }
+
+        // ---------------------------------------------------------------------
+        // Get program-stage, start-date, end-date
+        // ---------------------------------------------------------------------
+
+        ProgramStage programStage = programStageService.getProgramStage( programStageId );
+        Date startValue = format.parseDate( startDate );
+        Date endValue = format.parseDate( endDate );
+        List<TabularReportColumn> columns = getTableColumns();
+
+        // ---------------------------------------------------------------------
+        // Generate tabular report
+        // ---------------------------------------------------------------------
+        try
+        {
+            if ( type == null ) // Tabular report
+            {
+                totalRecords = programStageInstanceService.getTabularReportCount( anonynousEntryForm, programStage,
+                    columns, organisationUnits, level, useCompletedEvents, startValue, endValue );
+
+                total = getNumberOfPages( totalRecords );
+
+                this.paging = createPaging( totalRecords );
+
+                grid = programStageInstanceService.getTabularReport( anonynousEntryForm, programStage, columns,
+                    organisationUnits, level, startValue, endValue, !orderByOrgunitAsc, useCompletedEvents,
+                    accessPrivateInfo, displayOrgunitCode, paging.getStartPos(), paging.getPageSize(), i18n );
+            }
+            // Download as Excel
+            else
+            {
+                grid = programStageInstanceService.getTabularReport( anonynousEntryForm, programStage, columns,
+                    organisationUnits, level, startValue, endValue, !orderByOrgunitAsc, useCompletedEvents,
+                    accessPrivateInfo, displayOrgunitCode, null, null, i18n );
+            }
+        }
+        catch ( SQLGrammarException ex )
+        {
+            message = i18n.getString( "failed_to_get_events" );
+        }
+
+        return type == null ? SUCCESS : type;
+    }
+
+    // -------------------------------------------------------------------------
+    // Supportive methods
+    // -------------------------------------------------------------------------
+
+    private int getNumberOfPages( int totalRecord )
+    {
+        int size = ( pageSize != null ) ? pageSize : this.getDefaultPageSize();
+        return (totalRecord % size == 0) ? (totalRecord / size) : (totalRecord / size + 1);
+    }
+
+    public int getStartPos()
+    {
+        if ( currentPage == null )
+        {
+            return paging.getStartPos();
+        }
+        int startPos = currentPage <= 0 ? 0 : (currentPage - 1) * paging.getPageSize();
+        startPos = (startPos > total) ? total : startPos;
+        return startPos;
+    }
+
+    private List<TabularReportColumn> getTableColumns()
+    {
+        List<TabularReportColumn> columns = new ArrayList<TabularReportColumn>();
+
+        int index = 0;
+
+        for ( String filterValue : filterValues )
+        {
+            String[] values = filterValue.split( "_" );
+
+            if ( values != null && values.length >= 3 )
+            {
+                String prefix = values[0];
+
+                TabularReportColumn column = new TabularReportColumn();
+                column.setPrefix( prefix );
+                column.setIdentifier( values[1] );
+                column.setHidden( Boolean.parseBoolean( values[2] ) );
+
+                column.setOperator( values.length > 3 ? TextUtils.lower( values[3] ) : TextUtils.EMPTY);
+                column.setQuery( values.length > 4 ? TextUtils.lower( values[4] ) : TextUtils.EMPTY );
+				
+               if ( PREFIX_DATA_ELEMENT.equals( prefix ) )
+                {
+                    int objectId = Integer.parseInt( values[1] );
+                    DataElement dataElement = dataElementService.getDataElement( objectId );
+                    if ( dataElement.getType().equals( DataElement.VALUE_TYPE_INT ) )
+                    {
+                        column.setPrefix( PREFIX_NUMBER_DATA_ELEMENT );
+                    }
+                    dataElements.add( dataElement );
+
+                    String valueType = dataElement.getOptionSet() != null ? VALUE_TYPE_OPTION_SET : dataElement
+                        .getType();
+                    valueTypes.add( valueType );
+                    mapSuggestedValues.put( index, getSuggestedDataElementValues( dataElement ) );
+                    if ( dataElement.getType().equals( DataElement.VALUE_TYPE_DATE ) )
+                    {
+                        column.setDateType( true );
+                    }
+                    
+                    if ( useFormNameDataElement != null && useFormNameDataElement )
+                    {
+                        column.setName( dataElement.getFormNameFallback() );
+                    }
+                    else
+                    {
+                        column.setName( dataElement.getDisplayName() );  
+                    }
+                }
+
+                columns.add( column );
+
+                index++;
+            }
+        }
+
+        return columns;
+    }
+    
+    private List<String> getSuggestedDataElementValues( DataElement dataElement )
+    {
+        List<String> values = new ArrayList<String>();
+        String valueType = dataElement.getType();
+
+        if ( valueType.equals( DataElement.VALUE_TYPE_BOOL ) )
+        {
+            values.add( i18n.getString( "yes" ) );
+            values.add( i18n.getString( "no" ) );
+        }
+        if ( valueType.equals( DataElement.VALUE_TYPE_TRUE_ONLY ) )
+        {
+            values.add( i18n.getString( "" ) );
+            values.add( i18n.getString( "yes" ) );
+        }
+
+        return values;
+    }
+}

=== 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-10-08 17:16:47 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml	2013-10-09 11:26:54 +0000
@@ -874,6 +874,19 @@
 	</bean>
 
 	<!-- Tabular report -->
+	
+	<bean
+		id="org.hisp.dhis.caseentry.action.report.GenerateTabularReportAction"
+		class="org.hisp.dhis.caseentry.action.report.GenerateTabularReportAction"
+		scope="prototype">
+		<property name="programStageService" ref="org.hisp.dhis.program.ProgramStageService" />
+		<property name="programStageInstanceService"
+			ref="org.hisp.dhis.program.ProgramStageInstanceService" />
+		<property name="organisationUnitService"
+			ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
+		<property name="dataElementService" ref="org.hisp.dhis.dataelement.DataElementService" />
+		<property name="currentUserService" ref="org.hisp.dhis.user.CurrentUserService" />
+	</bean>
 
 	<bean id="org.hisp.dhis.caseentry.action.report.TabularInitializeAction"
 		class="org.hisp.dhis.caseentry.action.report.TabularInitializeAction"

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/struts.xml	2013-10-08 17:16:47 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/struts.xml	2013-10-09 11:26:54 +0000
@@ -868,6 +868,12 @@
 
 		<!-- Tabular report -->
 		
+	    <action name="searchProgramStageInstances"
+	      class="org.hisp.dhis.caseentry.action.report.GenerateTabularReportAction">
+	      <result name="success" type="velocity">/content.vm</result>
+	      <param name="page">/dhis-web-caseentry/programStageInstancesList.vm</param>
+	    </action>
+    
 		<action name="generateTabularReport" class="org.hisp.dhis.caseentry.action.NoAction">
 			<result name="success" type="velocity-json">/dhis-web-commons/ajax/jsonResponseSuccess.vm
 			</result>

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/viewPatientRegistationForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/viewPatientRegistationForm.vm	2013-10-08 08:47:47 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/viewPatientRegistationForm.vm	2013-10-09 11:26:54 +0000
@@ -124,7 +124,6 @@
 					<option value="registrationDate">$i18n.getString('registration_date')</option>
 					<option value="fullName">$i18n.getString('full_name')</option>
 					<option value="gender">$i18n.getString('gender')</option>
-					<option value="dobType">$i18n.getString('dob_type')</option>
 					<option value="birthDate">$i18n.getString('birth_date')</option>
 					<option value="age">$i18n.getString('age_years')</option>
 					<option value="phoneNumber">$i18n.getString('phone_number')</option>