← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 1982: Cleaning Code: GOI Reports Form & Result

 

------------------------------------------------------------
revno: 1982
committer: Bharath <chbharathk@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2010-11-01 16:44:31 +0530
message:
  Cleaning Code: GOI Reports Form & Result
modified:
  local/in/dhis-in-services/dhis-in-service-reports/src/main/java/org/hisp/dhis/reports/DefaultReportService.java
  local/in/dhis-web-reports-national/pom.xml
  local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/action/GetOrgUnitsAction.java
  local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/action/GetPeriodsAction.java
  local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/action/GetReportsAction.java
  local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/action/ReportsHomePageAction.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/org/hisp/dhis/reports/i18n_module.properties
  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-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-09-24 06:24:45 +0000
+++ 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
@@ -385,7 +385,7 @@
             cal.set( year, Calendar.DECEMBER, 31 );
         }
         Date lastDay = new Date( cal.getTimeInMillis() );
-        System.out.println( lastDay.toString() );
+        //System.out.println( lastDay.toString() );
         Period newPeriod = new Period();
         newPeriod = periodService.getPeriod( firstDay, lastDay, periodType );
         return newPeriod;
@@ -542,16 +542,18 @@
         return null;
 
     } // getDataElementPeriodType end
+
     
+    // -------------------------------------------------------------------------
+    // Get Aggregated Result for dataelement expression 
+    // -------------------------------------------------------------------------
     public String getResultDataValue( String formula, Date startDate, Date endDate, OrganisationUnit organisationUnit , String reportModelTB )
     {
         int deFlag1 = 0;
-        //int deFlag2 = 0;
         int isAggregated = 0;
 
         try
         {
-            // 6b1b7b5b7b5b7
             Pattern pattern = Pattern.compile( "(\\[\\d+\\.\\d+\\])" );
 
             Matcher matcher = pattern.matcher( formula );
@@ -588,14 +590,11 @@
                     if ( aggregatedValue == null )
                     {
                         replaceString = NULL_REPLACEMENT;
-                        //deFlag2 = 0;
                     }
                     else
                     {
                         replaceString = String.valueOf( aggregatedValue );
 
-                        //deFlag2 = 1;
-
                         isAggregated = 1;
                     }
 
@@ -603,7 +602,6 @@
                 else
                 {
                     deFlag1 = 1;
-                    //deFlag2 = 0;
                     PeriodType dePeriodType = getDataElementPeriodType( dataElement );
                     List<Period> periodList = new ArrayList<Period>( periodService.getIntersectingPeriodsByPeriodType(
                         dePeriodType, startDate, endDate ) );
@@ -622,10 +620,8 @@
                     DataValue dataValue = dataValueService.getDataValue( organisationUnit, dataElement, tempPeriod,
                         optionCombo );
 
-                    if ( dataValue != null )
+                    if ( dataValue != null && dataValue.getValue() != null )
                     {
-                        // Works for both text and boolean data types
-
                         replaceString = dataValue.getValue();
                     }
                     else
@@ -665,14 +661,12 @@
                 }
                 else
                 {
-
                     // This is to display financial data as it is like 2.1476838
                     resultValue = "" + d;
 
                     // These lines are to display financial data that do not
                     // have decimals
                     d = d * 10;
-
                     if ( d % 10 == 0 )
                     {
                         resultValue = "" + (int) d / 10;
@@ -686,17 +680,11 @@
                     {
                         resultValue = "" + (int) d;
                     }
-
-                    // if ( resultValue.equalsIgnoreCase( "0" ) )
-                    // {
-                    // resultValue = "";
-                    // }
                 }
 
             }
             else
             {
-                //deFlag2 = 0;
                 resultValue = buffer.toString();
             }
 
@@ -717,15 +705,14 @@
             throw new RuntimeException( "Illegal DataElement id", ex );
         }
     }
-    // functoin getResultDataValue start end
-    
-    // functoin getIndividualResultDataValue start
-    
+
+
+    // -------------------------------------------------------------------------
+    // Get Individual Result for dataelement expression 
+    // -------------------------------------------------------------------------
     public String getIndividualResultDataValue( String formula, Date startDate, Date endDate, OrganisationUnit organisationUnit , String reportModelTB )
     {
         int deFlag1 = 0;
-        //int deFlag2 = 0;
-    //    int isAggregated = 0;
        
         try
         {
@@ -739,7 +726,6 @@
 
             while ( matcher.find() )
             {
-
                 String replaceString = matcher.group();
 
                 replaceString = replaceString.replaceAll( "[\\[\\]]", "" );
@@ -786,16 +772,12 @@
                                 valueDoesNotExist = false;
                             }
                         }
-
                         replaceString = String.valueOf( aggregatedValue );
-
-                        //deFlag2 = 1;
                     }
                 }
                 else
                 {
                     deFlag1 = 1;
-                    //deFlag2 = 0;
                     PeriodType dePeriodType = getDataElementPeriodType( dataElement );
                     List<Period> periodList = new ArrayList<Period>( periodService.getIntersectingPeriodsByPeriodType( dePeriodType, startDate, endDate ) );
                     Period tempPeriod = new Period();
@@ -814,8 +796,6 @@
 
                     if ( dataValue != null )
                     {
-                        // Works for both text and boolean data types
-
                         replaceString = dataValue.getValue();
                         valueDoesNotExist = false;
                     }
@@ -877,16 +857,10 @@
                     {
                         resultValue = "" + (int) d;
                     }
-
-                    // if ( resultValue.equalsIgnoreCase( "0" ) )
-                    // {
-                    // resultValue = "";
-                    // }
                 }
             }
             else
             {
-                //deFlag2 = 0;
                 resultValue = buffer.toString();
             }
 
@@ -907,7 +881,6 @@
             throw new RuntimeException( "Illegal DataElement id", ex );
         }
     }
-    // functoin getIndividualResultDataValue end
     
      // functoin getBooleanDataValue stsrt
     
@@ -1290,7 +1263,8 @@
                     try
                     {
                         aggregatedValue = ( numeratorValue / denominatorValue ) * indicatorFactor;
-                    } catch ( Exception e )
+                    } 
+                    catch ( Exception e )
                     {
                         System.out.println( "Exception while calculating Indicator value for Indicaotr " + indicator.getName() );
                         aggregatedValue = 0.0;

=== modified file 'local/in/dhis-web-reports-national/pom.xml'
--- local/in/dhis-web-reports-national/pom.xml	2010-08-20 09:13:09 +0000
+++ local/in/dhis-web-reports-national/pom.xml	2010-11-01 11:14:31 +0000
@@ -105,7 +105,7 @@
     </dependency>
 	
 	<!-- JasperReports -->
-
+<!--
     <dependency>
       <groupId>jasperreports</groupId>
       <artifactId>jasperreports</artifactId>
@@ -128,7 +128,7 @@
         <groupId>com.lowagie</groupId>
         <artifactId>itext</artifactId>
     </dependency>
-    
+-->    
     <!-- Other -->
   <!--  
     <dependency>
@@ -139,7 +139,8 @@
     <dependency>
       <groupId>commons-logging</groupId>
       <artifactId>commons-logging</artifactId>
-    </dependency>    
+    </dependency>
+	<!--    
     <dependency>
       <groupId>jasperreports</groupId>
       <artifactId>jasperreports</artifactId>
@@ -167,6 +168,7 @@
         </exclusion>
       </exclusions>
     </dependency>
+	-->
     <dependency>
       <groupId>net.sourceforge.jexcelapi</groupId>
       <artifactId>jxl</artifactId>

=== modified file 'local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/action/GetOrgUnitsAction.java'
--- local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/action/GetOrgUnitsAction.java	2010-08-28 10:15:38 +0000
+++ local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/action/GetOrgUnitsAction.java	2010-11-01 11:14:31 +0000
@@ -51,13 +51,10 @@
     public String execute()
         throws Exception
     {
-        /* OrganisationUnit */
         if ( orgUnitId != null )
         {
             orgUnit = organisationUnitService.getOrganisationUnit( orgUnitId );
             ouLevel = "" + organisationUnitService.getLevelOfOrganisationUnit( orgUnit );
-
-            System.out.println( orgUnit.getId() + " ---- " + orgUnit.getShortName() );
         }
 
         return SUCCESS;

=== modified file 'local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/action/GetPeriodsAction.java'
--- local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/action/GetPeriodsAction.java	2010-06-20 07:27:46 +0000
+++ local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/action/GetPeriodsAction.java	2010-11-01 11:14:31 +0000
@@ -181,7 +181,7 @@
                 }
             }
         }
-        System.out.println("Periods Size = "+periods.size());
+
         return SUCCESS;
     }
 

=== modified file 'local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/action/GetReportsAction.java'
--- local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/action/GetReportsAction.java	2010-08-28 10:15:38 +0000
+++ local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/action/GetReportsAction.java	2010-11-01 11:14:31 +0000
@@ -65,12 +65,6 @@
         this.reportTypeName = reportTypeName;
     }
 
-    /*
-     * private String autogenrep;
-     * 
-     * public void setAutogenrep( String autogenrep ) { this.autogenrep =
-     * autogenrep; }
-     */
     private List<Report_in> reportList;
 
     public List<Report_in> getReportList()
@@ -92,29 +86,18 @@
     public String execute()
         throws Exception
     {
-        // raFolderName = reportService.getRAFolderName();
         if ( ouId != null )
         {
             try
             {
                 OrganisationUnit orgUnit = organisationUnitService.getOrganisationUnit( Integer.parseInt( ouId ) );
 
-                // int ouLevel =
-                // organisationUnitService.getLevelOfOrganisationUnit( orgUnit
-                // );
-
-                // if(autogenrep.equalsIgnoreCase( "1") )
-                // ouLevel++;
-
-                // orgUnitLevel = ""+ouLevel;
                 ouName = orgUnit.getShortName();
 
                 PeriodType periodTypeObj = periodService.getPeriodTypeByName( periodType );
 
                 reportList = new ArrayList<Report_in>( reportService.getReportsByPeriodSourceAndReportType(
                     periodTypeObj, orgUnit, reportTypeName ) );
-                System.out.println("Org Unit : "+ ouName + " Report List : " + reportList.size() );
-                // getSelectedReportList( reportListFileName );
             }
             catch ( Exception e )
             {
@@ -124,73 +107,4 @@
 
         return SUCCESS;
     }
-
-    /*
-     * public void getSelectedReportList( String reportListFileName ) { String
-     * fileName = reportListFileName; 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 }
-     * 
-     * String reportId = ""; String reportName = ""; String reportType = "";
-     * String reportLevel = ""; String reportModel = ""; String reportFileName =
-     * ""; int count = 0;
-     * 
-     * try { DocumentBuilderFactory docBuilderFactory =
-     * DocumentBuilderFactory.newInstance(); DocumentBuilder docBuilder =
-     * docBuilderFactory.newDocumentBuilder(); Document doc = docBuilder.parse(
-     * new File( path ) ); if ( doc == null ) { System.out.println(
-     * "XML File Not Found at user home" ); return; }
-     * 
-     * NodeList listOfReports = doc.getElementsByTagName( "report" ); int
-     * totalReports = listOfReports.getLength(); for ( int s = 0; s <
-     * totalReports; s++ ) { Node reportNode = listOfReports.item( s ); if (
-     * reportNode.getNodeType() == Node.ELEMENT_NODE ) { Element reportElement =
-     * (Element) reportNode; reportId = reportElement.getAttribute( "id" );
-     * 
-     * NodeList reportNameList = reportElement.getElementsByTagName( "name" );
-     * Element reportNameElement = (Element) reportNameList.item( 0 ); NodeList
-     * textreportNameList = reportNameElement.getChildNodes(); reportName =
-     * ((Node) textreportNameList.item( 0 )).getNodeValue().trim();
-     * 
-     * NodeList reportTypeList = reportElement.getElementsByTagName( "type" );
-     * Element reportTypeElement = (Element) reportTypeList.item( 0 ); NodeList
-     * textreportTypeList = reportTypeElement.getChildNodes(); reportType =
-     * ((Node) textreportTypeList.item( 0 )).getNodeValue().trim();
-     * 
-     * NodeList reportModelList = reportElement.getElementsByTagName( "model" );
-     * Element reportModelElement = (Element) reportModelList.item( 0 );
-     * NodeList textreportModelList = reportModelElement.getChildNodes();
-     * reportModel = ((Node) textreportModelList.item( 0
-     * )).getNodeValue().trim();
-     * 
-     * NodeList reportFileNameList = reportElement.getElementsByTagName(
-     * "filename" ); Element reportFileNameElement = (Element)
-     * reportFileNameList.item( 0 ); NodeList textreportFileNameList =
-     * reportFileNameElement.getChildNodes(); reportFileName = ((Node)
-     * textreportFileNameList.item( 0 )).getNodeValue().trim();
-     * 
-     * NodeList reportLevelList = reportElement.getElementsByTagName( "level" );
-     * Element reportLevelElement = (Element) reportLevelList.item( 0 );
-     * NodeList textreportLevelList = reportLevelElement.getChildNodes();
-     * reportLevel = ((Node) textreportLevelList.item( 0
-     * )).getNodeValue().trim();
-     * 
-     * if ( reportType.equals( periodType ) && reportLevel.equals( orgUnitLevel
-     * ) ) { Report reportObj = new Report(reportId, reportName, reportType,
-     * reportModel, reportFileName, reportLevel); reportList.add( count,
-     * reportObj ); count++; System.out.println( reportName + " : " + reportId
-     * ); } } }// end of for loop with s var }// try block end catch (
-     * SAXParseException err ) { System.out.println( "** Parsing error" +
-     * ", line " + err.getLineNumber() + ", uri " + err.getSystemId() );
-     * System.out.println( " " + err.getMessage() ); } catch ( SAXException e )
-     * { Exception x = e.getException(); ((x == null) ? e :
-     * x).printStackTrace(); } catch ( Throwable t ) { t.printStackTrace(); }
-     * 
-     * }// getReportList end
-     */
-
 }

=== modified file 'local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/action/ReportsHomePageAction.java'
--- local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/action/ReportsHomePageAction.java	2010-08-28 10:15:38 +0000
+++ local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/action/ReportsHomePageAction.java	2010-11-01 11:14:31 +0000
@@ -24,7 +24,7 @@
     {
         raFolderName = reportService.getRAFolderName();
 
-        clearCache();
+        //clearCache();
 
         return SUCCESS;
     }

=== 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-09-18 12:30:36 +0000
+++ local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/upward/action/GenerateUpwardReportAnalyserResultAction.java	2010-11-01 11:14:31 +0000
@@ -23,7 +23,6 @@
 import jxl.format.Border;
 import jxl.format.BorderLineStyle;
 import jxl.format.CellFormat;
-import jxl.format.VerticalAlignment;
 import jxl.write.Blank;
 import jxl.write.Label;
 import jxl.write.Number;
@@ -33,14 +32,12 @@
 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.OrganisationUnitService;
 import org.hisp.dhis.organisationunit.comparator.OrganisationUnitNameComparator;
 import org.hisp.dhis.period.Period;
 import org.hisp.dhis.period.PeriodService;
-import org.hisp.dhis.period.PeriodType;
 import org.hisp.dhis.reports.ReportService;
 import org.hisp.dhis.reports.Report_in;
 import org.w3c.dom.Document;
@@ -87,11 +84,6 @@
         this.organisationUnitService = organisationUnitService;
     }
 
-    public OrganisationUnitService getOrganisationUnitService()
-    {
-        return organisationUnitService;
-    }
-
     private I18nFormat format;
 
     public void setFormat( I18nFormat format )
@@ -102,14 +94,7 @@
     // -------------------------------------------------------------------------
     // Properties
     // -------------------------------------------------------------------------
-/*
-    private PeriodStore periodStore;
 
-    public void setPeriodStore( PeriodStore periodStore )
-    {
-        this.periodStore = periodStore;
-    }
-*/
     private InputStream inputStream;
 
     public InputStream getInputStream()
@@ -117,14 +102,6 @@
         return inputStream;
     }
 
-    /*
-    private String contentType;
-
-    public String getContentType()
-    {
-    return contentType;
-    }
-     */
     private String fileName;
 
     public String getFileName()
@@ -132,100 +109,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 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 )
@@ -246,28 +129,7 @@
     {
         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 )
@@ -289,7 +151,19 @@
         this.aggCB = aggCB;
     }
 
-//    private Hashtable<String, String> serviceList;
+    private List<OrganisationUnit> orgUnitList;
+
+    private Period selectedPeriod;
+
+    private SimpleDateFormat simpleDateFormat;
+
+    private SimpleDateFormat monthFormat;
+
+    private SimpleDateFormat simpleMonthFormat;
+
+    private List<String> deCodeType;
+
+    private List<String> serviceType;
 
     private List<Integer> sheetList;
 
@@ -301,67 +175,28 @@
 
     private Date eDate;
 
-    private Date sDateTemp;
-
-    private Date eDateTemp;
-
-    private PeriodType periodType;
-
-    public PeriodType getPeriodType()
-    {
-        return periodType;
-    }
-
-    private List<Period> periods;
-
-    public List<Period> getPeriods()
-    {
-        return periods;
-    }
-
-    private double tempNum = 0;
-
-//    private List<Integer> totalOrgUnitsCountList;
-
     private String raFolderName;
 
-    private List<OrganisationUnit> childOrgUnits;
-
-    public List<OrganisationUnit> getChildOrgUnits()
-    {
-        return childOrgUnits;
-    }
-
-    int deFlag1;
-
-    int deFlag2;
-
-    int isAggregated = 0;
     // -------------------------------------------------------------------------
-    // Action implementation
+    // Action Implementation
     // -------------------------------------------------------------------------
     public String execute()
         throws Exception
     {
-
         statementManager.initialise();
-        deFlag2 = 0;
-        deFlag1 = 0;
+
         // 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>();
         String deCodesXMLFileName = "";
         simpleDateFormat = new SimpleDateFormat( "MMM-yyyy" );
         monthFormat = new SimpleDateFormat( "MMMM" );
         simpleMonthFormat = new SimpleDateFormat( "MMM" );
-        yearFormat = new SimpleDateFormat( "yyyy" );
-        simpleYearFormat = new SimpleDateFormat( "yy" );
+        String parentUnit = "";
+        sheetList = new ArrayList<Integer>();
+        rowList = new ArrayList<Integer>();
+        colList = new ArrayList<Integer>();
         
         Report_in selReportObj =  reportService.getReport( Integer.parseInt( reportList ) );
         
@@ -370,15 +205,6 @@
         reportModelTB = selReportObj.getModel();
         reportFileNameTB = selReportObj.getExcelTemplateName();
         
-        System.out.println(reportModelTB + " : " + reportFileNameTB + " : " + deCodesXMLFileName );
-        
-        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";
@@ -392,7 +218,7 @@
             orgUnitList = new ArrayList<OrganisationUnit>( orgUnit.getChildren() );
             Collections.sort( orgUnitList, new OrganisationUnitNameComparator() );
         }
-        else if ( reportModelTB.equalsIgnoreCase( "STATIC" ) )
+        else if ( reportModelTB.equalsIgnoreCase( "STATIC" ) || reportModelTB.equalsIgnoreCase( "STATIC-DATAELEMENTS" ) || reportModelTB.equalsIgnoreCase( "STATIC-FINANCIAL" ) )
         {
             orgUnitList = new ArrayList<OrganisationUnit>();
             OrganisationUnit orgUnit = organisationUnitService.getOrganisationUnit( ouIDTB );
@@ -407,53 +233,9 @@
 
             parentUnit = orgUnit.getName();
         }
-        else if ( reportModelTB.equalsIgnoreCase( "STATIC-DATAELEMENTS" ) )
-        {
-            orgUnitList = new ArrayList<OrganisationUnit>();
-            OrganisationUnit orgUnit = organisationUnitService.getOrganisationUnit( ouIDTB );
-            orgUnitList.add( orgUnit );
-        }
-        else if ( reportModelTB.equalsIgnoreCase( "STATIC-FINANCIAL" ) )
-        {
-            orgUnitList = new ArrayList<OrganisationUnit>();
-            OrganisationUnit orgUnit = organisationUnitService.getOrganisationUnit( ouIDTB );
-            orgUnitList.add( orgUnit );
-        }
-        else 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( orgUnit );
-        }
-        else 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 );
-        }
-        else 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 );
-        }
-
+
+        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() ) );
@@ -463,219 +245,12 @@
         simpleDateFormat = new SimpleDateFormat( "MMM-yyyy" );
 
         // Getting DataValues
-        dataValueList = new ArrayList<String>();
         List<String> deCodesList = getDECodes( 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;
-
+        while ( it.hasNext() )
+        {
             OrganisationUnit currentOrgUnit = (OrganisationUnit) it.next();
 
             Iterator<String> it1 = deCodesList.iterator();
@@ -686,15 +261,12 @@
 
                 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() )
+                if( calendarList == null || calendarList.isEmpty() )
                 {
                     tempStartDate.setTime( selectedPeriod.getStartDate() );
                     tempEndDate.setTime( selectedPeriod.getEndDate() );
@@ -706,982 +278,176 @@
                     tempEndDate = calendarList.get( 1 );
                 }
 
-                if ( deCodeString.equalsIgnoreCase( "FACILITY" ) )
+                if( deCodeString.equalsIgnoreCase( "FACILITY" ) )
                 {
                     tempStr = currentOrgUnit.getName();
-
+                } 
+                else if( deCodeString.equalsIgnoreCase( "FACILITY-NOREPEAT" ) )
+                {
+                    tempStr = parentUnit;
+                } 
+                else if( deCodeString.equalsIgnoreCase( "FACILITYP" ) )
+                {
+                    tempStr = currentOrgUnit.getParent().getName();
+                } 
+                else if( deCodeString.equalsIgnoreCase( "FACILITYPP" ) )
+                {
+                    tempStr = currentOrgUnit.getParent().getParent().getName();
+                } 
+                else if( deCodeString.equalsIgnoreCase( "FACILITYPPP" ) )
+                {
+                    tempStr = currentOrgUnit.getParent().getParent().getParent().getName();
+                } 
+                else if( deCodeString.equalsIgnoreCase( "FACILITYPPPP" ) )
+                {
+                    tempStr = currentOrgUnit.getParent().getParent().getParent().getParent().getName();
+                } 
+                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( "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( "SLNO" ) )
+                {
+                    tempStr = "" + ( orgUnitCount + 1 );
+                } 
+                else if( deCodeString.equalsIgnoreCase( "NA" ) )
+                {
+                    tempStr = " ";
                 } 
                 else
                 {
-                    if ( deCodeString.equalsIgnoreCase( "FACILITY-NOREPEAT" ) )
-                    {
-                        tempStr = parentUnit;
-                    } 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();
-
-                            } else
-                            {
-                                if ( deCodeString.equalsIgnoreCase( "FACILITYPPP" ) )
-                                {
-                                    OrganisationUnit orgUnitP = new OrganisationUnit();
-
-                                    OrganisationUnit orgUnitPP = new OrganisationUnit();
-
-                                    orgUnitP = currentOrgUnit.getParent();
-
-                                    orgUnitPP = orgUnitP.getParent();
-
-                                    tempStr = orgUnitPP.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();
-
-                                    } 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( "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" ) )
-                                                                    {
-                                                                        String startMonth = "";
-
-                                                                        startMonth = monthFormat.format( sDate );
-
-                                                                        if ( startMonth.equalsIgnoreCase( "April" ) )
-                                                                        {
-                                                                            tempStr = "Quarter I";
-                                                                        } else
-                                                                        {
-                                                                            if ( startMonth.equalsIgnoreCase( "July" ) )
-                                                                            {
-                                                                                tempStr = "Quarter II";
-                                                                            } else
-                                                                            {
-                                                                                if ( startMonth.equalsIgnoreCase( "October" ) )
-                                                                                {
-                                                                                    tempStr = "Quarter III";
-                                                                                } 
-                                                                                else
-                                                                                {
-                                                                                    tempStr = "Quarter IV";
-
-                                                                                    //quarterPeriod = 1;
-
-                                                                                }
-                                                                            }
-                                                                        }
-                                                                    } else
-                                                                    {
-                                                                        if ( deCodeString.equalsIgnoreCase( "SIMPLE-QUARTER" ) )
-                                                                        {
-                                                                            String startMonth = "";
-
-                                                                            startMonth = monthFormat.format( sDate );
-
-                                                                            if ( startMonth.equalsIgnoreCase( "April" ) )
-                                                                            {
-                                                                                tempStr = "Q1";
-                                                                            } else
-                                                                            {
-                                                                                if ( startMonth.equalsIgnoreCase( "July" ) )
-                                                                                {
-                                                                                    tempStr = "Q2";
-                                                                                } else
-                                                                                {
-                                                                                    if ( startMonth.equalsIgnoreCase( "October" ) )
-                                                                                    {
-                                                                                        tempStr = "Q3";
-                                                                                    } else
-                                                                                    {
-                                                                                        tempStr = "Q4";
-
-                                                                                        //quarterPeriod = 1;
-
-                                                                                    }
-                                                                                }
-                                                                            }
-                                                                        } else
-                                                                        {
-                                                                            if ( deCodeString.equalsIgnoreCase( "QUARTER-MONTHS-SHORT" ) )
-                                                                            {
-                                                                                String startMonth = "";
-
-                                                                                startMonth = monthFormat.format( sDate );
-
-                                                                                if ( startMonth.equalsIgnoreCase( "April" ) )
-                                                                                {
-                                                                                    tempStr = "Apr - Jun";
-                                                                                } else
-                                                                                {
-                                                                                    if ( startMonth.equalsIgnoreCase( "July" ) )
-                                                                                    {
-                                                                                        tempStr = "Jul - Sep";
-                                                                                    } else
-                                                                                    {
-                                                                                        if ( startMonth.equalsIgnoreCase( "October" ) )
-                                                                                        {
-                                                                                            tempStr = "Oct - Dec";
-                                                                                        } else
-                                                                                        {
-                                                                                            tempStr = "Jan - Mar";
-
-                                                                                           // quarterPeriod = 1;
-
-                                                                                        }
-                                                                                    }
-                                                                                }
-                                                                            } else
-                                                                            {
-                                                                                if ( deCodeString.equalsIgnoreCase( "QUARTER-MONTHS" ) )
-                                                                                {
-                                                                                    String startMonth = "";
-
-                                                                                    startMonth = monthFormat.format( sDate );
-
-                                                                                    if ( startMonth.equalsIgnoreCase( "April" ) )
-                                                                                    {
-                                                                                        tempStr = "April - June";
-                                                                                    } else
-                                                                                    {
-                                                                                        if ( startMonth.equalsIgnoreCase( "July" ) )
-                                                                                        {
-                                                                                            tempStr = "July - September";
-                                                                                        } else
-                                                                                        {
-                                                                                            if ( startMonth.equalsIgnoreCase( "October" ) )
-                                                                                            {
-                                                                                                tempStr = "October - December";
-                                                                                            } else
-                                                                                            {
-                                                                                                tempStr = "January - March";
-
-                                                                                               // quarterPeriod = 1;
-
-                                                                                            }
-                                                                                        }
-                                                                                    }
-                                                                                } else
-                                                                                {
-                                                                                    if ( deCodeString.equalsIgnoreCase( "QUARTER-START-SHORT" ) )
-                                                                                    {
-                                                                                        String startMonth = "";
-
-                                                                                        startMonth = monthFormat.format( sDate );
-
-                                                                                        if ( startMonth.equalsIgnoreCase( "April" ) )
-                                                                                        {
-                                                                                            tempStr = "Apr";
-                                                                                        } else
-                                                                                        {
-                                                                                            if ( startMonth.equalsIgnoreCase( "July" ) )
-                                                                                            {
-                                                                                                tempStr = "Jul";
-                                                                                            } else
-                                                                                            {
-                                                                                                if ( startMonth.equalsIgnoreCase( "October" ) )
-                                                                                                {
-                                                                                                    tempStr = "Oct";
-                                                                                                } else
-                                                                                                {
-                                                                                                    tempStr = "Jan";
-
-                                                                                                   // quarterPeriod = 1;
-
-                                                                                                }
-                                                                                            }
-                                                                                        }
-                                                                                    } else
-                                                                                    {
-                                                                                        if ( deCodeString.equalsIgnoreCase( "QUARTER-START" ) )
-                                                                                        {
-                                                                                            String startMonth = "";
-
-                                                                                            startMonth = monthFormat.format( sDate );
-
-                                                                                            if ( startMonth.equalsIgnoreCase( "April" ) )
-                                                                                            {
-                                                                                                tempStr = "April";
-                                                                                            } else
-                                                                                            {
-                                                                                                if ( startMonth.equalsIgnoreCase( "July" ) )
-                                                                                                {
-                                                                                                    tempStr = "July";
-                                                                                                } else
-                                                                                                {
-                                                                                                    if ( startMonth.equalsIgnoreCase( "October" ) )
-                                                                                                    {
-                                                                                                        tempStr = "October";
-                                                                                                    } else
-                                                                                                    {
-                                                                                                        tempStr = "January";
-
-                                                                                                       // quarterPeriod = 1;
-
-                                                                                                    }
-                                                                                                }
-                                                                                            }
-                                                                                        } else
-                                                                                        {
-                                                                                            if ( deCodeString.equalsIgnoreCase( "QUARTER-END-SHORT" ) )
-                                                                                            {
-                                                                                                String endMonth = "";
-
-                                                                                                endMonth = monthFormat.format( eDate );
-
-                                                                                                if ( endMonth.equalsIgnoreCase( "June" ) )
-                                                                                                {
-                                                                                                    tempStr = "Jun";
-                                                                                                } else
-                                                                                                {
-                                                                                                    if ( endMonth.equalsIgnoreCase( "September" ) )
-                                                                                                    {
-                                                                                                        tempStr = "Sep";
-                                                                                                    } else
-                                                                                                    {
-                                                                                                        if ( endMonth.equalsIgnoreCase( "December" ) )
-                                                                                                        {
-                                                                                                            tempStr = "Dec";
-                                                                                                        } else
-                                                                                                        {
-                                                                                                            tempStr = "Mar";
-
-                                                                                                           // quarterPeriod = 1;
-
-                                                                                                        }
-                                                                                                    }
-                                                                                                }
-                                                                                            } else
-                                                                                            {
-                                                                                                if ( deCodeString.equalsIgnoreCase( "QUARTER-END" ) )
-                                                                                                {
-                                                                                                    String endMonth = "";
-
-                                                                                                    endMonth = monthFormat.format( eDate );
-
-                                                                                                    if ( endMonth.equalsIgnoreCase( "June" ) )
-                                                                                                    {
-                                                                                                        tempStr = "June";
-                                                                                                    } else
-                                                                                                    {
-                                                                                                        if ( endMonth.equalsIgnoreCase( "September" ) )
-                                                                                                        {
-                                                                                                            tempStr = "September";
-                                                                                                        } else
-                                                                                                        {
-                                                                                                            if ( endMonth.equalsIgnoreCase( "December" ) )
-                                                                                                            {
-                                                                                                                tempStr = "December";
-                                                                                                            } else
-                                                                                                            {
-                                                                                                                tempStr = "March";
-
-                                                                                                               // quarterPeriod = 1;
-
-                                                                                                            }
-                                                                                                        }
-                                                                                                    }
-                                                                                                } else
-                                                                                                {
-                                                                                                    if ( deCodeString.equalsIgnoreCase( "PERIOD-YEAR" ) )
-                                                                                                    {
-                                                                                                        sDateTemp = sDate;
-
-                                                                                                        Calendar tempQuarterYear = Calendar.getInstance();
-
-                                                                                                        tempQuarterYear.setTime( sDateTemp );
-
-                                                                                                        String startMonth = "";
-
-                                                                                                        startMonth = monthFormat.format( sDateTemp );
-
-                                                                                                        periodType = selectedPeriod.getPeriodType();
-
-                                                                                                        if ( periodType.getName().equalsIgnoreCase( "Yearly" ) )
-                                                                                                        {
-                                                                                                            sDateTemp = sDate;
-                                                                                                        } else
-                                                                                                        {
-                                                                                                            if ( ( startMonth.equalsIgnoreCase( "January" ) || startMonth.equalsIgnoreCase( "February" ) || startMonth.equalsIgnoreCase( "March" ) ) && periodType.getName().equalsIgnoreCase( "Quarterly" ) )
-                                                                                                            {
-                                                                                                                tempQuarterYear.roll( Calendar.YEAR, -1 );
-
-                                                                                                                sDateTemp = tempQuarterYear.getTime();
-
-                                                                                                            }
-                                                                                                        }
-
-                                                                                                        tempStr = yearFormat.format( sDateTemp );
-                                                                                                    } else
-                                                                                                    {
-                                                                                                        if ( deCodeString.equalsIgnoreCase( "SIMPLE-YEAR" ) )
-                                                                                                        {
-                                                                                                            sDateTemp = sDate;
-
-                                                                                                            Calendar tempQuarterYear = Calendar.getInstance();
-
-                                                                                                            tempQuarterYear.setTime( sDateTemp );
-
-                                                                                                            String startMonth = "";
-
-                                                                                                            startMonth = monthFormat.format( sDateTemp );
-
-                                                                                                            periodType = selectedPeriod.getPeriodType();
-
-                                                                                                            if ( periodType.getName().equalsIgnoreCase( "Yearly" ) )
-                                                                                                            {
-                                                                                                                sDateTemp = sDate;
-                                                                                                            } else
-                                                                                                            {
-                                                                                                                if ( ( startMonth.equalsIgnoreCase( "January" ) || startMonth.equalsIgnoreCase( "February" ) || startMonth.equalsIgnoreCase( "March" ) ) && periodType.getName().equalsIgnoreCase( "Quarterly" ) )
-                                                                                                                {
-                                                                                                                    tempQuarterYear.roll( Calendar.YEAR, -1 );
-
-                                                                                                                    sDateTemp = tempQuarterYear.getTime();
-
-                                                                                                                }
-                                                                                                            }
-
-                                                                                                            tempStr = simpleYearFormat.format( sDateTemp );
-                                                                                                        } else
-                                                                                                        {
-                                                                                                            if ( deCodeString.equalsIgnoreCase( "YEAR-END" ) )
-                                                                                                            {
-
-                                                                                                                sDateTemp = sDate;
-
-                                                                                                                Calendar tempQuarterYear = Calendar.getInstance();
-
-                                                                                                                tempQuarterYear.setTime( sDate );
-
-                                                                                                                sDate = tempQuarterYear.getTime();
-
-                                                                                                                String startMonth = "";
-
-                                                                                                                startMonth = monthFormat.format( sDateTemp );
-
-                                                                                                                periodType = selectedPeriod.getPeriodType();
-
-                                                                                                                if ( periodType.getName().equalsIgnoreCase( "Yearly" ) )
-                                                                                                                {
-                                                                                                                    tempQuarterYear.roll( Calendar.YEAR, 1 );
-
-                                                                                                                    sDateTemp = tempQuarterYear.getTime();
-
-                                                                                                                }
-
-                                                                                                                if ( !( startMonth.equalsIgnoreCase( "January" ) || startMonth.equalsIgnoreCase( "February" ) || startMonth.equalsIgnoreCase( "March" ) ) )
-                                                                                                                {
-                                                                                                                    tempQuarterYear.roll( Calendar.YEAR, 1 );
-
-                                                                                                                    sDateTemp = tempQuarterYear.getTime();
-
-                                                                                                                }
-
-                                                                                                                tempStr = yearFormat.format( sDateTemp );
-                                                                                                            } 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 ( periodType.getName().equalsIgnoreCase( "Yearly" ) )
-                                                                                                                    {
-                                                                                                                        sDateTemp = sDate;
-                                                                                                                    } else
-                                                                                                                    {
-                                                                                                                        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 ( periodType.getName().equalsIgnoreCase( "Yearly" ) )
-                                                                                                                    {
-                                                                                                                        tempQuarterYear.roll( Calendar.YEAR, 1 );
-
-                                                                                                                        eDateTemp = tempQuarterYear.getTime();
-                                                                                                                    }
-
-                                                                                                                    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
-                                                                                                                {
-                                                                                                                    if ( deCodeString.equalsIgnoreCase( "SLNO" ) )
-                                                                                                                    {
-                                                                                                                        tempStr = "" + ( orgUnitCount + 1 );
-                                                                                                                    } else
-                                                                                                                    {
-                                                                                                                        if ( deCodeString.equalsIgnoreCase( "NA" ) )
-                                                                                                                        {
-                                                                                                                            tempStr = " ";
-                                                                                                                        } else
-                                                                                                                        {
-                                                                                                                            rowCounter += 1;
-
-                                                                                                                            if ( sType.equalsIgnoreCase( "dataelement" ) )
-                                                                                                                            {
-                                                                                                                                if ( aggCB == null )
-                                                                                                                                {
-                                                                                                                                   // tempStr = getIndividualResultDataValue( deCodeString, tempStartDate.getTime(), tempEndDate.getTime(), currentOrgUnit );
-                                                                                                                                	 tempStr = reportService.getIndividualResultDataValue(deCodeString, tempStartDate.getTime(), tempEndDate.getTime(), currentOrgUnit, reportModelTB );
-                                                                                                                                } else
-                                                                                                                                {
-                                                                                                                                    //tempStr = getResultDataValue( deCodeString, tempStartDate.getTime(), tempEndDate.getTime(), currentOrgUnit );
-                                                                                                                                	tempStr = reportService.getResultDataValue( deCodeString, tempStartDate.getTime(), tempEndDate.getTime(), currentOrgUnit, reportModelTB );
-                                                                                                                                }
-
-                                                                                                                                if ( deFlag2 == 1 )
-                                                                                                                                {
-                                                                                                                                    try{
-                                                                                                                                    //tempNum = Integer.parseInt( tempStr );
-                                                                                                                                        tempNum = Double.parseDouble( tempStr );
-                                                                                                                                    }
-                                                                                                                                    catch(Exception ex){
-                                                                                                                                        tempNum = 0;
-                                                                                                                                    }
-                                                                                                                                }
-                                                                                                                            } else
-                                                                                                                            {
-                                                                                                                                if ( sType.equalsIgnoreCase( "indicator-parent" ) )
-                                                                                                                                {
-                                                                                                                                    if ( aggCB == null )
-                                                                                                                                    {
-                                                                                                                                        //tempStr = getIndividualResultIndicatorValue( deCodeString, tempStartDate.getTime(), tempEndDate.getTime(), currentOrgUnit.getParent() );
-                                                                                                                                    	tempStr = reportService.getIndividualResultIndicatorValue(deCodeString, tempStartDate.getTime(), tempEndDate.getTime(), currentOrgUnit.getParent() );
-                                                                                                                                    } else
-                                                                                                                                    {
-                                                                                                                                        //tempStr = getResultIndicatorValue( deCodeString, tempStartDate.getTime(), tempEndDate.getTime(), currentOrgUnit.getParent() );
-                                                                                                                                    	tempStr = reportService.getResultIndicatorValue( deCodeString, tempStartDate.getTime(), tempEndDate.getTime(), currentOrgUnit.getParent() );
-                                                                                                                                    }
-
-                                                                                                                                    if ( deFlag2 == 1 )
-                                                                                                                                    {
-                                                                                                                                        try{
-                                                                                                                                            //tempNum = Integer.parseInt( tempStr );
-                                                                                                                                            tempNum = Double.parseDouble( tempStr );
-                                                                                                                                            }
-                                                                                                                                            catch(Exception ex){
-                                                                                                                                                tempNum = 0;
-                                                                                                                                            }
-
-                                                                                                                                    }
-                                                                                                                                } else
-                                                                                                                                {
-                                                                                                                                    if ( sType.equalsIgnoreCase( "dataelement-boolean" ) )
-                                                                                                                                    {
-                                                                                                                                        if ( aggCB == null )
-                                                                                                                                        {
-                                                                                                                                            //tempStr = getBooleanDataValue( deCodeString, tempStartDate.getTime(), tempEndDate.getTime(), currentOrgUnit );
-                                                                                                                                        	tempStr = reportService.getBooleanDataValue(deCodeString, tempStartDate.getTime(), tempEndDate.getTime(), currentOrgUnit, reportModelTB);
-                                                                                                                                        } else
-                                                                                                                                        {
-                                                                                                                                            //tempStr = getBooleanDataValue( deCodeString, tempStartDate.getTime(), tempEndDate.getTime(), currentOrgUnit );
-                                                                                                                                        	tempStr = reportService.getBooleanDataValue(deCodeString, tempStartDate.getTime(), tempEndDate.getTime(), currentOrgUnit, reportModelTB);
-                                                                                                                                        }
-                                                                                                                                    } else
-                                                                                                                                    {
-                                                                                                                                        if ( aggCB == null )
-                                                                                                                                        {
-                                                                                                                                            //tempStr = getIndividualResultIndicatorValue( deCodeString, tempStartDate.getTime(), tempEndDate.getTime(), currentOrgUnit );
-                                                                                                                                        	tempStr = reportService.getIndividualResultIndicatorValue( deCodeString, tempStartDate.getTime(), tempEndDate.getTime(), currentOrgUnit );
-                                                                                                                                        } else
-                                                                                                                                        {
-                                                                                                                                            //tempStr = getResultIndicatorValue( deCodeString, tempStartDate.getTime(), tempEndDate.getTime(), currentOrgUnit );
-                                                                                                                                        	tempStr = reportService.getResultIndicatorValue( deCodeString, tempStartDate.getTime(), tempEndDate.getTime(), currentOrgUnit );
-                                                                                                                                        }
-                                                                                                                                        if ( deFlag2 == 1 )
-                                                                                                                                        {
-                                                                                                                                            try{
-                                                                                                                                                //tempNum = Integer.parseInt( tempStr );
-                                                                                                                                                tempNum = Double.parseDouble( tempStr );
-                                                                                                                                                }
-                                                                                                                                                catch(Exception ex){
-                                                                                                                                                    tempNum = 0;
-                                                                                                                                                }
-
-                                                                                                                                        }
-                                                                                                                                    }
-                                                                                                                                }
-                                                                                                                            }
-                                                                                                                        }
-                                                                                                                    }
-                                                                                                                }
-                                                                                                            }
-                                                                                                        }
-                                                                                                    }
-                                                                                                }
-                                                                                            }
-                                                                                        }
-                                                                                    }
-                                                                                }
-                                                                            }
-                                                                        }
-                                                                    }
-                                                                }
-                                                            }
-                                                        }
-                                                    }
-                                                }
-                                            }
-                                        }
-                                    }
-                                }
-                            }
-                        }
+                    if( sType.equalsIgnoreCase( "dataelement" ) )
+                    {
+                        if ( aggCB == null )
+                        {
+                            tempStr = reportService.getIndividualResultDataValue(deCodeString, tempStartDate.getTime(), tempEndDate.getTime(), currentOrgUnit, reportModelTB );
+                        } 
+                        else
+                        {
+                            tempStr = reportService.getResultDataValue( deCodeString, tempStartDate.getTime(), tempEndDate.getTime(), currentOrgUnit, reportModelTB );
+                        }
+                    } 
+                    else if ( sType.equalsIgnoreCase( "dataelement-boolean" ) )
+                    {
+                        if ( aggCB == null )
+                        {
+                            tempStr = reportService.getBooleanDataValue(deCodeString, tempStartDate.getTime(), tempEndDate.getTime(), currentOrgUnit, reportModelTB);
+                        } 
+                        else
+                        {
+                            tempStr = reportService.getBooleanDataValue(deCodeString, tempStartDate.getTime(), tempEndDate.getTime(), currentOrgUnit, reportModelTB);
+                        }
+                    }
+                    else
+                    {
+                        if ( aggCB == null )
+                        {
+                            tempStr = reportService.getIndividualResultIndicatorValue( deCodeString, tempStartDate.getTime(), tempEndDate.getTime(), currentOrgUnit );
+                        } 
+                        else
+                        {
+                            tempStr = reportService.getResultIndicatorValue( deCodeString, tempStartDate.getTime(), tempEndDate.getTime(), currentOrgUnit );
+                        }                       
                     }
                 }
+        
                 int tempRowNo = rowList.get( count1 );
                 int tempColNo = colList.get( count1 );
-                int sheetNo = sheetList.get( count1 ) + orgUnitGroupCount;
+                int sheetNo = sheetList.get( count1 );
                 WritableSheet sheet0 = outputReportWorkbook.getSheet( sheetNo );
+                
                 if ( tempStr == null || tempStr.equals( " " ) )
                 {
                     tempColNo += orgUnitCount;
-
+        
                     WritableCellFormat wCellformat = new WritableCellFormat();
                     wCellformat.setBorder( Border.ALL, BorderLineStyle.THIN );
                     wCellformat.setWrap( true );
                     wCellformat.setAlignment( Alignment.CENTRE );
-
+        
                     sheet0.addCell( new Blank( tempColNo, tempRowNo, wCellformat ) );
-                } else
+                } 
+                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
-                        {
-                            if ( deFlag2 == 1 )
-                            {
-                                sheet0.addCell( new Number( tempColNo, tempRowNo, tempNum, wCellformat ) );
-                            } else
-                            {
-                                sheet0.addCell( new Label( tempColNo, tempRowNo, tempStr, wCellformat ) );
-                            }
-                        }
-                    }
-
                     if ( reportModelTB.equalsIgnoreCase( "DYNAMIC-ORGUNIT" ) )
                     {
                         if ( deCodeString.equalsIgnoreCase( "FACILITYP" ) || deCodeString.equalsIgnoreCase( "FACILITYPP" ) || deCodeString.equalsIgnoreCase( "FACILITYPPP" ) || 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.setAlignment( Alignment.CENTRE );
-                        wCellformat.setWrap( true );
-
-                        if ( cell.getType() == CellType.LABEL )
-                        {
-                            Label l = (Label) cell;
-                            l.setString( tempStr );
-                            l.setCellFormat( cellFormat );
-                        } else
-                        {
-                            if ( deFlag2 == 1 )
-                            {
-                                sheet0.addCell( new Number( tempColNo, tempRowNo, tempNum, wCellformat ) );
-                            } else
-                            {
-                                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
-                        {
-                            if ( deFlag2 == 1 )
-                            {
-                                sheet0.addCell( new Number( tempColNo, tempRowNo, tempNum, wCellformat ) );
-                            } else
-                            {
-                                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 );
-                            System.out.println( "cell type = " + cell.getType() + " tempstr = " + tempStr );
-                        } else
-                        {
-                            System.out.println( "deFlag2 = " + deFlag2 + " tempstr = " + tempStr );
-                            if ( deFlag2 == 1 )
-                            {
-                                sheet0.addCell( new Number( tempColNo, tempRowNo, tempNum, wCellformat ) );
-                            } else
-                            {
-                                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
-                        {
-                            if ( deFlag2 == 1 )
-                            {
-                                sheet0.addCell( new Number( tempColNo, tempRowNo, tempNum, wCellformat ) );
-                            } else
-                            {
-                                sheet0.addCell( new Label( tempColNo, tempRowNo, tempStr, wCellformat ) );
-                            }
-                        }
-                    }
-                    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" ) )
-                                    {
-                                    } 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
-                                        {
-                                            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 );
-                            System.out.println( "cell type = " + cell.getType() + " tempstr = " + tempStr );
-                        } else
-                        {
-                            System.out.println( "deFlag2 = " + deFlag2 + " tempstr = " + tempStr );
-                            if ( deFlag2 == 1 )
-                            {
-                                sheet0.addCell( new Number( tempColNo, tempRowNo, tempNum, wCellformat ) );
-                            } else
-                            {
-                                sheet0.addCell( new Label( tempColNo, tempRowNo, tempStr, wCellformat ) );
-                            }
-                        }
-                    }
-
-                    // }
+                        } 
+                        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" ) ||  deCodeString.equalsIgnoreCase( "FACILITYPP" ) || deCodeString.equalsIgnoreCase( "FACILITYPPP" ) || 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
+                        {
+                            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 );
+    
+                    if ( cell.getType() == CellType.LABEL )
+                    {
+                        Label l = (Label) cell;
+                        l.setString( tempStr );
+                        l.setCellFormat( cellFormat );
+                    } 
+                    else
+                    {
+                        try
+                        {
+                            sheet0.addCell( new Number( tempColNo, tempRowNo, Double.parseDouble( tempStr ), 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();
 
@@ -1691,7 +457,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();
 
@@ -1715,8 +481,7 @@
         } 
         catch ( NullPointerException npe )
         {
-            // do nothing, but we might be using this somewhere without
-            // USER_HOME set, which will throw a NPE
+            System.out.println("DHIS2_HOME not set");
         }
 
         try
@@ -1726,8 +491,7 @@
             Document doc = docBuilder.parse( new File( path ) );
             if ( doc == null )
             {
-                // System.out.println( "There is no DECodes related XML file in
-                // the user home" );
+                System.out.println( "There is no DECodes related XML file in the ra folder" );
                 return null;
             }
 

=== 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-08-19 10:40:50 +0000
+++ local/in/dhis-web-reports-national/src/main/resources/org/hisp/dhis/reports/i18n_module.properties	2010-11-01 11:14:31 +0000
@@ -1,3 +1,10 @@
+goi_ra = Government of India Reports Analyser
+periodtype = PeriodType
+organisationunit = OrganisationUnit
+select_periodtype = Select PeriodType
+aggregated_data = Aggregated Data
+generate_report = Generate Report
+
 please_select_an_orgUnit= Please select an OrganisationUnit.
 please_select_a_dataset= Please select a dataset.
 please_select_period= Please select a period.
@@ -264,4 +271,5 @@
 frequency = Frequency
 excelname = Excel Name
 xmlname = Xml Name
-reporttype = Report Type
\ No newline at end of file
+reporttype = Report Type
+

=== 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-10-31 08:01:14 +0000
+++ local/in/dhis-web-reports-national/src/main/webapp/dhis-web-reports/upwardReportAnalysisFront.vm	2010-11-01 11:14:31 +0000
@@ -29,22 +29,22 @@
 	}			
 </script>
 
-<h1>Government of India Reports Analyser</h1>
+<h1>$i18n.getString( "goi_ra" )</h1>
 <hr /><br />
 <form id="reportForm" name="reportForm" action="generateUpwardReport.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. PeriodType : <br />
+				1. $i18n.getString( "periodtype" ) : <br />
 				<select id="periodTypeId" name="periodTypeId" style="width:200px" onchange="getPeriods()">
-					<option value="NA">[ Select PeriodType ]</option>
+					<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. OrganisationUnit : <br />
+				3. $i18n.getString( "organisationunit" ) : <br />
 				<input type="text" name="ouNameTB" id="ouNameTB" style="width:200px" disabled>         
 			</td>		
 		</tr>
@@ -58,11 +58,11 @@
 		</tr>			
 		<tr>
 			<td class="NormalB">
-				2. Periods : <br />
+				2. $i18n.getString( "periods" ) : <br />
 				<select id="availablePeriods" name="availablePeriods" style="width:200px"></select>
 			</td>
 			<td class="NormalB">
-				4. Reports :<br />
+				4. $i18n.getString( "reports" ) :<br />
 				<select id="reportList" name="reportList" style="width:200px"></select>
 			</td>
 		</tr>
@@ -77,9 +77,9 @@
 		<tr>
 			<td>&nbsp;</td>
 			<td>
-				<input type="checkbox" id="aggCB" name="aggCB" checked> Aggregated Data
+				<input type="checkbox" id="aggCB" name="aggCB" checked> $i18n.getString( "aggregated_data" )
 				<br><br>	  							
-				<input type="submit" id= "generate" name="generate" value="Generate Report" disabled="disabled">
+				<input type="submit" id= "generate" 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="reportTypeNameTB" id="reportTypeNameTB" value="$reportTypeName">