← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2003: Cleaning Code: Routine Report Form & Result

 

------------------------------------------------------------
revno: 2003
committer: Bharath <chbharathk@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2010-11-08 11:40:18 +0530
message:
  Cleaning Code: Routine Report Form & Result
modified:
  local/in/dhis-in-api/src/main/java/org/hisp/dhis/reports/ReportService.java
  local/in/dhis-in-api/src/main/java/org/hisp/dhis/reports/Report_inDesign.java
  local/in/dhis-in-services/dhis-in-service-reports/src/main/java/org/hisp/dhis/reports/DefaultReportService.java
  local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/routine/action/GenerateRoutineReportAnalyserFormAction.java
  local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/routine/action/GenerateRoutineReportAnalyserResultAction.java
  local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/upward/action/GenerateUpwardReportAnalyserResultAction.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/webapp/dhis-web-reports/routineReportAnalysisFront.vm
  local/in/dhis-web-reports-national/src/main/webapp/dhis-web-reports/upwardReportAnalysisFront.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-in-api/src/main/java/org/hisp/dhis/reports/ReportService.java'
--- local/in/dhis-in-api/src/main/java/org/hisp/dhis/reports/ReportService.java	2010-09-17 09:15:35 +0000
+++ local/in/dhis-in-api/src/main/java/org/hisp/dhis/reports/ReportService.java	2010-11-08 06:10:18 +0000
@@ -102,13 +102,20 @@
     // ReportService for Report Result Action
     // -------------------------------------------------------------------------
     
-   // public List<String> getDECodes( String fileName );
+    List<Report_inDesign> getReportDesign( String fileName );
+    
     String getResultDataValue( String formula, Date startDate, Date endDate, OrganisationUnit organisationUnit , String reportModelTB );
+    
     String getIndividualResultDataValue( String formula, Date startDate, Date endDate, OrganisationUnit organisationUnit, String reportModelTB );
+    
     String getResultIndicatorValue( String formula, Date startDate, Date endDate, OrganisationUnit organisationUnit );
+    
     String getIndividualResultIndicatorValue( String formula, Date startDate, Date endDate, OrganisationUnit organisationUnit );
+    
     String getBooleanDataValue( String formula, Date startDate, Date endDate, OrganisationUnit organisationUnit , String reportModelTB );
+    
     List<Calendar> getStartingEndingPeriods( String deType , Period selectedPeriod );
+    
     Period getPreviousPeriod( Period selectedPeriod );
 
 }

=== modified file 'local/in/dhis-in-api/src/main/java/org/hisp/dhis/reports/Report_inDesign.java'
--- local/in/dhis-in-api/src/main/java/org/hisp/dhis/reports/Report_inDesign.java	2010-08-19 10:40:50 +0000
+++ local/in/dhis-in-api/src/main/java/org/hisp/dhis/reports/Report_inDesign.java	2010-11-08 06:10:18 +0000
@@ -80,7 +80,7 @@
         
     }
     
-    public Report_inDesign(String stype, String ptype, int sheetno, int rowno, int colno, int rowmerge, int colmerge, String expression)
+    public Report_inDesign( String stype, String ptype, int sheetno, int rowno, int colno, int rowmerge, int colmerge, String expression )
     {
         this.stype = stype;
         this.ptype = ptype;
@@ -92,6 +92,16 @@
         this.expression = expression;        
     }
     
+    public Report_inDesign( String stype, String ptype, int sheetno, int rowno, int colno, String expression )
+    {
+        this.stype = stype;
+        this.ptype = ptype;
+        this.sheetno = sheetno;
+        this.rowno = rowno;
+        this.colno = colno;
+        this.expression = expression;        
+    }
+
     // -------------------------------------------------------------------------
     // Getters and setters
     // -------------------------------------------------------------------------

=== modified file 'local/in/dhis-in-services/dhis-in-service-reports/src/main/java/org/hisp/dhis/reports/DefaultReportService.java'
--- local/in/dhis-in-services/dhis-in-service-reports/src/main/java/org/hisp/dhis/reports/DefaultReportService.java	2010-11-01 11:14:31 +0000
+++ local/in/dhis-in-services/dhis-in-service-reports/src/main/java/org/hisp/dhis/reports/DefaultReportService.java	2010-11-08 06:10:18 +0000
@@ -1314,4 +1314,74 @@
             }
         }
     
+    // -------------------------------------------------------------------------
+    // Get Aggregated Result for dataelement expression 
+    // -------------------------------------------------------------------------
+
+    public List<Report_inDesign> getReportDesign( String fileName )
+    {
+        List<Report_inDesign> reportDesignList = new ArrayList<Report_inDesign>();
+        
+        String path = System.getProperty( "user.home" ) + File.separator + "dhis" + File.separator + configurationService.getConfigurationByKey( Configuration_IN.KEY_REPORTFOLDER ).getValue()
+            + File.separator + fileName;
+        try
+        {
+            String newpath = System.getenv( "DHIS2_HOME" );
+            if ( newpath != null )
+            {
+                path = newpath + File.separator + configurationService.getConfigurationByKey( Configuration_IN.KEY_REPORTFOLDER ).getValue() + File.separator + fileName;
+            }
+        }
+        catch ( NullPointerException npe )
+        {
+            System.out.println("DHIS2_HOME not set");
+        }
+
+        try
+        {
+            DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
+            DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();
+            Document doc = docBuilder.parse( new File( path ) );
+            if ( doc == null )
+            {
+                System.out.println( "There is no DECodes related XML file in the ra folder" );
+                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();
+                
+                String expression = ((Node) textDECodeList.item( 0 )).getNodeValue().trim();
+                String stype = deCodeElement.getAttribute( "stype" );
+                String ptype = deCodeElement.getAttribute( "type" );
+                int sheetno = new Integer( deCodeElement.getAttribute( "sheetno" ) );
+                int rowno = new Integer( deCodeElement.getAttribute( "rowno" ) );
+                int colno = new Integer( deCodeElement.getAttribute( "colno" ) );
+                
+                Report_inDesign report_inDesign = new Report_inDesign( stype, ptype, sheetno, rowno, colno, expression );
+                reportDesignList.add( report_inDesign );
+            }// 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();
+        }
+        return reportDesignList;
+    }
+    
 }

=== modified file 'local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/routine/action/GenerateRoutineReportAnalyserFormAction.java'
--- local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/routine/action/GenerateRoutineReportAnalyserFormAction.java	2010-08-28 10:15:38 +0000
+++ local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/routine/action/GenerateRoutineReportAnalyserFormAction.java	2010-11-08 06:10:18 +0000
@@ -5,13 +5,10 @@
 import java.util.Iterator;
 import java.util.List;
 
-import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.organisationunit.OrganisationUnitGroup;
 import org.hisp.dhis.organisationunit.OrganisationUnitGroupService;
 import org.hisp.dhis.organisationunit.OrganisationUnitGroupSet;
 import org.hisp.dhis.organisationunit.OrganisationUnitGroupSetPopulator;
-import org.hisp.dhis.organisationunit.OrganisationUnitService;
-import org.hisp.dhis.period.Period;
 import org.hisp.dhis.period.PeriodService;
 import org.hisp.dhis.period.PeriodType;
 import org.hisp.dhis.reports.ReportType;
@@ -21,7 +18,6 @@
 public class GenerateRoutineReportAnalyserFormAction
     implements Action
 {
-
     // -------------------------------------------------------------------------
     // Dependencies
     // -------------------------------------------------------------------------
@@ -33,25 +29,6 @@
         this.periodService = periodService;
     }
 
-    private OrganisationUnitService organisationUnitService;
-
-    public void setOrganisationUnitService( OrganisationUnitService organisationUnitService )
-    {
-        this.organisationUnitService = organisationUnitService;
-    }
-
-    public OrganisationUnitService getOrganisationUnitService()
-    {
-        return organisationUnitService;
-    }
-/*
-    private ReportService reportService;
-
-    public void setReportService( ReportService reportService )
-    {
-        this.reportService = reportService;
-    }
-*/    
     private OrganisationUnitGroupService organisationUnitGroupService;
 
     public void setOrganisationUnitGroupService( OrganisationUnitGroupService organisationUnitGroupService )
@@ -60,36 +37,9 @@
     }
 
     // -------------------------------------------------------------------------
-    // Constants
-    // -------------------------------------------------------------------------
-
-    private final int ALL = 0;
-
-    public int getALL()
-    {
-        return ALL;
-    }
-
-//    private String raFolderName;
-
-    // -------------------------------------------------------------------------
     // Properties
     // -------------------------------------------------------------------------
 
-    private Collection<OrganisationUnit> organisationUnits;
-
-    public Collection<OrganisationUnit> getOrganisationUnits()
-    {
-        return organisationUnits;
-    }
-
-    private Collection<Period> periods = new ArrayList<Period>();
-
-    public Collection<Period> getPeriods()
-    {
-        return periods;
-    }
-
     private Collection<PeriodType> periodTypes;
 
     public Collection<PeriodType> getPeriodTypes()
@@ -118,36 +68,31 @@
     public String execute()
         throws Exception
     {
-       // raFolderName = reportService.getRAFolderName();
-        
-        /* Report Info */
         reportTypeName = ReportType.RT_ROUTINE;
 
-        /* Period Info */
         periodTypes = periodService.getAllPeriodTypes();
 
-        Iterator<PeriodType> alldeIterator = periodTypes.iterator();
-        while ( alldeIterator.hasNext() )
+        Iterator<PeriodType> periodTypeIterator = periodTypes.iterator();
+        while ( periodTypeIterator.hasNext() )
         {
-            PeriodType type = alldeIterator.next();
-            if (type.getName().equalsIgnoreCase("Monthly") || type.getName().equalsIgnoreCase("quarterly") || type.getName().equalsIgnoreCase("yearly"))
+            PeriodType type = periodTypeIterator.next();
+            
+            if( type.getName().equalsIgnoreCase("Monthly") || type.getName().equalsIgnoreCase("quarterly") || type.getName().equalsIgnoreCase("yearly") )
             {
-                periods.addAll(periodService.getPeriodsByPeriodType(type));
             }
             else
             {
-               alldeIterator.remove();
+                periodTypeIterator.remove();
             }
         }
         
         OrganisationUnitGroupSet organisationUnitGroupSet1 = organisationUnitGroupService.getOrganisationUnitGroupSetByName( OrganisationUnitGroupSetPopulator.NAME_TYPE );
         
-        orgUnitGroupMembers = new ArrayList<OrganisationUnitGroup>(organisationUnitGroupSet1.getOrganisationUnitGroups());
+        orgUnitGroupMembers = new ArrayList<OrganisationUnitGroup>( organisationUnitGroupSet1.getOrganisationUnitGroups() );
         
         OrganisationUnitGroupSet organisationUnitGroupSet2 = organisationUnitGroupService.getOrganisationUnitGroupSetByName( OrganisationUnitGroupSetPopulator.NAME_OWNERSHIP );
         
-        orgUnitGroupMembers.addAll( new ArrayList<OrganisationUnitGroup>(organisationUnitGroupSet2.getOrganisationUnitGroups() ) );
-        
+        orgUnitGroupMembers.addAll( new ArrayList<OrganisationUnitGroup>( organisationUnitGroupSet2.getOrganisationUnitGroups() ) );
         
         return SUCCESS;
     }

=== modified file 'local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/routine/action/GenerateRoutineReportAnalyserResultAction.java'
--- local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/routine/action/GenerateRoutineReportAnalyserResultAction.java	2010-09-18 12:30:36 +0000
+++ local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/routine/action/GenerateRoutineReportAnalyserResultAction.java	2010-11-08 06:10:18 +0000
@@ -13,9 +13,6 @@
 import java.util.List;
 import java.util.UUID;
 
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-
 import jxl.CellType;
 import jxl.Workbook;
 import jxl.format.Alignment;
@@ -32,7 +29,6 @@
 import jxl.write.WritableWorkbook;
 
 import org.amplecode.quick.StatementManager;
-import org.apache.velocity.tools.generic.MathTool;
 import org.hisp.dhis.i18n.I18nFormat;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.organisationunit.OrganisationUnitGroup;
@@ -44,12 +40,7 @@
 import org.hisp.dhis.period.PeriodType;
 import org.hisp.dhis.reports.ReportService;
 import org.hisp.dhis.reports.Report_in;
-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 org.hisp.dhis.reports.Report_inDesign;
 
 import com.opensymphony.xwork2.Action;
 
@@ -95,19 +86,6 @@
         this.organisationUnitService = organisationUnitService;
     }
 
-    public OrganisationUnitService getOrganisationUnitService()
-    {
-        return organisationUnitService;
-    }
-
-     /*
-     * private DataElementCategoryService dataElementCategoryService;
-     * 
-     * public void setDataElementCategoryService( DataElementCategoryService
-     * dataElementCategoryService ) { this.dataElementCategoryService =
-     * dataElementCategoryService; }
-     */
-
     private I18nFormat format;
 
     public void setFormat( I18nFormat format )
@@ -118,12 +96,6 @@
     // -------------------------------------------------------------------------
     // Properties
     // -------------------------------------------------------------------------
-    /*
-     * private PeriodStore periodStore;
-     * 
-     * public void setPeriodStore( PeriodStore periodStore ) { this.periodStore
-     * = periodStore; }
-     */
     private InputStream inputStream;
 
     public InputStream getInputStream()
@@ -131,12 +103,6 @@
         return inputStream;
     }
 
-    /*
-     * private String contentType;
-     * 
-     * public String getContentType() { return contentType; }
-     */
-
     private String fileName;
 
     public String getFileName()
@@ -144,120 +110,6 @@
         return fileName;
     }
 
-    /*
-     * private int bufferSize;
-     * 
-     * public int getBufferSize() { return bufferSize; }
-     */
-
-    private MathTool mathTool;
-
-    public MathTool getMathTool()
-    {
-        return mathTool;
-    }
-
-    // private OrganisationUnit selectedOrgUnit;
-
-    // public OrganisationUnit getSelectedOrgUnit()
-    // {
-    // return selectedOrgUnit;
-    // }
-
-    private List<OrganisationUnit> orgUnitList;
-
-    public List<OrganisationUnit> getOrgUnitList()
-    {
-        return orgUnitList;
-    }
-
-    private Period selectedPeriod;
-
-    public Period getSelectedPeriod()
-    {
-        return selectedPeriod;
-    }
-
-    private List<String> dataValueList;
-
-    public List<String> getDataValueList()
-    {
-        return dataValueList;
-    }
-
-    private List<String> services;
-
-    public List<String> getServices()
-    {
-        return services;
-    }
-
-    private List<String> slNos;
-
-    public List<String> getSlNos()
-    {
-        return slNos;
-    }
-
-    private SimpleDateFormat simpleDateFormat;
-
-    public SimpleDateFormat getSimpleDateFormat()
-    {
-        return simpleDateFormat;
-    }
-
-    private SimpleDateFormat monthFormat;
-
-    public SimpleDateFormat getMonthFormat()
-    {
-        return monthFormat;
-    }
-
-    private SimpleDateFormat dailyFormat;
-
-    public SimpleDateFormat getDailyFormat()
-    {
-        return dailyFormat;
-    }
-
-    private SimpleDateFormat simpleMonthFormat;
-
-    public SimpleDateFormat getSimpleMonthFormat()
-    {
-        return simpleMonthFormat;
-    }
-
-    private SimpleDateFormat yearFormat;
-
-    public SimpleDateFormat getYearFormat()
-    {
-        return yearFormat;
-    }
-
-    private SimpleDateFormat simpleYearFormat;
-
-    public SimpleDateFormat getSimpleYearFormat()
-    {
-        return simpleYearFormat;
-    }
-
-    private List<String> deCodeType;
-
-    private List<String> serviceType;
-
-    private String reportFileNameTB;
-
-    public void setReportFileNameTB( String reportFileNameTB )
-    {
-        this.reportFileNameTB = reportFileNameTB;
-    }
-
-    private String reportModelTB;
-
-    /*
-     * public void setReportModelTB( String reportModelTB ) { this.reportModelTB
-     * = reportModelTB; }
-     */
     private String reportList;
 
     public void setReportList( String reportList )
@@ -265,21 +117,6 @@
         this.reportList = reportList;
     }
 
-    /*
-     * private String startDate;
-     * 
-     * public void setStartDate( String startDate ) { this.startDate =
-     * startDate; }
-     * 
-     * private String endDate;
-     * 
-     * public void setEndDate( String endDate ) { this.endDate = endDate; }
-     * 
-     * private List<String> orgUnitListCB;
-     * 
-     * public void setOrgUnitListCB( List<String> orgUnitListCB ) {
-     * this.orgUnitListCB = orgUnitListCB; }
-     */
     private int ouIDTB;
 
     public void setOuIDTB( int ouIDTB )
@@ -308,17 +145,25 @@
         this.organisationUnitGroupId = organisationUnitGroupId;
     }
 
-    /*
-     * private String ouNameTB;
-     * 
-     * public void setOuNameTB( String ouNameTB ) { this.ouNameTB = ouNameTB; }
-     */
-    // private Hashtable<String, String> serviceList;
-    private List<Integer> sheetList;
-
-    private List<Integer> rowList;
-
-    private List<Integer> colList;
+    private List<OrganisationUnit> orgUnitList;
+
+    private Period selectedPeriod;
+
+    private SimpleDateFormat simpleDateFormat;
+
+    private SimpleDateFormat monthFormat;
+
+    private SimpleDateFormat dailyFormat;
+
+    private SimpleDateFormat simpleMonthFormat;
+
+    private SimpleDateFormat yearFormat;
+
+    private SimpleDateFormat simpleYearFormat;
+
+    private String reportFileNameTB;
+
+    private String reportModelTB;
 
     private Date sDate;
 
@@ -330,31 +175,8 @@
 
     private PeriodType periodType;
 
-    public PeriodType getPeriodType()
-    {
-        return periodType;
-    }
-
-    private List<Period> periods;
-
-    public List<Period> getPeriods()
-    {
-        return periods;
-    }
-
-    // private List<Integer> totalOrgUnitsCountList;
-
     private String raFolderName;
 
-    private List<OrganisationUnit> childOrgUnits;
-
-    public List<OrganisationUnit> getChildOrgUnits()
-    {
-        return childOrgUnits;
-    }
-
-    // private List<OrganisationUnit> orgUnit;
-
     // -------------------------------------------------------------------------
     // Action implementation
     // -------------------------------------------------------------------------
@@ -364,68 +186,35 @@
     {
 
         statementManager.initialise();
+
         // Initialization
         raFolderName = reportService.getRAFolderName();
-
-        mathTool = new MathTool();
-        services = new ArrayList<String>();
-        slNos = new ArrayList<String>();
-        deCodeType = new ArrayList<String>();
-        serviceType = new ArrayList<String>();
-        // totalOrgUnitsCountList = new ArrayList<Integer>();
-
         simpleDateFormat = new SimpleDateFormat( "MMM-yyyy" );
         monthFormat = new SimpleDateFormat( "MMMM" );
         simpleMonthFormat = new SimpleDateFormat( "MMM" );
         yearFormat = new SimpleDateFormat( "yyyy" );
         simpleYearFormat = new SimpleDateFormat( "yy" );
         dailyFormat = new SimpleDateFormat( "yyyy-MM-dd" );
-        // deCodesXMLFileName = reportList + "DECodes.xml";
-
-        // getting Reports Details
-
         String deCodesXMLFileName = "";
+        String parentUnit = "";
 
         Report_in selReportObj = reportService.getReport( Integer.parseInt( reportList ) );
         deCodesXMLFileName = selReportObj.getXmlTemplateName();
         reportModelTB = selReportObj.getModel();
         reportFileNameTB = selReportObj.getExcelTemplateName();
 
-        System.out.println( reportModelTB + " : " + reportFileNameTB + " : " + deCodesXMLFileName + " : " + ouIDTB );
-
-        System.out.println( "Report Generation Start Time is : \t" + new Date() );
-
-        String parentUnit = "";
-
-        sheetList = new ArrayList<Integer>();
-        rowList = new ArrayList<Integer>();
-        colList = new ArrayList<Integer>();
-
         String inputTemplatePath = System.getenv( "DHIS2_HOME" ) + File.separator + raFolderName + File.separator
             + "template" + File.separator + reportFileNameTB;
         String outputReportPath = System.getenv( "DHIS2_HOME" ) + File.separator + raFolderName + File.separator
             + "output" + File.separator + UUID.randomUUID().toString() + ".xls";
-        Workbook templateWorkbook = Workbook.getWorkbook( new File( inputTemplatePath ) );
-
-        WritableWorkbook outputReportWorkbook = Workbook
-            .createWorkbook( new File( outputReportPath ), templateWorkbook );
-
-        if ( reportModelTB.equalsIgnoreCase( "DYNAMIC-ORGUNIT" ) )
+
+        if( reportModelTB.equalsIgnoreCase( "DYNAMIC-ORGUNIT" ) )
         {
             OrganisationUnit orgUnit = organisationUnitService.getOrganisationUnit( ouIDTB );
             orgUnitList = new ArrayList<OrganisationUnit>( orgUnit.getChildren() );
             Collections.sort( orgUnitList, new OrganisationUnitNameComparator() );
         }
-
-        if ( reportModelTB.equalsIgnoreCase( "STATIC" ) )
-        {
-            orgUnitList = new ArrayList<OrganisationUnit>();
-            OrganisationUnit orgUnit = organisationUnitService.getOrganisationUnit( ouIDTB );
-            orgUnitList.add( orgUnit );
-
-        }
-
-        if ( reportModelTB.equalsIgnoreCase( "dynamicwithrootfacility" ) )
+        else if( reportModelTB.equalsIgnoreCase( "dynamicwithrootfacility" ) )
         {
             OrganisationUnit orgUnit = organisationUnitService.getOrganisationUnit( ouIDTB );
             orgUnitList = new ArrayList<OrganisationUnit>( orgUnit.getChildren() );
@@ -433,304 +222,44 @@
             orgUnitList.add( orgUnit );
 
             parentUnit = orgUnit.getName();
-
-        }
-
-        if ( reportModelTB.equalsIgnoreCase( "STATIC-DATAELEMENTS" ) )
-        {
-            orgUnitList = new ArrayList<OrganisationUnit>();
-            OrganisationUnit orgUnit = organisationUnitService.getOrganisationUnit( ouIDTB );
-            orgUnitList.add( orgUnit );
-        }
-
-        if ( reportModelTB.equalsIgnoreCase( "STATIC-FINANCIAL" ) )
-        {
-            orgUnitList = new ArrayList<OrganisationUnit>();
-            OrganisationUnit orgUnit = organisationUnitService.getOrganisationUnit( ouIDTB );
-            orgUnitList.add( orgUnit );
-        }
-
-        if ( reportModelTB.equalsIgnoreCase( "INDICATOR-AGAINST-PARENT" ) )
-        {
-            OrganisationUnit orgUnit = organisationUnitService.getOrganisationUnit( ouIDTB );
-            // OrganisationUnit parent = orgUnit.getParent();
-            orgUnitList = new ArrayList<OrganisationUnit>();
-
-            Collections.sort( orgUnitList, new OrganisationUnitNameComparator() );
-
-            // orgUnitList.add( 0, parent );
-
-            orgUnitList.add( orgUnit );
-
-        }
-        if ( reportModelTB.equalsIgnoreCase( "INDICATOR-AGAINST-SIBLINGS" ) )
-        {
-            OrganisationUnit orgUnit = organisationUnitService.getOrganisationUnit( ouIDTB );
-
-            orgUnitList = new ArrayList<OrganisationUnit>();
-
-            orgUnitList.addAll( orgUnit.getChildren() );
-
-            Collections.sort( orgUnitList, new OrganisationUnitNameComparator() );
-
-            orgUnitList.add( 0, orgUnit );
-        }
-
-        if ( reportModelTB.equalsIgnoreCase( "INDICATOR-FOR-FEEDBACK" ) )
-        {
-            OrganisationUnit orgUnit = organisationUnitService.getOrganisationUnit( ouIDTB );
-
-            orgUnitList = new ArrayList<OrganisationUnit>();
-
-            orgUnitList.addAll( orgUnit.getChildren() );
-
-            Collections.sort( orgUnitList, new OrganisationUnitNameComparator() );
-
-            orgUnitList.add( 0, orgUnit );
-        }
-
+        }
+        else if( reportModelTB.equalsIgnoreCase( "STATIC" ) || reportModelTB.equalsIgnoreCase( "STATIC-DATAELEMENTS" ) || reportModelTB.equalsIgnoreCase( "STATIC-FINANCIAL" ) )
+        {
+            orgUnitList = new ArrayList<OrganisationUnit>();
+            OrganisationUnit orgUnit = organisationUnitService.getOrganisationUnit( ouIDTB );
+            orgUnitList.add( orgUnit );
+        }
+
+        System.out.println( orgUnitList.get( 0 ).getName()+ " : " + selReportObj.getName()+" : Report Generation Start Time is : " + new Date() );
+        
         selectedPeriod = periodService.getPeriod( availablePeriods );
 
         sDate = format.parseDate( String.valueOf( selectedPeriod.getStartDate() ) );
 
         eDate = format.parseDate( String.valueOf( selectedPeriod.getEndDate() ) );
 
-        simpleDateFormat = new SimpleDateFormat( "MMM-yyyy" );
+        Workbook templateWorkbook = Workbook.getWorkbook( new File( inputTemplatePath ) );
+
+        WritableWorkbook outputReportWorkbook = Workbook.createWorkbook( new File( outputReportPath ), templateWorkbook );
 
         // Getting DataValues
-        dataValueList = new ArrayList<String>();
-        List<String> deCodesList = getDECodes( deCodesXMLFileName );
+        List<Report_inDesign> reportDesignList = reportService.getReportDesign( deCodesXMLFileName );
+        int orgUnitCount = 0;
 
         Iterator<OrganisationUnit> it = orgUnitList.iterator();
-        int orgUnitCount = 0;
-        int orgUnitGroupCount = 0;
-
-        int rowCounter = 0;
-
-        //----------------------------------------------------------------------
-        // -----------------------------
-        // Feedback without orgunit START
-        // This part is for generating feedback reports for orgunits without any
-        // children
-        //----------------------------------------------------------------------
-        // -----------------------------
-
-        OrganisationUnit checkChildOrgunit = new OrganisationUnit();
-
-        checkChildOrgunit = organisationUnitService.getOrganisationUnit( ouIDTB );
-
-        childOrgUnits = new ArrayList<OrganisationUnit>();
-
-        childOrgUnits.addAll( checkChildOrgunit.getChildren() );
-
-        int children = 1;
-
-        if ( reportModelTB.equalsIgnoreCase( "INDICATOR-FOR-FEEDBACK" )
-            && (childOrgUnits == null || childOrgUnits.size() == 0) )
-        {
-            children = 0;
-        }
-
-        if ( children == 0 )
-        {
-            // int quarterPeriod = 0;
-
-            OrganisationUnit currentOrgUnit = (OrganisationUnit) it.next();
-
-            Iterator<String> it1 = deCodesList.iterator();
-            int count1 = 0;
-
-            while ( it1.hasNext() )
-            {
-                String deCodeString = (String) it1.next();
-
-                String deType = (String) deCodeType.get( count1 );
-                // String sType = (String) serviceType.get( count1 );
-                // int count = 0;
-                // double sum = 0.0;
-                // int flag1 = 0;
-                String tempStr = "";
-
-                Calendar tempStartDate = Calendar.getInstance();
-                Calendar tempEndDate = Calendar.getInstance();
-                List<Calendar> calendarList = new ArrayList<Calendar>( reportService.getStartingEndingPeriods( deType, selectedPeriod ) );
-                if ( calendarList == null || calendarList.isEmpty() )
-                {
-                    tempStartDate.setTime( selectedPeriod.getStartDate() );
-                    tempEndDate.setTime( selectedPeriod.getEndDate() );
-                    return SUCCESS;
-                }
-                else
-                {
-                    tempStartDate = calendarList.get( 0 );
-                    tempEndDate = calendarList.get( 1 );
-                }
-
-                if ( deCodeString.equalsIgnoreCase( "FACILITY" ) )
-                {
-                    tempStr = "";
-
-                }
-
-                else if ( deCodeString.equalsIgnoreCase( "FACILITYP" ) )
-                {
-                    tempStr = currentOrgUnit.getName();
-
-                }
-
-                else if ( deCodeString.equalsIgnoreCase( "FACILITYPP" ) )
-                {
-                    OrganisationUnit orgUnitP = new OrganisationUnit();
-
-                    orgUnitP = currentOrgUnit.getParent();
-
-                    tempStr = orgUnitP.getName();
-
-                }
-
-                else if ( deCodeString.equalsIgnoreCase( "FACILITYPPP" ) )
-                {
-                    OrganisationUnit orgUnitP = new OrganisationUnit();
-
-                    OrganisationUnit orgUnitPP = new OrganisationUnit();
-
-                    orgUnitP = currentOrgUnit.getParent();
-
-                    orgUnitPP = orgUnitP.getParent();
-
-                    tempStr = orgUnitPP.getName();
-
-                }
-
-                else if ( deCodeString.equalsIgnoreCase( "FACILITYPPPP" ) )
-                {
-                    OrganisationUnit orgUnitP = new OrganisationUnit();
-
-                    OrganisationUnit orgUnitPP = new OrganisationUnit();
-
-                    OrganisationUnit orgUnitPPP = new OrganisationUnit();
-
-                    orgUnitP = currentOrgUnit.getParent();
-
-                    orgUnitPP = orgUnitP.getParent();
-
-                    orgUnitPPP = orgUnitPP.getParent();
-
-                    tempStr = orgUnitPPP.getName();
-
-                }
-
-                else if ( deCodeString.equalsIgnoreCase( "PERIOD-MONTH" ) )
-                {
-                    tempStr = monthFormat.format( sDate );
-
-                }
-
-                else if ( deCodeString.equalsIgnoreCase( "YEAR-FROMTO" ) )
-                {
-
-                    sDateTemp = sDate;
-
-                    eDateTemp = eDate;
-
-                    Calendar tempQuarterYear = Calendar.getInstance();
-
-                    String startYear = "";
-
-                    String endYear = "";
-
-                    String startMonth = "";
-
-                    startMonth = monthFormat.format( sDateTemp );
-
-                    periodType = selectedPeriod.getPeriodType();
-
-                    tempQuarterYear.setTime( sDateTemp );
-
-                    if ( (startMonth.equalsIgnoreCase( "January" ) || startMonth.equalsIgnoreCase( "February" ) || startMonth
-                        .equalsIgnoreCase( "March" )) )
-                    {
-                        tempQuarterYear.roll( Calendar.YEAR, -1 );
-
-                        sDateTemp = tempQuarterYear.getTime();
-
-                    }
-
-                    startYear = yearFormat.format( sDateTemp );
-
-                    tempQuarterYear.setTime( eDateTemp );
-
-                    if ( !(startMonth.equalsIgnoreCase( "January" ) || startMonth.equalsIgnoreCase( "February" ) || startMonth
-                        .equalsIgnoreCase( "March" )) )
-                    {
-                        tempQuarterYear.roll( Calendar.YEAR, 1 );
-
-                        eDateTemp = tempQuarterYear.getTime();
-
-                    }
-                    endYear = yearFormat.format( eDateTemp );
-
-                    tempStr = startYear + " - " + endYear;
-
-                }
-
-                else
-                {
-                    tempStr = "";
-                }
-
-                WritableCellFormat wCellformat = new WritableCellFormat();
-                wCellformat.setBorder( Border.ALL, BorderLineStyle.THIN );
-                wCellformat.setWrap( true );
-                wCellformat.setAlignment( Alignment.CENTRE );
-
-                int tempRowNo = rowList.get( count1 );
-                int tempColNo = colList.get( count1 );
-                int sheetNo = sheetList.get( count1 ) + orgUnitGroupCount;
-                WritableSheet sheet0 = outputReportWorkbook.getSheet( sheetNo );
-
-                if ( tempStr == null || tempStr.equals( " " ) )
-                {
-                    sheet0.addCell( new Blank( tempColNo, tempRowNo, wCellformat ) );
-                }
-
-                sheet0.addCell( new Label( tempColNo, tempRowNo, tempStr, wCellformat ) );
-
-                count1++;
-            }
-
-        }
-
-        //----------------------------------------------------------------------
-        // -----------------------------
-        // Feedback without orgunit END
-        //----------------------------------------------------------------------
-        // -----------------------------
-
-        //----------------------------------------------------------------------
-        // -----------------------------
-        // All other reports START
-        //----------------------------------------------------------------------
-        // -----------------------------
-
-        while ( it.hasNext() && children != 0 )
-        {
-
-            // int quarterPeriod = 0;
-
-            OrganisationUnit currentOrgUnit = (OrganisationUnit) it.next();
-
-            Iterator<String> it1 = deCodesList.iterator();
-            int count1 = 0;
-            while ( it1.hasNext() )
-            {
-                String deCodeString = (String) it1.next();
-
-                String deType = (String) deCodeType.get( count1 );
-                String sType = (String) serviceType.get( count1 );
-                // int count = 0;
-                // double sum = 0.0;
-                // int flag1 = 0;
+        while ( it.hasNext() )
+        {
+            OrganisationUnit currentOrgUnit = (OrganisationUnit) it.next();
+
+            Iterator<Report_inDesign> reportDesignIterator = reportDesignList.iterator();
+            int count1 = 0;
+            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 = "";
                 double tempNum = 0;
 
@@ -752,7 +281,6 @@
                 if ( deCodeString.equalsIgnoreCase( "FACILITY" ) )
                 {
                     tempStr = currentOrgUnit.getName();
-
                 }
                 else if ( deCodeString.equalsIgnoreCase( "FACILITY-NOREPEAT" ) )
                 {
@@ -761,97 +289,54 @@
                 else if ( deCodeString.equalsIgnoreCase( "FACILITYP" ) )
                 {
                     tempStr = currentOrgUnit.getParent().getName();
-
                 }
-
                 else if ( deCodeString.equalsIgnoreCase( "FACILITYPP" ) )
                 {
-                    OrganisationUnit orgUnitP = new OrganisationUnit();
-
-                    orgUnitP = currentOrgUnit.getParent();
-
-                    tempStr = orgUnitP.getParent().getName();
-
+                    tempStr = currentOrgUnit.getParent().getParent().getName();
                 }
-
                 else if ( deCodeString.equalsIgnoreCase( "FACILITYPPP" ) )
                 {
-                    OrganisationUnit orgUnitP = new OrganisationUnit();
-
-                    OrganisationUnit orgUnitPP = new OrganisationUnit();
-
-                    orgUnitP = currentOrgUnit.getParent();
-
-                    orgUnitPP = orgUnitP.getParent();
-
-                    tempStr = orgUnitPP.getParent().getName();
-
+                    tempStr = currentOrgUnit.getParent().getParent().getParent().getName();
                 }
-
                 else if ( deCodeString.equalsIgnoreCase( "FACILITYPPPP" ) )
                 {
-                    OrganisationUnit orgUnitP = new OrganisationUnit();
-
-                    OrganisationUnit orgUnitPP = new OrganisationUnit();
-
-                    OrganisationUnit orgUnitPPP = new OrganisationUnit();
-
-                    orgUnitP = currentOrgUnit.getParent();
-
-                    orgUnitPP = orgUnitP.getParent();
-
-                    orgUnitPPP = orgUnitPP.getParent();
-
-                    tempStr = orgUnitPPP.getParent().getName();
-
+                    tempStr = currentOrgUnit.getParent().getParent().getParent().getParent().getName();
                 }
                 else if ( deCodeString.equalsIgnoreCase( "FACILITYCOMMENT" ) )
                 {
                     tempStr = currentOrgUnit.getComment();
                 }
-                else if ( deCodeString.equalsIgnoreCase( "PERIOD" )
-                    || deCodeString.equalsIgnoreCase( "PERIOD-NOREPEAT" ) )
+                else if ( deCodeString.equalsIgnoreCase( "PERIOD" ) || deCodeString.equalsIgnoreCase( "PERIOD-NOREPEAT" ) )
                 {
                     tempStr = simpleDateFormat.format( sDate );
-
                 }
                 else if ( deCodeString.equalsIgnoreCase( "PERIOD-MONTH" ) )
                 {
                     tempStr = monthFormat.format( sDate );
-
                 }
                 else if ( deCodeString.equalsIgnoreCase( "DAILY-PERIOD" ) )
                 {
                     tempStr = dailyFormat.format( sDate );
-
                 }
-
                 else if ( deCodeString.equalsIgnoreCase( "MONTH-START-SHORT" ) )
                 {
                     tempStr = simpleMonthFormat.format( sDate );
-
                 }
                 else if ( deCodeString.equalsIgnoreCase( "MONTH-END-SHORT" ) )
                 {
                     tempStr = simpleMonthFormat.format( eDate );
-
                 }
-
                 else if ( deCodeString.equalsIgnoreCase( "MONTH-START" ) )
                 {
                     tempStr = monthFormat.format( sDate );
-
                 }
                 else if ( deCodeString.equalsIgnoreCase( "MONTH-END" ) )
                 {
                     tempStr = monthFormat.format( eDate );
-
                 }
-
                 else if ( deCodeString.equalsIgnoreCase( "PERIOD-WEEK" ) )
                 {
                     tempStr = String.valueOf( tempStartDate.get( Calendar.WEEK_OF_MONTH ) );
-
                 }
                 else if ( deCodeString.equalsIgnoreCase( "PERIOD-QUARTER" ) )
                 {
@@ -863,7 +348,6 @@
                     {
                         tempStr = "Quarter I";
                     }
-
                     else if ( startMonth.equalsIgnoreCase( "July" ) )
                     {
                         tempStr = "Quarter II";
@@ -872,16 +356,11 @@
                     {
                         tempStr = "Quarter III";
                     }
-
                     else
                     {
                         tempStr = "Quarter IV";
-
-                        // quarterPeriod = 1;
-
                     }
                 }
-
                 else if ( deCodeString.equalsIgnoreCase( "SIMPLE-QUARTER" ) )
                 {
                     String startMonth = "";
@@ -892,7 +371,6 @@
                     {
                         tempStr = "Q1";
                     }
-
                     else if ( startMonth.equalsIgnoreCase( "July" ) )
                     {
                         tempStr = "Q2";
@@ -901,16 +379,11 @@
                     {
                         tempStr = "Q3";
                     }
-
                     else
                     {
                         tempStr = "Q4";
-
-                        // quarterPeriod = 1;
-
                     }
                 }
-
                 else if ( deCodeString.equalsIgnoreCase( "QUARTER-MONTHS-SHORT" ) )
                 {
                     String startMonth = "";
@@ -921,7 +394,6 @@
                     {
                         tempStr = "Apr - Jun";
                     }
-
                     else if ( startMonth.equalsIgnoreCase( "July" ) )
                     {
                         tempStr = "Jul - Sep";
@@ -930,16 +402,11 @@
                     {
                         tempStr = "Oct - Dec";
                     }
-
                     else
                     {
                         tempStr = "Jan - Mar";
-
-                        // quarterPeriod = 1;
-
                     }
                 }
-
                 else if ( deCodeString.equalsIgnoreCase( "QUARTER-MONTHS" ) )
                 {
                     String startMonth = "";
@@ -950,7 +417,6 @@
                     {
                         tempStr = "April - June";
                     }
-
                     else if ( startMonth.equalsIgnoreCase( "July" ) )
                     {
                         tempStr = "July - September";
@@ -959,16 +425,11 @@
                     {
                         tempStr = "October - December";
                     }
-
                     else
                     {
                         tempStr = "January - March";
-
-                        // quarterPeriod = 1;
-
                     }
                 }
-
                 else if ( deCodeString.equalsIgnoreCase( "QUARTER-START-SHORT" ) )
                 {
                     String startMonth = "";
@@ -979,7 +440,6 @@
                     {
                         tempStr = "Apr";
                     }
-
                     else if ( startMonth.equalsIgnoreCase( "July" ) )
                     {
                         tempStr = "Jul";
@@ -988,16 +448,11 @@
                     {
                         tempStr = "Oct";
                     }
-
                     else
                     {
                         tempStr = "Jan";
-
-                        // quarterPeriod = 1;
-
                     }
                 }
-
                 else if ( deCodeString.equalsIgnoreCase( "QUARTER-START" ) )
                 {
                     String startMonth = "";
@@ -1008,7 +463,6 @@
                     {
                         tempStr = "April";
                     }
-
                     else if ( startMonth.equalsIgnoreCase( "July" ) )
                     {
                         tempStr = "July";
@@ -1017,16 +471,11 @@
                     {
                         tempStr = "October";
                     }
-
                     else
                     {
                         tempStr = "January";
-
-                        // quarterPeriod = 1;
-
                     }
                 }
-
                 else if ( deCodeString.equalsIgnoreCase( "QUARTER-END-SHORT" ) )
                 {
                     String endMonth = "";
@@ -1037,7 +486,6 @@
                     {
                         tempStr = "Jun";
                     }
-
                     else if ( endMonth.equalsIgnoreCase( "September" ) )
                     {
                         tempStr = "Sep";
@@ -1046,16 +494,11 @@
                     {
                         tempStr = "Dec";
                     }
-
                     else
                     {
                         tempStr = "Mar";
-
-                        // quarterPeriod = 1;
-
                     }
                 }
-
                 else if ( deCodeString.equalsIgnoreCase( "QUARTER-END" ) )
                 {
                     String endMonth = "";
@@ -1066,7 +509,6 @@
                     {
                         tempStr = "June";
                     }
-
                     else if ( endMonth.equalsIgnoreCase( "September" ) )
                     {
                         tempStr = "September";
@@ -1075,16 +517,11 @@
                     {
                         tempStr = "December";
                     }
-
                     else
                     {
                         tempStr = "March";
-
-                        // quarterPeriod = 1;
-
                     }
                 }
-
                 else if ( deCodeString.equalsIgnoreCase( "PERIOD-YEAR" ) )
                 {
                     sDateTemp = sDate;
@@ -1103,7 +540,6 @@
                     {
                         sDateTemp = sDate;
                     }
-
                     else
                     {
                         if ( (startMonth.equalsIgnoreCase( "January" ) || startMonth.equalsIgnoreCase( "February" ) || startMonth
@@ -1113,13 +549,10 @@
                             tempQuarterYear.roll( Calendar.YEAR, -1 );
 
                             sDateTemp = tempQuarterYear.getTime();
-
                         }
                     }
-
                     tempStr = yearFormat.format( sDateTemp );
                 }
-
                 else if ( deCodeString.equalsIgnoreCase( "SIMPLE-YEAR" ) )
                 {
                     sDateTemp = sDate;
@@ -1138,7 +571,6 @@
                     {
                         sDateTemp = sDate;
                     }
-
                     else
                     {
                         if ( (startMonth.equalsIgnoreCase( "January" ) || startMonth.equalsIgnoreCase( "February" ) || startMonth
@@ -1154,10 +586,8 @@
 
                     tempStr = simpleYearFormat.format( sDateTemp );
                 }
-
                 else if ( deCodeString.equalsIgnoreCase( "YEAR-END" ) )
                 {
-
                     sDateTemp = sDate;
 
                     Calendar tempQuarterYear = Calendar.getInstance();
@@ -1254,7 +684,6 @@
                     tempStr = startYear + " - " + endYear;
 
                 }
-
                 else if ( deCodeString.equalsIgnoreCase( "SLNO" ) )
                 {
                     tempStr = "" + (orgUnitCount + 1);
@@ -1265,24 +694,11 @@
                 }
                 else
                 {
-                    rowCounter += 1;
-
                     if ( sType.equalsIgnoreCase( "dataelement" ) )
                     {
-                        /*
-                         * if ( organisationUnitGroupId == null ) { tempStr =
-                         * getIndividualResultDataValue( deCodeString,
-                         * tempStartDate.getTime(), tempEndDate .getTime(),
-                         * currentOrgUnit ); } else { tempStr =
-                         * getResultDataValue( deCodeString,
-                         * tempStartDate.getTime(), tempEndDate.getTime(),
-                         * currentOrgUnit ); }
-                         */
-
                         if ( organisationUnitGroupId.equals( "ALL" ) )
                         {
                             tempStr = reportService.getResultDataValue( deCodeString, tempStartDate.getTime(), tempEndDate.getTime(), currentOrgUnit, reportModelTB );
-
                         }
                         else if ( organisationUnitGroupId.equals( "Selected_Only" ) )
                         {
@@ -1290,15 +706,11 @@
                         }
                         else
                         {
-
-                            OrganisationUnitGroup orgUnitGroup = organisationUnitGroupService
-                                .getOrganisationUnitGroup( Integer.parseInt( organisationUnitGroupId ) );
-
-                            List<OrganisationUnit> orgGroupMembers = new ArrayList<OrganisationUnit>( orgUnitGroup
-                                .getMembers() );
-
-                            List<OrganisationUnit> orgUnitList = new ArrayList<OrganisationUnit>(
-                                organisationUnitService.getOrganisationUnitWithChildren( ouIDTB ) );
+                            OrganisationUnitGroup orgUnitGroup = organisationUnitGroupService.getOrganisationUnitGroup( Integer.parseInt( organisationUnitGroupId ) );
+
+                            List<OrganisationUnit> orgGroupMembers = new ArrayList<OrganisationUnit>( orgUnitGroup.getMembers() );
+
+                            List<OrganisationUnit> orgUnitList = new ArrayList<OrganisationUnit>( organisationUnitService.getOrganisationUnitWithChildren( ouIDTB ) );
 
                             orgGroupMembers.retainAll( orgUnitList );
 
@@ -1317,25 +729,12 @@
                                     value = 0.0;
                                     System.out.println( e );
                                 }
-                                // value = value + temp;
                                 temp += value;
                             }
 
                             tempNum = temp;
                             tempStr = String.valueOf( (int) temp );
                         }
-
-                    }
-                    else if ( sType.equalsIgnoreCase( "indicator-parent" ) )
-                    {
-                        if ( aggCB == null )
-                        {
-                            tempStr = reportService.getIndividualResultIndicatorValue( deCodeString, tempStartDate.getTime(), tempEndDate.getTime(), currentOrgUnit.getParent() );
-                        }
-                        else
-                        {
-                            tempStr = reportService.getResultIndicatorValue( deCodeString, tempStartDate.getTime(), tempEndDate.getTime(), currentOrgUnit.getParent() );
-                        }
                     }
                     else if ( sType.equalsIgnoreCase( "dataelement-boolean" ) )
                     {
@@ -1360,10 +759,12 @@
                         }
                     }
                 }
-                int tempRowNo = rowList.get( count1 );
-                int tempColNo = colList.get( count1 );
-                int sheetNo = sheetList.get( count1 ) + orgUnitGroupCount;
+                
+                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( " " ) )
                 {
                     tempColNo += orgUnitCount;
@@ -1377,87 +778,6 @@
                 }
                 else
                 {
-
-                    if ( reportModelTB.equalsIgnoreCase( "STATIC" ) )
-                    {
-                        if ( deCodeString.equalsIgnoreCase( "FACILITYP" ) )
-                        {
-
-                        }
-
-                        else if ( deCodeString.equalsIgnoreCase( "FACILITYPP" ) )
-                        {
-
-                        }
-
-                        else if ( deCodeString.equalsIgnoreCase( "FACILITYPPP" ) )
-                        {
-
-                        }
-
-                        else if ( deCodeString.equalsIgnoreCase( "FACILITYPPPP" ) )
-                        {
-
-                        }
-
-                        else if ( deCodeString.equalsIgnoreCase( "PERIOD" )
-                            || deCodeString.equalsIgnoreCase( "PERIOD-NOREPEAT" )
-                            || deCodeString.equalsIgnoreCase( "PERIOD-WEEK" )
-                            || deCodeString.equalsIgnoreCase( "PERIOD-MONTH" )
-                            || deCodeString.equalsIgnoreCase( "PERIOD-QUARTER" )
-                            || deCodeString.equalsIgnoreCase( "PERIOD-YEAR" )
-                            || deCodeString.equalsIgnoreCase( "MONTH-START" )
-                            || deCodeString.equalsIgnoreCase( "MONTH-END" )
-                            || deCodeString.equalsIgnoreCase( "MONTH-START-SHORT" )
-                            || deCodeString.equalsIgnoreCase( "MONTH-END-SHORT" )
-                            || deCodeString.equalsIgnoreCase( "SIMPLE-QUARTER" )
-                            || deCodeString.equalsIgnoreCase( "QUARTER-MONTHS-SHORT" )
-                            || deCodeString.equalsIgnoreCase( "QUARTER-MONTHS" )
-                            || deCodeString.equalsIgnoreCase( "QUARTER-START-SHORT" )
-                            || deCodeString.equalsIgnoreCase( "QUARTER-END-SHORT" )
-                            || deCodeString.equalsIgnoreCase( "QUARTER-START" )
-                            || deCodeString.equalsIgnoreCase( "QUARTER-END" )
-                            || deCodeString.equalsIgnoreCase( "SIMPLE-YEAR" )
-                            || deCodeString.equalsIgnoreCase( "YEAR-END" )
-                            || deCodeString.equalsIgnoreCase( "YEAR-FROMTO" ) )
-                        {
-
-                        }
-                        else
-                        {
-                            // tempColNo +=
-                            // orgUnitCount;
-                        }
-
-                        WritableCell cell = sheet0.getWritableCell( tempColNo, tempRowNo );
-
-                        CellFormat cellFormat = cell.getCellFormat();
-                        WritableCellFormat wCellformat = new WritableCellFormat();
-                        wCellformat.setBorder( Border.ALL, BorderLineStyle.THIN );
-                        wCellformat.setWrap( true );
-                        wCellformat.setAlignment( Alignment.CENTRE );
-
-                        if ( cell.getType() == CellType.LABEL )
-                        {
-                            Label l = (Label) cell;
-                            l.setString( tempStr );
-                            l.setCellFormat( cellFormat );
-                        }
-                        else
-                        {
-                            try
-                            {
-                                tempNum = Double.valueOf( tempStr );
-                                sheet0.addCell( new Number( tempColNo, tempRowNo, tempNum, wCellformat ) );
-
-                            }
-                            catch ( Exception e )
-                            {
-                                sheet0.addCell( new Label( tempColNo, tempRowNo, tempStr, wCellformat ) );
-                            }
-                        }
-                    }
-
                     if ( reportModelTB.equalsIgnoreCase( "DYNAMIC-ORGUNIT" ) )
                     {
                         if ( deCodeString.equalsIgnoreCase( "FACILITYP" )
@@ -1467,330 +787,44 @@
                         {
 
                         }
-
-                        else if ( deCodeString.equalsIgnoreCase( "PERIOD" )
-                            || deCodeString.equalsIgnoreCase( "PERIOD-NOREPEAT" )
-                            || deCodeString.equalsIgnoreCase( "PERIOD-WEEK" )
-                            || deCodeString.equalsIgnoreCase( "PERIOD-MONTH" )
-                            || deCodeString.equalsIgnoreCase( "PERIOD-QUARTER" )
-                            || deCodeString.equalsIgnoreCase( "PERIOD-YEAR" )
-                            || deCodeString.equalsIgnoreCase( "MONTH-START" )
-                            || deCodeString.equalsIgnoreCase( "MONTH-END" )
-                            || deCodeString.equalsIgnoreCase( "MONTH-START-SHORT" )
-                            || deCodeString.equalsIgnoreCase( "MONTH-END-SHORT" )
-                            || deCodeString.equalsIgnoreCase( "SIMPLE-QUARTER" )
-                            || deCodeString.equalsIgnoreCase( "QUARTER-MONTHS-SHORT" )
-                            || deCodeString.equalsIgnoreCase( "QUARTER-MONTHS" )
-                            || deCodeString.equalsIgnoreCase( "QUARTER-START-SHORT" )
-                            || deCodeString.equalsIgnoreCase( "QUARTER-END-SHORT" )
-                            || deCodeString.equalsIgnoreCase( "QUARTER-START" )
-                            || deCodeString.equalsIgnoreCase( "QUARTER-END" )
-                            || deCodeString.equalsIgnoreCase( "SIMPLE-YEAR" )
-                            || deCodeString.equalsIgnoreCase( "YEAR-END" )
-                            || deCodeString.equalsIgnoreCase( "YEAR-FROMTO" ) )
-                        {
-
-                        }
-
-                        else
-                        {
-                            tempColNo += orgUnitCount;
-                        }
-
-                        WritableCell cell = sheet0.getWritableCell( tempColNo, tempRowNo );
-
-                        CellFormat cellFormat = cell.getCellFormat();
-                        WritableCellFormat wCellformat = new WritableCellFormat();
-
-                        wCellformat.setBorder( Border.ALL, BorderLineStyle.THIN );
-                        wCellformat.setAlignment( Alignment.CENTRE );
-                        wCellformat.setWrap( true );
-
-                        if ( cell.getType() == CellType.LABEL )
-                        {
-                            Label l = (Label) cell;
-                            l.setString( tempStr );
-                            l.setCellFormat( cellFormat );
-                        }
-                        else
-                        {
-                            try
-                            {
-                                tempNum = Double.valueOf( tempStr );
-                                sheet0.addCell( new Number( tempColNo, tempRowNo, tempNum, wCellformat ) );
-
-                            }
-                            catch ( Exception e )
-                            {
-                                sheet0.addCell( new Label( tempColNo, tempRowNo, tempStr, wCellformat ) );
-                            }
-                        }
-                    }
-
-                    if ( reportModelTB.equalsIgnoreCase( "STATIC-DATAELEMENTS" )
-                        || reportModelTB.equalsIgnoreCase( "STATIC-FINANCIAL" ) )
-                    {
-                        if ( deCodeString.equalsIgnoreCase( "PERIOD-NOREPEAT" )
-                            || deCodeString.equalsIgnoreCase( "FACILITY" ) )
-                        {
-
-                        }
-                        if ( deCodeString.equalsIgnoreCase( "FACILITYP" ) )
-                        {
-
-                        }
-                        else if ( deCodeString.equalsIgnoreCase( "FACILITYPP" ) )
-                        {
-
-                        }
-
-                        else if ( deCodeString.equalsIgnoreCase( "FACILITYPPP" ) )
-                        {
-
-                        }
-
-                        else if ( deCodeString.equalsIgnoreCase( "FACILITYPPPP" ) )
-                        {
-
-                        }
-
-                        else if ( deCodeString.equalsIgnoreCase( "PERIOD" )
-                            || deCodeString.equalsIgnoreCase( "PERIOD-NOREPEAT" )
-                            || deCodeString.equalsIgnoreCase( "PERIOD-WEEK" )
-                            || deCodeString.equalsIgnoreCase( "PERIOD-MONTH" )
-                            || deCodeString.equalsIgnoreCase( "PERIOD-QUARTER" )
-                            || deCodeString.equalsIgnoreCase( "PERIOD-YEAR" )
-                            || deCodeString.equalsIgnoreCase( "MONTH-START" )
-                            || deCodeString.equalsIgnoreCase( "MONTH-END" )
-                            || deCodeString.equalsIgnoreCase( "MONTH-START-SHORT" )
-                            || deCodeString.equalsIgnoreCase( "MONTH-END-SHORT" )
-                            || deCodeString.equalsIgnoreCase( "SIMPLE-QUARTER" )
-                            || deCodeString.equalsIgnoreCase( "QUARTER-MONTHS-SHORT" )
-                            || deCodeString.equalsIgnoreCase( "QUARTER-MONTHS" )
-                            || deCodeString.equalsIgnoreCase( "QUARTER-START-SHORT" )
-                            || deCodeString.equalsIgnoreCase( "QUARTER-END-SHORT" )
-                            || deCodeString.equalsIgnoreCase( "QUARTER-START" )
-                            || deCodeString.equalsIgnoreCase( "QUARTER-END" )
-                            || deCodeString.equalsIgnoreCase( "SIMPLE-YEAR" )
-                            || deCodeString.equalsIgnoreCase( "YEAR-END" )
-                            || deCodeString.equalsIgnoreCase( "YEAR-FROMTO" ) )
-                        {
-
-                        }
-
-                        WritableCell cell = sheet0.getWritableCell( tempColNo, tempRowNo );
-
-                        CellFormat cellFormat = cell.getCellFormat();
-                        WritableCellFormat wCellformat = new WritableCellFormat();
-                        wCellformat.setBorder( Border.ALL, BorderLineStyle.THIN );
-                        wCellformat.setWrap( true );
-                        wCellformat.setAlignment( Alignment.CENTRE );
-
-                        if ( cell.getType() == CellType.LABEL )
-                        {
-                            Label l = (Label) cell;
-                            l.setString( tempStr );
-                            l.setCellFormat( cellFormat );
-                        }
-                        else
-                        {
-                            try
-                            {
-                                tempNum = Double.valueOf( tempStr );
-                                sheet0.addCell( new Number( tempColNo, tempRowNo, tempNum, wCellformat ) );
-
-                            }
-                            catch ( Exception e )
-                            {
-                                sheet0.addCell( new Label( tempColNo, tempRowNo, tempStr, wCellformat ) );
-                            }
-                        }
-                    }
-
-                    if ( reportModelTB.equalsIgnoreCase( "INDICATOR-AGAINST-PARENT" ) )
-                    {
-                        if ( deCodeString.equalsIgnoreCase( "FACILITYP" ) )
-                        {
-
-                        }
-
-                        else if ( deCodeString.equalsIgnoreCase( "FACILITYPP" ) )
-                        {
-
-                        }
-
-                        else if ( deCodeString.equalsIgnoreCase( "FACILITYPPP" ) )
-                        {
-
-                        }
-
-                        else if ( deCodeString.equalsIgnoreCase( "FACILITYPPPP" ) )
-                        {
-
-                        }
-
-                        else if ( deCodeString.equalsIgnoreCase( "PERIOD" )
-                            || deCodeString.equalsIgnoreCase( "PERIOD-NOREPEAT" )
-                            || deCodeString.equalsIgnoreCase( "PERIOD-WEEK" )
-                            || deCodeString.equalsIgnoreCase( "PERIOD-MONTH" )
-                            || deCodeString.equalsIgnoreCase( "PERIOD-QUARTER" )
-                            || deCodeString.equalsIgnoreCase( "PERIOD-YEAR" )
-                            || deCodeString.equalsIgnoreCase( "MONTH-START" )
-                            || deCodeString.equalsIgnoreCase( "MONTH-END" )
-                            || deCodeString.equalsIgnoreCase( "MONTH-START-SHORT" )
-                            || deCodeString.equalsIgnoreCase( "MONTH-END-SHORT" )
-                            || deCodeString.equalsIgnoreCase( "SIMPLE-QUARTER" )
-                            || deCodeString.equalsIgnoreCase( "QUARTER-MONTHS-SHORT" )
-                            || deCodeString.equalsIgnoreCase( "QUARTER-MONTHS" )
-                            || deCodeString.equalsIgnoreCase( "QUARTER-START-SHORT" )
-                            || deCodeString.equalsIgnoreCase( "QUARTER-END-SHORT" )
-                            || deCodeString.equalsIgnoreCase( "QUARTER-START" )
-                            || deCodeString.equalsIgnoreCase( "QUARTER-END" )
-                            || deCodeString.equalsIgnoreCase( "SIMPLE-YEAR" )
-                            || deCodeString.equalsIgnoreCase( "YEAR-END" )
-                            || deCodeString.equalsIgnoreCase( "YEAR-FROMTO" ) )
-                        {
-
-                        }
-                        else
-                        {
-                            // tempColNo +=
-                            // (orgUnitCount * 2);
-                        }
-
-                        WritableCell cell = sheet0.getWritableCell( tempColNo, tempRowNo );
-
-                        CellFormat cellFormat = cell.getCellFormat();
-                        WritableCellFormat wCellformat = new WritableCellFormat();
-                        wCellformat.setBorder( Border.ALL, BorderLineStyle.THIN );
-                        wCellformat.setAlignment( Alignment.CENTRE );
-
-                        if ( cell.getType() == CellType.LABEL )
-                        {
-                            Label l = (Label) cell;
-                            l.setString( tempStr );
-                            l.setCellFormat( cellFormat );
-                        }
-                        else
-                        {
-                            try
-                            {
-                                tempNum = Double.valueOf( tempStr );
-                                sheet0.addCell( new Number( tempColNo, tempRowNo, tempNum, wCellformat ) );
-
-                            }
-                            catch ( Exception e )
-                            {
-                                sheet0.addCell( new Label( tempColNo, tempRowNo, tempStr, wCellformat ) );
-                            }
-                        }
-                    }
-
-                    if ( reportModelTB.equalsIgnoreCase( "INDICATOR-AGAINST-SIBLINGS" )
-                        || reportModelTB.equalsIgnoreCase( "INDICATOR-FOR-FEEDBACK" ) )
-                    {
-
-                        if ( deCodeString.equalsIgnoreCase( "FACILITYP" ) )
-                        {
-
-                        }
-
-                        else if ( deCodeString.equalsIgnoreCase( "FACILITYPP" ) )
-                        {
-
-                        }
-
-                        else if ( deCodeString.equalsIgnoreCase( "FACILITYPPP" ) )
-                        {
-
-                        }
-
-                        else if ( deCodeString.equalsIgnoreCase( "FACILITYPPPP" ) )
-                        {
-
-                        }
-
-                        else if ( deCodeString.equalsIgnoreCase( "PERIOD" )
-                            || deCodeString.equalsIgnoreCase( "PERIOD-NOREPEAT" )
-                            || deCodeString.equalsIgnoreCase( "PERIOD-WEEK" )
-                            || deCodeString.equalsIgnoreCase( "PERIOD-MONTH" )
-                            || deCodeString.equalsIgnoreCase( "PERIOD-QUARTER" )
-                            || deCodeString.equalsIgnoreCase( "PERIOD-YEAR" )
-                            || deCodeString.equalsIgnoreCase( "MONTH-START" )
-                            || deCodeString.equalsIgnoreCase( "MONTH-END" )
-                            || deCodeString.equalsIgnoreCase( "MONTH-START-SHORT" )
-                            || deCodeString.equalsIgnoreCase( "MONTH-END-SHORT" )
-                            || deCodeString.equalsIgnoreCase( "SIMPLE-QUARTER" )
-                            || deCodeString.equalsIgnoreCase( "QUARTER-MONTHS-SHORT" )
-                            || deCodeString.equalsIgnoreCase( "QUARTER-MONTHS" )
-                            || deCodeString.equalsIgnoreCase( "QUARTER-START-SHORT" )
-                            || deCodeString.equalsIgnoreCase( "QUARTER-END-SHORT" )
-                            || deCodeString.equalsIgnoreCase( "QUARTER-START" )
-                            || deCodeString.equalsIgnoreCase( "QUARTER-END" )
-                            || deCodeString.equalsIgnoreCase( "SIMPLE-YEAR" )
-                            || deCodeString.equalsIgnoreCase( "YEAR-END" )
-                            || deCodeString.equalsIgnoreCase( "YEAR-FROMTO" ) )
-                        {
-
-                        }
-                        else
-                        {
-                            tempColNo += orgUnitCount;
-                        }
-
-                        WritableCell cell = sheet0.getWritableCell( tempColNo, tempRowNo );
-
-                        CellFormat cellFormat = cell.getCellFormat();
-                        WritableCellFormat wCellformat = new WritableCellFormat();
-
-                        wCellformat.setBorder( Border.ALL, BorderLineStyle.THIN );
-                        wCellformat.setWrap( true );
-                        wCellformat.setAlignment( Alignment.CENTRE );
-                        wCellformat.setVerticalAlignment( VerticalAlignment.CENTRE );
-
-                        if ( cell.getType() == CellType.LABEL )
-                        {
-                            Label l = (Label) cell;
-                            l.setString( tempStr );
-                            l.setCellFormat( cellFormat );
-                        }
-                        else
-                        {
-                            try
-                            {
-                                tempNum = Double.valueOf( tempStr );
-                                sheet0.addCell( new Number( tempColNo, tempRowNo, tempNum, wCellformat ) );
-
-                            }
-                            catch ( Exception e )
-                            {
-                                sheet0.addCell( new Label( tempColNo, tempRowNo, tempStr, wCellformat ) );
-                            }
-                        }
-                    }
-                    if ( reportModelTB.equalsIgnoreCase( "dynamicwithrootfacility" ) )
+                        else if ( deCodeString.equalsIgnoreCase( "PERIOD" )
+                            || deCodeString.equalsIgnoreCase( "PERIOD-NOREPEAT" )
+                            || deCodeString.equalsIgnoreCase( "PERIOD-WEEK" )
+                            || deCodeString.equalsIgnoreCase( "PERIOD-MONTH" )
+                            || deCodeString.equalsIgnoreCase( "PERIOD-QUARTER" )
+                            || deCodeString.equalsIgnoreCase( "PERIOD-YEAR" )
+                            || deCodeString.equalsIgnoreCase( "MONTH-START" )
+                            || deCodeString.equalsIgnoreCase( "MONTH-END" )
+                            || deCodeString.equalsIgnoreCase( "MONTH-START-SHORT" )
+                            || deCodeString.equalsIgnoreCase( "MONTH-END-SHORT" )
+                            || deCodeString.equalsIgnoreCase( "SIMPLE-QUARTER" )
+                            || deCodeString.equalsIgnoreCase( "QUARTER-MONTHS-SHORT" )
+                            || deCodeString.equalsIgnoreCase( "QUARTER-MONTHS" )
+                            || deCodeString.equalsIgnoreCase( "QUARTER-START-SHORT" )
+                            || deCodeString.equalsIgnoreCase( "QUARTER-END-SHORT" )
+                            || deCodeString.equalsIgnoreCase( "QUARTER-START" )
+                            || deCodeString.equalsIgnoreCase( "QUARTER-END" )
+                            || deCodeString.equalsIgnoreCase( "SIMPLE-YEAR" )
+                            || deCodeString.equalsIgnoreCase( "YEAR-END" )
+                            || deCodeString.equalsIgnoreCase( "YEAR-FROMTO" ) )
+                        {
+
+                        }
+                        else
+                        {
+                            tempColNo += orgUnitCount;
+                        }
+                    }
+                    else if ( reportModelTB.equalsIgnoreCase( "dynamicwithrootfacility" ) )
                     {
                         if ( deCodeString.equalsIgnoreCase( "FACILITYP" )
-                            || deCodeString.equalsIgnoreCase( "FACILITY-NOREPEAT" ) )
-                        {
-
-                        }
-
-                        else if ( deCodeString.equalsIgnoreCase( "FACILITYPP" ) )
-                        {
-
-                        }
-
-                        else if ( deCodeString.equalsIgnoreCase( "FACILITYPPP" ) )
-                        {
-
-                        }
-
-                        else if ( deCodeString.equalsIgnoreCase( "FACILITYPPPP" ) )
-                        {
-
-                        }
-
+                            || deCodeString.equalsIgnoreCase( "FACILITY-NOREPEAT" )
+                            || deCodeString.equalsIgnoreCase( "FACILITYPP" ) 
+                            || deCodeString.equalsIgnoreCase( "FACILITYPPP" ) 
+                            || deCodeString.equalsIgnoreCase( "FACILITYPPPP" ) )
+                        {
+
+                        }
                         else if ( deCodeString.equalsIgnoreCase( "PERIOD" )
                             || deCodeString.equalsIgnoreCase( "PERIOD-NOREPEAT" )
                             || deCodeString.equalsIgnoreCase( "PERIOD-WEEK" )
@@ -1818,54 +852,42 @@
                         {
                             tempRowNo += orgUnitCount;
                         }
-
-                        WritableCell cell = sheet0.getWritableCell( tempColNo, tempRowNo );
-
-                        CellFormat cellFormat = cell.getCellFormat();
-                        WritableCellFormat wCellformat = new WritableCellFormat();
-
-                        wCellformat.setBorder( Border.ALL, BorderLineStyle.THIN );
-                        wCellformat.setWrap( true );
-                        wCellformat.setAlignment( Alignment.CENTRE );
-                        wCellformat.setVerticalAlignment( VerticalAlignment.CENTRE );
-
-                        if ( cell.getType() == CellType.LABEL )
-                        {
-                            Label l = (Label) cell;
-                            l.setString( tempStr );
-                            l.setCellFormat( cellFormat );
-                        }
-                        else
-                        {
-                            try
-                            {
-                                tempNum = Double.valueOf( tempStr );
-                                sheet0.addCell( new Number( tempColNo, tempRowNo, tempNum, wCellformat ) );
-
-                            }
-                            catch ( Exception e )
-                            {
-                                sheet0.addCell( new Label( tempColNo, tempRowNo, tempStr, wCellformat ) );
-                            }
-
-                        }
-                    }
-
-                    // }
+                    }
+
+                    WritableCell cell = sheet0.getWritableCell( tempColNo, tempRowNo );
+
+                    CellFormat cellFormat = cell.getCellFormat();
+                    WritableCellFormat wCellformat = new WritableCellFormat();
+                    wCellformat.setBorder( Border.ALL, BorderLineStyle.THIN );
+                    wCellformat.setWrap( true );
+                    wCellformat.setAlignment( Alignment.CENTRE );
+                    wCellformat.setVerticalAlignment( VerticalAlignment.CENTRE );
+
+                    if ( cell.getType() == CellType.LABEL )
+                    {
+                        Label l = (Label) cell;
+                        l.setString( tempStr );
+                        l.setCellFormat( cellFormat );
+                    }
+                    else
+                    {
+                        try
+                        {
+                            tempNum = Double.valueOf( tempStr );
+                            sheet0.addCell( new Number( tempColNo, tempRowNo, tempNum, wCellformat ) );
+                        }
+                        catch ( Exception e )
+                        {
+                            sheet0.addCell( new Label( tempColNo, tempRowNo, tempStr, wCellformat ) );
+                        }
+                    }
+
                 }
                 count1++;
             }// inner while loop end
             orgUnitCount++;
         }// outer while loop end
 
-        /*
-         * ActionContext ctx = ActionContext.getContext(); HttpServletResponse
-         * res = (HttpServletResponse) ctx.get(
-         * ServletActionContext.HTTP_RESPONSE );
-         * 
-         * res.setContentType("application/vnd.ms-excel");
-         */
-
         outputReportWorkbook.write();
         outputReportWorkbook.close();
 
@@ -1875,7 +897,7 @@
         File outputReportFile = new File( outputReportPath );
         inputStream = new BufferedInputStream( new FileInputStream( outputReportFile ) );
 
-        System.out.println( "Report Generation End Time is : \t" + new Date() );
+        System.out.println( orgUnitList.get( 0 ).getName()+ " : " + selReportObj.getName()+" : Report Generation End Time is : " + new Date() );
 
         outputReportFile.deleteOnExit();
 
@@ -1884,68 +906,4 @@
         return SUCCESS;
     }
 
-    public List<String> getDECodes( String fileName )
-    {
-        List<String> deCodes = new ArrayList<String>();
-        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
-            // USER_HOME set, which will throw a NPE
-        }
-
-        try
-        {
-            DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
-            DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();
-            Document doc = docBuilder.parse( new File( path ) );
-            if ( doc == null )
-            {
-                // System.out.println( "There is no DECodes related XML file in
-                // the user home" );
-                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" ) ) );
-
-            }// 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();
-        }
-        return deCodes;
-    }// getDECodes end
-
 }

=== modified file 'local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/upward/action/GenerateUpwardReportAnalyserResultAction.java'
--- local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/upward/action/GenerateUpwardReportAnalyserResultAction.java	2010-11-01 11:14:31 +0000
+++ local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/upward/action/GenerateUpwardReportAnalyserResultAction.java	2010-11-08 06:10:18 +0000
@@ -40,6 +40,7 @@
 import org.hisp.dhis.period.PeriodService;
 import org.hisp.dhis.reports.ReportService;
 import org.hisp.dhis.reports.Report_in;
+import org.hisp.dhis.reports.Report_inDesign;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
@@ -109,20 +110,6 @@
         return fileName;
     }
 
-    private String reportFileNameTB;
-
-    public void setReportFileNameTB( String reportFileNameTB )
-    {
-        this.reportFileNameTB = reportFileNameTB;
-    }
-
-    private String reportModelTB;
-
-    public void setReportModelTB( String reportModelTB )
-    {
-        this.reportModelTB = reportModelTB;
-    }
-
     private String reportList;
 
     public void setReportList( String reportList )
@@ -151,6 +138,10 @@
         this.aggCB = aggCB;
     }
 
+    private String reportFileNameTB;
+
+    private String reportModelTB;
+
     private List<OrganisationUnit> orgUnitList;
 
     private Period selectedPeriod;
@@ -161,16 +152,6 @@
 
     private SimpleDateFormat simpleMonthFormat;
 
-    private List<String> deCodeType;
-
-    private List<String> serviceType;
-
-    private List<Integer> sheetList;
-
-    private List<Integer> rowList;
-
-    private List<Integer> colList;
-
     private Date sDate;
 
     private Date eDate;
@@ -187,16 +168,11 @@
 
         // Initialization
         raFolderName = reportService.getRAFolderName();
-        deCodeType = new ArrayList<String>();
-        serviceType = new ArrayList<String>();
         String deCodesXMLFileName = "";
         simpleDateFormat = new SimpleDateFormat( "MMM-yyyy" );
         monthFormat = new SimpleDateFormat( "MMMM" );
         simpleMonthFormat = new SimpleDateFormat( "MMM" );
         String parentUnit = "";
-        sheetList = new ArrayList<Integer>();
-        rowList = new ArrayList<Integer>();
-        colList = new ArrayList<Integer>();
         
         Report_in selReportObj =  reportService.getReport( Integer.parseInt( reportList ) );
         
@@ -208,9 +184,6 @@
 
         String inputTemplatePath = System.getenv( "DHIS2_HOME" ) + File.separator + raFolderName + File.separator + "template" + File.separator + reportFileNameTB;
         String outputReportPath = System.getenv( "DHIS2_HOME" ) + File.separator + raFolderName + File.separator + "output" + File.separator + UUID.randomUUID().toString() + ".xls";
-        Workbook templateWorkbook = Workbook.getWorkbook( new File( inputTemplatePath ) );
-
-        WritableWorkbook outputReportWorkbook = Workbook.createWorkbook( new File( outputReportPath ), templateWorkbook );
 
         if ( reportModelTB.equalsIgnoreCase( "DYNAMIC-ORGUNIT" ) )
         {
@@ -242,10 +215,12 @@
 
         eDate = format.parseDate( String.valueOf( selectedPeriod.getEndDate() ) );
 
-        simpleDateFormat = new SimpleDateFormat( "MMM-yyyy" );
+        Workbook templateWorkbook = Workbook.getWorkbook( new File( inputTemplatePath ) );
+
+        WritableWorkbook outputReportWorkbook = Workbook.createWorkbook( new File( outputReportPath ), templateWorkbook );
 
         // Getting DataValues
-        List<String> deCodesList = getDECodes( deCodesXMLFileName );
+        List<Report_inDesign> reportDesignList = reportService.getReportDesign( deCodesXMLFileName );
         int orgUnitCount = 0;
 
         Iterator<OrganisationUnit> it = orgUnitList.iterator();
@@ -253,14 +228,15 @@
         {
             OrganisationUnit currentOrgUnit = (OrganisationUnit) it.next();
 
-            Iterator<String> it1 = deCodesList.iterator();
             int count1 = 0;
-            while ( it1.hasNext() )
+            Iterator<Report_inDesign> reportDesignIterator = reportDesignList.iterator();
+            while ( reportDesignIterator.hasNext() )
             {
-                String deCodeString = (String) it1.next();
+                Report_inDesign report_inDesign = (Report_inDesign) reportDesignIterator.next();
 
-                String deType = (String) deCodeType.get( count1 );
-                String sType = (String) serviceType.get( count1 );
+                String deType = report_inDesign.getPtype();
+                String sType = report_inDesign.getStype();
+                String deCodeString = report_inDesign.getExpression();
                 String tempStr = "";
 
                 Calendar tempStartDate = Calendar.getInstance();
@@ -371,9 +347,9 @@
                     }
                 }
         
-                int tempRowNo = rowList.get( count1 );
-                int tempColNo = colList.get( count1 );
-                int sheetNo = sheetList.get( count1 );
+                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( " " ) )
@@ -465,67 +441,4 @@
 
         return SUCCESS;
     }
-
-    public List<String> getDECodes( String fileName )
-    {
-        List<String> deCodes = new ArrayList<String>();
-        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 )
-        {
-            System.out.println("DHIS2_HOME not set");
-        }
-
-        try
-        {
-            DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
-            DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();
-            Document doc = docBuilder.parse( new File( path ) );
-            if ( doc == null )
-            {
-                System.out.println( "There is no DECodes related XML file in the ra folder" );
-                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" ) ) );
-
-            }// 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();
-        }
-        return deCodes;
-    }// getDECodes end
-
 }

=== 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	2010-10-31 08:01:14 +0000
+++ local/in/dhis-web-reports-national/src/main/resources/META-INF/dhis/beans.xml	2010-11-08 06:10:18 +0000
@@ -175,25 +175,14 @@
 	<!-- Report Deletion end -->
 	<!-- Reports Management end 07/08/2010 Global-->
 	
-	<!-- Routine Reports  25/08/2010 Start-->
+	<!-- Routine Reports -->
 	<bean
 		id="org.hisp.dhis.reports.routine.action.GenerateRoutineReportAnalyserFormAction"
 		class="org.hisp.dhis.reports.routine.action.GenerateRoutineReportAnalyserFormAction"
 		scope="prototype">
 		
-		<property name="periodService">
-			<ref bean="org.hisp.dhis.period.PeriodService"/>
-		</property>
-		<property name="organisationUnitService">
-			<ref bean="org.hisp.dhis.organisationunit.OrganisationUnitService"/>
-		</property>
-		<!--	<property name="reportService"> 
-		<ref bean="org.hisp.dhis.reports.util.ReportService"/>
-		</property>-->
-		<property name="organisationUnitGroupService">
-			<ref
-				bean="org.hisp.dhis.organisationunit.OrganisationUnitGroupService"/>
-		</property>
+		<property name="periodService" ref="org.hisp.dhis.period.PeriodService" />
+		<property name="organisationUnitGroupService" ref="org.hisp.dhis.organisationunit.OrganisationUnitGroupService" />
 	</bean>
 	
 	<bean
@@ -201,26 +190,12 @@
 		class="org.hisp.dhis.reports.routine.action.GenerateRoutineReportAnalyserResultAction"
 		scope="prototype">
 		
-		<property name="statementManager" ref="statementManager"/>
-		
-		<property name="periodService">
-			<ref bean="org.hisp.dhis.period.PeriodService"/>
-		</property>
-		<property name="organisationUnitService">
-			<ref bean="org.hisp.dhis.organisationunit.OrganisationUnitService"/>
-		</property>
-		<!--	<property name="reportService">
-		<ref bean="org.hisp.dhis.reports.util.ReportService"/>
-		</property>-->
-		<!-- added report service 25/08/2010-->
-		<property name="reportService" ref="org.hisp.dhis.reports.ReportService">
-		</property>
-		<property name="organisationUnitGroupService">
-			<ref
-				bean="org.hisp.dhis.organisationunit.OrganisationUnitGroupService"/>
-		</property>
+		<property name="statementManager" ref="statementManager"/>		
+		<property name="periodService" ref="org.hisp.dhis.period.PeriodService" />
+		<property name="organisationUnitService" ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
+		<property name="reportService" ref="org.hisp.dhis.reports.ReportService" />
+		<property name="organisationUnitGroupService" ref="org.hisp.dhis.organisationunit.OrganisationUnitGroupService" />
 	</bean>
-	<!-- Routine Reports  25/08/2010 end-->
 	
 	<!-- ED Report -->
 	<bean id="org.hisp.dhis.reports.ed.action.EDReportFormAction"
@@ -425,7 +400,7 @@
 		
 	</bean>
 	
-	<!-- Upward Reports/ GOI Reports -->
+	<!-- Upward / GOI Reports -->
 	<bean
 		id="org.hisp.dhis.reports.upward.action.GenerateUpwardReportAnalyserFormAction"
 		class="org.hisp.dhis.reports.upward.action.GenerateUpwardReportAnalyserFormAction"
@@ -440,14 +415,9 @@
 		scope="prototype">
 		
 		<property name="statementManager" ref="statementManager"/>
-		<property name="periodService">
-			<ref bean="org.hisp.dhis.period.PeriodService"/>
-		</property>
-		<property name="organisationUnitService">
-			<ref bean="org.hisp.dhis.organisationunit.OrganisationUnitService"/>
-		</property>
-		<property name="reportService" ref="org.hisp.dhis.reports.ReportService">
-		</property>
+		<property name="periodService" ref="org.hisp.dhis.period.PeriodService" />
+		<property name="organisationUnitService" ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
+		<property name="reportService" ref="org.hisp.dhis.reports.ReportService" />
 	</bean>
 	
 	<!-- DataSet Lock Reports -->

=== 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	2010-11-01 11:14:31 +0000
+++ local/in/dhis-web-reports-national/src/main/resources/org/hisp/dhis/reports/i18n_module.properties	2010-11-08 06:10:18 +0000
@@ -1,9 +1,13 @@
 goi_ra = Government of India Reports Analyser
+routine_ra = Routine Report Analyser
 periodtype = PeriodType
 organisationunit = OrganisationUnit
 select_periodtype = Select PeriodType
 aggregated_data = Aggregated Data
 generate_report = Generate Report
+all = ALL
+selected_only = Selected Only
+orgunitgrouptype = OrgUnitGroupType 
 
 please_select_an_orgUnit= Please select an OrganisationUnit.
 please_select_a_dataset= Please select a dataset.

=== modified file 'local/in/dhis-web-reports-national/src/main/webapp/dhis-web-reports/routineReportAnalysisFront.vm'
--- local/in/dhis-web-reports-national/src/main/webapp/dhis-web-reports/routineReportAnalysisFront.vm	2010-08-28 10:15:38 +0000
+++ local/in/dhis-web-reports-national/src/main/webapp/dhis-web-reports/routineReportAnalysisFront.vm	2010-11-08 06:10:18 +0000
@@ -1,121 +1,98 @@
-
-
         		
-		        <script>
-		            //Global Variables
-		            
-					var reportModels = new HashTable();
-					var reportFileNames = new HashTable();
-
-		            // OrganisationUnit ids and its Names
-			            ##var orgUnits = new HashTable();
-			            ##foreach($orgUnit in $organisationUnits)
-			            ##    var orgUnitId = ""+$orgUnit.getId();
-			            ##    orgUnits.put(orgUnitId,"$orgUnit.getShortName()");
-			            ##end
-			            
-			            // OrganisationUnit ids and its Level
-			            ##var orgUnitLevels = new HashTable();
-			            ##foreach($orgUnit in $organisationUnits)
-			            ##    var orgUnitId = ""+$orgUnit.getId();
-			            ##    orgUnitLevels.put(orgUnitId,"$organisationUnitService.getLevelOfOrganisationUnit( $orgUnit )");
-			            ##end
-			            
-			            function formValidations()
-			            {			            
-			                var reportListIndex = document.reportForm.reportList.selectedIndex;
-			                var periodIndex = document.reportForm.availablePeriods.selectedIndex;
-			                var orgunitIdValue = document.reportForm.ouIDTB.value;
-			                			            
-			                if(orgunitIdValue == null || orgunitIdValue=="" || orgunitIdValue==" ") {alert("Please Select OrganisationUnit"); return false;}
-			                else if(document.reportForm.availablePeriods.options[periodIndex].text == null || document.reportForm.availablePeriods.options[periodIndex].text== "") {alert("Please Select Period"); return false;}
-			                else if(reportListIndex < 0 || document.reportForm.reportList.options[reportListIndex].text == null) {alert("Please Select Report"); return false;}
-			                
-						//	document.reportForm.reportModelTB.value = reportModels.get(document.reportForm.reportList.options[reportListIndex].value);
-						//	document.reportForm.reportFileNameTB.value = reportFileNames.get(document.reportForm.reportList.options[reportListIndex].value);
-
-			                return true;
-			            }			
-			        </script>
+<script>
+	function formValidations()
+	{			            
+        var reportList = document.getElementById("reportList");
+        var reportListIndex = reportList.selectedIndex;
+        var periodList = document.getElementById("availablePeriods");
+        var periodIndex = periodList.selectedIndex;
+        var ouIdTb = document.getElementById("ouIDTB");
+        var orgunitIdValue = ouIdTb.value;
+
+        if( periodList.options[periodIndex].text == null || periodList.options[periodIndex].text == "" ) 
+        {
+            alert("Please Select Period");
+            return false;
+        }                       
+        else if( orgunitIdValue == null || orgunitIdValue == "" || orgunitIdValue == " " ) 
+        {
+            alert("Please Select OrganisationUnit"); 
+            return false;
+        }       
+        else if( reportListIndex < 0 || reportList.options[reportListIndex].text == null ) 
+        {
+            alert("Please Select Report"); 
+            return false;
+        }
+								
+		return true;
+	}			
+</script>
 	  
-	        <h1>Routine Report Analyser</h1>
-	        <hr />	
-	        <br />
-	        <form id="reportForm" name="reportForm" action="generateRoutineReport.action" method="post" onsubmit="return formValidations()" target="_blank">        
-            <table align="center" style=" border-collapse: collapse; margin-top: 0;" cellpadding="0" cellspacing="0" width="730" border=0>		                
-		                <tr>
-                    			<td class="NormalB">
-                    			    PeriodType : <br />
-                    			    <select id="periodTypeId" name="periodTypeId" style="width:200px" onchange="getPeriods()">
-                            				<option value="NA">[ Select PeriodType ]</option>
-                            				#foreach ( $type in $periodTypes )
-                                					<option value="$type.name">$type.name</option>
-                            				#end
-                            				
-                        			</select>
-								</td>
-                      <td class="NormalB">                            
-                        OrganisationUnit : <br />
-                        <input type="text" name="ouNameTB" id="ouNameTB" size="20" disabled>         
-                      </td>
-       			
-                			</tr>
-                <tr>
-                    <td>&nbsp;</td>
-                    <td>&nbsp;</td>
-                </tr>
-                <tr>
-                    <td>&nbsp;</td>
-                    <td>&nbsp;</td>
-                </tr>			
-                <tr>
-          	          <td class="NormalB">
-          	              Periods : <br />
-                        <select id="availablePeriods" name="availablePeriods" style="width:200px">
-                            <option value="EMPTY_PLACEHOLDER_VALUE"></option>
-                        </select>
-			                        <select multiple id="selectedPeriods" name="selectedPeriods" style="display:none; width:200px; height:0px">				
-                            <option value="EMPTY_PLACEHOLDER_VALUE"></option>
-			                        </select>
-          	          </td>
-                                <td class="NormalB">
-                                    Reports :<br />
-                                    <select id="reportList" name="reportList" style="width:200px"></select>
-                                </td>
-                </tr>
-                <tr>
-                    <td>&nbsp;</td>
-                    <td>&nbsp;</td>
-                </tr>
-                <tr>
-                    <td>&nbsp;</td>
-                    <td>&nbsp;</td>
-                </tr>
-	                <tr>
-          	          <td class="NormalB">
-          	              OrgUnitGroupType : <br/>
-		                        <select id="organisationUnitGroupId" name="organisationUnitGroupId" style="width:20em" >
-									<option value="ALL" selected>ALL</option>
-									#foreach ( $member in $orgUnitGroupMembers )
-            					          <option value="$member.id" title="$member.name" >$member.name</option>
-            					    #end
-            					    <option value="Selected_Only" >Selected Only</option>
-								</select>
-					  </td>
-          	          <td>
-						  <!--<input type="checkbox" id="aggCB" name="aggCB" checked> Aggregated Data</td> -->
-						  <tr>
-						  <td>
-						  <br><br>	  							
-          	              <input type="submit" name="generate" value="Generate Report" disabled="disabled"/>
-						  <input type="hidden" name="autogen" id="autogen" value="0" >
-          	              <input type="hidden" name="ouIDTB" id="ouIDTB">
-          	              <input type="hidden" name="ouLevelTB" id="ouLevelTB">
-          	     <!--     <input type="hidden" name="reportModelTB" id="reportModelTB">
-						  <input type="hidden" name="reportFileNameTB" id="reportFileNameTB">
-						  <input type="hidden" name="reportListFileNameTB" id="reportListFileNameTB" value="routineReportsList.xml">-->
-						  <input type="hidden" name="reportTypeNameTB" id="reportTypeNameTB" value="$reportTypeName">
-                    	</td>
-                </tr>
-            	</table>
-        </form>
+<h1>$i18n.getString( "routine_ra" )</h1>
+<hr /><br />
+<form id="reportForm" name="reportForm" action="generateRoutineReport.action" method="post" onsubmit="return formValidations()" target="_blank">        
+	<table align="center" style=" border-collapse: collapse; margin-top: 0;" cellpadding="0" cellspacing="0" width="730" border=0>		                
+		<tr>
+			<td class="NormalB">
+				1. $i18n.getString( "periodtype" ) : <br />
+				<select id="periodTypeId" name="periodTypeId" style="width:200px" onchange="getPeriods()">
+					<option value="NA">[ $i18n.getString( "select_periodtype" ) ]</option>
+					#foreach ( $type in $periodTypes )
+						<option value="$type.name">$type.name</option>
+					#end
+				</select>
+			</td>
+			<td class="NormalB">                            
+				3. $i18n.getString( "organisationunit" ) : <br />
+				<input type="text" name="ouNameTB" id="ouNameTB" style="width:200px" disabled>         
+			</td>
+		</tr>
+		<tr>
+			<td>&nbsp;</td>
+			<td>&nbsp;</td>
+		</tr>
+		<tr>
+			<td>&nbsp;</td>
+			<td>&nbsp;</td>
+		</tr>			
+		<tr>
+			<td class="NormalB">
+				2. $i18n.getString( "periods" ) : <br />
+				<select id="availablePeriods" name="availablePeriods" style="width:200px"></select>
+			</td>
+			<td class="NormalB">
+				4. $i18n.getString( "reports" ) :<br />
+				<select id="reportList" name="reportList" style="width:200px"></select>
+			</td>
+		</tr>
+		<tr>
+			<td>&nbsp;</td>
+			<td>&nbsp;</td>
+		</tr>
+		<tr>
+			<td>&nbsp;</td>
+			<td>&nbsp;</td>
+		</tr>
+		<tr>
+			<td class="NormalB">
+				$i18n.getString( "orgunitgrouptype" ) : <br/>
+				<select id="organisationUnitGroupId" name="organisationUnitGroupId" style="width:200px" >
+					<option value="ALL" selected>$i18n.getString( "all" )</option>
+					#foreach ( $member in $orgUnitGroupMembers )
+						<option value="$member.id" title="$member.name" >$member.name</option>
+					#end
+					<option value="Selected_Only" >$i18n.getString( "selected_only" )</option>
+				</select>
+			</td>
+			<td>
+				<br><br>	  							
+				<input type="submit" name="generate" value="$i18n.getString( "generate_report" )" disabled="disabled"/>
+				<input type="hidden" name="autogen" id="autogen" value="0" >
+				<input type="hidden" name="ouIDTB" id="ouIDTB">
+				<input type="hidden" name="ouLevelTB" id="ouLevelTB">
+				<input type="hidden" name="reportTypeNameTB" id="reportTypeNameTB" value="$reportTypeName">
+			</td>
+		</tr>
+	</table>
+</form>

=== modified file 'local/in/dhis-web-reports-national/src/main/webapp/dhis-web-reports/upwardReportAnalysisFront.vm'
--- local/in/dhis-web-reports-national/src/main/webapp/dhis-web-reports/upwardReportAnalysisFront.vm	2010-11-01 11:14:31 +0000
+++ local/in/dhis-web-reports-national/src/main/webapp/dhis-web-reports/upwardReportAnalysisFront.vm	2010-11-08 06:10:18 +0000
@@ -19,7 +19,7 @@
 			alert("Please Select OrganisationUnit"); 
 			return false;
 		}		
-		else if( reportListIndex < 0 || document.reportForm.reportList.options[reportListIndex].text == null ) 
+		else if( reportListIndex < 0 || reportList.options[reportListIndex].text == null ) 
 		{
 			alert("Please Select Report"); 
 			return false;