← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 4953: Merge NRHM Report Excel import and Data Analyser from 2.3 to trunk

 

------------------------------------------------------------
revno: 4953
committer: Mithilesh Kumar Thakur<mithilesh.hisp@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2011-10-14 17:56:01 +0530
message:
  Merge NRHM Report Excel import and Data Analyser from 2.3 to trunk
modified:
  local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/action/DashBoardHomePageAction.java
  local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/ds/action/GenerateDataStatusResultAction.java
  local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/ds/action/GenerateSummaryDataStatusResultAction.java
  local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/dsMart/action/GenerateDataEntrySummaryStatusResultAction.java
  local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/util/DashBoardService.java
  local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/dataStatusResult.vm
  local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/welcomeTracker.vm
  local/in/dhis-web-excelimport/src/main/java/org/hisp/dhis/excelimport/portal/action/PortalExcelImportResultAction.java
  local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/meta/action/GenerateMetaDataReportResultAction.java
  local/in/dhis-web-reports-national/src/main/resources/struts.xml
  local/in/dhis-web-reports-national/src/main/webapp/dhis-web-reports/menu.vm


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/action/DashBoardHomePageAction.java'
--- local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/action/DashBoardHomePageAction.java	2011-10-13 09:49:44 +0000
+++ local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/action/DashBoardHomePageAction.java	2011-10-14 12:26:01 +0000
@@ -30,12 +30,14 @@
 import static org.hisp.dhis.system.util.ConversionUtils.getIdentifiers;
 import static org.hisp.dhis.system.util.TextUtils.getCommaDelimitedString;
 
+import java.text.SimpleDateFormat;
 import java.util.ArrayList;
 import java.util.Calendar;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.Date;
 import java.util.HashMap;
+import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 
@@ -147,6 +149,20 @@
         return totalEnrollCountMap;
     }
 
+    Map<String, Integer> totalEnrollCountForSelDateMap;
+    
+    public Map<String, Integer> getTotalEnrollCountForSelDateMap()
+    {
+        return totalEnrollCountForSelDateMap;
+    }
+
+    Integer totalRegCountForSelDate = 0;
+    
+    public Integer getTotalRegCountForSelDate()
+    {
+        return totalRegCountForSelDate;
+    }
+
     Integer totalRegCount = 0;
     
     public Integer getTotalRegCount()
@@ -161,6 +177,13 @@
         return totalRegCountList;
     }
 
+    List<Integer> totalRegCountListForSelDate;
+    
+    public List<Integer> getTotalRegCountListForSelDate()
+    {
+        return totalRegCountListForSelDate;
+    }
+
     List<Program> programList;
 
     public List<Program> getProgramList()
@@ -195,7 +218,13 @@
     {
         return navigationString;
     }
+
+    private String toDaysDate;
     
+    public String getToDaysDate()
+    {
+        return toDaysDate;
+    }
     
     // ---------------------------------------------------------------
     // Action Implementation
@@ -211,17 +240,37 @@
         programList = new ArrayList<Program>();
         rootOrgUnitEnrollCountList = new ArrayList<Integer>();
         totalRegCountList = new ArrayList<Integer>();
+        totalRegCountListForSelDate = new ArrayList<Integer>();
+        totalEnrollCountForSelDateMap = new HashMap<String, Integer>();
         
         resultString = "";
         
         navigationString = "Tracker Dashboard";
         
+        Date toDay = new Date();
+        Calendar cal = Calendar.getInstance();
+        cal.setTime( toDay );
+        //cal.roll( Calendar.DATE, false );
+        cal.add( Calendar.DATE, -1 );
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
+        toDaysDate = simpleDateFormat.format( cal.getTime() );
+        
         // getIndicatorValues();
 
         programList.addAll( programService.getAllPrograms() );
 
         if( programList != null && programList.size() > 0 )
         {
+            Iterator<Program> progIterator = programList.iterator();
+            while( progIterator.hasNext() )
+            {
+                Program prg = progIterator.next();
+                if( prg.getOrganisationUnits() == null || prg.getOrganisationUnits().size() <= 0)
+                {
+                    progIterator.remove();
+                }
+            }
+
             List<OrganisationUnit> rootOrgUnitList = new ArrayList<OrganisationUnit>( );
             if( drillDownOrgUnitId != null )
             {
@@ -259,6 +308,8 @@
                     String orgUnitIdsByComma = getCommaDelimitedString( getIdentifiers( OrganisationUnit.class, childTree ) );
     
                     Map<Integer, Integer> enrollCountMap = dashBoardService.getTotalEnrolledNumber( orgUnitIdsByComma );
+                    
+                    Map<Integer, Integer> enrollCountForSelDateMap = dashBoardService.getTotalEnrolledNumberForSelectedDate( orgUnitIdsByComma, toDaysDate );
                     if ( enrollCountMap != null )
                     {
                         for ( Program program : programList )
@@ -278,6 +329,22 @@
                             {
                                 totalEnrollCountMap.put( rootOrgUnitName+":"+program.getId(), tempResult );
                             }
+                            
+                            Integer tempResult1 = enrollCountForSelDateMap.get( program.getId() );
+                            if( tempResult1 == null )
+                            {
+                                tempResult1 = 0;
+                            }
+                            totalEnrollCountForSelDateMap.put( program.getId()+":"+ou.getId(), tempResult1 );
+                            Integer tempInteger1 = totalEnrollCountForSelDateMap.get( rootOrgUnitName+":"+program.getId() );
+                            if( tempInteger1 != null )
+                            {
+                                totalEnrollCountForSelDateMap.put( rootOrgUnitName+":"+program.getId(), tempResult1+tempInteger1 );
+                            }
+                            else
+                            {
+                                totalEnrollCountForSelDateMap.put( rootOrgUnitName+":"+program.getId(), tempResult1 );
+                            }
                         }
                     }
                     
@@ -286,6 +353,12 @@
                     totalRegCountList.add( regCount  );
                     
                     totalRegCount += regCount;
+                    
+                    Integer regCountForSelDate = dashBoardService.getTotalRegisteredCountForSelDate( orgUnitIdsByComma, toDaysDate );
+                    
+                    totalRegCountListForSelDate.add( regCountForSelDate );
+                    
+                    totalRegCountForSelDate += regCountForSelDate;
                 }
             }
         }
@@ -295,6 +368,7 @@
         return SUCCESS;
     }
 
+
     @SuppressWarnings( "unused" )
     private void getIndicatorValues()
     {

=== modified file 'local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/ds/action/GenerateDataStatusResultAction.java'
--- local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/ds/action/GenerateDataStatusResultAction.java	2011-09-03 09:46:15 +0000
+++ local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/ds/action/GenerateDataStatusResultAction.java	2011-10-14 12:26:01 +0000
@@ -352,7 +352,13 @@
     {
         return dataElementCount;
     }
+
+    private List<OrganisationUnit> dso;
     
+    public List<OrganisationUnit> getDso()
+    {
+        return dso;
+    }
 
     // ---------------------------------------------------------------
     // Action Implementation
@@ -500,7 +506,7 @@
         Iterator<OrganisationUnit> orgUnitListIterator = orgUnitList.iterator();
         OrganisationUnit o;
         // Set<OrganisationUnit> dso = new HashSet<OrganisationUnit>();
-        List<OrganisationUnit> dso = new ArrayList<OrganisationUnit>( selDataSet.getSources() );
+        dso = new ArrayList<OrganisationUnit>( selDataSet.getSources() );
         Iterator<Period> periodIterator;
         // dso = selDataSet.getSources();
 
@@ -529,8 +535,6 @@
                 periodInfo = "" + p.getId();
                 dataElementCount = 0;
 
-                
-
                     if ( dso == null )
                     {
                         dsResults.add( -1 );
@@ -540,16 +544,18 @@
                     else if ( !dso.contains( o ) )
                     {
                         System.out.println("Dataset : " + selDataSet.getName() + " not assign to " + o.getName() );
-                        /*
+                        List<OrganisationUnit> childOrgUnits = new ArrayList<OrganisationUnit>();
+                        childOrgUnits = filterChildOrgUnitsByDataSet( o, dso );
+
+                        
                         if( childOrgUnits == null || childOrgUnits.size() <= 0 )
                         {
                             dsResults.add( -2 );
                             continue;
                         }
-                        
-                        else*/
-                        //{
-                            /*orgUnitInfo = "-1";
+                        else
+                        {
+                            orgUnitInfo = "-1";
                             orgUnitCount = 0;
                             getOrgUnitInfo( o, dso );
         
@@ -589,13 +595,14 @@
                                 dataStatusPercentatge = 100;
         
                             dataStatusPercentatge = Math.round( dataStatusPercentatge * Math.pow( 10, 0 ) ) / Math.pow( 10, 0 );
-                            */
-                            //dsResults.add( (int) dataStatusPercentatge );
-                            dsResults.add( -1 );
-                            //dataElementCount = sqlResultSet.getInt( 1 );
-                            deCounts.add( -1 );
+                           
+                            dsResults.add( (int) dataStatusPercentatge );
+                            //dsResults.add( -1 );
+                            dataElementCount = sqlResultSet.getInt( 1 );
+                            //deCounts.add( -1 );
+                            deCounts.add( dataElementCount );
                             continue;
-                        //}
+                        }
                     }
 
                 orgUnitInfo = "" + o.getId();
@@ -814,16 +821,24 @@
         }
     }
 
-    /*
-     * private void getOrgUnitInfo( OrganisationUnit organisationUnit,
-     * List<OrganisationUnit> dso ) { Collection<OrganisationUnit> children =
-     * organisationUnit.getChildren();
-     * 
-     * Iterator<OrganisationUnit> childIterator = children.iterator();
-     * OrganisationUnit child; while ( childIterator.hasNext() ) { child =
-     * childIterator.next(); if ( dso.contains( child ) ) { orgUnitInfo += "," +
-     * child.getId(); orgUnitCount++; } getOrgUnitInfo( child, dso ); } }
-     */
+    
+     private void getOrgUnitInfo( OrganisationUnit organisationUnit, List<OrganisationUnit> dso ) 
+     { 
+         Collection<OrganisationUnit> children = organisationUnit.getChildren();
+      
+         Iterator<OrganisationUnit> childIterator = children.iterator();
+         OrganisationUnit child; 
+         while ( childIterator.hasNext() ) 
+         { 
+             child = childIterator.next(); 
+             if ( dso.contains( child ) ) 
+             { 
+                 orgUnitInfo += "," + child.getId(); orgUnitCount++; 
+             } 
+             getOrgUnitInfo( child, dso ); 
+         } 
+     }
+     
     private String getDEInfo( Collection<DataElement> dataElements )
     {
         StringBuffer deInfo = new StringBuffer( "-1" );
@@ -834,14 +849,12 @@
         }
         return deInfo.toString();
     }
-    /*
-     * private List<OrganisationUnit> filterChildOrgUnitsByDataSet(
-     * OrganisationUnit selectedOrganisationUnit, List<OrganisationUnit> dso ) {
-     * List<OrganisationUnit> filteredOrganisationUnits = new
-     * ArrayList<OrganisationUnit>(
-     * organisationUnitService.getOrganisationUnitWithChildren(
-     * selectedOrganisationUnit.getId() ) );
-     * filteredOrganisationUnits.retainAll( dso ); return
-     * filteredOrganisationUnits; }
-     */
+    
+     private List<OrganisationUnit> filterChildOrgUnitsByDataSet( OrganisationUnit selectedOrganisationUnit, List<OrganisationUnit> dso ) 
+     {
+         List<OrganisationUnit> filteredOrganisationUnits = new ArrayList<OrganisationUnit>( organisationUnitService.getOrganisationUnitWithChildren( selectedOrganisationUnit.getId() ) );
+         filteredOrganisationUnits.retainAll( dso ); return
+         filteredOrganisationUnits; 
+     }
+    
 }// class end

=== modified file 'local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/ds/action/GenerateSummaryDataStatusResultAction.java'
--- local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/ds/action/GenerateSummaryDataStatusResultAction.java	2011-04-27 17:15:13 +0000
+++ local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/ds/action/GenerateSummaryDataStatusResultAction.java	2011-10-14 12:26:01 +0000
@@ -1,5 +1,8 @@
 package org.hisp.dhis.dataanalyser.ds.action;
 
+import static org.hisp.dhis.system.util.ConversionUtils.getIdentifiers;
+import static org.hisp.dhis.system.util.TextUtils.getCommaDelimitedString;
+
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
@@ -306,9 +309,17 @@
         deInfo = "-1";
         DataSet dSet = dataSetService.getDataSet( Integer.parseInt( selectedDataSets ) );
         selDataSet = dSet;
-        for ( DataElement de : dSet.getDataElements() )
-            deInfo += "," + de.getId();
-
+        Collection<DataElement> dataElements = new ArrayList<DataElement>();
+        dataElements = selDataSet.getDataElements();
+        int dataSetMemberCount1 = 0;
+        for ( DataElement de1 : dataElements )
+        {
+            dataSetMemberCount1 += de1.getCategoryCombo().getOptionCombos().size();
+        }
+        Collection<Integer> dataElementIds = new ArrayList<Integer>( getIdentifiers(DataElement.class, dataElements ) );
+        deInfo = getCommaDelimitedString( dataElementIds );
+        //deInfo = getDEInfo( dataElements );
+        
         // OrgUnit Related Info
         OrganisationUnit selectedOrgUnit = new OrganisationUnit();
         orgUnitList = new ArrayList<OrganisationUnit>();
@@ -323,8 +334,7 @@
             Iterator<String> orgUnitIterator = orgUnitListCB.iterator();
             while ( orgUnitIterator.hasNext() )
             {
-                OrganisationUnit o = organisationUnitService.getOrganisationUnit( Integer
-                    .parseInt( (String) orgUnitIterator.next() ) );
+                OrganisationUnit o = organisationUnitService.getOrganisationUnit( Integer.parseInt( (String) orgUnitIterator.next() ) );
                 orgUnitList.add( o );
                 List<OrganisationUnit> organisationUnits = new ArrayList<OrganisationUnit>( o.getChildren() );
                 Collections.sort( organisationUnits, new OrganisationUnitShortNameComparator() );
@@ -373,13 +383,14 @@
         Period endPeriod = periodService.getPeriod( eDateLB );
 
         PeriodType dataSetPeriodType = selDataSet.getPeriodType();       
-        periodList = periodService.getPeriodsBetweenDates( dataSetPeriodType, startPeriod.getStartDate(),
-            endPeriod.getEndDate() );
+        periodList = periodService.getPeriodsBetweenDates( dataSetPeriodType, startPeriod.getStartDate(), endPeriod.getEndDate() );
 
         periodInfo = "-1";
         for ( Period p : periodList )
+        {
             periodInfo += "," + p.getId();
-
+        }
+        
         dataViewName = createDataView( orgUnitInfo, deInfo, periodInfo );
         String query = "";
         String query2 = "";
@@ -390,16 +401,6 @@
         query2 = "SELECT COUNT(*) FROM " + dataViewName
             + " WHERE dataelementid IN (?) AND sourceid = ? AND periodid IN (?)";
 
-        Collection<DataElement> dataElements = new ArrayList<DataElement>();
-        dataElements = selDataSet.getDataElements();
-
-        int dataSetMemberCount1 = 0;
-        for ( DataElement de1 : dataElements )
-        {
-            dataSetMemberCount1 += de1.getCategoryCombo().getOptionCombos().size();
-        }
-
-        deInfo = getDEInfo( dataElements );
         Iterator<OrganisationUnit> orgUnitListIterator = orgUnitList.iterator();
         OrganisationUnit o;
         dso = new HashSet<OrganisationUnit>();

=== modified file 'local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/dsMart/action/GenerateDataEntrySummaryStatusResultAction.java'
--- local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/dsMart/action/GenerateDataEntrySummaryStatusResultAction.java	2011-09-03 09:46:15 +0000
+++ local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/dsMart/action/GenerateDataEntrySummaryStatusResultAction.java	2011-10-14 12:26:01 +0000
@@ -145,7 +145,6 @@
         this.facilityLB = facilityLB;
     }
     
-    
     private String immChildOption;
 
     public void setImmChildOption( String immChildOption )
@@ -246,8 +245,6 @@
     
     String orgUnitInfo;
 
-    String periodInfo;
-
     String deInfo;
 
     int orgUnitCount;
@@ -282,6 +279,7 @@
     {
         return ouMapForChildDSAssociation;
     }
+
     // ---------------------------------------------------------------
     // Action Implementation
     // ---------------------------------------------------------------
@@ -316,22 +314,11 @@
             selectedDataSets = Integer.parseInt( dsId );
         }
         
-        
         // Data Set Related Information
         selDataSet = dataSetService.getDataSet( selectedDataSets );
-        dataSetName = selDataSet.getName();
-        
-        Collection<DataElement> dataElements = new ArrayList<DataElement>();
-        dataElements = selDataSet.getDataElements();
-        totalDataElementCount = 0;
-        for ( DataElement de1 : dataElements )
-        {
-            totalDataElementCount += de1.getCategoryCombo().getOptionCombos().size();
-        }
-        
+        dataSetName = selDataSet.getName();        
         dataSetSources = new ArrayList<OrganisationUnit>( selDataSet.getSources() );
         
-        
         // Period Related Info
         Period startPeriod = periodService.getPeriod( sDateLB );
         Period endPeriod = periodService.getPeriod( eDateLB );
@@ -341,27 +328,10 @@
         
         periodNameList = dashBoardService.getPeriodNamesByPeriodType( dataSetPeriodType, periodList );
         
-        periodInfo = "-1";
-        for ( Period p : periodList )
-            periodInfo += "," + p.getId();
-
-        
-        /*
-        Iterator<Period> periodIterator = periodList.iterator();
-        Period p;
-        periodInfo = "-1";
-        while( periodIterator.hasNext() )
-        {
-            p = (Period) periodIterator.next();
-            periodInfo += "," + p.getId();
-        }
-        */
         // Period Information for map
         Collection<Integer> periodIds = new ArrayList<Integer>( getIdentifiers(Period.class, periodList ) );
-        
         periodIdsByComma = getCommaDelimitedString( periodIds );
         
-        
         // OrgUnit Related Info
         OrganisationUnit selectedOrgUnit = new OrganisationUnit();
         orgUnitList = new ArrayList<OrganisationUnit>();
@@ -370,11 +340,7 @@
             selectedOrgUnit = organisationUnitService.getOrganisationUnit( Integer.parseInt( orgUnitListCB.get( 0 ) ) );
             orgUnitList = new ArrayList<OrganisationUnit>( organisationUnitService.getOrganisationUnitWithChildren( selectedOrgUnit.getId() ) );
         
-            tempOrgUnitList = new ArrayList<OrganisationUnit>( organisationUnitService.getOrganisationUnitWithChildren( selectedOrgUnit.getId() ) );
-            
-            // for Map
-            //childOrgUnitTreeIds = new ArrayList<Integer>( getIdentifiers( OrganisationUnit.class, tempOrgUnitList ) );
-            //childOrgUnitsByComma = getCommaDelimitedString( childOrgUnitTreeIds );
+            tempOrgUnitList = new ArrayList<OrganisationUnit>( organisationUnitService.getOrganisationUnitWithChildren( selectedOrgUnit.getId() ) );            
         }
         else if ( facilityLB.equals( "immChildren" ) )
         {
@@ -632,58 +598,7 @@
             levelNames.add( ouLevelNames[count1] );
             count1++;
         }
-        
- /*       
-        
-        String query2 = "";
-        if ( includeZeros == null )
-        {
-            query2 = "SELECT organisationunitid, periodid, value FROM dataentrystatus  WHERE datasetid = " + selDataSet.getId() +  " AND organisationunitid IN (" + orgUnitInfo + ") AND periodid IN (" + periodInfo + ") and includezero ='N' ";
-        }
-        else
-        {
-            query2 = "SELECT organisationunitid, periodid, value FROM dataentrystatus  WHERE datasetid = " + selDataSet.getId() +  " AND organisationunitid IN (" + orgUnitInfo + ") AND periodid IN (" + periodInfo + ") and includezero ='Y' ";
-        }
-        
-        SqlRowSet rs = jdbcTemplate.queryForRowSet( query );
-        
-        double value ;
-        int result;
-        while ( rs.next() )
-        {                
-            Integer orgUnitId = rs.getInt( 1 );
-            Integer periodId = rs.getInt( 2 );
-            String tempValue =  rs.getString( 3 );
-            
-            try
-            {
-                value = Double.parseDouble( tempValue );
-            }
-            catch ( Exception e )
-            {
-                value = 0.0;
-            }
-            
-            if ( value >= 5.0 )
-            {
-                result = 1;
-            }
-            
-            else
-            {
-                result = 0;
-            }
-           
-            String orgIdPeriodId =  orgUnitId + ":" + periodId;
-            //double dataElementCount = ( value * (double) totalDataElementCount ) / 100;
-            
-            //value = Math.round( value * Math.pow( 10, 0 ) ) / Math.pow( 10, 0 );
-            //dataElementCount = Math.round( dataElementCount * Math.pow( 10, 0 ) ) / Math.pow( 10, 0 );
-            
-            ouMapDataEntryStatusResult.put( orgIdPeriodId, result );
-            //ouMapDataElementCount.put( orgIdPeriodId, (int)dataElementCount );
-        }
-*/        
+                
         System.out.println( "Data Entry Summary  Status Using Mart End Time  : " + new Date() );
         return SUCCESS;
     }

=== modified file 'local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/util/DashBoardService.java'
--- local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/util/DashBoardService.java	2011-10-13 09:49:44 +0000
+++ local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/util/DashBoardService.java	2011-10-14 12:26:01 +0000
@@ -191,6 +191,35 @@
         }
     }
 
+    public Map<Integer, Integer> getTotalEnrolledNumberForSelectedDate( String orgUnitIdsByComma, String toDaysDate )
+    {
+        Map<Integer, Integer> aggDeMap = new HashMap<Integer, Integer>();
+        try
+        {
+            String query = "SELECT programinstance.programid, COUNT(*) FROM programinstance INNER JOIN patient " +
+                                        " ON programinstance.patientid = patient.patientid " +
+                                        " WHERE patient.organisationunitid IN ("+ orgUnitIdsByComma +") AND " +
+                                        " patient.registrationdate LIKE '"+ toDaysDate+"%' GROUP BY programid";
+
+            SqlRowSet rs = jdbcTemplate.queryForRowSet( query );
+            
+            while ( rs.next() )
+            {
+                Integer programId = rs.getInt( 1 );
+                Integer totalCount = rs.getInt( 2 );
+                {
+                    aggDeMap.put( programId, totalCount );
+                }
+            }
+            
+            return aggDeMap;
+        }
+        catch( Exception e )
+        {
+            throw new RuntimeException( e );
+        }
+    }
+
     public Integer getTotalRegisteredCount( String orgUnitIdsByComma )
     {
         Integer totalRegCount = 0;
@@ -214,6 +243,30 @@
         }
     }
 
+    public Integer getTotalRegisteredCountForSelDate( String orgUnitIdsByComma, String selDate )
+    {
+        Integer totalRegCount = 0;
+        try
+        {
+            String query = "SELECT COUNT(*) FROM patient " +
+                               " WHERE organisationunitid IN ("+ orgUnitIdsByComma +") AND " +
+                               	" registrationdate LIKE '"+ selDate+"%'";
+
+            SqlRowSet rs = jdbcTemplate.queryForRowSet( query );
+            
+            if ( rs != null && rs.next() )
+            {
+                totalRegCount = rs.getInt( 1 );
+            }
+            
+            return totalRegCount;
+        }
+        catch( Exception e )
+        {
+            throw new RuntimeException( e );
+        }
+    }
+
     
     public List<Period> getMonthlyPeriods( Date start, Date end )
     {

=== modified file 'local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/dataStatusResult.vm'
--- local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/dataStatusResult.vm	2011-07-07 07:02:33 +0000
+++ local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/dataStatusResult.vm	2011-10-14 12:26:01 +0000
@@ -126,13 +126,13 @@
                                     #if( $result < 0 )
                                         <td  bgcolor="white">&nbsp;</td>
                                     #elseif( $result == 0 )
-                                        <td align="center" bgcolor="#ff0000"><font color="#000000"><a href="javascript:getNullReportInfo('$selDataSet.id','$periodCount.id','$chiildorgUnit.id')">$result% #if( $deCount != -1 ) ( $deCount ) #end</a></font></td>
+                                        <td align="center" bgcolor="#ff0000"><font color="#000000">#if( $dso.contains($chiildorgUnit) )<a href="javascript:getNullReportInfo('$selDataSet.id','$periodCount.id','$chiildorgUnit.id')">$result% #if( $deCount != -1 ) ( $deCount ) #end</a>#else $result% #end</font></td>
                                     #elseif( $result > 75 )
-                                        <td align="center" bgcolor="#9ACD32"><font color="#000000"><a href="javascript:getNullReportInfo('$selDataSet.id','$periodCount.id','$chiildorgUnit.id')">$result% #if( $deCount != -1 ) ( $deCount ) #end</a></font></td>
+                                        <td align="center" bgcolor="#9ACD32"><font color="#000000">#if( $dso.contains($chiildorgUnit) )<a href="javascript:getNullReportInfo('$selDataSet.id','$periodCount.id','$chiildorgUnit.id')">$result% #if( $deCount != -1 ) ( $deCount ) #end</a> #else $result% #end</font></td>
                                     #elseif( $result > 40 && $result <= 75 )
-                                        <td align="center" bgcolor="#FF66FF"><font color="#000000"><a href="javascript:getNullReportInfo('$selDataSet.id','$periodCount.id','$chiildorgUnit.id')">$result% #if( $deCount != -1 ) ( $deCount ) #end</a></font></td>
+                                        <td align="center" bgcolor="#FF66FF"><font color="#000000">#if( $dso.contains($chiildorgUnit) )<a href="javascript:getNullReportInfo('$selDataSet.id','$periodCount.id','$chiildorgUnit.id')">$result% #if( $deCount != -1 ) ( $deCount ) #end</a> #else $result% #end</font></td>
                                     #else
-                                        <td align="center" bgcolor="#FFFF00"><font color="#000000"><a href="javascript:getNullReportInfo('$selDataSet.id','$periodCount.id','$chiildorgUnit.id')">$result% #if( $deCount != -1 ) ( $deCount ) #end</a></font></td>
+                                        <td align="center" bgcolor="#FFFF00"><font color="#000000">#if( $dso.contains($chiildorgUnit) )<a href="javascript:getNullReportInfo('$selDataSet.id','$periodCount.id','$chiildorgUnit.id')">$result% #if( $deCount != -1 ) ( $deCount ) #end</a> #else $result% #end</font></td>
                                     #end
                                     #set( $count2 = $count2 + 1 )
                                 #end

=== modified file 'local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/welcomeTracker.vm'
--- local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/welcomeTracker.vm	2011-09-03 09:46:15 +0000
+++ local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/welcomeTracker.vm	2011-10-14 12:26:01 +0000
@@ -7,48 +7,55 @@
 
 #set( $mark = 0 )
 
-<table>
-    <tr valign="top">
-		<td valign="top">
-			<table valign="top">
-				<tr bgcolor="#c0c0c0">
-					<td align="center">$rootOrgUnitName</td>
-					<td align="center">Registered</td>
-					#foreach( $program in $programList )
-					<td align="center">$program.name</td>
-					#end
-				</tr>
-				#set( $count1 = 0 )
-				#foreach( $orgUnit in $immChildrenList )
-				<tr style="#if( $mark == 1 )background-color:#e0e0e0;#end" >
-					<td><a href="index.action?drillDownOrgUnitId=$orgUnit.id">$orgUnit.shortName</a></td>
-					<td align="center">$totalRegCountList.get( $count1 )</td>
-					#foreach( $program in $programList )
-					<td align="center">$totalEnrollCountMap.get( "$program.id:$orgUnit.id" )</td>
-					#end
-				</tr>
-					#set( $count1 = $count1 + 1 )
-					#if( $mark == 1 )
-						#set( $mark = 0 )
-					#else
-						#set( $mark = 1 )
-					#end    
-				#end
-                <tr bgcolor="#c0c0c0">
-                    <td align="center">Total :</td>
-                    <td align="center">$totalRegCount</td>
-                    #foreach( $program in $programList )
-                    <td align="center">$!totalEnrollCountMap.get( "$rootOrgUnitName:$program.id" )</td>
-                    #end                    
-                </tr>
+<table valign="top" width="95%" border="1" cellspacing="0" cellpadding="5" >
+	<tr bgcolor="#c0c0c0" style="height:23px">
+		<td align="center" rowspan="2"><strong>$rootOrgUnitName</strong></td>
+		<td align="center" colspan="2"><strong>Registered</strong></td>
+		#foreach( $program in $programList )
+		<td align="center" colspan="2"><strong>$program.name</strong></td>
+		#end
+	</tr>
+	<tr bgcolor="#c0c0c0" align="center" style="height:25px">
+		<td><strong>Total</strong></td>
+		<td><strong>$toDaysDate</strong></td>
+		#foreach( $program in $programList )
+		<td><strong>Total</strong></td>
+		<td><strong>$toDaysDate</strong></td>
+		#end
+	</tr>	
 
-			</table>
-		</td>
-		<td>&nbsp;&nbsp;&nbsp;</td>
-		<td><div id="myChart"></div></td>
+	#set( $count1 = 0 )
+	#foreach( $orgUnit in $immChildrenList )
+	<tr style="#if( $mark == 1 )background-color:#e0e0e0;#end height:23px" >
+		<td><a href="index.action?drillDownOrgUnitId=$orgUnit.id">$orgUnit.shortName</a></td>
+		<td align="center">$totalRegCountList.get( $count1 )</td>
+		<td align="center">$totalRegCountListForSelDate.get( $count1 )</td>
+		#foreach( $program in $programList )
+		<td align="center">$totalEnrollCountMap.get( "$program.id:$orgUnit.id" )</td>
+		<td align="center">$totalEnrollCountForSelDateMap.get( "$program.id:$orgUnit.id" )</td>
+		#end
+	</tr>
+	#set( $count1 = $count1 + 1 )
+	#if( $mark == 1 )
+		#set( $mark = 0 )
+	#else
+		#set( $mark = 1 )
+	#end    
+	#end
+	<tr bgcolor="#c0c0c0" style="height:23px">
+		<td align="center"><strong>Total :</strong></td>
+		<td align="center"><strong>$totalRegCount</strong></td>
+		<td align="center"><strong>$totalRegCountForSelDate</strong></td>
+		#foreach( $program in $programList )
+		<td align="center"><strong>$!totalEnrollCountMap.get( "$rootOrgUnitName:$program.id" )</strong></td>
+		<td align="center"><strong>$!totalEnrollCountForSelDateMap.get( "$rootOrgUnitName:$program.id" )</strong></td>
+		#end                    
 	</tr>
 </table>
 
+<br/>
+<div id="myChart"></div>
+
 <script>
 
     Ext.require('Ext.chart.*');
@@ -100,7 +107,7 @@
     });			
 
         var panel1 = Ext.create('widget.panel', {
-                        width: 600,
+                        width: 750,
                         height: 500,
                         title: 'Total Enrolled By Facility',
                         renderTo: 'myChart',

=== modified file 'local/in/dhis-web-excelimport/src/main/java/org/hisp/dhis/excelimport/portal/action/PortalExcelImportResultAction.java'
--- local/in/dhis-web-excelimport/src/main/java/org/hisp/dhis/excelimport/portal/action/PortalExcelImportResultAction.java	2011-09-03 05:48:23 +0000
+++ local/in/dhis-web-excelimport/src/main/java/org/hisp/dhis/excelimport/portal/action/PortalExcelImportResultAction.java	2011-10-14 12:26:01 +0000
@@ -50,6 +50,14 @@
 
 public class PortalExcelImportResultAction implements Action
 {
+    private static final String PHC_FORMAT = "PHC";
+    private static final String CHC_FORMAT = "CHC";
+    private static final String SDH_TH_FORMAT = "SUB-DIVISIONAL/TALUKA HOSPITAL";
+    private static final String SC_FORMAT = "SC";
+    private static final String DH_FORMAT = "DISTRICT HOSPITAL";
+    private static final String BLOCK_FORMAT = "BLOCK";
+    private static final String DISTRICT_FORMAT = "DISTRICT";
+    
     // -------------------------------------------------------------------------
     // Dependencies
     // -------------------------------------------------------------------------
@@ -393,7 +401,263 @@
         
         return deCodeList;
     }
-
+    
+    private void importPortalData( WritableWorkbook importWorkbook ) throws Exception
+    {
+        List<ExcelImport_Header> headerInfoList = new ArrayList<ExcelImport_Header>();
+        headerInfoList = getHeaderInfo( importSheetId );
+
+        List<ExcelImport_DeCode> deCodeList = new ArrayList<ExcelImport_DeCode>();
+        deCodeList = getDataInfo( importSheetId );
+        
+        Map<String, String> monthMap = new HashMap<String, String>();
+        monthMap.put( "January", "01" );
+        monthMap.put( "February", "02" );
+        monthMap.put( "March", "03" );
+        monthMap.put( "April", "04" );
+        monthMap.put( "May", "05" );
+        monthMap.put( "June", "06" );
+        monthMap.put( "July", "07" );
+        monthMap.put( "August", "08" );
+        monthMap.put( "September", "09" );
+        monthMap.put( "October", "10" );
+        monthMap.put( "November", "11" );
+        monthMap.put( "December", "12" );
+        
+        String selectedMonth = "";
+        String selectedPeriodicity = "";
+        String selectedFinancialYear = "";
+        String selectedFormat = "";
+        String selectedParentName = "";
+        
+        String query = "";
+        String storedBy = currentUserService.getCurrentUsername();
+        if ( storedBy == null )
+        {
+            storedBy = "[unknown]";
+        }
+        
+        DataSet dataSet = dataSetService.getDataSet( datasetId );
+        
+        Sheet sheet = importWorkbook.getSheet( 0 );
+
+        for( ExcelImport_Header header : headerInfoList )
+        {
+            sheet = importWorkbook.getSheet( header.getSheetno() );
+            String cellContent = sheet.getCell( header.getColno(), header.getRowno() ).getContents();
+            
+            if( cellContent.equalsIgnoreCase( "" ) || cellContent == null || cellContent.equalsIgnoreCase( " " ) )
+            {
+                continue;
+            }
+
+            if( header.getExpression().equalsIgnoreCase( ExcelImport_Header.HEADER_PERIOD ) )
+            {
+                selectedMonth = monthMap.get( cellContent );
+            }
+            else if( header.getExpression().equalsIgnoreCase( ExcelImport_Header.HEADER_FINANCIALYEAR ) )
+            {
+                selectedFinancialYear = cellContent;
+            }
+            else if( header.getExpression().equalsIgnoreCase( ExcelImport_Header.HEADER_FORMAT ) )
+            {
+                selectedFormat = cellContent;
+            }
+            else if( header.getExpression().equalsIgnoreCase( ExcelImport_Header.HEADER_FACILITY_PARENT ) )
+            {
+                selectedParentName = cellContent;
+            }
+            else if( header.getExpression().equalsIgnoreCase( ExcelImport_Header.HEADER_PERIODICITY ) )
+            {
+                selectedPeriodicity = cellContent;
+            }
+        }
+        
+        String selStartDate = "";
+        String selEndDate = "";
+        if( !selectedFinancialYear.trim().equalsIgnoreCase( "" ) )
+        {
+            if( selectedMonth.equals( "01" ) || selectedMonth.equals( "02" ) || selectedMonth.equals( "03" ) )
+            {
+                selStartDate = selectedFinancialYear.split( "-" )[1] + "-" + selectedMonth + "-" + "01";
+            }
+            else
+            {
+                selStartDate = selectedFinancialYear.split( "-" )[0] + "-" + selectedMonth + "-" + "01";
+            }
+        }
+
+        PeriodType periodType = periodService.getPeriodTypeByName( selectedPeriodicity );
+        Period selectedPeriod = getSelectedPeriod( selStartDate, periodType );
+        SimpleDateFormat periodFormat;
+        if( periodType.getName().equalsIgnoreCase("Monthly") )
+        {
+            periodFormat = new SimpleDateFormat("MMM-yyyy");
+        }
+        else if( periodType.getName().equalsIgnoreCase("Monthly") )
+        {
+            periodFormat = new SimpleDateFormat("yyyy");
+        }
+        else
+        {
+            periodFormat = new SimpleDateFormat("yyyy-MM-dd");
+        }
+        
+        Integer selectedBlockId = 0;
+        if( selectedFormat.equals( CHC_FORMAT ) || selectedFormat.equals( SDH_TH_FORMAT ) )
+        {
+            selectedBlockId = getOrgUnitIdByURL( selectedParentName + ":" + DISTRICT_FORMAT );
+        }
+        else if( selectedFormat.equals( PHC_FORMAT ) || selectedFormat.equals( SC_FORMAT ) )
+        {
+            selectedBlockId = getOrgUnitIdByURL( selectedParentName + ":" +  BLOCK_FORMAT );
+        }
+        else
+        {
+            selectedBlockId = getOrgUnitIdByComment( selectedParentName );
+        }
+        
+        if( selectedBlockId != null )
+        {
+            List<OrganisationUnit> orgUnitList = new ArrayList<OrganisationUnit>( organisationUnitService.getOrganisationUnitWithChildren( selectedBlockId ) );
+            OrganisationUnitGroup orgUnitGroup = organisationUnitGroupService.getOrganisationUnitGroup( orgunitGroupId );
+            orgUnitList.retainAll( orgUnitGroup.getMembers() );
+            List<Integer> orgUnitIds = new ArrayList<Integer>( getIdentifiers( OrganisationUnit.class, orgUnitList ) );
+            
+            System.out.println( orgUnitList.size() + " : " + orgUnitGroup.getMembers().size() + " : " + orgUnitList.size() );
+            
+            int facilityStartRow = Integer.parseInt( facilityStart.split( "," )[0] );
+            int facilityStartCol = Integer.parseInt( facilityStart.split( "," )[1] );
+            
+            String facility = sheet.getCell( facilityStartCol, facilityStartRow ).getContents();
+            int colCount = facilityStartCol;
+            String facilityP = "";
+            while( facility != null && !facility.trim().equalsIgnoreCase( "" ) )
+            {
+                String tempFacility = facility;
+                if( selectedFormat.equals( CHC_FORMAT ) || selectedFormat.equals( SDH_TH_FORMAT ) )
+                {
+                    if( sheet.getCell( colCount, facilityStartRow-1 ).getContents() != null && !sheet.getCell( colCount, facilityStartRow-1 ).getContents().trim().equalsIgnoreCase( "" ) )
+                    {
+                        facilityP = sheet.getCell( colCount, facilityStartRow-1 ).getContents();
+                    }
+                    
+                    facility = sheet.getCell( colCount, facilityStartRow ).getContents();
+                    
+                    tempFacility = selectedParentName+ ":" + facilityP + ":" + facility + ":" + selectedFormat;
+                }
+                else if( selectedFormat.equals( PHC_FORMAT ) || selectedFormat.equals( SC_FORMAT ) )
+                {
+                    if( sheet.getCell( colCount, facilityStartRow-2 ).getContents() != null && !sheet.getCell( colCount, facilityStartRow-2 ).getContents().trim().equalsIgnoreCase( "" ) )
+                    {
+                        facilityP = sheet.getCell( colCount, facilityStartRow-2 ).getContents();
+                    }
+                    
+                    facility = sheet.getCell( colCount, facilityStartRow ).getContents();
+                    
+                    tempFacility = facilityP + ":" + selectedParentName + ":" + facility + ":" + selectedFormat;
+                }
+                
+                if( facility.trim().equalsIgnoreCase( "Total" ) )
+                {
+                    colCount++;
+                    facility = sheet.getCell( colCount, facilityStartRow ).getContents();
+
+                    continue;
+                }
+                
+                System.out.println("tempFacility: "+ tempFacility);
+                Integer currentOrgunitId = getOrgUnitIdByURL( tempFacility );
+                if( currentOrgunitId != null )
+                {
+                    OrganisationUnit portalOrgUnit = organisationUnitService.getOrganisationUnit( currentOrgunitId );
+                    
+                    if( portalOrgUnit != null && orgUnitList.contains( portalOrgUnit ) )
+                    {
+                        System.out.println("--------Importing started for :"+portalOrgUnit.getName() + "-------------" );
+                        DataSetLock dataSetLock = dataSetLockService.getDataSetLockByDataSetPeriodAndSource( dataSet, selectedPeriod, portalOrgUnit );
+                        if( dataSetLock != null )
+                        {
+                            message += "<br><font color=red><strong>Unable to Import : Corresponding Dataset ( "+dataSet.getName()+" ) for " + portalOrgUnit.getName() + " and for period : " + periodFormat.format( selectedPeriod.getStartDate() ) + " is locked.</strong></font>";
+                            System.out.println("Unable to Import : Corresponding Dataset ( "+dataSet.getName()+" ) for " + portalOrgUnit.getName() + " and for period : " + periodFormat.format( selectedPeriod.getStartDate() ) + " is locked.");
+                            colCount++;
+                            facility = sheet.getCell( colCount, facilityStartRow ).getContents();
+                            
+                            continue;
+                        }
+
+                        int insertFlag = 1;
+                        String insertQuery = "INSERT INTO datavalue (dataelementid, periodid, sourceid, categoryoptioncomboid, value, storedby, lastupdated ) VALUES ";
+
+                        for( ExcelImport_DeCode deCode : deCodeList )
+                        {
+                            String deCodeExpression = deCode.getExpression();
+                            if( deCodeExpression != null && !deCodeExpression.trim().equals( "" ) )
+                            {
+                                Integer deId = Integer.parseInt( deCodeExpression.split( "\\." )[0] );
+                                Integer deCOCId = Integer.parseInt( deCodeExpression.split( "\\." )[1] );
+                                
+                                String dataValue = sheet.getCell( colCount, deCode.getRowno() ).getContents();
+                                
+                                query = "SELECT value FROM datavalue WHERE dataelementid = " + deId + 
+                                            " AND categoryoptioncomboid = " + deCOCId +
+                                            " AND periodid = " + selectedPeriod.getId() +
+                                            " AND sourceid = " + portalOrgUnit.getId();
+
+                                long t;
+                                Date d = new Date();
+                                t = d.getTime();
+                                java.sql.Date lastUpdatedDate = new java.sql.Date( t );
+
+                                SqlRowSet sqlResultSet1 = jdbcTemplate.queryForRowSet( query );
+                                if ( sqlResultSet1 != null && sqlResultSet1.next() )
+                                {
+                                    String updateQuery = "UPDATE datavalue SET value = '" + dataValue + "', storedby = '" + storedBy + "',lastupdated='" + lastUpdatedDate + "' WHERE dataelementid = "+ deId +" AND periodid = " + selectedPeriod.getId() + " AND sourceid = " + portalOrgUnit.getId() + " AND categoryoptioncomboid = "+deCOCId;
+                                    jdbcTemplate.update( updateQuery );
+                                }
+                                else
+                                {
+                                    if( dataValue != null && !dataValue.trim().equalsIgnoreCase( "" ) )
+                                    {
+                                        insertQuery += "( "+ deId + ", " + selectedPeriod.getId() + ", "+ portalOrgUnit.getId() +", " + deCOCId + ", '" + dataValue + "', '" + storedBy + "', '" + lastUpdatedDate + "' ), ";
+                                        insertFlag = 2;
+                                    }
+                                }
+                            }
+                        }
+                        
+                        if( insertFlag != 1 )
+                        {
+                            insertQuery = insertQuery.substring( 0, insertQuery.length()-2 );
+                            jdbcTemplate.update( insertQuery );
+                            System.out.println("Data is uploaded in DHIS for : "+ facility);
+                        }
+                        message += "<br>Data is uploaded into DHIS for : "+ facility + " and for period : "+ periodFormat.format( selectedPeriod.getStartDate() );
+                    }
+                    else
+                    {
+                        System.out.println( facility + " is not a memeber of orgunitgroup : "+ orgUnitGroup.getName() );
+                        message += "<br><font color=red>" + facility + " is not a memeber of orgunitgroup : "+ orgUnitGroup.getName() + "</font>";
+                    }
+                }
+                else
+                {
+                    System.out.println("No Mapping found in DHIS for :"+ facility + " : NULL");
+                    message += "<br><font color=red>No Mapping found in DHIS for : "+ facility + "</font>";
+                }
+                
+                colCount++;
+                facility = sheet.getCell( colCount, facilityStartRow ).getContents();
+                
+            }
+            
+            
+        }
+        
+    }
+
+
+    /*
     private void importPortalData( WritableWorkbook importWorkbook ) throws Exception
     {
         List<ExcelImport_Header> headerInfoList = new ArrayList<ExcelImport_Header>();
@@ -510,8 +774,23 @@
             
             String facility = sheet.getCell( facilityStartCol, facilityStartRow ).getContents();
             int colCount = facilityStartCol;
+            String facilityP = "";
             while( facility != null && !facility.trim().equalsIgnoreCase( "" ) )
             {
+                if( selectedFormat.equals( CHC_FORMAT ))
+                {
+                    if( sheet.getCell( colCount, facilityStartRow-1 ).getContents() != null && !sheet.getCell( colCount, facilityStartRow-1 ).getContents().trim().equalsIgnoreCase( "" ) )
+                    {
+                        facilityP = sheet.getCell( colCount, facilityStartRow-1 ).getContents();
+                    }
+                    
+                    facility = sheet.getCell( colCount, facilityStartRow ).getContents();
+                    
+                    System.out.println( facility + " :: " + facilityP );
+                    colCount++;
+                    continue;
+                }
+                
                 if( facility.trim().equalsIgnoreCase( "Total" ) )
                 {
                     colCount++;
@@ -608,6 +887,7 @@
         }
         
     }
+*/
 
     public void setTextFormatForExcelShett( WritableWorkbook excelImportFile )
     {
@@ -644,10 +924,21 @@
         
         return null;
     }
-    
+
+    public Integer getOrgUnitIdByURL( String url )
+    {
+        String query = "SELECT organisationunitid FROM organisationunit WHERE url LIKE '"+ url +"'";
+        SqlRowSet sqlResultSet = jdbcTemplate.queryForRowSet( query );
+        if ( sqlResultSet != null && sqlResultSet.next() )
+        {
+            return sqlResultSet.getInt( 1 );
+        }
+        return null;
+    }
+
     public Integer getOrgUnitIdByComment( String comment )
     {
-        String query = "SELECT organisationunitid FROM organisationunit WHERE comment LIKE '"+ comment +"'";
+        String query = "SELECT organisationunitid FROM organisationunit WHERE shortname LIKE '"+ comment +"'";
         SqlRowSet sqlResultSet = jdbcTemplate.queryForRowSet( query );
         if ( sqlResultSet != null && sqlResultSet.next() )
         {

=== modified file 'local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/meta/action/GenerateMetaDataReportResultAction.java'
--- local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/meta/action/GenerateMetaDataReportResultAction.java	2011-09-03 05:48:23 +0000
+++ local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/meta/action/GenerateMetaDataReportResultAction.java	2011-10-14 12:26:01 +0000
@@ -1173,7 +1173,7 @@
                     String PARENT = new String();
                     if ( ou.getParent() != null )
                     {
-                        PARENT = ou.getParent().getName();
+                        PARENT = ou.getParent().getShortName();
                     }
                     else
                     {
@@ -1254,7 +1254,7 @@
                 {
                     sheet0.addCell( new Number( colStart, rowStart, ou.getId(), getCellFormat2() ) );
                     int ouLevel = ou.getLevel();
-                    sheet0.addCell( new Label( colStart + ouLevel, rowStart, ou.getName(), getCellFormat2() ) );
+                    sheet0.addCell( new Label( colStart + ouLevel, rowStart, ou.getShortName(), getCellFormat2() ) );
                 }
                 else
                 {

=== modified file 'local/in/dhis-web-reports-national/src/main/resources/struts.xml'
--- local/in/dhis-web-reports-national/src/main/resources/struts.xml	2011-10-13 08:00:58 +0000
+++ local/in/dhis-web-reports-national/src/main/resources/struts.xml	2011-10-14 12:26:01 +0000
@@ -165,7 +165,7 @@
             <param name="menu">/dhis-web-reports/menuWithTreeForIDSPReport.vm</param>
             <param name="javascripts">../dhis-web-commons/ouwt/ouwt.js,../dhis-web-commons/lists/lists.js,javascript/reportManagement.js,javascript/hashtable.js</param>
             <param name="stylesheets">css/StylesForTags.css</param>
-            <param name="requiredAuthorities">F_REPORT_ROUTINE</param>
+            <param name="requiredAuthorities">F_REPORT_IDSP</param>
             <interceptor-ref name="organisationUnitTreeStack"/>
         </action>		
         <action name="generateIDSPReportResult"
@@ -177,9 +177,6 @@
                 <param name="bufferSize">1024</param>
             </result>
         </action>
-		
-		
-		
 		        
         <!-- ED Reports -->
         <action name="edReportForm"
@@ -743,7 +740,7 @@
 			<param name="menu">/dhis-web-reports/menuWithTreeForColdChainRoutineReport.vm</param>
 			<param name="javascripts">../dhis-web-commons/ouwt/ouwt.js,../dhis-web-commons/lists/lists.js,javascript/reportManagement.js,javascript/hashtable.js</param>
 			<param name="stylesheets">css/StylesForTags.css</param>
-			<param name="requiredAuthorities">F_REPORT_LINELIST_PORTAL</param>
+			<param name="requiredAuthorities">F_REPORT_LINELIST_COLDCHAIN</param>
 			<interceptor-ref name="organisationUnitTreeStack"/>
 		</action>		
 		

=== modified file 'local/in/dhis-web-reports-national/src/main/webapp/dhis-web-reports/menu.vm'
--- local/in/dhis-web-reports-national/src/main/webapp/dhis-web-reports/menu.vm	2011-10-13 08:00:58 +0000
+++ local/in/dhis-web-reports-national/src/main/webapp/dhis-web-reports/menu.vm	2011-10-14 12:26:01 +0000
@@ -9,68 +9,73 @@
     </ul>
 #end
 
-#if( $auth.hasAccess( "dhis-web-reports", "upwardReportAnalyser") )
-    <ul>
-        <li>Report Analysis</li>
-        <ul>
-            #if( $auth.hasAccess( "dhis-web-reports", "upwardReportAnalyser") )
-                <li><a href = "upwardReportAnalyser.action">GOI Reports</a></li>
-            #end
-            #if( $auth.hasAccess( "dhis-web-reports", "edReportForm") )
-                <li><a href = "edReportForm.action">Indicator Reports</a></li>
-            #end
-            #if( $auth.hasAccess( "dhis-web-reports", "routineReportAnalyser") )
-                <li><a href = "routineReportAnalyser.action">Routine Reports</a></li>
-            #end
-            #if( $auth.hasAccess( "dhis-web-reports", "feedbackReportAnalyser") )
-                <li><a href = "feedbackReportAnalyser.action">Feedback Reports</a></li>
-            #end
-            #if( $auth.hasAccess( "dhis-web-reports", "aggregationReportAnalyser") )
-                <li><a href = "aggregationReportAnalyser.action">Aggregation Reports</a></li>
-            #end
-            #if( $auth.hasAccess( "dhis-web-reports", "linelistingReportAnalyser") )
-                <li><a href = "linelistingReportAnalyser.action">Linelisting Reports</a></li>
-            #end
-            #if( $auth.hasAccess( "dhis-web-reports", "periodWiseprogressReportAnalyser") )
-                <li><a href = "periodWiseprogressReportAnalyser.action">Periodwise Progress Reports</a></li>
-            #end
-            #if( $auth.hasAccess( "dhis-web-reports", "ouWiseProgressReportAnalyser") )
-                <li><a href = "ouWiseProgressReportAnalyser.action">Orgunitwise Progress Reports</a></li>
-            #end
-            #if( $auth.hasAccess( "dhis-web-reports", "metaDataReportAnalyser") )
-                <li><a href = "metaDataReportAnalyser.action">Meta Data Reports</a></li>
-            #end
-            #if( $auth.hasAccess( "dhis-web-reports", "dataSetLockReportAnalyser") )
-                <li><a href = "dataSetLockReportAnalyser.action">DataSet Lock Reports</a></li>
-            #end
-            #if( $auth.hasAccess( "dhis-web-reports", "quarterlyPhysicalReport") )
-                <li><a href = "quarterlyPhysicalReport.action ">Quarterly Physical Output Reports</a></li>
-            #end
-            #if( $auth.hasAccess( "dhis-web-reports", "mobileReportAnalyser") )
-                <li><a href = "mobileReportAnalyser.action">Mobile Reports</a></li>
-            #end
-            #if( $auth.hasAccess( "dhis-web-reports", "csReviewReportForm") )
-                <li><a href = "csReviewReportForm.action">CS Review Reports</a></li>
-            #end
-            #if( $auth.hasAccess( "dhis-web-reports", "populateUsers") )
-                <li><a href = "populateUsers.action">Populate Users</a></li>
-            #end
-            #if( $auth.hasAccess( "dhis-web-reports", "autoReportAnalyser") )
-                <li><a href = "autoReportAnalyser.action">Bulk Reports</a></li>
-            #end
-            #if( $auth.hasAccess( "dhis-web-reports", "linelistingWebPortalReportAnalyser") )
-                <li><a href = "linelistingWebPortalReportAnalyser.action">Linelisting WebPortal Reports</a></li>
-            #end
-            #if( $auth.hasAccess( "dhis-web-reports", "populateMultipleUsers") )
-				<li><a href = "populateMultipleUsers.action">Populate Users From Excel</a></li>
-			#end
-            <!--<li><a href = "advancedReportAnalyser.action">Advanced Reports</a></li>-->
-            <li><a href = "coldChainReportAnalyser.action">Cold Chain Report</a>
-            <li><a href = "idspReportAnalyser.action">IDSP Report</a>
-            <li><a href = "lineListingBulkReportAnalyser.action">Linelisting Bulk Report</a>
-        </ul>
-    </ul>
-#end
+<ul>
+	<li>Report Analysis</li>
+	<ul>
+		#if( $auth.hasAccess( "dhis-web-reports", "upwardReportAnalyser") )
+			<li><a href = "upwardReportAnalyser.action">GOI Reports</a></li>
+		#end
+		#if( $auth.hasAccess( "dhis-web-reports", "edReportForm") )
+			<li><a href = "edReportForm.action">Indicator Reports</a></li>
+		#end
+		#if( $auth.hasAccess( "dhis-web-reports", "routineReportAnalyser") )
+			<li><a href = "routineReportAnalyser.action">Routine Reports</a></li>
+		#end
+		#if( $auth.hasAccess( "dhis-web-reports", "feedbackReportAnalyser") )
+			<li><a href = "feedbackReportAnalyser.action">Feedback Reports</a></li>
+		#end
+		#if( $auth.hasAccess( "dhis-web-reports", "aggregationReportAnalyser") )
+			<li><a href = "aggregationReportAnalyser.action">Aggregation Reports</a></li>
+		#end
+		#if( $auth.hasAccess( "dhis-web-reports", "linelistingReportAnalyser") )
+			<li><a href = "linelistingReportAnalyser.action">Linelisting Reports</a></li>
+		#end
+		#if( $auth.hasAccess( "dhis-web-reports", "periodWiseprogressReportAnalyser") )
+			<li><a href = "periodWiseprogressReportAnalyser.action">Periodwise Progress Reports</a></li>
+		#end
+		#if( $auth.hasAccess( "dhis-web-reports", "ouWiseProgressReportAnalyser") )
+			<li><a href = "ouWiseProgressReportAnalyser.action">Orgunitwise Progress Reports</a></li>
+		#end
+		#if( $auth.hasAccess( "dhis-web-reports", "metaDataReportAnalyser") )
+			<li><a href = "metaDataReportAnalyser.action">Meta Data Reports</a></li>
+		#end
+		#if( $auth.hasAccess( "dhis-web-reports", "dataSetLockReportAnalyser") )
+			<li><a href = "dataSetLockReportAnalyser.action">DataSet Lock Reports</a></li>
+		#end
+		#if( $auth.hasAccess( "dhis-web-reports", "quarterlyPhysicalReport") )
+			<li><a href = "quarterlyPhysicalReport.action ">Quarterly Physical Output Reports</a></li>
+		#end
+		#if( $auth.hasAccess( "dhis-web-reports", "mobileReportAnalyser") )
+			<li><a href = "mobileReportAnalyser.action">Mobile Reports</a></li>
+		#end
+		#if( $auth.hasAccess( "dhis-web-reports", "csReviewReportForm") )
+			<li><a href = "csReviewReportForm.action">CS Review Reports</a></li>
+		#end
+		#if( $auth.hasAccess( "dhis-web-reports", "populateUsers") )
+			<li><a href = "populateUsers.action">Populate Users</a></li>
+		#end
+		#if( $auth.hasAccess( "dhis-web-reports", "autoReportAnalyser") )
+			<li><a href = "autoReportAnalyser.action">Bulk Reports</a></li>
+		#end
+		#if( $auth.hasAccess( "dhis-web-reports", "linelistingWebPortalReportAnalyser") )
+			<li><a href = "linelistingWebPortalReportAnalyser.action">Linelisting WebPortal Reports</a></li>
+		#end
+		#if( $auth.hasAccess( "dhis-web-reports", "populateMultipleUsers") )
+			<li><a href = "populateMultipleUsers.action">Populate Users From Excel</a></li>
+		#end
+		#if( $auth.hasAccess( "dhis-web-reports", "idspReportAnalyser") )
+			<li><a href = "idspReportAnalyser.action">IDSP Reports</a>
+		#end
+		#if( $auth.hasAccess( "dhis-web-reports", "coldChainReportAnalyser") )
+			<li><a href = "coldChainReportAnalyser.action">Cold Chain Reports</a>
+		#end
+		#if( $auth.hasAccess( "dhis-web-reports", "lineListingBulkReportAnalyser") )
+			<li><a href = "lineListingBulkReportAnalyser.action">Linelisting Bulk Report</a>
+		#end	
+		<!--<li><a href = "advancedReportAnalyser.action">Advanced Reports</a></li>-->
+	</ul>
+</ul>
+
 
 #if( $auth.hasAccess( "dhis-web-reports", "benificiaryInfoReportsAnalyser") )
     <ul>