← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 6481: Add new report in local/in/NRHM-Report

 

------------------------------------------------------------
revno: 6481
committer: Mithilesh Kumar Thakur<mithilesh.hisp@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2012-04-04 17:28:27 +0530
message:
  Add new report in local/in/NRHM-Report
added:
  local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/action/GetIndicatorsAction.java
  local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/benificiaryinfo/action/GetPatientDetailsAction.java
  local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/benificiaryinfo/action/GetPatientReportResultAction.java
  local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/benificiaryinfo/action/GetRegistredPatientInformationAction.java
  local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/benificiaryinfo/action/PatientInfoReportsFormAction.java
  local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/ed/action/RankingReportResultAction.java
  local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/util/ProgramDetail.java
  local/in/dhis-web-reports-national/src/main/webapp/dhis-web-reports/javascript/patient.js
  local/in/dhis-web-reports-national/src/main/webapp/dhis-web-reports/menuWithTreeForPatientInfo.vm
  local/in/dhis-web-reports-national/src/main/webapp/dhis-web-reports/patientDetails.vm
  local/in/dhis-web-reports-national/src/main/webapp/dhis-web-reports/patientInfoReportsForm.vm
  local/in/dhis-web-reports-national/src/main/webapp/dhis-web-reports/patientRegistrationList.vm
modified:
  local/in/dhis-web-reports-national/pom.xml
  local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/activeplan/action/ActivePlanReportsResultAction.java
  local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/portal/action/PortalReportsResultAction.java
  local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/portal/action/PortalReportsResult_ACS.java
  local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/portal/action/PortalReportsResult_Action.java
  local/in/dhis-web-reports-national/src/main/resources/META-INF/dhis/beans.xml
  local/in/dhis-web-reports-national/src/main/resources/org/hisp/dhis/reports/i18n_module.properties
  local/in/dhis-web-reports-national/src/main/resources/struts.xml
  local/in/dhis-web-reports-national/src/main/webapp/WEB-INF/web.xml
  local/in/dhis-web-reports-national/src/main/webapp/dhis-web-reports/menu.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 'local/in/dhis-web-reports-national/pom.xml'
--- local/in/dhis-web-reports-national/pom.xml	2012-03-30 08:17:05 +0000
+++ local/in/dhis-web-reports-national/pom.xml	2012-04-04 11:58:27 +0000
@@ -19,6 +19,10 @@
 	
 	<dependencies>
 		
+    <dependency>
+      <groupId>javax.servlet</groupId>
+      <artifactId>servlet-api</artifactId>
+	</dependency>		
 		<!-- DHIS -->
 		
 		<dependency>
@@ -64,10 +68,10 @@
 			<groupId>org.hisp.dhis</groupId>
 			<artifactId>dhis-service-datamart-default</artifactId>
 		</dependency>
-		<dependency>
+<!--		<dependency>
 			<groupId>org.hisp.dhis</groupId>
 			<artifactId>dhis-service-core</artifactId>
-		</dependency>
+		</dependency>-->
 		<dependency>
 			<groupId>org.hisp.dhis</groupId>
 			<artifactId>dhis-service-aggregationengine-default</artifactId>
@@ -82,19 +86,23 @@
 			<groupId>org.hisp.dhis</groupId>
 			<artifactId>dhis-support-external</artifactId>
 		</dependency>
-		<dependency>
+		<!--<dependency>
 			<groupId>org.hisp.dhis</groupId>
 			<artifactId>dhis-in-api</artifactId>
 			<version>${project.version}</version>
-		</dependency>
+		</dependency>-->
 		<dependency>
 			<groupId>org.hisp.dhis</groupId>
 			<artifactId>dhis-in-service-survey</artifactId>
 			<version>${project.version}</version>
 		</dependency>
-		<dependency>
+		<!--<dependency>
 			<groupId>org.hisp.dhis</groupId>
 			<artifactId>dhis-service-patient</artifactId>
+		</dependency>-->
+		<dependency>
+		  <groupId>org.hisp.dhis</groupId>
+		  <artifactId>dhis-web-api</artifactId>
 		</dependency>
 		
 		<!-- Web -->
@@ -180,4 +188,7 @@
 		</dependency>
 		
 	</dependencies>
+  <properties>
+    <rootDir>../../</rootDir>
+  </properties>	
 </project>

=== added file 'local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/action/GetIndicatorsAction.java'
--- local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/action/GetIndicatorsAction.java	1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/action/GetIndicatorsAction.java	2012-04-04 11:58:27 +0000
@@ -0,0 +1,77 @@
+package org.hisp.dhis.reports.action;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.hisp.dhis.common.comparator.IdentifiableObjectNameComparator;
+import org.hisp.dhis.indicator.Indicator;
+import org.hisp.dhis.indicator.IndicatorGroup;
+import org.hisp.dhis.indicator.IndicatorService;
+
+import com.opensymphony.xwork2.Action;
+
+public class GetIndicatorsAction implements Action
+{
+
+    private final static int ALL = 0;
+
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
+    
+    private IndicatorService indicatorService;
+
+    public void setIndicatorService( IndicatorService indicatorService )
+    {
+        this.indicatorService = indicatorService;
+    }
+    
+    // -------------------------------------------------------------------------
+    // Input & output
+    // -------------------------------------------------------------------------
+
+    private Integer id;
+
+    public void setId( Integer id )
+    {
+        this.id = id;
+    }
+    
+    private List<Indicator> indicators;
+
+    public List<Indicator> getIndicators()
+    {
+        return indicators;
+    }
+    
+    // -------------------------------------------------------------------------
+    // Action implementation
+    // -------------------------------------------------------------------------
+
+    public String execute()throws Exception
+    {
+    
+        if ( id == null || id == 0 )
+        {
+            indicators = new ArrayList<Indicator>( indicatorService.getAllIndicators() );
+        }
+        else
+        {
+            IndicatorGroup indicatorGroup = indicatorService.getIndicatorGroup( id );
+    
+            if ( indicatorGroup != null )
+            {
+                indicators = new ArrayList<Indicator>( indicatorGroup.getMembers() );
+            }
+            else
+            {
+                indicators = new ArrayList<Indicator>();
+            }
+        }
+        Collections.sort( indicators, new IdentifiableObjectNameComparator() );
+        return SUCCESS;
+    
+    }
+    
+}

=== modified file 'local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/activeplan/action/ActivePlanReportsResultAction.java'
--- local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/activeplan/action/ActivePlanReportsResultAction.java	2011-12-26 10:07:59 +0000
+++ local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/activeplan/action/ActivePlanReportsResultAction.java	2012-04-04 11:58:27 +0000
@@ -1125,8 +1125,8 @@
                             {
                                 DataElement d1e = dataElementService.getDataElement( Integer.parseInt( deCodeString ) );
 
-                                PatientDataValue patientDataValue1 = patientDataValueService.getPatientDataValue(
-                                    programStageInstance, d1e, selectedOrgUnit );
+                                //PatientDataValue patientDataValue1 = patientDataValueService.getPatientDataValue( programStageInstance, d1e, selectedOrgUnit );
+                                PatientDataValue patientDataValue1 = patientDataValueService.getPatientDataValue( programStageInstance, d1e );
                                 if ( patientDataValue1 == null )
                                 {
                                     tempStr = " ";
@@ -1282,9 +1282,8 @@
                                             {
                                                 if ( !deCollectedNames.contains( dename ) )
                                                 {
-                                                    PatientDataValue patientDataValue1 = patientDataValueService
-                                                        .getPatientDataValue( programStageInstanceName, d1e,
-                                                            selectedOrgUnit );
+                                                    //PatientDataValue patientDataValue1 = patientDataValueService.getPatientDataValue( programStageInstanceName, d1e, selectedOrgUnit );
+                                                    PatientDataValue patientDataValue1 = patientDataValueService.getPatientDataValue( programStageInstanceName, d1e );
                                                     if ( patientDataValue1 != null )
                                                     {
                                                         valuePresent = true;
@@ -1319,9 +1318,8 @@
                                         {
                                             if ( !deCollectedNames.contains( dename ) )
                                             {
-                                                PatientDataValue patientDataValue1 = patientDataValueService
-                                                    .getPatientDataValue( programStageInstanceName, d1e,
-                                                        selectedOrgUnit );
+                                                //PatientDataValue patientDataValue1 = patientDataValueService.getPatientDataValue( programStageInstanceName, d1e,selectedOrgUnit );
+                                                PatientDataValue patientDataValue1 = patientDataValueService.getPatientDataValue( programStageInstanceName, d1e );
                                                 if ( patientDataValue1 != null )
                                                 {
                                                     valuePresent = true;
@@ -1369,8 +1367,8 @@
                                     // +deCollectedNames );
                                     if ( !deCollectedNames.contains( dename ) )
                                     {
-                                        PatientDataValue patientDataValue1 = patientDataValueService
-                                            .getPatientDataValue( programStageInstanceName, d1e, selectedOrgUnit );
+                                        //PatientDataValue patientDataValue1 = patientDataValueService.getPatientDataValue( programStageInstanceName, d1e, selectedOrgUnit );
+                                        PatientDataValue patientDataValue1 = patientDataValueService.getPatientDataValue( programStageInstanceName, d1e );
                                         if ( patientDataValue1 != null )
                                         {
                                             valuePresent = true;

=== added file 'local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/benificiaryinfo/action/GetPatientDetailsAction.java'
--- local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/benificiaryinfo/action/GetPatientDetailsAction.java	1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/benificiaryinfo/action/GetPatientDetailsAction.java	2012-04-04 11:58:27 +0000
@@ -0,0 +1,254 @@
+package org.hisp.dhis.reports.benificiaryinfo.action;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.hisp.dhis.patient.Patient;
+import org.hisp.dhis.patient.PatientAttribute;
+import org.hisp.dhis.patient.PatientAttributeGroup;
+import org.hisp.dhis.patient.PatientIdentifier;
+import org.hisp.dhis.patient.PatientIdentifierType;
+import org.hisp.dhis.patient.PatientService;
+import org.hisp.dhis.patientattributevalue.PatientAttributeValue;
+import org.hisp.dhis.patientattributevalue.PatientAttributeValueService;
+
+import com.opensymphony.xwork2.Action;
+
+public class GetPatientDetailsAction
+implements Action
+{
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
+
+    private PatientService patientService;
+    
+    public void setPatientService( PatientService patientService )
+    {
+        this.patientService = patientService;
+    }
+    
+    private PatientAttributeValueService patientAttributeValueService;
+    
+    public void setPatientAttributeValueService( PatientAttributeValueService patientAttributeValueService )
+    {
+        this.patientAttributeValueService = patientAttributeValueService;
+    }
+    
+    
+/*
+    private PatientIdentifierService patientIdentifierService;
+    
+    public void setPatientIdentifierService( PatientIdentifierService patientIdentifierService )
+    {
+        this.patientIdentifierService = patientIdentifierService;
+    }
+
+    private ProgramService programService;
+    
+    public void setProgramService( ProgramService programService )
+    {
+        this.programService = programService;
+    }
+
+
+
+    private PatientAttributeService patientAttributeService;
+    
+    public void setPatientAttributeService( PatientAttributeService patientAttributeService )
+    {
+        this.patientAttributeService = patientAttributeService;
+    }
+
+    private PatientAttributeGroupService patientAttributeGroupService;
+    
+    public void setPatientAttributeGroupService( PatientAttributeGroupService patientAttributeGroupService )
+    {
+        this.patientAttributeGroupService = patientAttributeGroupService;
+    }
+
+    private PatientIdentifierTypeService patientIdentifierTypeService;
+    
+    public void setPatientIdentifierTypeService( PatientIdentifierTypeService patientIdentifierTypeService )
+    {
+        this.patientIdentifierTypeService = patientIdentifierTypeService;
+    }
+*/
+
+    // -------------------------------------------------------------------------
+    // Input/Output and its Getter / Setter
+    // -------------------------------------------------------------------------
+
+    private int id;
+    
+    public void setId( int id )
+    {
+        this.id = id;
+    }
+
+    private Patient patient;
+    
+    public Patient getPatient()
+    {
+        return patient;
+    }
+/*
+    private Patient representative;
+    
+    public Patient getRepresentative()
+    {
+        return representative;
+    }
+*/
+    private PatientIdentifier patientIdentifier;
+    
+    public PatientIdentifier getPatientIdentifier()
+    {
+        return patientIdentifier;
+    }
+    /*
+    private Collection<Program> programs;
+    
+    public Collection<Program> getPrograms()
+    {
+        return programs;
+    }
+    */
+    private Map<Integer, String> patientAttributeValueMap = new HashMap<Integer, String>();
+    
+    public Map<Integer, String> getPatientAttributeValueMap()
+    {
+        return patientAttributeValueMap;
+    }
+
+    private Collection<PatientAttribute> noGroupAttributes;
+    
+    public Collection<PatientAttribute> getNoGroupAttributes()
+    {
+        return noGroupAttributes;
+    }
+    
+    private List<PatientAttributeGroup> attributeGroups;
+    
+    public List<PatientAttributeGroup> getAttributeGroups()
+    {
+        return attributeGroups;
+    }
+
+    private Collection<PatientIdentifierType> identifierTypes;
+    
+    public Collection<PatientIdentifierType> getIdentifierTypes()
+    {
+        return identifierTypes;
+    }
+/*
+    private Map<Integer, String> identiferMap;
+    
+    public Map<Integer, String> getIdentiferMap()
+    {
+        return identiferMap;
+    }
+
+    private String childContactName;
+    
+    public String getChildContactName()
+    {
+        return childContactName;
+    }
+
+    private String childContactType;
+    
+    public String getChildContactType()
+    {
+        return childContactType;
+    }
+ */
+    private String systemIdentifier;
+   
+    public String getSystemIdentifier()
+    {
+        return systemIdentifier;
+    }
+    
+    // -------------------------------------------------------------------------
+    // Action implementation
+    // -------------------------------------------------------------------------
+
+    public String execute()
+        throws Exception
+    {
+        patient = patientService.getPatient( id );
+
+       // patientIdentifier = patientIdentifierService.getPatientIdentifier( patient );
+
+        // = patientIdentifierTypeService.getAllPatientIdentifierTypes();
+        
+        /*
+        identiferMap = new HashMap<Integer, String>();
+
+        PatientIdentifierType idType = null;
+        representative = patient.getRepresentative();
+
+        if ( patient.isUnderAge() && representative != null )
+        {
+            for ( PatientIdentifier representativeIdentifier : representative.getIdentifiers() )
+            {
+                if ( representativeIdentifier.getIdentifierType() != null
+                    && representativeIdentifier.getIdentifierType().isRelated() )
+                {
+                    //identiferMap.put( representativeIdentifier.getIdentifierType().getId(), representativeIdentifier.getIdentifier() );
+                }
+            }
+        }
+
+        for ( PatientIdentifier identifier : patient.getIdentifiers() )
+        {
+            idType = identifier.getIdentifierType();
+
+            if ( idType != null )
+            {
+                //identiferMap.put( identifier.getIdentifierType().getId(), identifier.getIdentifier() );
+            }
+            else
+            {
+                systemIdentifier = identifier.getIdentifier();
+            }
+        }
+    */
+        for ( PatientAttribute patientAttribute : patient.getAttributes() )
+        {
+            patientAttributeValueMap.put( patientAttribute.getId(), PatientAttributeValue.UNKNOWN );
+        }
+
+        Collection<PatientAttributeValue> patientAttributeValues = patientAttributeValueService.getPatientAttributeValues( patient );
+
+        for ( PatientAttributeValue patientAttributeValue : patientAttributeValues )
+        {
+            if ( PatientAttribute.TYPE_COMBO.equalsIgnoreCase( patientAttributeValue.getPatientAttribute()
+                .getValueType() ) )
+            {
+                patientAttributeValueMap.put( patientAttributeValue.getPatientAttribute().getId(),
+                    patientAttributeValue.getPatientAttributeOption().getName() );
+            }
+            else
+            {
+                patientAttributeValueMap.put( patientAttributeValue.getPatientAttribute().getId(),
+                    patientAttributeValue.getValue() );
+            }
+        }
+        /*
+        programs = programService.getAllPrograms();
+
+        noGroupAttributes = patientAttributeService.getPatientAttributesNotGroup();
+
+        attributeGroups = new ArrayList<PatientAttributeGroup>( patientAttributeGroupService.getAllPatientAttributeGroups() );
+        Collections.sort( attributeGroups, new PatientAttributeGroupSortOrderComparator() );
+        */
+        return SUCCESS;
+
+    }
+
+}
+

=== added file 'local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/benificiaryinfo/action/GetPatientReportResultAction.java'
--- local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/benificiaryinfo/action/GetPatientReportResultAction.java	1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/benificiaryinfo/action/GetPatientReportResultAction.java	2012-04-04 11:58:27 +0000
@@ -0,0 +1,838 @@
+package org.hisp.dhis.reports.benificiaryinfo.action;
+
+import java.io.BufferedInputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.InputStream;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Collection;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+
+import jxl.Workbook;
+import jxl.format.Alignment;
+import jxl.format.Border;
+import jxl.format.BorderLineStyle;
+import jxl.format.VerticalAlignment;
+import jxl.write.Blank;
+import jxl.write.Label;
+import jxl.write.Number;
+import jxl.write.WritableCellFormat;
+import jxl.write.WritableSheet;
+import jxl.write.WritableWorkbook;
+
+import org.hisp.dhis.config.Configuration_IN;
+import org.hisp.dhis.i18n.I18nFormat;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.patient.Patient;
+import org.hisp.dhis.patient.PatientAttribute;
+import org.hisp.dhis.patient.PatientIdentifier;
+import org.hisp.dhis.patient.PatientIdentifierService;
+import org.hisp.dhis.patient.PatientService;
+import org.hisp.dhis.patientattributevalue.PatientAttributeValue;
+import org.hisp.dhis.patientattributevalue.PatientAttributeValueService;
+import org.hisp.dhis.program.Program;
+import org.hisp.dhis.program.ProgramService;
+import org.hisp.dhis.reports.ReportService;
+import org.hisp.dhis.reports.Report_inDesign;
+import org.springframework.jdbc.core.JdbcTemplate;
+import org.springframework.jdbc.support.rowset.SqlRowSet;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+
+import com.opensymphony.xwork2.Action;
+
+public class GetPatientReportResultAction implements Action
+{
+    
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
+    
+    private ReportService reportService;
+
+    public void setReportService( ReportService reportService )
+    {
+        this.reportService = reportService;
+    }
+    
+    private PatientService patientService;
+    
+    public void setPatientService( PatientService patientService )
+    {
+        this.patientService = patientService;
+    }
+    
+    private ProgramService programService;
+    
+    public void setProgramService( ProgramService programService )
+    {
+        this.programService = programService;
+    }
+    
+    private PatientIdentifierService patientIdentifierService;
+
+    public void setPatientIdentifierService( PatientIdentifierService patientIdentifierService )
+    {
+        this.patientIdentifierService = patientIdentifierService;
+    }
+ /*   
+    private PatientAttributeService patientAttributeService;
+    
+    public void setPatientAttributeService( PatientAttributeService patientAttributeService )
+    {
+        this.patientAttributeService = patientAttributeService;
+    }
+ */   
+   private PatientAttributeValueService patientAttributeValueService;
+    
+    public void setPatientAttributeValueService( PatientAttributeValueService patientAttributeValueService )
+    {
+        this.patientAttributeValueService = patientAttributeValueService;
+    }
+    
+    private JdbcTemplate jdbcTemplate;
+
+    public void setJdbcTemplate( JdbcTemplate jdbcTemplate )
+    {
+        this.jdbcTemplate = jdbcTemplate;
+    }
+    
+    private I18nFormat format;
+
+    public void setFormat( I18nFormat format )
+    {
+        this.format = format;
+    }
+    
+    // -------------------------------------------------------------------------
+    // Input/Output and its Getter / Setter
+    // -------------------------------------------------------------------------
+    
+ 
+    private int patientId;
+
+    public void setPatientId( int patientId )
+    {
+        this.patientId = patientId;
+    }
+
+    private int selProgramId;
+   
+    public void setSelProgramId( int selProgramId )
+    {
+        this.selProgramId = selProgramId;
+    }
+
+    private String excelTemplateName;
+    
+    public void setExcelTemplateName( String excelTemplateName )
+    {
+        this.excelTemplateName = excelTemplateName;
+    }
+    
+    private String xmlTemplateName;
+    
+    public void setXmlTemplateName( String xmlTemplateName )
+    {
+        this.xmlTemplateName = xmlTemplateName;
+    }
+
+    private String inputTemplatePath;
+    private String outputReportPath;
+    private String raFolderName;
+    
+    
+    private String fileName;
+
+    public String getFileName()
+    {
+        return fileName;
+    }
+    
+    private InputStream inputStream;
+
+    public InputStream getInputStream()
+    {
+        return inputStream;
+    }
+    
+    
+    private List<String> serviceType;
+    private List<String> deCodeType;
+    private List<Integer> sheetList;
+    private List<Integer> rowList;
+    private List<Integer> colList;
+    private List<Integer> progList;
+    
+    private Patient patient;
+    private Program program;
+    
+    private Map<Integer, String> patientAttributeValueMap = new HashMap<Integer, String>();
+    
+    public Map<Integer, String> getPatientAttributeValueMap()
+    {
+        return patientAttributeValueMap;
+    }
+    
+    private Map<String, String> programStageDataElementValueMap = new HashMap<String, String>();
+    
+    public Map<String, String> getProgramStageDataElementValueMap()
+    {
+        return programStageDataElementValueMap;
+    }
+    
+    
+    private Date executionDate;
+    // -------------------------------------------------------------------------
+    // Action implementation
+    // -------------------------------------------------------------------------
+
+
+
+    public String execute() throws Exception 
+    {
+        
+        System.out.println( "Report Generation Start Time is : \t" + new Date() );
+        
+        raFolderName = reportService.getRAFolderName();
+        
+        
+        //System.out.println( "PatientId= " + patientId + "----SelProgramId= " + selProgramId );
+       // System.out.println( "-----excelTemplateName=" + excelTemplateName + "-----xmlTemplateName=" + xmlTemplateName );
+        patient = patientService.getPatient( patientId );
+        //OrganisationUnit orgunit = patient.getOrganisationUnit();
+        
+        program = programService.getProgram( selProgramId );
+        
+        String reportFileNameTB = excelTemplateName;
+       // String deCodesXMLFileName = xmlTemplateName;
+        
+        inputTemplatePath = System.getenv( "DHIS2_HOME" ) + File.separator + raFolderName + File.separator + "template" + File.separator + reportFileNameTB;
+        outputReportPath = System.getenv( "DHIS2_HOME" ) + File.separator +  Configuration_IN.DEFAULT_TEMPFOLDER;
+        File newdir = new File( outputReportPath );
+        if( !newdir.exists() )
+        {
+            newdir.mkdirs();
+        }
+        outputReportPath += File.separator + UUID.randomUUID().toString() + ".xls";
+        /*
+        select identifier from patientidentifier where patientid = 122748 and patientidentifiertypeid = 1;
+
+
+        select patientdatavalue.programstageinstanceid,programstageinstance.programstageid,
+        dataelementid,organisationunitid,value from patientdatavalue
+        inner join programstageinstance on patientdatavalue.programstageinstanceid = programstageinstance.programstageinstanceid
+       inner join programinstance on programstageinstance.programinstanceid = programinstance.programinstanceid
+        where programinstance.patientid = 122748;
+       
+        select patientdatavalue.programstageinstanceid,programstageinstance.programstageid,programinstance.enrollmentdate,programinstance.programinstanceid,
+        dataelementid,organisationunitid,value from patientdatavalue
+        inner join programstageinstance on patientdatavalue.programstageinstanceid = programstageinstance.programstageinstanceid
+        inner join programinstance on programstageinstance.programinstanceid = programinstance.programinstanceid
+        where programinstance.patientid = 6417;
+       
+        select patientdatavalue.programstageinstanceid,programstageinstance.programstageid,programinstance.enrollmentdate,programinstance.programinstanceid,
+        dataelementid,organisationunitid,value from patientdatavalue
+        inner join programstageinstance on patientdatavalue.programstageinstanceid = programstageinstance.programstageinstanceid
+        inner join programinstance on programstageinstance.programinstanceid = programinstance.programinstanceid
+        where programinstance.patientid = 6417 and organisationunitid = 13692;
+       
+       
+       
+       final query
+       
+        select patientdatavalue.programstageinstanceid,programstageinstance.programstageid,
+        dataelementid,organisationunitid,programstageinstance.executiondate,value from patientdatavalue
+        inner join programstageinstance on patientdatavalue.programstageinstanceid = programstageinstance.programstageinstanceid
+        inner join programinstance on programstageinstance.programinstanceid = programinstance.programinstanceid
+        where programinstance.patientid = 6417;
+
+       query for ACS Report
+       
+       SELECT patient.patientid, patient.firstname, patient.gender, patient.birthdate, programstageinstanceid, executiondate,patient.middlename,patient.lastname,patient.registrationdate FROM programstageinstance 
+                                        INNER JOIN programinstance ON programinstance.programinstanceid = programstageinstance.programinstanceid 
+                                       INNER JOIN patient on programinstance.patientid = patient.patientid 
+                                         WHERE programinstance.programid IN (1) 
+                                         AND executiondate >= '2012-03-30'
+                                        AND executiondate <= '2012-03-30'
+                                         AND patient.organisationunitid = 1 ORDER BY executiondate ;
+       
+       
+        *
+        *
+        */
+        
+        String query = "SELECT patientdatavalue.programstageinstanceid,programstageinstance.programstageid,dataelementid,value,programstageinstance.executiondate from patientdatavalue " +
+                       " INNER JOIN programstageinstance on patientdatavalue.programstageinstanceid = programstageinstance.programstageinstanceid " +
+                       " INNER JOIN programinstance on programstageinstance.programinstanceid = programinstance.programinstanceid " +
+                       " WHERE programinstance.patientid = " + patient.getId() + " ORDER BY executiondate" ;
+                       
+
+       
+        SqlRowSet sqlResultSet = jdbcTemplate.queryForRowSet( query );
+        
+        if ( sqlResultSet != null )
+        {
+            sqlResultSet.beforeFirst();
+            while ( sqlResultSet.next() )
+            {
+                String programStageDataElement = "";
+                
+                int programStageInstanceId = sqlResultSet.getInt( 1 );
+                int programStageId = sqlResultSet.getInt( 2 );
+                int dataElementId = sqlResultSet.getInt( 3 );
+                String deValue = sqlResultSet.getString( 4 );
+                executionDate = sqlResultSet.getDate( 5 );
+                
+                programStageDataElement = programStageId + ":" + dataElementId;
+                
+                programStageDataElementValueMap.put( programStageDataElement, deValue );
+                
+            }
+        }
+        
+        for ( PatientAttribute patientAttribute : patient.getAttributes() )
+        {
+            patientAttributeValueMap.put( patientAttribute.getId(), PatientAttributeValue.UNKNOWN );
+        }
+
+        Collection<PatientAttributeValue> patientAttributeValues = patientAttributeValueService.getPatientAttributeValues( patient );
+
+        for ( PatientAttributeValue patientAttributeValue : patientAttributeValues )
+        {
+            if ( PatientAttribute.TYPE_COMBO.equalsIgnoreCase( patientAttributeValue.getPatientAttribute()
+                .getValueType() ) )
+            {
+                patientAttributeValueMap.put( patientAttributeValue.getPatientAttribute().getId(),
+                    patientAttributeValue.getPatientAttributeOption().getName() );
+            }
+            else
+            {
+                patientAttributeValueMap.put( patientAttributeValue.getPatientAttribute().getId(),
+                    patientAttributeValue.getValue() );
+            }
+        }
+        
+        
+        generateReport();
+        
+        //System.out.println( "PatientId=" + patientId + "----SelProgramId= " + selProgramId );
+        //System.out.println( "-----excelTemplateName=" + excelTemplateName + "-----xmlTemplateName=" + xmlTemplateName );
+        System.out.println( "Report Generation End Time is : \t" + new Date() );
+        
+        return SUCCESS;
+    }
+    
+    public void generateReport() throws Exception
+    {
+        Workbook templateWorkbook = Workbook.getWorkbook( new File( inputTemplatePath ) );
+        WritableWorkbook outputReportWorkbook = Workbook.createWorkbook( new File( outputReportPath ), templateWorkbook );
+        
+        // Cell formatting
+        WritableCellFormat wCellformat = new WritableCellFormat();
+        wCellformat.setBorder( Border.ALL, BorderLineStyle.THIN );
+        wCellformat.setAlignment( Alignment.CENTRE );
+        wCellformat.setVerticalAlignment( VerticalAlignment.CENTRE );
+        wCellformat.setWrap( true );
+
+        WritableCellFormat deWCellformat = new WritableCellFormat();
+        deWCellformat.setBorder( Border.ALL, BorderLineStyle.THIN );
+        deWCellformat.setAlignment( Alignment.CENTRE );
+        deWCellformat.setVerticalAlignment( VerticalAlignment.JUSTIFY );
+        deWCellformat.setWrap( true );
+        
+       // SimpleDateFormat simpleDateFormat = new SimpleDateFormat( "yyyy-MM-dd" );
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat( "dd-MM-yyyy" );
+        
+        String deCodesXMLFileName = xmlTemplateName;
+        
+        List<Report_inDesign> reportDesignList = reportService.getReportDesign( deCodesXMLFileName );
+        
+        
+      //  List<String> deCodesList = getDECodes( deCodesXMLFileName );
+        /*
+        String query = "SELECT patient.patientid, patient.firstname, patient.gender, patient.birthdate, programstageinstanceid, executiondate FROM programstageinstance " +
+                        " INNER JOIN programinstance ON programinstance.programinstanceid = programstageinstance.programinstanceid " +
+                        " INNER JOIN patient on programinstance.patientid = patient.patientid " +
+                        " WHERE programinstance.programid IN ("+ reportLevelTB +") " +
+                        " AND executiondate >= '"+startDate+"'" +
+                        " AND executiondate <= '"+endDate+"' "+
+                        " AND patient.organisationunitid = "+ ouIDTB +" ORDER BY executiondate" ;
+
+       
+        SqlRowSet sqlResultSet1 = jdbcTemplate.queryForRowSet( query );
+        if ( sqlResultSet1 != null )
+        {
+         */
+            int rowNo = 1;
+           // sqlResultSet1.beforeFirst();
+            /*
+            while ( sqlResultSet1.next() )
+            {
+                int patientId = sqlResultSet1.getInt( 1 );
+                String patientName = sqlResultSet1.getString( 2 );
+                String patinetGender = sqlResultSet1.getString( 3 );
+                Date patientBirthDate = sqlResultSet1.getDate( 4 );
+                int programStageInstanceId = sqlResultSet1.getInt( 5 );
+                Date executionDate = sqlResultSet1.getDate( 6 );
+                
+                Patient patient = patientService.getPatient( patientId );
+              
+                ProgramStageInstance prgStageInstance = programStageInstanceService.getProgramStageInstance( programStageInstanceId );
+               
+                */
+                List<PatientIdentifier> patientIdentifiers = new ArrayList<PatientIdentifier>( patientIdentifierService.getPatientIdentifiers( patient ) );
+                int count1 = 0;
+                Iterator<Report_inDesign> reportDesignIterator = reportDesignList.iterator();
+                while( reportDesignIterator.hasNext() )
+                {
+                    Report_inDesign report_inDesign = (Report_inDesign) reportDesignIterator.next();
+                    
+                    String deType = report_inDesign.getPtype();
+                    String sType = report_inDesign.getStype();
+                    String deCodeString = report_inDesign.getExpression();
+                    String tempStr = "";
+                    
+                    //int tempColNo = colList.get( count1 );
+                   // int sheetNo = sheetList.get( count1 );
+                   // String tempStr = "";
+                   // String sType = serviceType.get( count1 );
+                   // int tempRowNo = rowList.get( count1 );
+                    
+                    if( sType.equalsIgnoreCase("slno") )
+                    {
+                        tempStr = "" + rowNo;
+                    }
+                    else if( deCodeString.equalsIgnoreCase("GENDER") )
+                    {
+                        tempStr = patient.getGender();
+                    }
+                    else if( deCodeString.equalsIgnoreCase("AGE") )
+                    {
+                        if( patient.getDobType() == 'V' || patient.getDobType() == 'D')
+                        {
+                            tempStr =  simpleDateFormat.format(patient.getBirthDate());
+                        }
+                        else
+                        {
+                            tempStr = patient.getAge();
+                            
+                        }
+                    }
+                    
+                    /*
+                    else if( deCodeString.equalsIgnoreCase("DOB") )
+                    {
+                        tempStr =  simpleDateFormat.format(patient.getBirthDate());
+                    }
+                    */
+                    
+                    else if( deCodeString.equalsIgnoreCase("ADMISSION") )
+                    {
+                        //tempStr = program.getDateOfEnrollmentDescription();
+                        tempStr = simpleDateFormat.format( executionDate );
+                    }
+                    
+                    
+                    else if( deCodeString.equalsIgnoreCase("FACILITY") )
+                    {
+                        tempStr = patient.getOrganisationUnit().getName();
+                    }
+                    
+                    else if( deCodeString.equalsIgnoreCase("PATIENTNAME") )
+                    {
+                        tempStr = patient.getFullName();
+                    }
+                    
+                    
+                    
+                    else if( sType.equalsIgnoreCase("identifier") )
+                    {
+                        //System.out.println( "Inside pipart0" );
+                        tempStr = " ";
+                        for( PatientIdentifier patientIdentifier : patientIdentifiers )
+                        {
+                                //System.out.println( patientIdentifier.getId() + " : " + deCode );
+                                if( patientIdentifier.getIdentifierType() != null && patientIdentifier.getIdentifierType().getId() == Integer.parseInt(deCodeString) )
+                                {
+                                        try
+                                        {
+                                                tempStr = patientIdentifier.getIdentifier();
+                                        }
+                                        catch( Exception e )
+                                        {
+                                        }
+                                        break;
+                                }
+                        }
+                    }
+                    else if( sType.equalsIgnoreCase("attributes") )
+                    {
+                        tempStr = " ";
+                        for( PatientAttribute patientAttribute : patient.getAttributes() )
+                        {
+                                if( patientAttribute.getId() == Integer.parseInt(deCodeString) )
+                                {
+                                        try
+                                        {
+                                                tempStr = patientAttributeValueMap.get( patientAttribute.getId() );
+                                        }
+                                        catch( Exception e )
+                                        {
+                                        }
+                                        break;
+                                }
+                        }
+                    }
+                    /*
+                    else if( sType.equalsIgnoreCase("PI-PART6") )
+                    {
+                        tempStr = " ";
+                        for( PatientAttribute patientAttribute : patient.getAttributes() )
+                        {
+                                if( patientIdentifier.getIdentifierType() != null && patientIdentifier.getIdentifierType().getId() == Integer.parseInt(deCode) )
+                                {
+                                        try
+                                        {
+                                                tempStr = patientIdentifier.getIdentifier().split("-")[6];
+                                        }
+                                        catch( Exception e )
+                                        {
+                                        }
+                                        break;
+                                }
+                        }
+                    }
+                    else if( sType.equalsIgnoreCase("dataelement") )
+                    {
+                        DataElement de = dataElementService.getDataElement( Integer.parseInt( deCode ) );
+                        PatientDataValue patientDV = patientDataValueService.getPatientDataValue( prgStageInstance, de, selectedOrgUnit );
+                        if( patientDV != null && patientDV.getValue() != null )
+                        {
+                                tempStr = patientDV.getValue();
+                        }
+                    }
+                    else if( sType.equalsIgnoreCase("dataelement-dd") )
+                    {
+                        DataElement de = dataElementService.getDataElement( Integer.parseInt( deCode ) );
+                        PatientDataValue patientDV = patientDataValueService.getPatientDataValue( prgStageInstance, de, selectedOrgUnit );
+                        if( patientDV != null && patientDV.getValue() != null )
+                        {
+                                Integer optionComboId = Integer.parseInt( patientDV.getValue() );
+                                DataElementCategoryOptionCombo deCOC = dataElementCategoryOptionComboService.getDataElementCategoryOptionCombo( optionComboId );
+                                tempStr = deCOC.getName();
+                        }
+                    }
+                    */
+                    else if( sType.equalsIgnoreCase("dataelement") )
+                    {
+                        tempStr = " ";
+                        tempStr = programStageDataElementValueMap.get( deCodeString );
+                    }
+                    
+                    else if( sType.equalsIgnoreCase("dataelementdate") )
+                    {
+                        tempStr = programStageDataElementValueMap.get( deCodeString );
+                        
+                        if (  tempStr != null )
+                        {
+                            Date tempDate = format.parseDate( tempStr );
+                            Calendar tempSDate = Calendar.getInstance();
+                            tempSDate.setTime( tempDate );
+                            
+                            tempStr =  simpleDateFormat.format( tempSDate.getTime() );
+                        }
+                        else
+                        {
+                            tempStr = " ";
+                        }
+                        
+                    }
+                    else if( sType.equalsIgnoreCase("after7thday") )
+                    {
+                        tempStr = programStageDataElementValueMap.get( deCodeString );
+                        
+                        if (  tempStr != null )
+                        {
+                            Date tempDate = format.parseDate( tempStr );
+                            Calendar tempSDate = Calendar.getInstance();
+                            tempSDate.setTime( tempDate );
+                            tempSDate.add(Calendar.DATE, 7);
+                            //tempStr = "" + tempSDate.get(Calendar.YEAR) + "-" + ( tempSDate.get(Calendar.MONTH) + 1) + "-" +tempSDate.get(Calendar.DATE);
+                            tempStr =  simpleDateFormat.format( tempSDate.getTime() );
+                            
+                        }
+                        else
+                        {
+                            tempStr = " ";
+                        }
+                        
+                    }
+                    
+                    else if( sType.equalsIgnoreCase("after15thday") )
+                    {
+                        tempStr = programStageDataElementValueMap.get( deCodeString );
+                        
+                        if (  tempStr != null )
+                        {
+                            Date tempDate = format.parseDate( tempStr );
+                            Calendar tempSDate = Calendar.getInstance();
+                            tempSDate.setTime( tempDate );
+                            tempSDate.add(Calendar.DATE, 15);
+                            //tempStr = "" + tempSDate.get(Calendar.YEAR) + "-" + ( tempSDate.get(Calendar.MONTH) + 1) + "-" +tempSDate.get(Calendar.DATE);
+                            
+                            tempStr =  simpleDateFormat.format( tempSDate.getTime() );
+                            
+                        }
+                        else
+                        {
+                            tempStr = " ";
+                        }
+                        
+                    }
+                    
+                    else if( sType.equalsIgnoreCase("1stmonth") )
+                    {
+                        tempStr = programStageDataElementValueMap.get( deCodeString ); 
+                        
+                        if (  tempStr != null )
+                        {
+                            Date tempDate = format.parseDate( tempStr );
+                            Calendar tempSDate = Calendar.getInstance();
+                            tempSDate.setTime( tempDate );
+                            tempSDate.add(Calendar.MONTH, 1);
+                            //tempStr = "" + tempSDate.get(Calendar.YEAR) + "-" + ( tempSDate.get(Calendar.MONTH) + 1) + "-" +tempSDate.get(Calendar.DATE);
+                            tempStr =  simpleDateFormat.format( tempSDate.getTime() );
+                            
+                        }
+                        else
+                        {
+                            tempStr = " ";
+                        }
+
+                    }
+                    
+                    else if( sType.equalsIgnoreCase("after45thday") )
+                    {
+                        tempStr = programStageDataElementValueMap.get( deCodeString );
+                        
+                        if (  tempStr != null )
+                        {
+                            Date tempDate = format.parseDate( tempStr );
+                            Calendar tempSDate = Calendar.getInstance();
+                            tempSDate.setTime( tempDate );
+                            tempSDate.add(Calendar.DATE, 45);
+                            //tempStr = "" + tempSDate.get(Calendar.YEAR) + "-" + ( tempSDate.get(Calendar.MONTH) + 1) + "-" +tempSDate.get(Calendar.DATE);
+                            tempStr =  simpleDateFormat.format( tempSDate.getTime() );
+                            
+                        }
+                        else
+                        {
+                            tempStr = " ";
+                        }
+                    }
+                    
+                    else if( sType.equalsIgnoreCase("2ndmonth") )
+                    {
+                        tempStr = programStageDataElementValueMap.get( deCodeString );
+                        
+                        if (  tempStr != null )
+                        {
+                            Date tempDate = format.parseDate( tempStr );
+                            Calendar tempSDate = Calendar.getInstance();
+                            tempSDate.setTime( tempDate );
+                            tempSDate.add(Calendar.MONTH, 2);
+                           // tempStr = "" + tempSDate.get(Calendar.DATE);
+                           // tempStr = "" + tempSDate.get(Calendar.YEAR) + "-" + ( tempSDate.get(Calendar.MONTH) + 1) + "-" +tempSDate.get(Calendar.DATE);
+                            tempStr =  simpleDateFormat.format( tempSDate.getTime() );
+                            
+                        }
+                        else
+                        {
+                            tempStr = " ";
+                        }
+                    }
+                    
+                    else if( sType.equalsIgnoreCase("3rdmonth") )
+                    {
+                        tempStr = programStageDataElementValueMap.get( deCodeString );
+                        
+                        if (  tempStr != null )
+                        {
+                            Date tempDate = format.parseDate( tempStr );
+                            Calendar tempSDate = Calendar.getInstance();
+                            tempSDate.setTime( tempDate );
+                            tempSDate.add(Calendar.MONTH, 3);
+                           // tempStr = "" + tempSDate.get(Calendar.DATE);
+                            //tempStr = "" + tempSDate.get(Calendar.YEAR) + "-" + ( tempSDate.get(Calendar.MONTH) + 1) + "-" +tempSDate.get(Calendar.DATE);
+                            tempStr =  simpleDateFormat.format( tempSDate.getTime() );
+                            
+                        }
+                        else
+                        {
+                            tempStr = " ";
+                        }
+                    }
+                   
+                    else if( sType.equalsIgnoreCase("6thmonth") )
+                    {
+                        tempStr = programStageDataElementValueMap.get( deCodeString );
+                        
+                        if (  tempStr != null )
+                        {
+                            Date tempDate = format.parseDate( tempStr );
+                            Calendar tempSDate = Calendar.getInstance();
+                            tempSDate.setTime( tempDate );
+                            tempSDate.add(Calendar.MONTH, 6);
+                           // tempStr = "" + tempSDate.get(Calendar.DATE);
+                            //tempStr = "" + tempSDate.get(Calendar.YEAR) + "-" + ( tempSDate.get(Calendar.MONTH) + 1) + "-" +tempSDate.get(Calendar.DATE);
+                            tempStr =  simpleDateFormat.format( tempSDate.getTime() );
+                            
+                        }
+                        else
+                        {
+                            tempStr = " ";
+                        }
+                    }
+                    else if( sType.equalsIgnoreCase("1year") )
+                    {
+                        tempStr = programStageDataElementValueMap.get( deCodeString );
+                        
+                        if (  tempStr != null )
+                        {
+                            Date tempDate = format.parseDate( tempStr );
+                            Calendar tempSDate = Calendar.getInstance();
+                            tempSDate.setTime( tempDate );
+                            tempSDate.add(Calendar.YEAR, 1);
+                           // tempStr = "" + tempSDate.get(Calendar.DATE);
+                            //tempStr = "" + tempSDate.get(Calendar.YEAR) + "-" +tempSDate.get(Calendar.MONTH) + "-" +tempSDate.get(Calendar.DATE);
+                            
+                            tempStr =  simpleDateFormat.format( tempSDate.getTime() );
+                            
+                        }
+                        else
+                        {
+                            tempStr = " ";
+                        }
+                    }
+                    
+                    //System.out.println( sType + " : " + tempStr );
+                     
+                    //System.out.println( sType + " : " + deCodeString + " : " + tempStr );
+                    
+                    int tempRowNo = report_inDesign.getRowno();
+                    int tempColNo = report_inDesign.getColno();
+                    int sheetNo = report_inDesign.getSheetno();
+                    WritableSheet sheet0 = outputReportWorkbook.getSheet( sheetNo );
+                    if ( tempStr == null || tempStr.equals( " " ) )
+                    {
+                        
+            
+                        sheet0.addCell( new Blank( tempColNo, tempRowNo, wCellformat ) );
+                    } 
+                    else
+                    {
+                    
+                        if ( deCodeString.equalsIgnoreCase( "FACILITYP" ) || deCodeString.equalsIgnoreCase( "FACILITYPP" ) || deCodeString.equalsIgnoreCase( "FACILITYPPP" ) || deCodeString.equalsIgnoreCase( "FACILITYPPPP" ) )
+                        {
+                            
+                        } 
+                        
+                        else
+                        {   
+                           // System.out.println( sType + " : " + deCode + " : " + tempStr );
+                            try
+                            {
+                                sheet0.addCell( new Number( tempColNo, tempRowNo, Double.parseDouble( tempStr ), wCellformat ) );
+                            }
+                            catch( Exception e )
+                            {
+                                sheet0.addCell( new Label( tempColNo, tempRowNo, tempStr, wCellformat ) );
+                            }
+                        }
+
+                    }
+                    
+                    count1++;
+                }
+                
+                rowNo++;
+            //}
+        //}
+        
+        outputReportWorkbook.write();
+        outputReportWorkbook.close();
+        fileName = excelTemplateName;
+        File outputReportFile = new File( outputReportPath );
+        inputStream = new BufferedInputStream( new FileInputStream( outputReportFile ) );
+        outputReportFile.deleteOnExit();
+        
+    }
+
+/*    
+    public List<String> getDECodes( String fileName )
+    {
+        List<String> deCodes = new ArrayList<String>();
+        String path = System.getenv( "DHIS2_HOME" ) + File.separator + raFolderName + File.separator + fileName;
+
+        try 
+        {
+            DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
+            DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();
+            Document doc = docBuilder.parse( new File( path ) );
+            if ( doc == null )
+            {
+                return null;
+            }
+
+            NodeList listOfDECodes = doc.getElementsByTagName( "de-code" );
+            int totalDEcodes = listOfDECodes.getLength();
+
+            for ( int s = 0; s < totalDEcodes; s++ )
+            {
+                Element deCodeElement = ( Element ) listOfDECodes.item( s );
+                NodeList textDECodeList = deCodeElement.getChildNodes();
+                deCodes.add( ( ( Node ) textDECodeList.item( 0 ) ).getNodeValue().trim() );
+                serviceType.add( deCodeElement.getAttribute( "stype" ) );
+                deCodeType.add( deCodeElement.getAttribute( "type" ) );
+                sheetList.add( new Integer( deCodeElement.getAttribute( "sheetno" ) ) );
+                rowList.add( new Integer( deCodeElement.getAttribute( "rowno" ) ) );
+                colList.add( new Integer( deCodeElement.getAttribute( "colno" ) ) );
+                progList.add( new Integer( deCodeElement.getAttribute( "progno" ) ) );
+            }// end of for loop with s var
+
+        }// try block end
+        catch ( SAXParseException err )
+        {
+        } 
+        catch ( SAXException e )
+        {
+            Exception x = e.getException();
+            ( ( x == null ) ? e : x ).printStackTrace();
+        } 
+        catch ( Throwable t )
+        {
+            t.printStackTrace();
+        }
+
+        return deCodes;
+    }
+    
+*/    
+    
+    
+}

=== added file 'local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/benificiaryinfo/action/GetRegistredPatientInformationAction.java'
--- local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/benificiaryinfo/action/GetRegistredPatientInformationAction.java	1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/benificiaryinfo/action/GetRegistredPatientInformationAction.java	2012-04-04 11:58:27 +0000
@@ -0,0 +1,467 @@
+package org.hisp.dhis.reports.benificiaryinfo.action;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.organisationunit.OrganisationUnitService;
+import org.hisp.dhis.paging.ActionPagingSupport;
+import org.hisp.dhis.patient.Patient;
+import org.hisp.dhis.patient.PatientAttribute;
+import org.hisp.dhis.patient.PatientAttributeService;
+import org.hisp.dhis.patient.PatientService;
+import org.hisp.dhis.patientattributevalue.PatientAttributeValue;
+import org.hisp.dhis.patientattributevalue.PatientAttributeValueService;
+import org.hisp.dhis.reports.ReportService;
+import org.hisp.dhis.reports.util.ProgramDetail;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+
+public class GetRegistredPatientInformationAction extends ActionPagingSupport<Patient>
+{
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
+
+
+    private PatientAttributeValueService patientAttributeValueService;
+    
+    public void setPatientAttributeValueService( PatientAttributeValueService patientAttributeValueService )
+    {
+        this.patientAttributeValueService = patientAttributeValueService;
+    }
+    
+    
+    private PatientAttributeService patientAttributeService;
+    
+    public void setPatientAttributeService( PatientAttributeService patientAttributeService )
+    {
+        this.patientAttributeService = patientAttributeService;
+    }
+    
+    private ReportService reportService;
+
+    public void setReportService( ReportService reportService )
+    {
+        this.reportService = reportService;
+    }
+    
+    private OrganisationUnitService organisationUnitService;
+
+    public void setOrganisationUnitService( OrganisationUnitService organisationUnitService )
+    {
+        this.organisationUnitService = organisationUnitService;
+    }
+    
+    private PatientService patientService;
+    
+    public void setPatientService( PatientService patientService )
+    {
+        this.patientService = patientService;
+    }
+    
+    // -------------------------------------------------------------------------
+    // Input
+    // -------------------------------------------------------------------------
+    
+    private List<String> searchText = new ArrayList<String>();
+
+    public void setSearchText( List<String> searchText )
+    {
+        this.searchText = searchText;
+    }
+
+    private Boolean listAll;
+    
+    public void setListAll( Boolean listAll )
+    {
+        this.listAll = listAll;
+    }
+
+    public Boolean getListAll()
+    {
+        return listAll;
+    }
+   
+    private List<Integer> searchingAttributeId = new ArrayList<Integer>();
+    
+    public void setSearchingAttributeId( List<Integer> searchingAttributeId )
+    {
+        this.searchingAttributeId = searchingAttributeId;
+    }
+    /*
+    private List<Program> programs;
+    
+    public List<Program> getPrograms()
+    {
+        return programs;
+    }
+    */
+    // -------------------------------------------------------------------------
+    // Output
+    // -------------------------------------------------------------------------
+
+
+
+    private Integer total;
+    
+    public Integer getTotal()
+    {
+        return total;
+    }
+    
+    private Map<String, String> mapPatientPatientAttr = new HashMap<String, String>();
+    
+    public Map<String, String> getMapPatientPatientAttr()
+    {
+        return mapPatientPatientAttr;
+    }
+    
+    private Collection<Patient> patients = new ArrayList<Patient>();
+    
+    public Collection<Patient> getPatients()
+    {
+        return patients;
+    }
+    /*
+    private Map<Integer, List<Program>> mapPatientPrograms = new HashMap<Integer, List<Program>>();
+    
+    public Map<Integer, List<Program>> getMapPatientPrograms()
+    {
+        return mapPatientPrograms;
+    }
+    */
+    
+    
+    // -------------------------------------------------------------------------
+    // Getters/Setters
+    // -------------------------------------------------------------------------
+
+
+    private List<PatientAttribute> patientAttributes = new ArrayList<PatientAttribute>();
+    
+    public List<PatientAttribute> getPatientAttributes()
+    {
+        return patientAttributes;
+    }
+    
+    private Map<Integer, String> mapPatientOrgunit = new HashMap<Integer, String>();
+    
+    public Map<Integer, String> getMapPatientOrgunit()
+    {
+        return mapPatientOrgunit;
+    }
+    
+    private String raFolderName;
+    
+    
+    private List<ProgramDetail> programList;
+    
+    public List<ProgramDetail> getProgramList()
+    {
+        return programList;
+    }
+    
+    private int ouIDTB;
+
+    public void setOuIDTB( int ouIDTB )
+    {
+        this.ouIDTB = ouIDTB;
+    }
+    
+    private Boolean isSelectedOrg;
+    
+    public void setIsSelectedOrg( Boolean isSelectedOrg )
+    {
+        this.isSelectedOrg = isSelectedOrg;
+    }
+    
+
+    // -------------------------------------------------------------------------
+    // Action implementation
+    // -------------------------------------------------------------------------
+
+    public String execute()
+        throws Exception
+    {
+        //OrganisationUnit organisationUnit = selectedStateManager.getSelectedOrganisationUnit();
+        OrganisationUnit organisationUnit = organisationUnitService.getOrganisationUnit( ouIDTB );
+        // ---------------------------------------------------------------------
+        // Get all of patients into the selected organisation unit
+        // ---------------------------------------------------------------------
+        /*
+        if ( listAll != null && listAll )
+        {
+            listAllPatient( organisationUnit );
+
+            return SUCCESS;
+        }
+    */
+        // ---------------------------------------------------------------------
+        // Search patients by attributes
+        // ---------------------------------------------------------------------
+        
+        //System.out.println( "searchingAttributeId= "  + searchingAttributeId + "---,searchText= " + searchText );
+        
+        //System.out.println( "OrganisationUnit= "  + ouIDTB + "---,is Selected Org checked = " + isSelectedOrg );
+        
+        raFolderName = reportService.getRAFolderName();
+        
+        programList = new ArrayList<ProgramDetail>();
+        
+        for ( Integer attributeId : searchingAttributeId )
+        {
+            if ( attributeId != null && attributeId != 0 )
+            {
+                patientAttributes.add( patientAttributeService.getPatientAttribute( attributeId ) );
+            }
+        }
+        
+        
+        if( isSelectedOrg )
+        {
+            searchPatientByNameAndOrgUnit( searchText , organisationUnit );
+        }
+        else
+        {
+            searchPatientByAttributes( searchingAttributeId, searchText );
+        }
+        
+        
+        getProgramDetailList();
+        
+        return SUCCESS;
+
+    }
+
+    // -------------------------------------------------------------------------
+    // Supporting methods
+    // -------------------------------------------------------------------------
+/*
+    private void listAllPatient( OrganisationUnit organisationUnit )
+    {
+        total = patientService.countGetPatientsByOrgUnit( organisationUnit );
+        this.paging = createPaging( total );
+
+        patients = new ArrayList<Patient>( patientService.getPatients( organisationUnit, paging.getStartPos(), paging
+            .getPageSize() ) );
+    }
+*/
+    
+    private void searchPatientByNameAndOrgUnit( List<String> searchText , OrganisationUnit organisationUnit )
+    {
+       
+        total = patientService.countGetPatientsByOrgUnit( organisationUnit );
+        this.paging = createPaging( total );
+       
+        //Collection<Patient> tempPatients = new ArrayList<Patient>();
+        for( String text : searchText )
+        {
+            //tPatients( OrganisationUnit organisationUnit, String searchText, int min, int max )
+            
+            List<Patient> tempPatients = new ArrayList<Patient>( patientService.getPatients( organisationUnit, text, paging.getStartPos(), paging.getPageSize() ));
+            patients.addAll( tempPatients ); 
+        }
+        
+        total = patients.size();
+        this.paging = createPaging( total );
+        
+        
+        Collection<PatientAttributeValue> attributeValues = patientAttributeValueService.getPatientAttributeValues( patients );
+
+        for ( Patient patient : patients )
+        {
+            //programs.addAll( patient.getPrograms() );
+            
+            mapPatientOrgunit.put( patient.getId(), getHierarchyOrgunit( patient.getOrganisationUnit() ) );
+    
+            for ( PatientAttributeValue attributeValue : attributeValues )
+            {
+                mapPatientPatientAttr.put( patient.getId() + "-" + attributeValue.getPatientAttribute().getId(),
+                    attributeValue.getValue() );
+            }
+            
+            //mapPatientPrograms.put( patient.getId(), getProgramsByPatient( patient ) );            
+        }
+        
+    }
+    
+    
+    private void searchPatientByAttributes( List<Integer> searchingAttributeId, List<String> searchText )
+    {
+        total = patientAttributeValueService.countSearchPatients( searchingAttributeId, searchText );
+        this.paging = createPaging( total );
+        
+        patients = patientAttributeValueService.searchPatients( searchingAttributeId, searchText, paging.getStartPos(),
+            paging.getPageSize() );
+        
+        /*
+        if ( isSelectedOrg )
+        {
+            Iterator<Patient> patientIterator = patients.iterator();
+            while ( patientIterator.hasNext() )
+            {
+                Patient patient = patientIterator.next();
+                
+                OrganisationUnit orgUnit = organisationUnitService.getOrganisationUnit( ouIDTB );
+                
+                if ( patient.getOrganisationUnit().getId() != orgUnit.getId() )
+                {
+                    patientIterator.remove();
+                }
+            }
+            total = patients.size();
+            this.paging = createPaging( total );
+        }
+        */
+        
+        Collection<PatientAttributeValue> attributeValues = patientAttributeValueService.getPatientAttributeValues( patients );
+
+        for ( Patient patient : patients )
+        {
+            //programs.addAll( patient.getPrograms() );
+            
+            mapPatientOrgunit.put( patient.getId(), getHierarchyOrgunit( patient.getOrganisationUnit() ) );
+
+            for ( PatientAttributeValue attributeValue : attributeValues )
+            {
+                mapPatientPatientAttr.put( patient.getId() + "-" + attributeValue.getPatientAttribute().getId(),
+                    attributeValue.getValue() );
+            }
+            
+            //mapPatientPrograms.put( patient.getId(), getProgramsByPatient( patient ) );            
+        }
+    }
+
+    private String getHierarchyOrgunit( OrganisationUnit orgunit )
+    {
+        String hierarchyOrgunit = orgunit.getName();
+
+        while ( orgunit.getParent() != null )
+        {
+            hierarchyOrgunit = orgunit.getParent().getName() + " / " + hierarchyOrgunit;
+
+            orgunit = orgunit.getParent();
+        }
+
+        return hierarchyOrgunit;
+    }
+/*    
+    private List<Program> getProgramsByPatient( Patient patient )
+    {
+       
+        List<Program> tempPrograms = new ArrayList<Program>( patient.getPrograms());
+        List<Program> programsList = new ArrayList<Program>();
+        
+        if( tempPrograms != null && tempPrograms.size() != 0 )
+        {
+            for( Program program : tempPrograms )
+            {
+                programsList.add( program );
+            }
+            
+        }
+
+        return programsList;
+    }
+*/    
+
+    public void getProgramDetailList()
+    {
+        String fileName = "NBITSProgramList.xml";
+        String path = System.getProperty( "user.home" ) + File.separator + "dhis" + File.separator + raFolderName + File.separator + fileName;
+        try
+        {
+            String newpath = System.getenv( "DHIS2_HOME" );
+            if ( newpath != null )
+            {
+                path = newpath + File.separator + raFolderName + File.separator + fileName;
+            }
+        }
+        catch ( NullPointerException npe )
+        {
+            // do nothing, but we might be using this somewhere without
+            // DHIS2_HOME set, which will throw a NPE
+        }
+
+        String programId = "";
+        String programName = "";
+        String excelTemplateName = "";
+        String xmlTemplateName = "";
+
+        try
+        {
+            DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
+            DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();
+            Document doc = docBuilder.parse( new File( path ) );
+            if ( doc == null )
+            {
+                System.out.println( "XML File Not Found at user home" );
+                return;
+            }
+
+            NodeList listOfReports = doc.getElementsByTagName( "program" );
+            int totalReports = listOfReports.getLength();
+            for ( int s = 0; s < totalReports; s++ )
+            {
+                Node reportNode = listOfReports.item( s );
+                if ( reportNode.getNodeType() == Node.ELEMENT_NODE )
+                {
+                    Element programElement = (Element) reportNode;
+                    programId = programElement.getAttribute( "id" );
+
+                    NodeList programNameList = programElement.getElementsByTagName( "name" );
+                    Element programNameElement = (Element) programNameList.item( 0 );
+                    NodeList textProgramNameList = programNameElement.getChildNodes();
+                    programName = ((Node) textProgramNameList.item( 0 )).getNodeValue().trim();
+
+
+                    NodeList programExcelNameList = programElement.getElementsByTagName( "excelTemplateName" );
+                    Element programExcelElement = (Element) programExcelNameList.item( 0 );
+                    NodeList textProgramExcelNameList = programExcelElement.getChildNodes();
+                    excelTemplateName = ((Node) textProgramExcelNameList.item( 0 )).getNodeValue().trim();
+
+                    NodeList programXMLNameList = programElement.getElementsByTagName( "xmlTemplateName" );
+                    Element programXMLElement = (Element) programXMLNameList.item( 0 );
+                    NodeList textProgramXMLNameList = programXMLElement.getChildNodes();
+                    xmlTemplateName = ((Node) textProgramXMLNameList.item( 0 )).getNodeValue().trim();
+
+
+                    ProgramDetail programObj = new ProgramDetail(programId, programName, excelTemplateName, xmlTemplateName);
+                    programList.add( programObj );
+
+                }
+            }// end of for loop with s var
+        }// try block end
+        catch ( SAXParseException err )
+        {
+            System.out.println( "** Parsing error" + ", line " + err.getLineNumber() + ", uri " + err.getSystemId() );
+            System.out.println( " " + err.getMessage() );
+        }
+        catch ( SAXException e )
+        {
+            Exception x = e.getException();
+            ((x == null) ? e : x).printStackTrace();
+        }
+        catch ( Throwable t )
+        {
+            t.printStackTrace();
+        }
+
+    }// getReportList end
+    
+    
+    
+}

=== added file 'local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/benificiaryinfo/action/PatientInfoReportsFormAction.java'
--- local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/benificiaryinfo/action/PatientInfoReportsFormAction.java	1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/benificiaryinfo/action/PatientInfoReportsFormAction.java	2012-04-04 11:58:27 +0000
@@ -0,0 +1,61 @@
+package org.hisp.dhis.reports.benificiaryinfo.action;
+
+import java.util.Collection;
+
+import org.hisp.dhis.patient.PatientAttribute;
+import org.hisp.dhis.patient.PatientAttributeService;
+
+import com.opensymphony.xwork2.Action;
+
+public class PatientInfoReportsFormAction implements Action
+{
+    
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
+    
+    private PatientAttributeService patientAttributeService;
+
+    public void setPatientAttributeService( PatientAttributeService patientAttributeService )
+    {
+        this.patientAttributeService = patientAttributeService;
+    }
+    
+    // -------------------------------------------------------------------------
+    // Input/output
+    // -------------------------------------------------------------------------
+
+    private Collection<PatientAttribute> patientAttributes;
+
+    public Collection<PatientAttribute> getPatientAttributes()
+    {
+        return patientAttributes;
+    }
+
+    
+    
+    // -------------------------------------------------------------------------
+    // Action implementation
+    // -------------------------------------------------------------------------
+    
+    public String execute() throws Exception
+    {
+        
+        patientAttributes = patientAttributeService.getAllPatientAttributes();
+        /*
+        programs = programService.getAllPrograms();
+
+        organisationUnit = selectionManager.getSelectedOrganisationUnit();
+
+        if ( organisationUnit == null )
+        {
+            status = 1;
+        }
+        else if ( !organisationUnit.isHasPatients() )
+        {
+            status = 2;
+        }
+    */
+        return SUCCESS;
+    }
+}

=== added file 'local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/ed/action/RankingReportResultAction.java'
--- local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/ed/action/RankingReportResultAction.java	1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/ed/action/RankingReportResultAction.java	2012-04-04 11:58:27 +0000
@@ -0,0 +1,542 @@
+package org.hisp.dhis.reports.ed.action;
+
+import static org.hisp.dhis.system.util.ConversionUtils.getIdentifiers;
+import static org.hisp.dhis.system.util.TextUtils.getCommaDelimitedString;
+
+import java.io.BufferedInputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.InputStream;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import jxl.Workbook;
+import jxl.format.Alignment;
+import jxl.format.Border;
+import jxl.format.BorderLineStyle;
+import jxl.format.Colour;
+import jxl.format.VerticalAlignment;
+import jxl.write.Formula;
+import jxl.write.Label;
+import jxl.write.Number;
+import jxl.write.WritableCellFormat;
+import jxl.write.WritableSheet;
+import jxl.write.WritableWorkbook;
+
+import org.amplecode.quick.StatementManager;
+import org.hisp.dhis.common.comparator.IdentifiableObjectNameComparator;
+import org.hisp.dhis.config.Configuration_IN;
+import org.hisp.dhis.indicator.Indicator;
+import org.hisp.dhis.indicator.IndicatorService;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.organisationunit.OrganisationUnitService;
+import org.hisp.dhis.period.Period;
+import org.hisp.dhis.period.PeriodService;
+import org.hisp.dhis.reports.ReportService;
+import org.hisp.dhis.user.CurrentUserService;
+
+import com.opensymphony.xwork2.Action;
+
+public class RankingReportResultAction implements Action
+{
+    private final String GENERATEAGGDATA = "generateaggdata";
+
+    private final String USEEXISTINGAGGDATA = "useexistingaggdata";
+
+    private final String USECAPTUREDDATA = "usecaptureddata";
+    
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
+    private StatementManager statementManager;
+
+    public void setStatementManager( StatementManager statementManager )
+    {
+        this.statementManager = statementManager;
+    }
+
+    private PeriodService periodService;
+
+    public void setPeriodService( PeriodService periodService )
+    {
+        this.periodService = periodService;
+    }
+
+    private IndicatorService indicatorService;
+
+    public void setIndicatorService( IndicatorService indicatorService )
+    {
+        this.indicatorService = indicatorService;
+    }
+
+    private ReportService reportService;
+
+    public void setReportService( ReportService reportService )
+    {
+        this.reportService = reportService;
+    }
+    
+    private CurrentUserService currentUserService;
+
+    public void setCurrentUserService( CurrentUserService currentUserService )
+    {
+        this.currentUserService = currentUserService;
+    }    
+
+    private OrganisationUnitService organisationUnitService;
+
+    public void setOrganisationUnitService( OrganisationUnitService organisationUnitService )
+    {
+        this.organisationUnitService = organisationUnitService;
+    }
+
+    // -------------------------------------------------------------------------
+    // Getter & Setter
+    // -------------------------------------------------------------------------
+    private InputStream inputStream;
+
+    public InputStream getInputStream()
+    {
+        return inputStream;
+    }
+
+    private String fileName;
+
+    public String getFileName()
+    {
+        return fileName;
+    }
+
+    private Integer selectedStartPeriodId;
+
+    public void setSelectedStartPeriodId( Integer selectedStartPeriodId )
+    {
+        this.selectedStartPeriodId = selectedStartPeriodId;
+    }
+
+    private Integer selectedEndPeriodId;
+
+    public void setSelectedEndPeriodId( Integer selectedEndPeriodId )
+    {
+        this.selectedEndPeriodId = selectedEndPeriodId;
+    }
+/*
+    private Integer indicatorGroupId;
+    
+    public void setIndicatorGroupId( Integer indicatorGroupId )
+    {
+        this.indicatorGroupId = indicatorGroupId;
+    }
+*/
+    private String aggData;
+    
+    public void setAggData( String aggData )
+    {
+        this.aggData = aggData;
+    }
+    
+    private List<OrganisationUnit> orgUnitList;
+    
+    private List<String> selectedIndicators;
+
+    public void setSelectedIndicators( List<String> selectedIndicators )
+    {
+        this.selectedIndicators = selectedIndicators;
+    }
+    
+    
+    // -------------------------------------------------------------------------
+    // Action implementation
+    // -------------------------------------------------------------------------
+
+    public String execute()
+        throws Exception
+    {
+        statementManager.initialise();
+        
+        String[] excelColumns = 
+            {   "A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z",
+                "AA","AB","AC","AD","AE","AF","AG","AH","AI","AJ","AK","AL","AM","AN","AO","AP","AQ","AR","AS","AT","AU","AV","AW","AX","AY","AZ",
+                "BA","BB","BC","BD","BE","BF","BG","BH","BI","BJ","BK","BL","BM","BN","BO","BP","BQ","BR","BS","BT","BU","BV","BW","BX","BY","BZ" 
+            };
+        
+        orgUnitList = new ArrayList<OrganisationUnit>();
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat( "MMM-yy" );
+        
+        //System.out.println( "selected Indicators size : " + selectedIndicators.size() );
+        
+        System.out.println( "Report Generation Start Time is : \t" + new Date() );
+        
+        String outputReportPath = System.getenv( "DHIS2_HOME" ) + File.separator +  Configuration_IN.DEFAULT_TEMPFOLDER;
+        File newdir = new File( outputReportPath );
+        if( !newdir.exists() )
+        {
+            newdir.mkdirs();
+        }
+        outputReportPath += File.separator + UUID.randomUUID().toString() + ".xls";
+
+        WritableWorkbook outputReportWorkbook = Workbook.createWorkbook( new File( outputReportPath ) );
+        WritableSheet sheet0 = outputReportWorkbook.createSheet( "RankingReport", 0 );
+        
+        // Period Info
+        Period selectedStartPeriod = periodService.getPeriod( selectedStartPeriodId );
+        Period selectedEndPeriod = periodService.getPeriod( selectedEndPeriodId );
+        
+        if ( selectedStartPeriod == null || selectedEndPeriod == null )
+        {
+            System.out.println( "There is no period with that id" );
+            sheet0.addCell( new Label( 2, 2, "There is no period with that id", getCellFormat2() ) );
+            outputReportWorkbook.write();
+            outputReportWorkbook.close();
+
+            fileName = "RankingReport.xls";
+            File outputReportFile = new File( outputReportPath );
+            inputStream = new BufferedInputStream( new FileInputStream( outputReportFile ) );
+
+            outputReportFile.deleteOnExit();
+            statementManager.destroy();
+            return SUCCESS;
+        }
+
+        List<Period> periodList = new ArrayList<Period>( periodService.getIntersectingPeriods( selectedStartPeriod.getStartDate(), selectedEndPeriod.getEndDate() ) );
+        Collection<Integer> periodIds = new ArrayList<Integer>( getIdentifiers(Period.class, periodList ) );
+        String periodIdsByComma = getCommaDelimitedString( periodIds );
+
+        
+        List<OrganisationUnit> curUserRootOrgUnitList = new ArrayList<OrganisationUnit>( currentUserService.getCurrentUser().getOrganisationUnits() );
+        String orgUnitName = "";
+        
+        if ( curUserRootOrgUnitList != null && curUserRootOrgUnitList.size() > 0 )
+        {
+            for ( OrganisationUnit orgUnit : curUserRootOrgUnitList )
+            {
+                orgUnitName += orgUnit.getName() + ", ";
+                List<OrganisationUnit> childList = new ArrayList<OrganisationUnit>( orgUnit.getChildren() );
+                Collections.sort( childList, new IdentifiableObjectNameComparator() );
+                orgUnitList.addAll( childList );
+                orgUnitList.add( orgUnit );
+            }
+        }
+      
+        if ( curUserRootOrgUnitList == null || curUserRootOrgUnitList.size() == 0 )
+        {
+            System.out.println( "There is no orgunit with that User" );
+            sheet0.addCell( new Label( 2, 2, "There is no orgunit with that User", getCellFormat2() ) );
+            outputReportWorkbook.write();
+            outputReportWorkbook.close();
+
+            fileName = "RankingReport.xls";
+            File outputReportFile = new File( outputReportPath );
+            inputStream = new BufferedInputStream( new FileInputStream( outputReportFile ) );
+
+            outputReportFile.deleteOnExit();
+            statementManager.destroy();
+
+            return SUCCESS;
+        }
+
+        //IndicatorGroup selectedIndicatorGroup = indicatorService.getIndicatorGroup( indicatorGroupId );
+        
+        //if ( selectedIndicatorGroup == null )
+        if ( selectedIndicators == null || selectedIndicators.size() == 0 )
+        {
+            System.out.println( "There is no IndicatorGroup with that id" );
+            sheet0.addCell( new Label( 2, 2, "There is no IndicatorGroup with that id", getCellFormat2() ) );
+            outputReportWorkbook.write();
+            outputReportWorkbook.close();
+
+            fileName = "IndicatorReport.xls";
+            File outputReportFile = new File( outputReportPath );
+            inputStream = new BufferedInputStream( new FileInputStream( outputReportFile ) );
+
+            outputReportFile.deleteOnExit();
+
+            statementManager.destroy();
+            return SUCCESS;
+        }
+
+        //List<Indicator> indicators = new ArrayList<Indicator>( selectedIndicatorGroup.getMembers() );
+        
+        List<Indicator> indicatorList = new ArrayList<Indicator>();
+        Iterator<String> deIterator = selectedIndicators.iterator();
+        while ( deIterator.hasNext() )
+        {
+            // String indicatorId = (String) deIterator.next();
+            int serviceID = Integer.parseInt( (String) deIterator.next() );
+            Indicator indicator = indicatorService.getIndicator( serviceID );
+           
+            indicatorList.add( indicator );
+
+        }
+        
+        //String dataElmentIdsByComma = getDataelementIds( indicators );
+        String dataElmentIdsByComma = getDataelementIds( indicatorList );
+        //String dataElmentIdsByComma = getDataelementIds( indicators );
+        
+        int rowCount = 4;
+        int colCount = 0;
+
+        // Printing Header Info
+        sheet0.mergeCells( colCount, rowCount, colCount, rowCount + 1 );
+        sheet0.addCell( new Label( colCount++, rowCount, "Sl. No.", getCellFormat1() ) );
+        sheet0.mergeCells( colCount, rowCount, colCount, rowCount + 1 );
+        sheet0.addCell( new Label( colCount++, rowCount, "Facility", getCellFormat1() ) );
+
+        //for ( Indicator indicator : indicators )
+        for ( Indicator indicator : indicatorList )
+        {
+            sheet0.mergeCells( colCount, rowCount, colCount + 1, rowCount );
+            sheet0.addCell( new Label( colCount, rowCount, indicator.getName(), getCellFormat1() ) );
+            //sheet0.addCell( new Label( colCount++, rowCount + 1, "Numerator", getCellFormat1() ) );
+            //sheet0.addCell( new Label( colCount++, rowCount + 1, "Denominator", getCellFormat1() ) );
+            sheet0.addCell( new Label( colCount++, rowCount + 1, "Indicator Value", getCellFormat1() ) );
+            sheet0.addCell( new Label( colCount++, rowCount + 1, "Rank", getCellFormat1() ) );
+        }
+
+        // Printing Main Header Info
+        //String mainHeaderInfo = "Indicator Group Name - " + selectedIndicatorGroup.getName() +  " ,OrgUnit Name is "+ orgUnitName + " From : "
+        String mainHeaderInfo = "OrgUnit Name is "+ orgUnitName + " From : " + simpleDateFormat.format( selectedStartPeriod.getStartDate() ) + " To : "
+            + simpleDateFormat.format( selectedEndPeriod.getStartDate() );
+        sheet0.mergeCells( 0, 1, colCount - 1, 1 );
+        sheet0.addCell( new Label( 0, 1, mainHeaderInfo, getCellFormat1() ) );
+
+        rowCount += 2;
+        int slno = 1;
+        int rowStart = rowCount+1;
+        for ( OrganisationUnit ou : orgUnitList )
+        {
+            colCount = 0;
+            Map<String, String> aggDeMap = new HashMap<String, String>();
+            if( aggData.equalsIgnoreCase( USEEXISTINGAGGDATA ) )
+            {
+                aggDeMap.putAll( reportService.getResultDataValueFromAggregateTable( ou.getId(), dataElmentIdsByComma, periodIdsByComma ) );
+            }
+            else if( aggData.equalsIgnoreCase( GENERATEAGGDATA ) )
+            {
+                List<OrganisationUnit> childOrgUnitTree = new ArrayList<OrganisationUnit>( organisationUnitService.getOrganisationUnitWithChildren( ou.getId() ) );
+                List<Integer> childOrgUnitTreeIds = new ArrayList<Integer>( getIdentifiers( OrganisationUnit.class, childOrgUnitTree ) );
+                String childOrgUnitsByComma = getCommaDelimitedString( childOrgUnitTreeIds );
+
+                aggDeMap.putAll( reportService.getAggDataFromDataValueTable( childOrgUnitsByComma, dataElmentIdsByComma, periodIdsByComma ) );
+            }
+            else if( aggData.equalsIgnoreCase( USECAPTUREDDATA ) )
+            {
+                aggDeMap.putAll( reportService.getAggDataFromDataValueTable( ""+ou.getId(), dataElmentIdsByComma, periodIdsByComma ) );
+            }
+
+            if ( slno != orgUnitList.size() )
+            {
+                sheet0.addCell( new Number( colCount++, rowCount, slno, getCellFormat2() ) );
+                sheet0.addCell( new Label( colCount++, rowCount, ou.getName(), getCellFormat2() ) );
+            }
+            else
+            {
+                sheet0.addCell( new Label( colCount++, rowCount, "", getCellFormat1() ) );
+                sheet0.addCell( new Label( colCount++, rowCount, ou.getName(), getCellFormat1() ) );
+            }
+            
+            //for ( Indicator indicator : indicators )
+            for ( Indicator indicator : indicatorList )
+            {
+                Double numValue = 0.0;
+                Double denValue = 0.0;
+                Double indValue = 0.0;
+                
+                try
+                {
+                    numValue = Double.parseDouble( reportService.getAggVal( indicator.getNumerator(), aggDeMap ) );
+                }
+                catch( Exception e )
+                {
+                    numValue = 0.0;
+                }
+                
+                try
+                {
+                    denValue = Double.parseDouble( reportService.getAggVal( indicator.getDenominator(), aggDeMap ) );    
+                }
+                catch( Exception e )
+                {
+                    denValue = 0.0;
+                }
+
+                try
+                {
+                    if( denValue != 0.0 )
+                    {
+                        indValue = ( numValue / denValue ) * indicator.getIndicatorType().getFactor();
+                    }
+                    else
+                    {
+                        indValue = 0.0;
+                    }
+                }
+                catch( Exception e )
+                {
+                    indValue = 0.0;
+                }
+
+                if ( indValue == null )
+                    indValue = 0.0;
+                if ( numValue == null )
+                    numValue = 0.0;
+                if ( denValue == null )
+                    denValue = 0.0;
+                
+                numValue = Math.round( numValue * Math.pow( 10, 1 ) ) / Math.pow( 10, 1 );
+                denValue = Math.round( denValue * Math.pow( 10, 1 ) ) / Math.pow( 10, 1 );
+                indValue = Math.round( indValue * Math.pow( 10, 1 ) ) / Math.pow( 10, 1 );
+
+                //sheet0.addCell( new Number( colCount++, rowCount, numValue, getCellFormat2() ) );
+                //sheet0.addCell( new Number( colCount++, rowCount, denValue, getCellFormat2() ) );
+                
+                
+                if( slno != orgUnitList.size() )
+                {
+                    sheet0.addCell( new Number( colCount++, rowCount, indValue, getCellFormat2() ) );
+                    String rankFormula = "RANK("+ excelColumns[colCount-1]  +""+(rowCount+1)+","+excelColumns[colCount-1]+""+rowStart+""+":"+excelColumns[colCount-1]+""+(rowStart+orgUnitList.size()-2)+",0)";
+                    System.out.println( rankFormula );
+                    sheet0.addCell( new Formula( colCount++, rowCount, rankFormula, getCellFormat1()) );
+                }
+                else
+                {
+                    //sheet0.mergeCells( 0, rowCount, colCount - 1, rowCount );
+                    //sheet0.addCell( new Label( 0, rowCount++, "", getCellFormat1() ) );
+
+                    sheet0.addCell( new Number( colCount++, rowCount, indValue, getCellFormat1() ) );
+                    sheet0.addCell( new Label( colCount++, rowCount, " ", getCellFormat1()) );
+                }
+            }
+
+            slno++;
+            rowCount++;
+        }
+
+        // Printing Indicator Formula Info
+        rowCount++;
+        colCount = 2;
+
+        sheet0.mergeCells( colCount, rowCount, colCount + 2, rowCount );
+        sheet0.addCell( new Label( colCount, rowCount, "Indicator Name", getCellFormat1() ) );
+        colCount += 3;
+        sheet0.mergeCells( colCount, rowCount, colCount + 2, rowCount );
+        sheet0.addCell( new Label( colCount, rowCount, "Numerator Desciption", getCellFormat1() ) );
+        colCount += 3;
+        sheet0.mergeCells( colCount, rowCount, colCount + 2, rowCount );
+        sheet0.addCell( new Label( colCount, rowCount, "Denominator Description", getCellFormat1() ) );
+
+        rowCount++;
+        
+        //for ( Indicator indicator : indicators )
+        for ( Indicator indicator : indicatorList )
+        {
+            colCount = 2;
+
+            sheet0.mergeCells( colCount, rowCount, colCount + 2, rowCount );
+            sheet0.addCell( new Label( colCount, rowCount, indicator.getName(), getCellFormat2() ) );
+            colCount += 3;
+            sheet0.mergeCells( colCount, rowCount, colCount + 2, rowCount );
+            sheet0.addCell( new Label( colCount, rowCount, indicator.getNumeratorDescription(), getCellFormat2() ) );
+            colCount += 3;
+            sheet0.mergeCells( colCount, rowCount, colCount + 2, rowCount );
+            sheet0.addCell( new Label( colCount, rowCount, indicator.getDenominatorDescription(), getCellFormat2() ) );
+
+            rowCount++;
+        }
+
+        outputReportWorkbook.write();
+        outputReportWorkbook.close();
+
+        
+        fileName = "RankingReport_" + orgUnitName + "_" + simpleDateFormat.format( selectedStartPeriod.getStartDate() ) + "_" + simpleDateFormat.format( selectedEndPeriod.getStartDate() ) + ".xls";
+        fileName = fileName.replaceAll( " ", "" );
+        fileName = fileName.replaceAll( ",", "_" );
+        
+        File outputReportFile = new File( outputReportPath );
+        
+        System.out.println( fileName );
+        
+        inputStream = new BufferedInputStream( new FileInputStream( outputReportFile ) );
+
+        outputReportFile.deleteOnExit();
+
+        statementManager.destroy();
+        System.out.println( "Report Generation End Time is : \t" + new Date() );
+        return SUCCESS;
+    }
+
+
+    public WritableCellFormat getCellFormat1()
+        throws Exception
+    {
+        WritableCellFormat wCellformat = new WritableCellFormat();
+
+        wCellformat.setBorder( Border.ALL, BorderLineStyle.THIN );
+        wCellformat.setAlignment( Alignment.CENTRE );
+        wCellformat.setVerticalAlignment( VerticalAlignment.CENTRE );
+        wCellformat.setBackground( Colour.GRAY_25 );
+        wCellformat.setWrap( true );
+
+        return wCellformat;
+    }
+
+    public WritableCellFormat getCellFormat2()
+        throws Exception
+    {
+        WritableCellFormat wCellformat = new WritableCellFormat();
+
+        wCellformat.setBorder( Border.ALL, BorderLineStyle.THIN );
+        wCellformat.setAlignment( Alignment.CENTRE );
+        wCellformat.setVerticalAlignment( VerticalAlignment.CENTRE );
+        wCellformat.setWrap( true );
+
+        return wCellformat;
+    }
+    
+    public String getDataelementIds( List<Indicator> indicatorList )
+    {
+        String dataElmentIdsByComma = "-1";
+        for( Indicator indicator : indicatorList )
+        {
+            String formula = indicator.getNumerator() + " + " + indicator.getDenominator();
+            try
+            {
+                Pattern pattern = Pattern.compile( "(\\[\\d+\\.\\d+\\])" );
+
+                Matcher matcher = pattern.matcher( formula );
+                StringBuffer buffer = new StringBuffer();
+
+                while ( matcher.find() )
+                {
+                    String replaceString = matcher.group();
+
+                    replaceString = replaceString.replaceAll( "[\\[\\]]", "" );
+                    replaceString = replaceString.substring( 0, replaceString.indexOf( '.' ) );
+
+                    int dataElementId = Integer.parseInt( replaceString );
+                    dataElmentIdsByComma += "," + dataElementId;
+                    replaceString = "";
+                    matcher.appendReplacement( buffer, replaceString );
+                }
+            }
+            catch( Exception e )
+            {
+                
+            }
+        }
+        
+        return dataElmentIdsByComma;
+    }
+
+
+}

=== modified file 'local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/portal/action/PortalReportsResultAction.java'
--- local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/portal/action/PortalReportsResultAction.java	2012-02-02 09:56:51 +0000
+++ local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/portal/action/PortalReportsResultAction.java	2012-04-04 11:58:27 +0000
@@ -765,7 +765,8 @@
                                             if ( pStageInstance.getExecutionDate() != null ) {
                                                 if ( includePeriod.equalsIgnoreCase( "periodincluding" ) ) {
                                                     if ( pStageInstance.getExecutionDate().before( eDate ) ) {
-                                                        PatientDataValue patientDataValue1 = patientDataValueService.getPatientDataValue( pStageInstance, d1e, patientOuList.get(patient) );
+                                                        //PatientDataValue patientDataValue1 = patientDataValueService.getPatientDataValue( pStageInstance, d1e, patientOuList.get(patient) );
+                                                        PatientDataValue patientDataValue1 = patientDataValueService.getPatientDataValue( pStageInstance, d1e );
 
                                                         if ( patientDataValue1 == null ) {
                                                             tempStr = " ";
@@ -798,7 +799,8 @@
                                                         }
                                                     }
                                                 } else {
-                                                    PatientDataValue patientDataValue1 = patientDataValueService.getPatientDataValue( pStageInstance, d1e, patientOuList.get(patient) );
+                                                    //PatientDataValue patientDataValue1 = patientDataValueService.getPatientDataValue( pStageInstance, d1e, patientOuList.get(patient) );
+                                                    PatientDataValue patientDataValue1 = patientDataValueService.getPatientDataValue( pStageInstance, d1e );
 
                                                     if ( patientDataValue1 == null ) {
                                                         tempStr = " ";
@@ -853,7 +855,8 @@
                                             {
                                                 ProgramStageInstance programStageInstance = itrPSI.next();
 
-                                                PatientDataValue patientDataValue = patientDataValueService.getPatientDataValue( programStageInstance, d1e, patientOuList.get(patient) );
+                                                //PatientDataValue patientDataValue = patientDataValueService.getPatientDataValue( programStageInstance, d1e, patientOuList.get(patient) );
+                                                PatientDataValue patientDataValue = patientDataValueService.getPatientDataValue( programStageInstance, d1e );
                                                 //System.out.println("psi = "+programStageInstance.getId() + " de = "+d1e + " ou = "+patientOuList.get(patient));
                                                 if ( patientDataValue != null )
                                                 {
@@ -1006,7 +1009,8 @@
                                         while ( itrPSI.hasNext() )
                                         {
                                             ProgramStageInstance programStageInstance = itrPSI.next();
-                                            PatientDataValue patientDataValue = patientDataValueService.getPatientDataValue( programStageInstance, d1e, patientOuList.get(patient) );
+                                            //PatientDataValue patientDataValue = patientDataValueService.getPatientDataValue( programStageInstance, d1e, patientOuList.get(patient) );
+                                            PatientDataValue patientDataValue = patientDataValueService.getPatientDataValue( programStageInstance, d1e );
                                             if ( patientDataValue != null )
                                             {
                                                 if ( d1e.getType().equalsIgnoreCase( DataElement.VALUE_TYPE_DATE ) )
@@ -1058,7 +1062,8 @@
                                         {
 
                                             ProgramStageInstance programStageInstance = itrPSI.next();
-                                            PatientDataValue patientDataValue1 = patientDataValueService.getPatientDataValue( programStageInstance, d1e, patientOuList.get(patient) );
+                                            //PatientDataValue patientDataValue1 = patientDataValueService.getPatientDataValue( programStageInstance, d1e, patientOuList.get(patient) );
+                                            PatientDataValue patientDataValue1 = patientDataValueService.getPatientDataValue( programStageInstance, d1e );
                                             if ( patientDataValue1 != null )
                                             {
                                                 ifaCount = Integer.parseInt( patientDataValue1.getValue() ) + ifaCount;
@@ -1457,7 +1462,8 @@
                                             if ( pStageInstance.getExecutionDate() != null ) {
                                                 if ( includePeriod.equalsIgnoreCase( "periodincluding" ) ) {
                                                     if ( pStageInstance.getExecutionDate().before( eDate ) ) {
-                                                        PatientDataValue patientDataValue1 = patientDataValueService.getPatientDataValue( pStageInstance, d1e, patientOuList.get(patient) );
+                                                        //PatientDataValue patientDataValue1 = patientDataValueService.getPatientDataValue( pStageInstance, d1e, patientOuList.get(patient) );
+                                                        PatientDataValue patientDataValue1 = patientDataValueService.getPatientDataValue( pStageInstance, d1e );
 
                                                         if ( patientDataValue1 == null ) {
                                                             tempStr = " ";
@@ -1490,8 +1496,8 @@
                                                         }
                                                     }
                                                 } else {
-                                                    PatientDataValue patientDataValue1 = patientDataValueService.getPatientDataValue( pStageInstance, d1e, patientOuList.get(patient) );
-
+                                                    //PatientDataValue patientDataValue1 = patientDataValueService.getPatientDataValue( pStageInstance, d1e, patientOuList.get(patient) );
+                                                    PatientDataValue patientDataValue1 = patientDataValueService.getPatientDataValue( pStageInstance, d1e );
                                                     if ( patientDataValue1 == null ) {
                                                         tempStr = " ";
                                                     } else if ( d1e.getType().equalsIgnoreCase( DataElement.VALUE_TYPE_STRING ) && d1e.isMultiDimensional() ) {
@@ -1545,7 +1551,8 @@
                                             {
                                                 ProgramStageInstance programStageInstance = itrPSI.next();
 
-                                                PatientDataValue patientDataValue = patientDataValueService.getPatientDataValue( programStageInstance, d1e, patientOuList.get(patient) );
+                                                //PatientDataValue patientDataValue = patientDataValueService.getPatientDataValue( programStageInstance, d1e, patientOuList.get(patient) );
+                                                PatientDataValue patientDataValue = patientDataValueService.getPatientDataValue( programStageInstance, d1e );
                                                 //System.out.println("psi = "+programStageInstance.getId() + " de = "+d1e + " ou = "+patientOuList.get(patient));
                                                 if ( patientDataValue != null )
                                                 {
@@ -1698,7 +1705,8 @@
                                         while ( itrPSI.hasNext() )
                                         {
                                             ProgramStageInstance programStageInstance = itrPSI.next();
-                                            PatientDataValue patientDataValue = patientDataValueService.getPatientDataValue( programStageInstance, d1e, patientOuList.get(patient) );
+                                           // PatientDataValue patientDataValue = patientDataValueService.getPatientDataValue( programStageInstance, d1e, patientOuList.get(patient) );
+                                            PatientDataValue patientDataValue = patientDataValueService.getPatientDataValue( programStageInstance, d1e );
                                             if ( patientDataValue != null )
                                             {
                                                 if ( d1e.getType().equalsIgnoreCase( DataElement.VALUE_TYPE_DATE ) )
@@ -1750,7 +1758,8 @@
                                         {
 
                                             ProgramStageInstance programStageInstance = itrPSI.next();
-                                            PatientDataValue patientDataValue1 = patientDataValueService.getPatientDataValue( programStageInstance, d1e, patientOuList.get(patient) );
+                                           // PatientDataValue patientDataValue1 = patientDataValueService.getPatientDataValue( programStageInstance, d1e, patientOuList.get(patient) );
+                                            PatientDataValue patientDataValue1 = patientDataValueService.getPatientDataValue( programStageInstance, d1e );
                                             if ( patientDataValue1 != null )
                                             {
                                                 ifaCount = Integer.parseInt( patientDataValue1.getValue() ) + ifaCount;

=== modified file 'local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/portal/action/PortalReportsResult_ACS.java'
--- local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/portal/action/PortalReportsResult_ACS.java	2012-02-17 07:09:28 +0000
+++ local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/portal/action/PortalReportsResult_ACS.java	2012-04-04 11:58:27 +0000
@@ -354,7 +354,8 @@
                     else if( sType.equalsIgnoreCase("dataelement") )
                     {
                         DataElement de = dataElementService.getDataElement( Integer.parseInt( deCode ) );
-                        PatientDataValue patientDV = patientDataValueService.getPatientDataValue( prgStageInstance, de, selectedOrgUnit );
+                        //PatientDataValue patientDV = patientDataValueService.getPatientDataValue( prgStageInstance, de, selectedOrgUnit );
+                        PatientDataValue patientDV = patientDataValueService.getPatientDataValue( prgStageInstance, de );
                         if( patientDV != null && patientDV.getValue() != null )
                         {
                                 tempStr = patientDV.getValue();
@@ -363,7 +364,8 @@
                     else if( sType.equalsIgnoreCase("dataelement-dd") )
                     {
                         DataElement de = dataElementService.getDataElement( Integer.parseInt( deCode ) );
-                        PatientDataValue patientDV = patientDataValueService.getPatientDataValue( prgStageInstance, de, selectedOrgUnit );
+                        //PatientDataValue patientDV = patientDataValueService.getPatientDataValue( prgStageInstance, de, selectedOrgUnit );
+                        PatientDataValue patientDV = patientDataValueService.getPatientDataValue( prgStageInstance, de );
                         if( patientDV != null && patientDV.getValue() != null )
                         {
                                 Integer optionComboId = Integer.parseInt( patientDV.getValue() );
@@ -374,7 +376,8 @@
                     else if( sType.equalsIgnoreCase("dataelement-b") )
                     {
                         DataElement de = dataElementService.getDataElement( Integer.parseInt( deCode ) );
-                        PatientDataValue patientDV = patientDataValueService.getPatientDataValue( prgStageInstance, de, selectedOrgUnit );
+                        //PatientDataValue patientDV = patientDataValueService.getPatientDataValue( prgStageInstance, de, selectedOrgUnit );
+                        PatientDataValue patientDV = patientDataValueService.getPatientDataValue( prgStageInstance, de );
                         if( patientDV != null && patientDV.getValue() != null )
                         {
                                 if( patientDV.getValue().equalsIgnoreCase("false") )
@@ -394,13 +397,15 @@
                         //System.out.println( " dealy : " + dealy + " ,reason: " + reason );
                         
                         DataElement deDealy = dataElementService.getDataElement( Integer.parseInt( dealy ) );
-                        PatientDataValue patientDelayDV = patientDataValueService.getPatientDataValue( prgStageInstance, deDealy, selectedOrgUnit );
+                        //PatientDataValue patientDelayDV = patientDataValueService.getPatientDataValue( prgStageInstance, deDealy, selectedOrgUnit );
+                        PatientDataValue patientDelayDV = patientDataValueService.getPatientDataValue( prgStageInstance, deDealy );
                         if( patientDelayDV != null && patientDelayDV.getValue() != null )
                         {
                             if( patientDelayDV.getValue().equalsIgnoreCase("true") )
                             {
                                 DataElement deReason = dataElementService.getDataElement( Integer.parseInt( reason ) );
-                                PatientDataValue patientReasonDV = patientDataValueService.getPatientDataValue( prgStageInstance, deReason, selectedOrgUnit );
+                                //PatientDataValue patientReasonDV = patientDataValueService.getPatientDataValue( prgStageInstance, deReason, selectedOrgUnit );
+                                PatientDataValue patientReasonDV = patientDataValueService.getPatientDataValue( prgStageInstance, deReason );
                                 if( patientReasonDV != null && patientReasonDV.getValue() != null )
                                 {
                                         Integer optionComboId = Integer.parseInt( patientReasonDV.getValue() );
@@ -431,14 +436,16 @@
                         }
                         
                         DataElement deWeight = dataElementService.getDataElement( Integer.parseInt( weightDE ) );
-                        PatientDataValue patientWeightDV = patientDataValueService.getPatientDataValue( prgStageInstance, deWeight, selectedOrgUnit );
+                       // PatientDataValue patientWeightDV = patientDataValueService.getPatientDataValue( prgStageInstance, deWeight, selectedOrgUnit );
+                        PatientDataValue patientWeightDV = patientDataValueService.getPatientDataValue( prgStageInstance, deWeight );
                         if( patientWeightDV != null && patientWeightDV.getValue() != null )
                         {
                             tempStrWeight = patientWeightDV.getValue();
                         }
                         
                         DataElement deHeight = dataElementService.getDataElement( Integer.parseInt( heightDE ) );
-                        PatientDataValue patientHeightDV = patientDataValueService.getPatientDataValue( prgStageInstance, deHeight, selectedOrgUnit );
+                        //PatientDataValue patientHeightDV = patientDataValueService.getPatientDataValue( prgStageInstance, deHeight, selectedOrgUnit );
+                        PatientDataValue patientHeightDV = patientDataValueService.getPatientDataValue( prgStageInstance, deHeight );
                         if( patientHeightDV != null && patientHeightDV.getValue() != null )
                         {
                             tempStrHeight = patientHeightDV.getValue();
@@ -485,14 +492,16 @@
                         }
                         
                         DataElement deStart = dataElementService.getDataElement( Integer.parseInt( startDE ) );
-                        PatientDataValue patientStartDV = patientDataValueService.getPatientDataValue( prgStageInstance, deStart, selectedOrgUnit );
+                        //PatientDataValue patientStartDV = patientDataValueService.getPatientDataValue( prgStageInstance, deStart, selectedOrgUnit );
+                        PatientDataValue patientStartDV = patientDataValueService.getPatientDataValue( prgStageInstance, deStart );
                         if( patientStartDV != null && patientStartDV.getValue() != null )
                         {
                             tempStartDate = patientStartDV.getValue();
                         }
                         
                         DataElement deEnd = dataElementService.getDataElement( Integer.parseInt( endDE ) );
-                        PatientDataValue patientEndDV = patientDataValueService.getPatientDataValue( prgStageInstance, deEnd, selectedOrgUnit );
+                        //PatientDataValue patientEndDV = patientDataValueService.getPatientDataValue( prgStageInstance, deEnd, selectedOrgUnit );
+                        PatientDataValue patientEndDV = patientDataValueService.getPatientDataValue( prgStageInstance, deEnd );
                         if( patientEndDV != null && patientEndDV.getValue() != null )
                         {
                             tempEndDate = patientEndDV.getValue();
@@ -551,14 +560,16 @@
                         }
                         
                         DataElement dePDate = dataElementService.getDataElement( Integer.parseInt( pdate ) );
-                        PatientDataValue patientPdateDV = patientDataValueService.getPatientDataValue( prgStageInstance, dePDate, selectedOrgUnit );
+                        //PatientDataValue patientPdateDV = patientDataValueService.getPatientDataValue( prgStageInstance, dePDate, selectedOrgUnit );
+                        PatientDataValue patientPdateDV = patientDataValueService.getPatientDataValue( prgStageInstance, dePDate );
                         if( patientPdateDV != null && patientPdateDV.getValue() != null )
                         {
                             tempPDate = patientPdateDV.getValue();
                         }
                         
                         DataElement dePTime = dataElementService.getDataElement( Integer.parseInt( pTime ) );
-                        PatientDataValue patientPTimeDV = patientDataValueService.getPatientDataValue( prgStageInstance, dePTime, selectedOrgUnit );
+                        //PatientDataValue patientPTimeDV = patientDataValueService.getPatientDataValue( prgStageInstance, dePTime, selectedOrgUnit );
+                        PatientDataValue patientPTimeDV = patientDataValueService.getPatientDataValue( prgStageInstance, dePTime );
                         if( patientPTimeDV != null && patientPTimeDV.getValue() != null )
                         {
                             tempPTime = patientPTimeDV.getValue();
@@ -603,7 +614,8 @@
                         }
                         
                         DataElement deAcsDate = dataElementService.getDataElement( Integer.parseInt( acsDate ) );
-                        PatientDataValue patientAcsdateDV = patientDataValueService.getPatientDataValue( prgStageInstance, deAcsDate, selectedOrgUnit );
+                        //PatientDataValue patientAcsdateDV = patientDataValueService.getPatientDataValue( prgStageInstance, deAcsDate, selectedOrgUnit );
+                        PatientDataValue patientAcsdateDV = patientDataValueService.getPatientDataValue( prgStageInstance, deAcsDate );
                         if( patientAcsdateDV != null && patientAcsdateDV.getValue() != null )
                         {
                             tempAcsDate = patientAcsdateDV.getValue();
@@ -611,14 +623,16 @@
                         
                         
                         DataElement deAcsTime = dataElementService.getDataElement( Integer.parseInt( acsTime ) );
-                        PatientDataValue patientAcsTimeDV = patientDataValueService.getPatientDataValue( prgStageInstance, deAcsTime, selectedOrgUnit );
+                        //PatientDataValue patientAcsTimeDV = patientDataValueService.getPatientDataValue( prgStageInstance, deAcsTime, selectedOrgUnit );
+                        PatientDataValue patientAcsTimeDV = patientDataValueService.getPatientDataValue( prgStageInstance, deAcsTime );
                         if( patientAcsTimeDV != null && patientAcsTimeDV.getValue() != null )
                         {
                             tempAcsTime = patientAcsTimeDV.getValue();
                         }
                         
                         DataElement dePreDate = dataElementService.getDataElement( Integer.parseInt( preDate ) );
-                        PatientDataValue patientPredateDV = patientDataValueService.getPatientDataValue( prgStageInstance, dePreDate, selectedOrgUnit );
+                        //PatientDataValue patientPredateDV = patientDataValueService.getPatientDataValue( prgStageInstance, dePreDate, selectedOrgUnit );
+                        PatientDataValue patientPredateDV = patientDataValueService.getPatientDataValue( prgStageInstance, dePreDate );
                         if( patientPredateDV != null && patientPredateDV.getValue() != null )
                         {
                             tempPreDate = patientPredateDV.getValue();
@@ -627,7 +641,8 @@
                         
                         
                         DataElement dePreTime = dataElementService.getDataElement( Integer.parseInt( preTime ) );
-                        PatientDataValue patientPreTimeDV = patientDataValueService.getPatientDataValue( prgStageInstance, dePreTime, selectedOrgUnit );
+                        //PatientDataValue patientPreTimeDV = patientDataValueService.getPatientDataValue( prgStageInstance, dePreTime, selectedOrgUnit );
+                        PatientDataValue patientPreTimeDV = patientDataValueService.getPatientDataValue( prgStageInstance, dePreTime );
                         if( patientPreTimeDV != null && patientPreTimeDV.getValue() != null )
                         {
                             tempPreTime = patientPreTimeDV.getValue();
@@ -799,7 +814,8 @@
                     else if( sType.equalsIgnoreCase("dataelement") )
                     {
                         DataElement de = dataElementService.getDataElement( Integer.parseInt( deCode ) );
-                        PatientDataValue patientDV = patientDataValueService.getPatientDataValue( prgStageInstance, de, selectedOrgUnit );
+                        PatientDataValue patientDV = patientDataValueService.getPatientDataValue( prgStageInstance, de );
+                        //PatientDataValue patientDV = patientDataValueService.getPatientDataValue( prgStageInstance, de, selectedOrgUnit );
                         if( patientDV != null && patientDV.getValue() != null )
                         {
                                 tempStr = patientDV.getValue();
@@ -808,7 +824,8 @@
                     else if( sType.equalsIgnoreCase("dataelement-dd") )
                     {
                         DataElement de = dataElementService.getDataElement( Integer.parseInt( deCode ) );
-                        PatientDataValue patientDV = patientDataValueService.getPatientDataValue( prgStageInstance, de, selectedOrgUnit );
+                        //PatientDataValue patientDV = patientDataValueService.getPatientDataValue( prgStageInstance, de, selectedOrgUnit );
+                        PatientDataValue patientDV = patientDataValueService.getPatientDataValue( prgStageInstance, de );
                         if( patientDV != null && patientDV.getValue() != null )
                         {
                                 Integer optionComboId = Integer.parseInt( patientDV.getValue() );
@@ -819,7 +836,8 @@
                     else if( sType.equalsIgnoreCase("dataelement-b") )
                     {
                         DataElement de = dataElementService.getDataElement( Integer.parseInt( deCode ) );
-                        PatientDataValue patientDV = patientDataValueService.getPatientDataValue( prgStageInstance, de, selectedOrgUnit );
+                        //PatientDataValue patientDV = patientDataValueService.getPatientDataValue( prgStageInstance, de, selectedOrgUnit );
+                        PatientDataValue patientDV = patientDataValueService.getPatientDataValue( prgStageInstance, de );
                         if( patientDV != null && patientDV.getValue() != null )
                         {
                                 if( patientDV.getValue().equalsIgnoreCase("false") )

=== modified file 'local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/portal/action/PortalReportsResult_Action.java'
--- local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/portal/action/PortalReportsResult_Action.java	2012-02-17 07:09:28 +0000
+++ local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/portal/action/PortalReportsResult_Action.java	2012-04-04 11:58:27 +0000
@@ -434,7 +434,8 @@
                     else if( sType.equalsIgnoreCase("dataelement") )
                     {
                         DataElement de = dataElementService.getDataElement( Integer.parseInt( deCode ) );
-                        PatientDataValue patientDV = patientDataValueService.getPatientDataValue( prgStageInstance, de, selectedOrgUnit );
+                        //PatientDataValue patientDV = patientDataValueService.getPatientDataValue( prgStageInstance, de, selectedOrgUnit );
+                        PatientDataValue patientDV = patientDataValueService.getPatientDataValue( prgStageInstance, de );
                         if( patientDV != null && patientDV.getValue() != null )
                         {
                         	tempStr = patientDV.getValue();
@@ -443,7 +444,8 @@
                     else if( sType.equalsIgnoreCase("dataelement-dd") )
                     {
                         DataElement de = dataElementService.getDataElement( Integer.parseInt( deCode ) );
-                        PatientDataValue patientDV = patientDataValueService.getPatientDataValue( prgStageInstance, de, selectedOrgUnit );
+                        //PatientDataValue patientDV = patientDataValueService.getPatientDataValue( prgStageInstance, de, selectedOrgUnit );
+                        PatientDataValue patientDV = patientDataValueService.getPatientDataValue( prgStageInstance, de );
                         if( patientDV != null && patientDV.getValue() != null )
                         {
                         	Integer optionComboId = Integer.parseInt( patientDV.getValue() );
@@ -454,7 +456,8 @@
                     else if( sType.equalsIgnoreCase("dataelement-b") )
                     {
                         DataElement de = dataElementService.getDataElement( Integer.parseInt( deCode ) );
-                        PatientDataValue patientDV = patientDataValueService.getPatientDataValue( prgStageInstance, de, selectedOrgUnit );
+                        //PatientDataValue patientDV = patientDataValueService.getPatientDataValue( prgStageInstance, de, selectedOrgUnit );
+                        PatientDataValue patientDV = patientDataValueService.getPatientDataValue( prgStageInstance, de );
                         if( patientDV != null && patientDV.getValue() != null )
                         {
                         	if( patientDV.getValue().equalsIgnoreCase("false") )

=== added file 'local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/util/ProgramDetail.java'
--- local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/util/ProgramDetail.java	1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/util/ProgramDetail.java	2012-04-04 11:58:27 +0000
@@ -0,0 +1,129 @@
+package org.hisp.dhis.reports.util;
+
+
+public class ProgramDetail
+{
+    /**
+     * Unique Id
+     */
+    private String id;
+
+    /**
+     * Report Name
+     */
+    private String name;
+    
+    /**
+     * excelTemplateName is the xls Template File Name for this report
+     */
+    private String excelTemplateName;
+    
+    /**
+     * xmlTemplateName is the xml Template File Name for this report
+     */
+    private String xmlTemplateName;
+    
+    
+    // -------------------------------------------------------------------------
+    // Constructors
+    // -------------------------------------------------------------------------
+
+    public ProgramDetail()
+    {
+
+    }
+
+    public ProgramDetail( String id, String name )
+    {
+        this.id = id;
+        this.name = name;
+    }
+    
+    public ProgramDetail( String id, String name, String excelTemplateName, String xmlTemplateName )
+    {
+        this.id = id;
+        this.name = name;
+        this.excelTemplateName = excelTemplateName;
+        this.xmlTemplateName = xmlTemplateName;
+    }
+
+    
+    // -------------------------------------------------------------------------
+    // hashCode and equals
+    // -------------------------------------------------------------------------
+
+    @Override
+    public int hashCode()
+    {
+        return name.hashCode();
+    }
+
+    @Override
+    public boolean equals( Object o )
+    {
+        if ( this == o )
+        {
+            return true;
+        }
+
+        if ( o == null )
+        {
+            return false;
+        }
+
+        if ( !(o instanceof ProgramDetail ) )
+        {
+            return false;
+        }
+
+        final ProgramDetail other = ( ProgramDetail ) o;
+
+        return name.equals( other.getName() );
+    }
+
+    
+    // -------------------------------------------------------------------------
+    // Getters and setters
+    // -------------------------------------------------------------------------
+    
+    public String getId()
+    {
+        return id;
+    }
+
+    public void setId( String id )
+    {
+        this.id = id;
+    }
+
+    public String getName()
+    {
+        return name;
+    }
+
+    public void setName( String name )
+    {
+        this.name = name;
+    }
+
+    public String getExcelTemplateName()
+    {
+        return excelTemplateName;
+    }
+
+    public void setExcelTemplateName( String excelTemplateName )
+    {
+        this.excelTemplateName = excelTemplateName;
+    }
+
+    public String getXmlTemplateName()
+    {
+        return xmlTemplateName;
+    }
+
+    public void setXmlTemplateName( String xmlTemplateName )
+    {
+        this.xmlTemplateName = xmlTemplateName;
+    }
+    
+}

=== modified file 'local/in/dhis-web-reports-national/src/main/resources/META-INF/dhis/beans.xml'
--- local/in/dhis-web-reports-national/src/main/resources/META-INF/dhis/beans.xml	2012-03-19 06:11:45 +0000
+++ local/in/dhis-web-reports-national/src/main/resources/META-INF/dhis/beans.xml	2012-04-04 11:58:27 +0000
@@ -208,6 +208,25 @@
 		<property name="organisationUnitService" ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
     </bean>
 	
+    <bean id="org.hisp.dhis.reports.action.GetIndicatorsAction"
+        class="org.hisp.dhis.reports.action.GetIndicatorsAction"
+        scope="prototype">
+        
+        <property name="indicatorService" ref="org.hisp.dhis.indicator.IndicatorService" />
+    </bean>
+	
+	
+    <bean id="org.hisp.dhis.reports.ed.action.RankingReportResultAction"
+        class="org.hisp.dhis.reports.ed.action.RankingReportResultAction"
+        scope="prototype">
+        <property name="statementManager" ref="statementManager"/>
+        <property name="periodService" ref="org.hisp.dhis.period.PeriodService" />
+        <property name="indicatorService" ref="org.hisp.dhis.indicator.IndicatorService" />
+        <property name="reportService" ref="org.hisp.dhis.reports.ReportService" />
+        <property name="currentUserService" ref="org.hisp.dhis.user.CurrentUserService" />
+        <property name="organisationUnitService" ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
+    </bean>
+	
 	<!-- MD Report -->
     <bean id="org.hisp.dhis.reports.md.action.MDReportFormAction"
         class="org.hisp.dhis.reports.md.action.MDReportFormAction"
@@ -341,7 +360,7 @@
         <property name="dataSetService">
             <ref bean="org.hisp.dhis.dataset.DataSetService"/>
         </property>
-<!--        <property name="dataSetLockService">
+        <!--<property name="dataSetLockService">
             <ref bean="org.hisp.dhis.datalock.DataSetLockService"/>
         </property>-->
         <property name="reportService" ref="org.hisp.dhis.reports.ReportService">
@@ -457,6 +476,7 @@
         <property name="organisationUnitService" ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
         <property name="reportService" ref="org.hisp.dhis.reports.ReportService" />
         <property name="periodService" ref="org.hisp.dhis.period.PeriodService" />
+		<property name="organisationUnitGroupService" ref="org.hisp.dhis.organisationunit.OrganisationUnitGroupService" />
 <!--    <property name="dataSetService" ref="org.hisp.dhis.dataset.DataSetService" />
         <property name="dataElementService" ref="org.hisp.dhis.dataelement.DataElementService" />-->
     </bean>
@@ -1274,7 +1294,63 @@
             <ref bean="org.hisp.dhis.relationship.RelationshipTypeService"/>
         </property>
     </bean>
-    
+
+<!-- Patient Information Reports 20/03/2012 -->	
+	
+    <bean
+        id="org.hisp.dhis.reports.benificiaryinfo.action.PatientInfoReportsFormAction"
+        class="org.hisp.dhis.reports.benificiaryinfo.action.PatientInfoReportsFormAction"
+        scope="prototype">
+        <property name="patientAttributeService"
+			ref="org.hisp.dhis.patient.PatientAttributeService" />
+    </bean>		
+	
+
+    <bean
+        id="org.hisp.dhis.reports.benificiaryinfo.action.GetRegistredPatientInformationAction"
+        class="org.hisp.dhis.reports.benificiaryinfo.action.GetRegistredPatientInformationAction"
+        scope="prototype">
+		<property name="patientAttributeValueService" ref="org.hisp.dhis.patientattributevalue.PatientAttributeValueService" />
+		<property name="patientAttributeService"
+			ref="org.hisp.dhis.patient.PatientAttributeService" />
+		<property name="reportService" ref="org.hisp.dhis.reports.ReportService" />
+		<property name="organisationUnitService" ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
+		<property name="patientService" ref="org.hisp.dhis.patient.PatientService" />
+    </bean>	
+
+	<bean id="org.hisp.dhis.reports.benificiaryinfo.action.GetPatientDetailsAction"
+		class="org.hisp.dhis.reports.benificiaryinfo.action.GetPatientDetailsAction" scope="prototype">
+		<property name="patientService" ref="org.hisp.dhis.patient.PatientService" />
+		<!--<property name="patientIdentifierService"
+			ref="org.hisp.dhis.patient.PatientIdentifierService" />-->
+		<!--<property name="programService" ref="org.hisp.dhis.program.ProgramService" />-->
+		<property name="patientAttributeValueService"
+			ref="org.hisp.dhis.patientattributevalue.PatientAttributeValueService" />
+		<!--<property name="patientAttributeService">
+			<ref bean="org.hisp.dhis.patient.PatientAttributeService" />
+		</property>
+		<property name="patientAttributeGroupService"
+			ref="org.hisp.dhis.patient.PatientAttributeGroupService" />
+		<property name="patientIdentifierTypeService">
+			<ref bean="org.hisp.dhis.patient.PatientIdentifierTypeService" />
+		</property>-->
+	</bean>	
+
+	<bean id="org.hisp.dhis.reports.benificiaryinfo.action.GetPatientReportResultAction"
+		class="org.hisp.dhis.reports.benificiaryinfo.action.GetPatientReportResultAction" scope="prototype">
+		<!--<property name="patientIdentifierService"
+			ref="org.hisp.dhis.patient.PatientIdentifierService" />-->
+		<property name="programService" ref="org.hisp.dhis.program.ProgramService" />
+		<property name="reportService" ref="org.hisp.dhis.reports.ReportService" />
+		<property name="patientService" ref="org.hisp.dhis.patient.PatientService" />
+		<property name="patientIdentifierService" ref="org.hisp.dhis.patient.PatientIdentifierService" />
+		<property name="patientAttributeValueService" ref="org.hisp.dhis.patientattributevalue.PatientAttributeValueService" />
+		<property name="jdbcTemplate" ref="jdbcTemplate"/>
+	</bean>	
+	
+	
+	
+			
     <!-- NBITS : Portal Reports -->
     
     <bean id="org.hisp.dhis.reports.portal.action.PortalReportsFormAction"

=== modified file 'local/in/dhis-web-reports-national/src/main/resources/org/hisp/dhis/reports/i18n_module.properties'
--- local/in/dhis-web-reports-national/src/main/resources/org/hisp/dhis/reports/i18n_module.properties	2011-12-14 11:06:08 +0000
+++ local/in/dhis-web-reports-national/src/main/resources/org/hisp/dhis/reports/i18n_module.properties	2012-04-04 11:58:27 +0000
@@ -303,4 +303,32 @@
 back = Back
 select_orgUnitGroup = Select OrgUnit Group
 orgunitgroup = OrgUnit Group
-md_report_ra = MD Report Analyser
\ No newline at end of file
+md_report_ra = MD Report Analyser
+available_indicatorList = Available Indicator List
+selected_IndicatorList = Selected Indicator List
+patient_info = Patient Information
+tracking_report = Tracking Reports
+report_analyser = Report Analyser
+patient_management = Patient Management
+search_by_name_id = Search by Name or ID
+search = Search
+specify_search_criteria = Please specify Name/ID
+search_patients_by_attributes = Search patient by Name/Identifier
+total_result = Total number of results
+search_result_matching_the_search_criteria = Result matches the search criteria
+full_name = Full Name
+gender = Gender
+date_of_birth = Date of Birth
+age = Age
+hierachy_orgunit = Hierarchy Organisation Unit
+enrolled_in_program = Enrolled in Programs
+show_details = Show details
+patient_details = Patient Details
+dob_type = DOB Type
+blood_group = Blood group
+none = None
+identifiers = Identifiers
+patient_system_id = System generated ID
+attributes = Attributes
+no_xls_xml = There is no xml and xls template for selected program
+in_selected_orgU = In Selected Organisation Unit
\ No newline at end of file

=== modified file 'local/in/dhis-web-reports-national/src/main/resources/struts.xml'
--- local/in/dhis-web-reports-national/src/main/resources/struts.xml	2012-02-17 07:09:28 +0000
+++ local/in/dhis-web-reports-national/src/main/resources/struts.xml	2012-04-04 11:58:27 +0000
@@ -188,6 +188,17 @@
             <param name="stylesheets">css/StylesForTags.css</param>
             <param name="requiredAuthorities">F_EDREPORT_GENERATE</param>
         </action>
+		
+		<action name="getIndicators"
+			class="org.hisp.dhis.reports.action.GetIndicatorsAction">
+			<result name="success" type="velocity-xml">/dhis-web-reports/responseIndicator.vm</result>
+			<param name="javascripts">javascript/reports.js,javascript/date.js</param>
+			<param name="onExceptionReturn">plainTextError</param>
+		</action>
+		
+		
+		
+		
         <action name="generateEDReport"
             class="org.hisp.dhis.reports.ed.action.EDReportResultAction">
             <result name="success" type="stream">
@@ -197,6 +208,15 @@
                 <param name="bufferSize">1024</param>
             </result>
         </action>
+        <action name="generateEDRankingReport"
+            class="org.hisp.dhis.reports.ed.action.RankingReportResultAction">
+            <result name="success" type="stream">
+                <param name="contentType">application/vnd.ms-excel</param>
+                <param name="inputName">inputStream</param>
+                <param name="contentDisposition">filename="${fileName}"</param>
+                <param name="bufferSize">1024</param>
+            </result>
+        </action>
 
 		<!-- MD Reports -->
         <action name="mdReportAnalyser"
@@ -834,7 +854,48 @@
                 <param name="bufferSize">1024</param>
             </result>
         </action>
-        
+
+<!-- Patient Information Reports 20/03/2012 -->		
+		
+        <action name="patientInfoReportsAnalyser"
+            class="org.hisp.dhis.reports.benificiaryinfo.action.PatientInfoReportsFormAction">
+            <result name="success" type="velocity">/main.vm</result>
+            <param name="page">/dhis-web-reports/patientInfoReportsForm.vm</param>
+            <param name="menu">/dhis-web-reports/menuWithTreeForPatientInfo.vm</param>
+            <param name="javascripts">../dhis-web-commons/ouwt/ouwt.js,../dhis-web-commons/javascripts/lists.js,javascript/patient.js,javascript/hashtable.js</param>
+            <param name="stylesheets">css/StylesForTags.css</param>
+            <param name="requiredAuthorities">F_REPORT_BENIFICIARY_INFO</param>
+            <interceptor-ref name="organisationUnitTreeStack"/>
+        </action>		
+		
+        <action name="searchRegistredPatient"
+            class="org.hisp.dhis.reports.benificiaryinfo.action.GetRegistredPatientInformationAction">
+            <result name="success" type="velocity">/content.vm</result>
+            <param name="page">/dhis-web-reports/patientRegistrationList.vm</param>
+            <param name="javascripts">../dhis-web-commons/javascripts/lists.js,javascript/patient.js,javascript/hashtable.js</param>
+            <param name="stylesheets">css/StylesForTags.css</param>
+            <param name="requiredAuthorities">F_REPORT_BENIFICIARY_INFO</param>
+        </action>				
+		
+		<action name="getPatientDetails"
+			class="org.hisp.dhis.reports.benificiaryinfo.action.GetPatientDetailsAction">
+			<result name="success" type="velocity">/content.vm</result>
+			<param name="page">/dhis-web-reports/patientDetails.vm</param>
+		</action>		
+		
+		
+        <action name="generatePatientReport"
+            class="org.hisp.dhis.reports.benificiaryinfo.action.GetPatientReportResultAction">
+            <result name="success" type="stream">
+                <param name="contentType">application/vnd.ms-excel</param>
+                <param name="inputName">inputStream</param>
+                <param name="contentDisposition">filename="${fileName}"</param>
+                <param name="bufferSize">1024</param>
+            </result>
+        </action>		
+		
+		
+		       
         <!-- Portal Reports -->
         <action name="portalReportsAnalyser"
             class="org.hisp.dhis.reports.portal.action.PortalReportsFormAction">

=== modified file 'local/in/dhis-web-reports-national/src/main/webapp/WEB-INF/web.xml'
--- local/in/dhis-web-reports-national/src/main/webapp/WEB-INF/web.xml	2011-03-08 21:38:01 +0000
+++ local/in/dhis-web-reports-national/src/main/webapp/WEB-INF/web.xml	2012-04-04 11:58:27 +0000
@@ -23,7 +23,7 @@
   </filter>
   <filter>
     <filter-name>OpenSessionInViewFilter</filter-name>
-    <filter-class>org.springframework.orm.hibernate3.support.OpenSessionInViewFilter</filter-class>
+    <filter-class>org.springframework.orm.hibernate4.support.OpenSessionInViewFilter</filter-class>
   </filter>
   <filter>
     <filter-name>springSecurityFilterChain</filter-name>

=== added file 'local/in/dhis-web-reports-national/src/main/webapp/dhis-web-reports/javascript/patient.js'
--- local/in/dhis-web-reports-national/src/main/webapp/dhis-web-reports/javascript/patient.js	1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-reports-national/src/main/webapp/dhis-web-reports/javascript/patient.js	2012-04-04 11:58:27 +0000
@@ -0,0 +1,220 @@
+//-----------------------------------------------------------------------------
+// Search Patient
+//-----------------------------------------------------------------------------
+
+function searchPatientsOnKeyUp( event )
+{
+	var key = getKeyCode( event );
+	
+	if ( key==13 )// Enter
+	{
+		searchPatients();
+	}
+}
+
+function getKeyCode(e)
+{
+	 if (window.event)
+		return window.event.keyCode;
+	 return (e)? e.which : null;
+}
+
+
+function searchPatients()
+{
+	hideById( 'listPatientDiv' );
+	var searchTextFields = jQuery('[name=searchText]');
+	var flag = true;
+	jQuery( searchTextFields ).each( function( i, item )
+    {
+		if( jQuery( item ).val() == '' )
+		{
+			showWarningMessage( i18n_specify_search_criteria );
+			flag = false;
+		}
+	});
+	
+	if(!flag) return;
+	
+	contentDiv = 'listPatientDiv';
+	jQuery( "#loaderDiv" ).show();
+	$.ajax({
+		url: 'searchRegistredPatient.action',
+		type:"POST",
+		data: getParamsForDiv('searchPatientDiv'),
+		success: function( html ){
+				statusSearching = 1;
+				setInnerHTML( 'listPatientDiv', html );
+				showById('listPatientDiv');
+				jQuery( "#loaderDiv" ).hide();
+			}
+		});
+}
+
+function getParamsForDiv( patientDiv )
+{
+	var params = '';
+	jQuery("#" + patientDiv + " :input").each(function()
+		{
+			var elementId = $(this).attr('id');
+			
+			if( $(this).attr('type') == 'checkbox' )
+			{
+				var checked = jQuery(this).attr('checked') ? true : false;
+				params += elementId + "=" + checked + "&";
+			}
+			else if( $(this).attr('type') != 'button' )
+			{
+				params += elementId + "="+ htmlEncode(jQuery(this).val()) + "&";
+			}
+		});
+		
+	return params;
+}
+
+//-----------------------------------------------------------------------------
+//View patient details
+//-----------------------------------------------------------------------------
+
+function showPatientDetails( patientId )
+{
+ $('#detailsInfo').load("getPatientDetails.action", 
+		{
+			id:patientId
+		}
+		, function( ){
+		}).dialog({
+			title: i18n_patient_details,
+			maximize: true, 
+			closable: true,
+			modal:true,
+			overlay:{background:'#000000', opacity:0.1},
+			width: 500,
+			height: 500
+		});;
+}
+
+
+function getSelectedOrgUnit( orgUnitIds )
+{
+	jQuery.postJSON("getOrgUnitName.action",{
+    	  id : orgUnitIds[0]
+     }, function( json ){
+           setFieldValue( "ouNameTB",json.organisationUnit.name );
+     });
+}
+
+function getOUDetails(orgUnitIds)
+{
+	$.post("getOrgUnitDetails.action",
+		{
+			orgUnitId : orgUnitIds
+		},
+		function (data)
+		{
+			getOUDetailsRecevied(data);
+		},'xml');
+}
+
+function getOUDetailsRecevied(xmlObject)
+{
+		
+    var orgUnits = xmlObject.getElementsByTagName("orgunit");
+
+    for ( var i = 0; i < orgUnits.length; i++ )
+    {
+        var id = orgUnits[ i ].getElementsByTagName("id")[0].firstChild.nodeValue;
+        var orgUnitName = orgUnits[ i ].getElementsByTagName("name")[0].firstChild.nodeValue;
+        var level = orgUnits[ i ].getElementsByTagName("level")[0].firstChild.nodeValue;
+		
+        document.getElementById("ouNameTB").value = orgUnitName;
+        //document.reportForm.ouNameTB.value = orgUnitName;
+    }    		
+}
+
+
+function generatePatientReport( event, patientId )
+{
+	
+	var tempPatientId = "";
+	var tempProgramId = "";
+	
+	var programDropDown = document.getElementById("programId_"+patientId);
+	var selProgramId = programDropDown.options[ programDropDown.selectedIndex ].value;
+	//alert(patientId +"----" + selProgramId );
+	
+	var excelTemplateName = "";
+	var xmlTemplateName = "";
+	
+	tempPatientId = patientId;
+	tempProgramId = selProgramId;
+	
+	
+	var flag = 1;
+	
+	
+    for ( i = 0; i < programIds.length; i++ )
+    {
+    	if( selProgramId == programIds[i] )
+    	{
+    		//alert( programIds[i] + "----" + selProgramId );
+    		excelTemplateName = programExcelFileNames.get(programIds[i]);
+    		xmlTemplateName = programXmlFileNames.get(programIds[i]);
+    		//alert( excelTemplateName + "----" + xmlTemplateName );
+    		//document.getElementById("exportToExcel").href="generatePatientReport.action?patientId=" + patientId + "&selProgramId=" + selProgramId + "&excelTemplateName=" + excelTemplateName + "&xmlTemplateName=" + xmlTemplateName;
+    		
+    		flag = 2;
+    		break;
+    	}
+
+    }
+    if( flag != 2 )
+    {
+    	//alert("There is no xml and xls template for selected program");
+    	showWarningMessage( i18n_no_xls_xml );
+    	return;
+    	
+    }
+    
+	else
+    {	
+		/*
+		document.forms[0].method="Post";
+	    document.forms[0].action="../Customer";
+	    document.forms[0].submit();
+	    */
+	    
+	    //event.target.href = "generatePatientReport.action?patientId=" + patientId + "&selProgramId=" + selProgramId + "&excelTemplateName=" + excelTemplateName + "&xmlTemplateName=" + xmlTemplateName;
+		
+	    //alert( tempPatientId + "----" + tempProgramId + "----" + excelTemplateName + "----" + xmlTemplateName  );
+		
+	    document.getElementById("patientId").value = tempPatientId;
+	    document.getElementById("selProgramId").value = tempProgramId;
+	    document.getElementById("excelTemplateName").value = excelTemplateName;
+	    document.getElementById("xmlTemplateName").value = xmlTemplateName;
+	    
+	    /*
+	    alert( document.getElementById("patientId").value );
+	    alert( document.getElementById("selProgramId").value );
+	    alert( document.getElementById("excelTemplateName").value );
+	    alert( document.getElementById("xmlTemplateName").value );
+	    */
+	    document.patientForm.action = "generatePatientReport.action";
+	    document.patientForm.submit();
+	    
+		/*
+	    document.PatientForm.method="get";
+	    
+		document.PatientForm.action = "generatePatientReport.action?patientId=" + patientId + "&selProgramId=" + selProgramId + "&excelTemplateName=" + excelTemplateName + "&xmlTemplateName=" + xmlTemplateName;
+        document.PatientForm.submit();
+		*/
+		//document.getElementById("exportToExcel").href="generatePatientReport.action?patientId=" + patientId + "&selProgramId=" + selProgramId + "&excelTemplateName=" + excelTemplateName + "&xmlTemplateName=" + xmlTemplateName;
+    }
+	
+	//event.target.href = "generatePatientReport.action?patientId=" + patientId + "&selProgramId=" + selProgramId;
+	
+	//document.getElementById("exportToExcel").href="generatePatientReport.action?patientId=" + patientId + "&selProgramId=" + selProgramId;
+	
+	//alert( event.target.href );
+	
+}

=== modified file 'local/in/dhis-web-reports-national/src/main/webapp/dhis-web-reports/menu.vm'
--- local/in/dhis-web-reports-national/src/main/webapp/dhis-web-reports/menu.vm	2011-12-14 11:06:08 +0000
+++ local/in/dhis-web-reports-national/src/main/webapp/dhis-web-reports/menu.vm	2012-04-04 11:58:27 +0000
@@ -82,19 +82,20 @@
 
 #if( $auth.hasAccess( "dhis-web-reports", "benificiaryInfoReportsAnalyser") )
     <ul>
-        <li>NameBased Reports</li>
+        <li>Tracker Reports</li>
         <ul>
+            <li><a href = "patientInfoReportsAnalyser.action">Patient Information</a></li>
             #if( $auth.hasAccess( "dhis-web-reports", "benificiaryInfoReportsAnalyser") )
-                <li><a href = "benificiaryInfoReportsAnalyser.action">NBITS Benificiary Info</a></li>
+                <li><a href = "benificiaryInfoReportsAnalyser.action">Tracker Benificiary Info</a></li>
             #end
             #if( $auth.hasAccess( "dhis-web-reports", "activePlanReportsAnalyser") )
-                <li><a href = "activePlanReportsAnalyser.action">NBITS ActivityPlan</a></li>
+                <li><a href = "activePlanReportsAnalyser.action">Tracker Activity Plan</a></li>
             #end
             #if( $auth.hasAccess( "dhis-web-reports", "portalReportsAnalyser") )
-                <li><a href = "portalReportsAnalyser.action">NBITS Portal Reports</a></li>
+                <li><a href = "portalReportsAnalyser.action">Tracker Portal Reports</a></li>
             #end
             #if( $auth.hasAccess( "dhis-web-reports", "nbitsReportsAnalyser") )
-                <li><a href = "nbitsReportsAnalyser.action">NBITS Reports</a></li>
+                <li><a href = "nbitsReportsAnalyser.action">Tracker Reports</a></li>
             #end
         </ul>
     </ul>

=== added file 'local/in/dhis-web-reports-national/src/main/webapp/dhis-web-reports/menuWithTreeForPatientInfo.vm'
--- local/in/dhis-web-reports-national/src/main/webapp/dhis-web-reports/menuWithTreeForPatientInfo.vm	1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-reports-national/src/main/webapp/dhis-web-reports/menuWithTreeForPatientInfo.vm	2012-04-04 11:58:27 +0000
@@ -0,0 +1,36 @@
+<a href="index.action"><h2>$i18n.getString( "report_analyser" )</h2></a>
+
+<ul>
+    <li><a href="index.action">$i18n.getString( "tracking_report" )</a></li>
+    <ul>
+    	<li>
+            $i18n.getString( "patient_info" )
+        </li>
+    </ul>
+</ul>
+
+<br>
+
+#parse( "/dhis-web-commons/ouwt/orgunittree.vm" )
+
+<script type="text/javascript">
+
+	function orgUnitHasBeenSelected( orgUnitIds )
+	{
+		
+		document.getElementById("ouIDTB").value = orgUnitIds;
+		
+		if( orgUnitIds == null || orgUnitIds == "" )
+		{
+			return;
+		}
+	
+		if(orgUnitIds != null && orgUnitIds != "" )
+		{
+			getSelectedOrgUnit(orgUnitIds);
+		}
+	}
+	
+	selection.setListenerFunction( orgUnitHasBeenSelected );
+
+</script>
\ No newline at end of file

=== added file 'local/in/dhis-web-reports-national/src/main/webapp/dhis-web-reports/patientDetails.vm'
--- local/in/dhis-web-reports-national/src/main/webapp/dhis-web-reports/patientDetails.vm	1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-reports-national/src/main/webapp/dhis-web-reports/patientDetails.vm	2012-04-04 11:58:27 +0000
@@ -0,0 +1,87 @@
+<table>
+	<tr>
+		<td>
+			<label class="bold">$i18n.getString('full_name') : </label>
+		</td>
+		<td>
+			$patient.getFullName()
+		</td>
+	</tr>
+	<tr>
+		<td>
+			<label class="bold">$i18n.getString('gender') : </label>
+		</td>
+		<td>
+			$i18n.getString($patient.gender)
+		</td>
+	</tr>
+	<tr>
+		<td><label class="bold">$i18n.getString('dob_type') : </label>
+		</td>
+		<td>
+			$!patient.dobType
+		</td>
+	</tr>
+	<tr>
+		<td><label class="bold">$i18n.getString('date_of_birth') : </label>
+		</td>
+		<td>
+			$format.formatDate( $!patient.birthDate )
+		</td>
+	</tr>
+	<tr>
+		<td><label class="bold">$i18n.getString('blood_group') : </label>
+		</td>
+		<td>
+			#if($!patient.bloodGroup && !$patient.bloodGroup.equals("")) $patient.bloodGroup #else $i18n.getString('none') #end
+		</td>
+	</tr>
+	
+	<tr><td>&nbsp;</td></tr>
+	<tr>
+		<td><label class="bold">$i18n.getString( "identifiers" )</label></td>
+	</tr>
+	#foreach( $patientIdentifier in $patient.identifiers )
+	<tr>
+		<td>
+			<label class="bold">
+				#if($!patientIdentifier.identifierType)  $!patientIdentifier.identifierType.name
+				#else $i18n.getString( "patient_system_id") #end :
+			</label>
+		</td>
+		<td>
+			  $patientIdentifier.identifier
+		</td>
+	</tr>
+	#end
+	
+	<tr><td colspan='2'>&nbsp;</td></tr>
+	<tr>
+		<td colspan='2'><label class="bold">$i18n.getString( "attributes" )</label></td>
+	</tr>
+	#foreach( $attribute in $patient.attributes )
+		#if( $patientAttributeValueMap.get( $attribute.id ) != " " )
+		<tr>
+			<td><label class="bold">$attribute.name : </label>
+			</td>
+			<td>
+				#if($attribute.valueType=="YES/NO")
+					$attribute.id   $i18n.getString( $patientAttributeValueMap.get( $attribute.id ) )
+				#else
+					$attribute.id   $patientAttributeValueMap.get( $attribute.id )
+				#end
+			</td>
+		</tr>
+		#end
+	#end
+	
+	<tr><td>&nbsp;</td></tr>
+	<tr>
+		<td><label class="bold">$i18n.getString( "enrolled_in_program" )</label></td>
+		<td>
+			#foreach( $program in $patient.programs )
+				$program.name<br>
+			#end
+		</td>
+	</tr>
+</table>
\ No newline at end of file

=== added file 'local/in/dhis-web-reports-national/src/main/webapp/dhis-web-reports/patientInfoReportsForm.vm'
--- local/in/dhis-web-reports-national/src/main/webapp/dhis-web-reports/patientInfoReportsForm.vm	1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-reports-national/src/main/webapp/dhis-web-reports/patientInfoReportsForm.vm	2012-04-04 11:58:27 +0000
@@ -0,0 +1,39 @@
+
+<h3>$i18n.getString( "patient_management" )</h3>
+<hr style="clear:both">
+
+<div id='searchPatientDiv'>
+	<table>	
+		<tbody>
+			<tr>
+				<td>$i18n.getString( "search_by_name_id" )</td>
+				<td>
+					<select id="searchingAttributeId" name="searchingAttributeId" style='display:none'>
+						<option value="">$i18n.getString( "search_by_name_identifier" )</option>
+						<option value="0">$i18n.getString( "search_by_program" )</option>
+						#foreach( $attribute in $patientAttributes )
+							<option value="$attribute.id" valueType='$attribute.valueType'>$encoder.htmlEncode( $attribute.name )</option>
+						#end
+    				</select>
+    			</td>
+			</tr>	
+			<tr>
+				<td>
+					<input type="text" id="searchText" name="searchText" maxlength="30" style="width:20em" value="$!searchText" onkeyup='searchPatientsOnKeyUp( event );'>
+					<label><em title="$i18n.getString( "required" )" class="required">*</em></label>
+					&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+				</td>
+				<td>$i18n.getString( "organisationunit" ) :&nbsp;&nbsp;&nbsp;&nbsp;<input type="text" name="ouNameTB" id="ouNameTB" style="width:200px" disabled>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
+				<td><input type="checkbox" name="isSelectedOrg" id="isSelectedOrg" >$i18n.getString( "in_selected_orgU" )&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
+				<td><input type="button" value='$i18n.getString( "search" )' onclick='searchPatients();'></td>
+			</tr>
+			<input type="hidden" name="ouIDTB" id="ouIDTB">
+		</tbody>
+	</table>
+</div>
+<div id='listPatientDiv'></div> <!-- List searching patients -->
+#parse( "/dhis-web-commons/loader/loader.vm" )
+
+<script>
+	var i18n_specify_search_criteria = '$encoder.jsEscape( $i18n.getString( "specify_search_criteria" ) , "'")';
+</script>
\ No newline at end of file

=== added file 'local/in/dhis-web-reports-national/src/main/webapp/dhis-web-reports/patientRegistrationList.vm'
--- local/in/dhis-web-reports-national/src/main/webapp/dhis-web-reports/patientRegistrationList.vm	1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-reports-national/src/main/webapp/dhis-web-reports/patientRegistrationList.vm	2012-04-04 11:58:27 +0000
@@ -0,0 +1,213 @@
+<script type="text/javascript">
+
+
+    var programIds = new Array();
+    var programNames = new Array();
+
+    #set( $count1 = 0 );
+    #foreach( $program in $programList )
+       programIds[$count1] = $program.id;
+       programNames[$count1] = '$program.name';
+       #set( $count1 = $count1 + 1 );
+    #end
+
+    var programExcelFileNames = new HashTable();
+    var programXmlFileNames = new HashTable();
+
+    // Programs  ids and its Xls and Xml files
+    #foreach($program in $programList)
+        var programId = ""+"$program.id";
+        programExcelFileNames.put(programId,"$program.excelTemplateName");
+        programXmlFileNames.put(programId,"$program.xmlTemplateName");
+    #end
+	
+</script>
+
+
+
+<form id="patientForm" name="patientForm"  target="_blank">
+<table>
+<!--
+	<tr>
+		<td> Size of Program List : $programList.size() </td>
+		#foreach( $program in $programList )
+			<th>$program.id $program.name  $program.excelTemplateName  $program.xmlTemplateName  </th>
+	   #end
+		<td>&nbsp;</td>
+		<td>&nbsp;</td>
+	</tr>	
+-->
+	<input type="hidden" name="patientId" id="patientId">
+    <input type="hidden" name="selProgramId" id="selProgramId">
+    <input type="hidden" name="excelTemplateName" id="excelTemplateName">
+    <input type="hidden" name="xmlTemplateName" id="xmlTemplateName">
+	<tr>
+		<td class='text-column' >$i18n.getString( "search_result_matching_the_search_criteria" ):</td>
+		<td>&nbsp;</td>
+		<td>&nbsp;</td>
+		<td>$i18n.getString( "search_patients_by_attributes" )</td>
+	</tr>	
+	<tr>
+		<td class='text-column' >$i18n.getString( "total_result" )</td>
+		<td>&nbsp;</td>
+		<td>&nbsp;</td>
+		<td>$!total</td>
+	</tr>
+</table>
+
+
+#if( $patients.size() > 0 )
+<table class="mainPageTable">
+	<tr>
+    <td>
+      <table class="listTable" id="patientList" width='100%'>               
+          <col width="30"/>
+			#foreach( $attribute in $patientAttributes )
+				<col/>
+			#end
+          <col/>
+          <col/>
+          <col/>
+          <col/>
+		  #if($mapPatientOrgunit.size()!=0)
+          <col/>
+		  #end
+          <col width="200"/>    
+		  
+		  <thead>
+			<tr>
+				<th>#</th>
+				#foreach( $attribute in $patientAttributes )
+					<th id="patientAttributeName">$attribute.name</th>
+				#end
+				<th>$i18n.getString( "full_name" )</th>          
+				<th>$i18n.getString( "gender" )</th>
+				<th>$i18n.getString( "date_of_birth" )</th> 
+				<th class="{sorter: false}">$i18n.getString( "age" )</th>
+				#if($mapPatientOrgunit.size()!=0)
+				<th>$i18n.getString( "hierachy_orgunit" )</th>
+				#end
+				##if($mapPatientPrograms.size()!=0)
+				<th class="{sorter: false}">$i18n.getString( "enrolled_in_program" )</th>
+				##end
+				<th class="{sorter: false}">&nbsp;</th>
+				<th class="{sorter: false}">$i18n.getString( "operations" )</th>
+			  </tr>
+          </thead>
+		  
+          <tbody id="list">	
+		  #set( $mark = false )
+          #foreach( $patient in $patients )
+          	<tr id="tr${patient.id}" #alternate($mark) >
+				
+				<td>
+					#set( $nr = ( ( $paging.getCurrentPage() - 1  ) * $paging.pageSize ) + $velocityCount )
+					$nr
+				</td>
+				
+				#foreach( $attribute in $patientAttributes )
+					#set ( $key = $patient.id + '-' + $attribute.id )
+					<td>
+						#if( $attribute.valueType == 'YES/NO')
+							$i18n.getString( $mapPatientPatientAttr.get($key) )
+						#else
+							$mapPatientPatientAttr.get($key)
+						#end
+					</td>
+				#end
+					
+				<td>$!patient.getFullName()</td>
+				
+				<td>$i18n.getString($!patient.gender)</td>
+				
+				<td>$format.formatDate( $!patient.birthDate)</td>
+				
+				<td>$!patient.getAge()</td>
+				
+				#if($mapPatientOrgunit.size()!=0)
+				
+					<td>$!mapPatientOrgunit.get($patient.id)</td>
+				
+				#end
+				##if($mapPatientPrograms.size()!=0)
+				##set( $programs = $mapPatientPrograms.get( $patient.id ) )
+				#set( $programs =  $patient.getPrograms() )
+				#if( $programs.size() !=0 )
+					<td><select id="programId_$patient.id" name="programId_$patient.id" style="width:15em">
+						#foreach( $program in $programs )
+							<option value="$program.id" title="$program.name">$encoder.htmlEncode( $program.name )</option>
+						#end
+    				</select></td>
+				#else
+					<td><select id="programId_$patient.id" name="programId_$patient.id" style="width:15em" disabled="disabled">
+						#foreach( $program in $programs )
+							<option value="$program.id" title="$program.name">$encoder.htmlEncode( $program.name )</option>
+						#end
+    				</select></td>				
+				#end				
+				
+				#if( $patient.getPrograms().size() !=0 )
+				  <td>
+					<input type="button" id='generateButton' value="$i18n.getString( 'generate' )" onclick="javascript:generatePatientReport( event, '$patient.id' )" title='$i18n.getString( "generate" )'>
+				   <!-- <a  href="#" onclick="javascript:generatePatientReport( event, '$patient.id' )" title='$i18n.getString( "generate" )' target="_blank">$i18n.getString( "generate" )</a>-->
+				  <!--<a id="exportToExcel" name="exportToExcel" href="#" onclick="javascript:generatePatientReport( event, '$patient.id' )" title='$i18n.getString( "generate" )' target="_blank"><img src="images/GenerateButton.gif" alt='$i18n.getString( "generate" )'></a>-->
+				  </td>
+				#else
+				  <td>	
+				  <input type="button" id='generateButton' value="$i18n.getString( 'generate' )" onclick="javascript:generatePatientReport( event, '$patient.id' )" disabled="disabled" title='$i18n.getString( "generate" )'>
+				  <!--<a  href="#" onclick="javascript:generatePatientReport( event, '$patient.id' )" title='$i18n.getString( "generate" )' disabled="disabled" target="_blank">$i18n.getString( "generate" )</a>-->
+				  <!--<a id="exportToExcel" name="exportToExcel" href="#" onclick="javascript:generatePatientReport( event, '$patient.id' )" title='$i18n.getString( "generate" )' target="_blank" style='display:none'><img src="images/GenerateButton.gif" alt='$i18n.getString( "generate" )'></a>-->	  
+				  </td>
+				#end  
+				
+				<td>
+				<a href="javascript:showPatientDetails( '$patient.id' )" title='$i18n.getString( "show_details" )'><img src="../images/information.png" alt='$i18n.getString( "show_details" )'></a>
+				<!--
+				#if( $patient.getPrograms().size() !=0 )
+				  <input type="button" id='generateButton' value="$i18n.getString( 'generate' )" onclick="javascript:generatePatientReport( event, '$patient.id' )" title='$i18n.getString( "generate" )'>
+				  <!--<a id="exportToExcel" name="exportToExcel" href="#" onclick="javascript:generatePatientReport( event, '$patient.id' )" title='$i18n.getString( "generate" )' target="_blank"><img src="images/GenerateButton.gif" alt='$i18n.getString( "generate" )'></a>-->
+				<!--
+				#else
+				  <input type="button" id='generateButton' value="$i18n.getString( 'generate' )" onclick="javascript:generatePatientReport( event, '$patient.id' )" style='display:none' title='$i18n.getString( "generate" )'>
+				  <!--<a id="exportToExcel" name="exportToExcel" href="#" onclick="javascript:generatePatientReport( event, '$patient.id' )" title='$i18n.getString( "generate" )' target="_blank" style='display:none'><img src="images/GenerateButton.gif" alt='$i18n.getString( "generate" )'></a>-->	  
+				<!--
+				#end  
+				  <!--<input type="button" id='generateButton' value="$i18n.getString( 'generate' )" onclick='generatePatientReport( '$patient.id' );'>-->
+				
+
+				
+				</td>
+				
+			</tr>
+			#set( $mark = !$mark)
+    	#end
+    	</tbody>
+    
+	 </table>
+    </td>
+  </tr>
+  <tr>
+  	<td colspan="8">
+		<p></p>
+  		<div class="paging-container">
+				#parse( "/dhis-web-commons/paging/paging.vm" )
+		</div>
+	</td>
+  	<td></td>
+  </tr>
+</table>
+
+
+#end
+</form>
+
+<div id="detailsInfo">
+</div>
+<script type="text/javascript">
+	jQuery(document).ready(function(){	
+		tableSorter( 'patientList' );
+	});
+	var i18n_patient_details = '$encoder.jsEscape( $i18n.getString( "patient_details" ) , "'" )';
+	var i18n_no_xls_xml = '$encoder.jsEscape( $i18n.getString( "no_xls_xml" ) , "'")';
+	
+</script>