← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2165: Added Mobile Data Status in Dashboard

 

------------------------------------------------------------
revno: 2165
committer: Mithilesh Kumar Thakur<mithilesh.hisp@xxxxxxxxx>
branch nick: trunk
timestamp: Thu 2010-11-25 13:20:13 +0530
message:
  Added Mobile Data Status in Dashboard
added:
  local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ds/mobile/action/GenerateGroupWiseMobileDataStatusResultAction.java
  local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ds/mobile/action/GenerateLastUpdatedMobileDataSetResultAction.java
  local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ds/mobile/action/GenerateMobileDataStatusResultAction.java
  local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ds/mobile/action/GenerateSummaryMobileDataStatusResultAction.java
  local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/groupWiseMobileDataStatusResult.vm
  local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/lastUpdatedMobileDataSetSatusResult.vm
  local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/mobileDataStatusResult.vm
  local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/summaryMobileSatusResult.vm
modified:
  local/in/dhis-web-dashboard/src/main/resources/META-INF/dhis/beans.xml
  local/in/dhis-web-dashboard/src/main/resources/org/hisp/dhis/dashboard/i18n_module.properties
  local/in/dhis-web-dashboard/src/main/resources/struts.xml
  local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/dataStatusMobileFront.vm
  local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/javascript/ds.js


--
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
=== added file 'local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ds/mobile/action/GenerateGroupWiseMobileDataStatusResultAction.java'
--- local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ds/mobile/action/GenerateGroupWiseMobileDataStatusResultAction.java	1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ds/mobile/action/GenerateGroupWiseMobileDataStatusResultAction.java	2010-11-25 07:50:13 +0000
@@ -0,0 +1,912 @@
+/*
+ * Copyright (c) 2004-2010, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ *   list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ *   this list of conditions and the following disclaimer in the documentation
+ *   and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ *   be used to endorse or promote products derived from this software without
+ *   specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.hisp.dhis.dashboard.ds.mobile.action;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.UUID;
+
+import org.hibernate.SessionFactory;
+import org.hisp.dhis.dashboard.util.DashBoardService;
+import org.hisp.dhis.dataelement.DataElement;
+import org.hisp.dhis.dataelement.DataElementGroup;
+import org.hisp.dhis.dataelement.DataElementService;
+import org.hisp.dhis.dataset.DataSet;
+import org.hisp.dhis.dataset.DataSetService;
+import org.hisp.dhis.options.displayproperty.DisplayPropertyHandler;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.organisationunit.OrganisationUnitLevel;
+import org.hisp.dhis.organisationunit.OrganisationUnitService;
+import org.hisp.dhis.organisationunit.comparator.OrganisationUnitNameComparator;
+import org.hisp.dhis.organisationunit.comparator.OrganisationUnitShortNameComparator;
+import org.hisp.dhis.period.Period;
+import org.hisp.dhis.period.PeriodService;
+import org.hisp.dhis.period.PeriodType;
+import org.hisp.dhis.source.Source;
+import org.hisp.dhis.user.User;
+import org.hisp.dhis.user.UserStore;
+import org.springframework.jdbc.core.JdbcTemplate;
+import org.springframework.jdbc.support.rowset.SqlRowSet;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Mithilesh Kumar Thakur
+ *
+ * @version GenerateGroupWiseMobileDataStatusResultAction.java Nov 25, 2010 11:00:07 AM
+ */
+public class GenerateGroupWiseMobileDataStatusResultAction
+implements Action
+{
+
+    // ---------------------------------------------------------------
+    // Dependencies
+    // ---------------------------------------------------------------
+    
+    private JdbcTemplate jdbcTemplate;
+
+    public void setJdbcTemplate( JdbcTemplate jdbcTemplate )
+    {
+        this.jdbcTemplate = jdbcTemplate;
+    }    
+
+    @SuppressWarnings("unused")
+    private SessionFactory sessionFactory;
+
+    public void setSessionFactory( SessionFactory sessionFactory )
+    {
+        this.sessionFactory = sessionFactory;
+    }
+    
+    private OrganisationUnitService organisationUnitService;
+
+    public void setOrganisationUnitService( OrganisationUnitService organisationUnitService )
+    {
+        this.organisationUnitService = organisationUnitService;
+    }
+
+    public OrganisationUnitService getOrganisationUnitService()
+    {
+        return organisationUnitService;
+    }
+
+    private PeriodService periodService;
+
+    public void setPeriodService( PeriodService periodService )
+    {
+        this.periodService = periodService;
+    }
+
+    private DataSetService dataSetService;
+
+    public void setDataSetService( DataSetService dataSetService )
+    {
+        this.dataSetService = dataSetService;
+    }
+
+    public DataSetService getDataSetService()
+    {
+        return dataSetService;
+    }
+
+    private DataElementService dataElementService;
+
+    public DataElementService getDataElementService()
+    {
+        return dataElementService;
+    }
+
+    public void setDataElementService( DataElementService dataElementService )
+    {
+        this.dataElementService = dataElementService;
+    }
+
+    private DashBoardService dashBoardService;
+
+    public void setDashBoardService( DashBoardService dashBoardService )
+    {
+        this.dashBoardService = dashBoardService;
+    }
+    
+    @SuppressWarnings("unused")
+        private DisplayPropertyHandler displayPropertyHandler;
+
+    public void setDisplayPropertyHandler( DisplayPropertyHandler displayPropertyHandler )
+    {
+        this.displayPropertyHandler = displayPropertyHandler;
+    }
+    
+    private UserStore userStore;
+
+    public void setUserStore( UserStore userStore )
+    {
+        this.userStore = userStore;
+    }
+    // ---------------------------------------------------------------
+    // Output Parameters
+    // ---------------------------------------------------------------
+
+    private Map<OrganisationUnit, List<Integer>> ouMapDataStatusResult;
+
+    private Collection<Period> periodList;
+
+    private List<OrganisationUnit> orgUnitList;
+    
+    
+    private Map<OrganisationUnit, String> ouMapUserPhoneNo;
+
+    public Map<OrganisationUnit, String> getOuMapUserPhoneNo()
+    {
+        return ouMapUserPhoneNo;
+    }
+
+    public List<OrganisationUnit> getOrgUnitList()
+    {
+        return orgUnitList;
+    }
+
+    private List<DataSet> dataSetList;
+
+    public List<DataSet> getDataSetList()
+    {
+        return dataSetList;
+    }
+
+    private List<Integer> results;
+
+    public List<Integer> getResults()
+    {
+        return results;
+    }
+
+    private Map<DataSet, Map<OrganisationUnit, List<Integer>>> dataStatusResult;
+
+    public Map<DataSet, Map<OrganisationUnit, List<Integer>>> getDataStatusResult()
+    {
+        return dataStatusResult;
+    }
+
+    private Map<DataSet, Collection<Period>> dataSetPeriods;
+
+    public Map<DataSet, Collection<Period>> getDataSetPeriods()
+    {
+        return dataSetPeriods;
+    }
+
+    private List<DataElementGroup> dataElementGroups;
+
+    public List<DataElementGroup> getDataElementGroups()
+    {
+        return dataElementGroups;
+    }
+
+    private List<DataElementGroup> applicableDataElementGroups;
+
+    public List<DataElementGroup> getApplicableDataElementGroups()
+    {
+        return applicableDataElementGroups;
+    }
+
+    List<Period> selectedPeriodList;
+
+    public List<Period> getSelectedPeriodList()
+    {
+        return selectedPeriodList;
+    }
+
+    List<String> levelNames;
+
+    public List<String> getLevelNames()
+    {
+        return levelNames;
+    }
+
+    private int maxOULevel;
+
+    public int getMaxOULevel()
+    {
+        return maxOULevel;
+    }
+
+    // ---------------------------------------------------------------
+    // Input Parameters
+    // ---------------------------------------------------------------
+
+    private String dsId;
+
+    public void setDsId( String dsId )
+    {
+        this.dsId = dsId;
+    }
+
+    @SuppressWarnings("unused")
+    private String selectedButton;
+
+    public void setselectedButton( String selectedButton )
+    {
+        this.selectedButton = selectedButton;
+    }
+
+    private String ouId;
+
+    public void setOuId( String ouId )
+    {
+        this.ouId = ouId;
+    }
+
+    private String immChildOption;
+
+    public void setImmChildOption( String immChildOption )
+    {
+        this.immChildOption = immChildOption;
+    }
+
+    private int sDateLB;
+
+    public void setSDateLB( int dateLB )
+    {
+        sDateLB = dateLB;
+    }
+
+    public int getSDateLB()
+    {
+        return sDateLB;
+    }
+
+    private int eDateLB;
+
+    public void setEDateLB( int dateLB )
+    {
+        eDateLB = dateLB;
+    }
+
+    public int getEDateLB()
+    {
+        return eDateLB;
+    }
+
+    private String facilityLB;
+
+    public void setFacilityLB( String facilityLB )
+    {
+        this.facilityLB = facilityLB;
+    }
+
+    private List<String> orgUnitListCB;
+
+    public void setOrgUnitListCB( List<String> orgUnitListCB )
+    {
+        this.orgUnitListCB = orgUnitListCB;
+    }
+
+    private List<String> selectedDataSets;
+
+    public void setSelectedDataSets( List<String> selectedDataSets )
+    {
+        this.selectedDataSets = selectedDataSets;
+    }
+
+    public List<String> getSelectedDataSets()
+    {
+        return selectedDataSets;
+    }
+
+    private int minOULevel;
+
+    public int getMinOULevel()
+    {
+        return minOULevel;
+    }
+
+    private int number;
+
+    public int getNumber()
+    {
+        return number;
+    }
+    
+    private List<String> periodNameList;
+    
+    public List<String> getPeriodNameList() 
+    {
+        return periodNameList;
+    }
+
+    private String includeZeros;
+
+    public void setIncludeZeros(String includeZeros) 
+    {
+        this.includeZeros = includeZeros;
+    }
+    
+    public String getIncludeZeros()
+    {
+        return includeZeros;
+    }
+
+    String orgUnitInfo;
+
+    String periodInfo;
+
+    String deInfo;
+
+    int orgUnitCount;
+
+    private String dataViewName;
+    
+    private DataSet selDataSet;
+
+    public DataSet getSelDataSet()
+    {
+        return selDataSet;
+    }
+    
+    private String userPhoneNo;
+    
+    public String getUserPhoneNo()
+    {
+        return userPhoneNo;
+    }
+    // ---------------------------------------------------------------
+    // Action Implementation
+    // ---------------------------------------------------------------
+    
+
+
+    //    @SuppressWarnings({ "deprecation", "unchecked" })
+    public String execute()
+        throws Exception
+    {
+        orgUnitCount = 0;
+        dataViewName = "";
+
+        // Intialization
+        ouMapDataStatusResult = new HashMap<OrganisationUnit, List<Integer>>();
+        ouMapUserPhoneNo = new HashMap<OrganisationUnit,String>();//for User PhoneNo Map
+        
+        results = new ArrayList<Integer>();
+        maxOULevel = 1;
+        minOULevel = organisationUnitService.getNumberOfOrganisationalLevels();
+
+        if ( immChildOption != null && immChildOption.equalsIgnoreCase( "yes" ) )
+        {
+            orgUnitListCB = new ArrayList<String>();
+            orgUnitListCB.add( ouId );
+            facilityLB = "immChildren";
+            selectedDataSets = new ArrayList<String>();
+            selectedDataSets.add( dsId );
+        }
+
+        // OrgUnit Related Info
+        OrganisationUnit selectedOrgUnit = new OrganisationUnit();
+        orgUnitList = new ArrayList<OrganisationUnit>();
+        if ( facilityLB.equals( "children" ) )
+        {
+            selectedOrgUnit = organisationUnitService.getOrganisationUnit( Integer.parseInt( orgUnitListCB.get( 0 ) ) );
+            orgUnitList = getChildOrgUnitTree( selectedOrgUnit );         
+        }
+        else if ( facilityLB.equals( "immChildren" ) )
+        {
+            @SuppressWarnings("unused")
+            int number;
+
+            selectedOrgUnit = organisationUnitService.getOrganisationUnit( Integer.parseInt( orgUnitListCB.get( 0 ) ) );
+            number = selectedOrgUnit.getChildren().size();
+            orgUnitList = new ArrayList<OrganisationUnit>();
+
+            Iterator<String> orgUnitIterator = orgUnitListCB.iterator();
+            while ( orgUnitIterator.hasNext() )
+            {
+                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() );
+                orgUnitList.addAll( organisationUnits );
+            }
+        }
+        else
+        {
+            Iterator<String> orgUnitIterator = orgUnitListCB.iterator();
+            OrganisationUnit o;
+            while ( orgUnitIterator.hasNext() )
+            {
+                o = organisationUnitService.getOrganisationUnit( Integer.parseInt( orgUnitIterator.next() ) );
+                orgUnitList.add( o );
+            }
+        }
+
+        for ( String ds : selectedDataSets )
+        {
+            DataSet dSet = dataSetService.getDataSet( Integer.parseInt( ds ) );
+            selDataSet = dSet;
+        }
+
+        Set<Source> dSetSource = selDataSet.getSources();
+        orgUnitInfo = "-1";
+        Iterator<OrganisationUnit> ouIt = orgUnitList.iterator();
+
+        while ( ouIt.hasNext() )
+        {
+            OrganisationUnit ou = ouIt.next();
+            orgUnitCount = 0;
+            if ( !dSetSource.contains( ou ) )
+            {
+                getDataSetAssignedOrgUnitCount( ou, dSetSource );
+
+                if ( orgUnitCount > 0 )
+                {
+                    orgUnitInfo += "," + ou.getId();
+                    getOrgUnitInfo( ou );
+                }
+                else
+                {
+                    ouIt.remove();
+                }
+            }
+            else
+            {
+                orgUnitInfo += "," + ou.getId();
+            }
+        }
+
+        // Period Related Info
+        Period startPeriod = periodService.getPeriod( sDateLB );
+        Period endPeriod = periodService.getPeriod( eDateLB );
+
+        
+        selectedPeriodList = new ArrayList<Period>( periodService.getIntersectingPeriods( startPeriod.getStartDate(),
+            endPeriod.getEndDate() ) );
+
+        periodInfo = "-1";
+        for ( Period p : selectedPeriodList )
+            periodInfo += "," + p.getId();
+
+        // DataSet Related Info
+        dataSetList = new ArrayList<DataSet>();
+        deInfo = "-1";
+        selDataSet = new DataSet();      
+        selDataSet = dataSetService.getDataSet( Integer.parseInt( selectedDataSets.get( 0 ) ) );
+
+        // Data Element Group Related Info
+        dataElementGroups = new ArrayList<DataElementGroup>();
+        dataElementGroups.addAll( getApplicableDataElementGroups( selDataSet ) );
+
+        for ( DataElementGroup deGroup : dataElementGroups )
+        {
+            for ( DataElement de : deGroup.getMembers() )
+                deInfo += "," + de.getId();
+        }
+
+        dataViewName = createDataView( orgUnitInfo, deInfo, periodInfo );
+       
+        String query = "";
+        query = "SELECT COUNT(*) FROM " + dataViewName
+            + " WHERE dataelementid IN (?) AND sourceid IN (?) AND periodid IN (?)";
+
+        Collection<DataElement> dataElements = new ArrayList<DataElement>();
+        PeriodType dataSetPeriodType;
+        periodList = new ArrayList<Period>();
+
+        dataElements = selDataSet.getDataElements();
+        dataSetPeriodType = selDataSet.getPeriodType();
+        periodList = periodService.getIntersectingPeriodsByPeriodType( dataSetPeriodType, startPeriod.getStartDate(),
+            endPeriod.getEndDate() );
+
+        dataSetPeriods = new HashMap<DataSet, Collection<Period>>();
+        Iterator<DataElementGroup> dataElementGroupIterator = dataElementGroups.iterator();
+
+        DataSet ds;
+        DataElementGroup deg;
+
+        while ( dataElementGroupIterator.hasNext() )
+        {
+            ds = dataSetService.getDataSet( Integer.valueOf( selectedDataSets.get( 0 ) ) );
+            deg = (DataElementGroup) dataElementGroupIterator.next();
+
+            dataElements = deg.getMembers();
+            dataElements.retainAll( ds.getDataElements() );
+
+            int deGroupMemberCount1 = 0;
+            for ( DataElement de1 : dataElements )
+            {
+                deGroupMemberCount1 += de1.getCategoryCombo().getOptionCombos().size();
+            }
+
+            deInfo = getDEInfo( dataElements );
+
+            dataSetPeriodType = ds.getPeriodType();
+
+            periodList = periodService.getIntersectingPeriodsByPeriodType( dataSetPeriodType, startPeriod.getStartDate(),
+                endPeriod.getEndDate() );
+            dataSetPeriods.put( ds, periodList );
+
+            Iterator<OrganisationUnit> orgUnitListIterator = orgUnitList.iterator();
+            OrganisationUnit o;
+            Set<Source> dso = new HashSet<Source>();
+            Iterator<Period> periodIterator;
+
+            while ( orgUnitListIterator.hasNext() )
+            {
+                o = (OrganisationUnit) orgUnitListIterator.next();
+                
+                // user phone no
+                userPhoneNo = "";
+                
+                List<User> users = new ArrayList<User>( userStore.getUsersByOrganisationUnit( o ) );
+                
+                for ( User user : users )
+                {
+                    if ( user != null && user.getPhoneNumber() != null  && !user.getPhoneNumber().trim().equalsIgnoreCase( "" ) )
+                    {
+                        userPhoneNo += user.getPhoneNumber() + ", ";
+                    }
+                }    
+                
+                ouMapUserPhoneNo.put( o, userPhoneNo );      
+                
+                orgUnitInfo = "" + o.getId();
+
+                if ( maxOULevel < organisationUnitService.getLevelOfOrganisationUnit( o ) )
+                    maxOULevel = organisationUnitService.getLevelOfOrganisationUnit( o );
+
+                if ( minOULevel > organisationUnitService.getLevelOfOrganisationUnit( o ) )
+                    minOULevel = organisationUnitService.getLevelOfOrganisationUnit( o );
+
+                dso = ds.getSources();
+                periodIterator = periodList.iterator();
+
+                Period p;
+               // @SuppressWarnings("unused")
+                //Collection dataValueResult;
+                double dataStatusPercentatge;
+
+                while ( periodIterator.hasNext() )
+                {
+                    p = (Period) periodIterator.next();
+                    periodInfo = "" + p.getId();
+
+                    if ( dso == null )
+                    {
+                        results.add( -1 );
+                        continue;
+                    }
+                    else if ( !dso.contains( o ) )
+                    {
+                        orgUnitInfo = "-1";
+                        orgUnitCount = 0;
+                        getOrgUnitInfo( o, dso );
+
+                        if(includeZeros == null)
+                        {
+                            query = "SELECT COUNT(*) FROM " + dataViewName + " WHERE dataelementid IN (" + deInfo
+                            + ") AND sourceid IN (" + orgUnitInfo + ") AND periodid IN (" + periodInfo + ") AND value <> 0";
+                        }
+                        else
+                        {
+                            query = "SELECT COUNT(*) FROM " + dataViewName + " WHERE dataelementid IN (" + deInfo
+                            + ") AND sourceid IN (" + orgUnitInfo + ") AND periodid IN (" + periodInfo + ")";
+                        }
+                       
+                        SqlRowSet sqlResultSet = jdbcTemplate.queryForRowSet( query );
+                        
+                        if ( sqlResultSet.next() )
+                        {
+                            try
+                            {
+                                dataStatusPercentatge = ((double) sqlResultSet.getInt( 1 ) / (double) (deGroupMemberCount1 * orgUnitCount)) * 100.0;
+                            }
+                            catch ( Exception e )
+                            {
+                                dataStatusPercentatge = 0.0;
+                            }
+                        }
+                        else
+                            dataStatusPercentatge = 0.0;
+
+                        if ( dataStatusPercentatge > 100.0 )
+                            dataStatusPercentatge = 100;
+
+                        dataStatusPercentatge = Math.round( dataStatusPercentatge * Math.pow( 10, 0 ) )
+                            / Math.pow( 10, 0 );
+
+                        results.add( (int) dataStatusPercentatge );
+                        continue;
+                    }
+
+                    orgUnitInfo = "" + o.getId();
+
+                    if(includeZeros == null)
+                        {
+                            query = "SELECT COUNT(*) FROM " + dataViewName + " WHERE dataelementid IN (" + deInfo
+                        + ") AND sourceid IN (" + orgUnitInfo + ") AND periodid IN (" + periodInfo + ") AND value <> 0";
+                        }
+                        else
+                        {
+                            query = "SELECT COUNT(*) FROM " + dataViewName + " WHERE dataelementid IN (" + deInfo
+                        + ") AND sourceid IN (" + orgUnitInfo + ") AND periodid IN (" + periodInfo + ")";
+                        }
+                    
+                    SqlRowSet sqlResultSet = jdbcTemplate.queryForRowSet( query );
+                  
+                    if ( sqlResultSet.next() )
+                    {
+                        try
+                        {
+                            dataStatusPercentatge = ((double) sqlResultSet.getInt( 1 ) / (double) deGroupMemberCount1) * 100.0;
+                        }
+                        catch ( Exception e )
+                        {
+                            dataStatusPercentatge = 0.0;
+                        }
+                    }
+                    else
+                        dataStatusPercentatge = 0.0;
+
+                    if ( dataStatusPercentatge > 100.0 )
+                        dataStatusPercentatge = 100;
+
+                    dataStatusPercentatge = Math.round( dataStatusPercentatge * Math.pow( 10, 0 ) ) / Math.pow( 10, 0 );
+
+                    results.add( (int) dataStatusPercentatge );
+                }
+            }
+        }
+
+        // For Level Names
+        String ouLevelNames[] = new String[organisationUnitService.getNumberOfOrganisationalLevels() + 1];
+        for ( int i = 0; i < ouLevelNames.length; i++ )
+        {
+            ouLevelNames[i] = "Level" + i;
+        }
+
+        List<OrganisationUnitLevel> ouLevels = new ArrayList<OrganisationUnitLevel>( organisationUnitService.getFilledOrganisationUnitLevels() );
+        for ( OrganisationUnitLevel ouL : ouLevels )
+        {
+            ouLevelNames[ouL.getLevel()] = ouL.getName();
+        }
+
+        levelNames = new ArrayList<String>();
+        int count1 = minOULevel;
+        while ( count1 <= maxOULevel )
+        {
+            levelNames.add( ouLevelNames[count1] );
+            count1++;
+        }
+
+        periodNameList = dashBoardService.getPeriodNamesByPeriodType( dataSetPeriodType, periodList );
+        
+        try
+        {
+
+        }
+        finally
+        {
+            try
+            {
+                deleteDataView( dataViewName );
+            }
+            catch ( Exception e )
+            {
+                System.out.println( "Exception while closing DB Connections : " + e.getMessage() );
+            }
+        }// finally block end
+
+        return SUCCESS;
+    }
+
+    public void getDataSetAssignedOrgUnitCount( OrganisationUnit organisationUnit, Set<Source> dso )
+    {
+        Collection<OrganisationUnit> children = organisationUnit.getChildren();
+
+        Iterator<OrganisationUnit> childIterator = children.iterator();
+        OrganisationUnit child;
+        while ( childIterator.hasNext() )
+        {
+            child = childIterator.next();
+            if ( dso.contains( child ) )
+            {
+                orgUnitCount++;
+            }
+            getDataSetAssignedOrgUnitCount( child, dso );
+        }
+
+    }
+
+    public String createDataView( String orgUnitInfo, String deInfo, String periodInfo )
+    {
+        String dataViewName = "_ds_" + UUID.randomUUID().toString();
+        dataViewName = dataViewName.replaceAll( "-", "" );
+
+        String query = "DROP VIEW IF EXISTS " + dataViewName;
+
+        try
+        {
+            @SuppressWarnings("unused")
+                        int sqlResult = jdbcTemplate.update( query );
+
+            System.out.println( "View " + dataViewName + " dropped Successfully (if exists) " );
+
+            query = "CREATE view " + dataViewName + " AS "
+                + " SELECT sourceid,dataelementid,periodid,value FROM datavalue " + " WHERE dataelementid in ("
+                + deInfo + ") AND " + " sourceid in (" + orgUnitInfo + ") AND " + " periodid in (" + periodInfo + ")";
+
+            sqlResult = jdbcTemplate.update( query );
+
+            System.out.println( "View " + dataViewName + " created Successfully" );
+        } // try block end
+        catch ( Exception e )
+        {
+            System.out.println( "SQL Exception : " + e.getMessage() );
+            return null;
+        }
+        finally
+        {
+            try
+            {             
+            }
+            catch ( Exception e )
+            {
+                System.out.println( "SQL Exception : " + e.getMessage() );
+                return null;
+            }
+        }// finally block end
+
+        return dataViewName;
+    }
+
+    public void deleteDataView( String dataViewName )
+    {
+        String query = "DROP VIEW IF EXISTS " + dataViewName;
+
+        try
+        {
+            @SuppressWarnings("unused")
+            int sqlResult = jdbcTemplate.update( query );
+            System.out.println( "View " + dataViewName + " dropped Successfully" );
+        } // try block end
+        catch ( Exception e )
+        {
+            System.out.println( "SQL Exception : " + e.getMessage() );
+        }
+        finally
+        {
+            try
+            {
+            }
+            catch ( Exception e )
+            {
+                System.out.println( "SQL Exception : " + e.getMessage() );
+            }
+        }// finally block end
+    }
+
+    // Returns the OrgUnitTree for which Root is the orgUnit
+    @SuppressWarnings("unchecked")
+    public List<OrganisationUnit> getChildOrgUnitTree( OrganisationUnit orgUnit )
+    {
+        List<OrganisationUnit> orgUnitTree = new ArrayList<OrganisationUnit>();
+        orgUnitTree.add( orgUnit );
+        List<OrganisationUnit> children = new ArrayList<OrganisationUnit>( orgUnit.getChildren() );
+        Collections.sort( children, new OrganisationUnitNameComparator() );
+        Iterator childIterator = children.iterator();
+        OrganisationUnit child;
+        
+        while ( childIterator.hasNext() )
+        {
+            child = (OrganisationUnit) childIterator.next();
+            orgUnitTree.addAll( getChildOrgUnitTree( child ) );
+        }
+        return orgUnitTree;
+    }// getChildOrgUnitTree end
+
+    private void getOrgUnitInfo( OrganisationUnit organisationUnit )
+    {
+        Collection<OrganisationUnit> children = organisationUnit.getChildren();
+        Iterator<OrganisationUnit> childIterator = children.iterator();
+        OrganisationUnit child;
+        
+        while ( childIterator.hasNext() )
+        {
+            child = childIterator.next();
+            orgUnitInfo += "," + child.getId();
+            getOrgUnitInfo( child );
+        }
+    }
+
+    private void getOrgUnitInfo( OrganisationUnit organisationUnit, Set<Source> 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" );
+
+        for ( DataElement de : dataElements )
+        {
+            deInfo.append( "," ).append( de.getId() );
+        }
+        return deInfo.toString();
+    }
+
+    public Map<OrganisationUnit, List<Integer>> getOuMapDataStatusResult()
+    {
+        return ouMapDataStatusResult;
+    }
+
+    public Collection<Period> getPeriodList()
+    {
+        return periodList;
+    }
+
+    @SuppressWarnings("unchecked")
+    public List<DataElementGroup> getApplicableDataElementGroups( DataSet selectedDataSet )
+    {
+        List<DataElement> dataSetMembers = new ArrayList<DataElement>();
+        dataSetMembers.addAll( selectedDataSet.getDataElements() );
+        List<DataElementGroup> allDataElementGroups = new ArrayList<DataElementGroup>( dataElementService
+            .getAllDataElementGroups() );
+        List<DataElementGroup> applicableDataElementGroups = new ArrayList<DataElementGroup>();
+        Iterator degIterator = allDataElementGroups.iterator();
+
+        while ( degIterator.hasNext() )
+        {
+            DataElementGroup deg = (DataElementGroup) degIterator.next();
+            List<DataElement> checkDataElement = new ArrayList<DataElement>( deg.getMembers() );
+            checkDataElement.retainAll( dataSetMembers );
+
+            if ( checkDataElement != null && checkDataElement.size() > 0 )
+            {
+                applicableDataElementGroups.add( deg );
+            }
+        }
+        return applicableDataElementGroups;
+    }
+
+}// class end
+

=== added file 'local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ds/mobile/action/GenerateLastUpdatedMobileDataSetResultAction.java'
--- local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ds/mobile/action/GenerateLastUpdatedMobileDataSetResultAction.java	1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ds/mobile/action/GenerateLastUpdatedMobileDataSetResultAction.java	2010-11-25 07:50:13 +0000
@@ -0,0 +1,823 @@
+/*
+ * Copyright (c) 2004-2010, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ *   list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ *   this list of conditions and the following disclaimer in the documentation
+ *   and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ *   be used to endorse or promote products derived from this software without
+ *   specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.hisp.dhis.dashboard.ds.mobile.action;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.hibernate.SessionFactory;
+import org.hisp.dhis.dashboard.util.DashBoardService;
+import org.hisp.dhis.dataelement.DataElement;
+import org.hisp.dhis.dataset.DataSet;
+import org.hisp.dhis.dataset.DataSetService;
+import org.hisp.dhis.options.displayproperty.DisplayPropertyHandler;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.organisationunit.OrganisationUnitLevel;
+import org.hisp.dhis.organisationunit.OrganisationUnitService;
+import org.hisp.dhis.organisationunit.comparator.OrganisationUnitNameComparator;
+import org.hisp.dhis.organisationunit.comparator.OrganisationUnitShortNameComparator;
+import org.hisp.dhis.period.Period;
+import org.hisp.dhis.period.PeriodService;
+import org.hisp.dhis.period.PeriodType;
+import org.hisp.dhis.source.Source;
+import org.hisp.dhis.user.User;
+import org.hisp.dhis.user.UserCredentials;
+import org.hisp.dhis.user.UserStore;
+import org.springframework.jdbc.core.JdbcTemplate;
+import org.springframework.jdbc.support.rowset.SqlRowSet;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Mithilesh Kumar Thakur
+ *
+ * @version GenerateLastUpdatedMobileDataSetResultAction.java Nov 25, 2010 12:02:35 PM
+ */
+public class GenerateLastUpdatedMobileDataSetResultAction
+implements Action
+{
+    // ---------------------------------------------------------------
+    // Dependencies
+    // ---------------------------------------------------------------
+    
+    private JdbcTemplate jdbcTemplate;
+
+    public void setJdbcTemplate( JdbcTemplate jdbcTemplate )
+    {
+        this.jdbcTemplate = jdbcTemplate;
+    }
+
+    @SuppressWarnings( "unused" )
+    private SessionFactory sessionFactory;
+
+    public void setSessionFactory( SessionFactory sessionFactory )
+    {
+        this.sessionFactory = sessionFactory;
+    }
+
+    private OrganisationUnitService organisationUnitService;
+
+    public void setOrganisationUnitService( OrganisationUnitService organisationUnitService )
+    {
+        this.organisationUnitService = organisationUnitService;
+    }
+/*    
+    private DataValueService dataValueService;
+
+    public void setDataValueService( DataValueService dataValueService )
+    {
+        this.dataValueService = dataValueService;
+    }
+*/
+    public OrganisationUnitService getOrganisationUnitService()
+    {
+        return organisationUnitService;
+    }
+
+    private PeriodService periodService;
+
+    public void setPeriodService( PeriodService periodService )
+    {
+        this.periodService = periodService;
+    }
+
+    private DataSetService dataSetService;
+
+    public void setDataSetService( DataSetService dataSetService )
+    {
+        this.dataSetService = dataSetService;
+    }
+
+    public DataSetService getDataSetService()
+    {
+        return dataSetService;
+    }
+
+    private DashBoardService dashBoardService;
+
+    public void setDashBoardService( DashBoardService dashBoardService )
+    {
+        this.dashBoardService = dashBoardService;
+    }
+
+    private DisplayPropertyHandler displayPropertyHandler;
+
+    public void setDisplayPropertyHandler( DisplayPropertyHandler displayPropertyHandler )
+    {
+        this.displayPropertyHandler = displayPropertyHandler;
+    }
+    
+    private UserStore userStore;
+    
+    public void setUserStore( UserStore userStore )
+    {
+        this.userStore = userStore;
+    }
+      
+    @SuppressWarnings("unused")
+    private Comparator<OrganisationUnit> orgUnitComparator;
+
+    public void setOrgUnitComparator( Comparator<OrganisationUnit> orgUnitComparator )
+    {
+        this.orgUnitComparator = orgUnitComparator;
+    }
+    
+    // ---------------------------------------------------------------
+    // Output Parameters
+    // ---------------------------------------------------------------
+
+    private Map<OrganisationUnit, List<String>> ouMapDataStatusResult;
+
+    public Map<OrganisationUnit, List<String>> getOuMapDataStatusResult()
+    {
+        return ouMapDataStatusResult;
+    }
+    
+    private Map<OrganisationUnit, String> ouMapUserPhoneNo;
+    
+    public Map<OrganisationUnit, String> getOuMapUserPhoneNo()
+    {
+        return ouMapUserPhoneNo;
+    }
+
+    private Collection<Period> periodList;
+
+    public Collection<Period> getPeriodList()
+    {
+        return periodList;
+    }
+
+    private List<OrganisationUnit> orgUnitList;
+
+    public List<OrganisationUnit> getOrgUnitList()
+    {
+        return orgUnitList;
+    }
+
+    private List<DataSet> dataSetList;
+
+    public List<DataSet> getDataSetList()
+    {
+        return dataSetList;
+    }
+
+    private List<Integer> results;
+
+    public List<Integer> getResults()
+    {
+        return results;
+    }
+
+    private Map<DataSet, Map<OrganisationUnit, List<Integer>>> dataStatusResult;
+
+    public Map<DataSet, Map<OrganisationUnit, List<Integer>>> getDataStatusResult()
+    {
+        return dataStatusResult;
+    }
+
+    private Map<DataSet, Collection<Period>> dataSetPeriods;
+
+    public Map<DataSet, Collection<Period>> getDataSetPeriods()
+    {
+        return dataSetPeriods;
+    }
+
+    List<Period> selectedPeriodList;
+
+    public List<Period> getSelectedPeriodList()
+    {
+        return selectedPeriodList;
+    }
+
+    List<String> levelNames;
+
+    public List<String> getLevelNames()
+    {
+        return levelNames;
+    }
+
+    private int maxOULevel;
+
+    public int getMaxOULevel()
+    {
+        return maxOULevel;
+    }
+    
+    private String userPhoneNo;
+    
+    public String getUserPhoneNo()
+    {
+        return userPhoneNo;
+    }
+    
+    // ---------------------------------------------------------------
+    // Input Parameters
+    // ---------------------------------------------------------------
+
+
+
+    private String dsId;
+
+    public void setDsId( String dsId )
+    {
+        this.dsId = dsId;
+    }
+
+    private String includeZeros;
+
+    public void setIncludeZeros( String includeZeros )
+    {
+        this.includeZeros = includeZeros;
+    }
+    
+    public String getIncludeZeros()
+    {
+        return includeZeros;
+    }
+
+    private String selectedButton;
+
+    public void setselectedButton( String selectedButton )
+    {
+        this.selectedButton = selectedButton;
+    }
+
+    public String getSelectedButton()
+    {
+        return selectedButton;
+    }
+
+    private String ouId;
+
+    public void setOuId( String ouId )
+    {
+        this.ouId = ouId;
+    }
+
+    private String immChildOption;
+
+    public void setImmChildOption( String immChildOption )
+    {
+        this.immChildOption = immChildOption;
+    }
+
+    private int sDateLB;
+
+    public void setSDateLB( int dateLB )
+    {
+        sDateLB = dateLB;
+    }
+
+    public int getSDateLB()
+    {
+        return sDateLB;
+    }
+
+    private int eDateLB;
+
+    public void setEDateLB( int dateLB )
+    {
+        eDateLB = dateLB;
+    }
+
+    public int getEDateLB()
+    {
+        return eDateLB;
+    }
+
+    private String facilityLB;
+
+    public void setFacilityLB( String facilityLB )
+    {
+        this.facilityLB = facilityLB;
+    }
+
+    private List<String> orgUnitListCB;
+
+    public void setOrgUnitListCB( List<String> orgUnitListCB )
+    {
+        this.orgUnitListCB = orgUnitListCB;
+    }
+
+    private List<String> selectedDataSets;
+
+    public void setSelectedDataSets( List<String> selectedDataSets )
+    {
+        this.selectedDataSets = selectedDataSets;
+    }
+
+    public List<String> getSelectedDataSets()
+    {
+        return selectedDataSets;
+    }
+
+    private int minOULevel;
+
+    public int getMinOULevel()
+    {
+        return minOULevel;
+    }
+
+    private int number;
+
+    public int getNumber()
+    {
+        return number;
+    }
+
+    private DataSet selDataSet;
+
+    public DataSet getSelDataSet()
+    {
+        return selDataSet;
+    }
+
+    private List<String> periodNameList;
+
+    public List<String> getPeriodNameList()
+    {
+        return periodNameList;
+    }
+
+    String orgUnitInfo;
+
+    String periodInfo;
+
+    String deInfo;
+
+    int orgUnitCount;
+
+//    private String dataViewName;
+
+    // ---------------------------------------------------------------
+    // Action Implementation
+    // ---------------------------------------------------------------
+//    @SuppressWarnings( { "deprecation", "unchecked" } )
+    public String execute()
+        throws Exception
+    {
+        
+        orgUnitCount = 0;
+//        dataViewName = "";
+
+        // Intialization
+        periodNameList = new ArrayList<String>();
+        ouMapDataStatusResult = new HashMap<OrganisationUnit, List<String>>();
+        ouMapUserPhoneNo = new HashMap<OrganisationUnit,String>();//for User PhoneNo Map
+        
+        results = new ArrayList<Integer>();
+        maxOULevel = 1;
+        minOULevel = organisationUnitService.getNumberOfOrganisationalLevels();
+      
+        if ( immChildOption != null && immChildOption.equalsIgnoreCase( "yes" ) )
+        {
+            orgUnitListCB = new ArrayList<String>();
+            orgUnitListCB.add( ouId );
+
+            facilityLB = "immChildren";
+
+            selectedDataSets = new ArrayList<String>();
+            selectedDataSets.add( dsId );
+        }
+
+        // DataSet Related Info
+        dataSetList = new ArrayList<DataSet>();
+
+        deInfo = "-1";
+        if ( selectedDataSets == null )
+        {
+            System.out.println( "slectedDataSets is empty" );
+        }
+        else
+        {
+            //System.out.println( "slectedDataSets is not empty" );
+        }
+        for ( String ds : selectedDataSets )
+        {
+            DataSet dSet = dataSetService.getDataSet( Integer.parseInt( ds ) );
+            selDataSet = dSet;
+            for ( DataElement de : dSet.getDataElements() )
+                deInfo += "," + de.getId();
+        }
+
+        // OrgUnit Related Info
+        OrganisationUnit selectedOrgUnit = new OrganisationUnit();
+        orgUnitList = new ArrayList<OrganisationUnit>();
+        if ( facilityLB.equals( "children" ) )
+        {
+            selectedOrgUnit = organisationUnitService.getOrganisationUnit( Integer.parseInt( orgUnitListCB.get( 0 ) ) );
+            orgUnitList = getChildOrgUnitTree( selectedOrgUnit );                     
+        }
+        else if ( facilityLB.equals( "immChildren" ) )
+        {
+            @SuppressWarnings( "unused" )
+            int number;
+
+            selectedOrgUnit = organisationUnitService.getOrganisationUnit( Integer.parseInt( orgUnitListCB.get( 0 ) ) );
+            number = selectedOrgUnit.getChildren().size();
+            orgUnitList = new ArrayList<OrganisationUnit>();
+
+            Iterator<String> orgUnitIterator = orgUnitListCB.iterator();
+            while ( orgUnitIterator.hasNext() )
+            {
+                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() );
+                orgUnitList.addAll( organisationUnits );              
+            }
+        }
+        else
+        {
+            Iterator<String> orgUnitIterator = orgUnitListCB.iterator();
+            OrganisationUnit o;
+            while ( orgUnitIterator.hasNext() )
+            {
+                o = organisationUnitService.getOrganisationUnit( Integer.parseInt( orgUnitIterator.next() ) );
+                orgUnitList.add( o );                
+                Collections.sort( orgUnitList, new OrganisationUnitShortNameComparator() );               
+                displayPropertyHandler.handle( orgUnitList );
+            }
+        }
+
+        Set<Source> dSetSource = selDataSet.getSources();
+        orgUnitInfo = "-1";
+        Iterator<OrganisationUnit> ouIt = orgUnitList.iterator();
+        while ( ouIt.hasNext() )
+        {
+            OrganisationUnit ou = ouIt.next();
+
+            orgUnitCount = 0;
+            if ( !dSetSource.contains( ou ) )
+            {
+                getDataSetAssignedOrgUnitCount( ou, dSetSource );
+
+                if ( orgUnitCount > 0 )
+                {
+                    orgUnitInfo += "," + ou.getId();
+                    getOrgUnitInfo( ou );
+                }
+                else
+                {
+                    ouIt.remove();
+                }
+            }
+            else
+            {
+                orgUnitInfo += "," + ou.getId();
+            }
+        }
+       
+        // Period Related Info
+        Period startPeriod = periodService.getPeriod( sDateLB );
+        Period endPeriod = periodService.getPeriod( eDateLB );
+
+        PeriodType dataSetPeriodType = selDataSet.getPeriodType();        
+        periodList = new ArrayList<Period>( periodService.getIntersectingPeriodsByPeriodType( dataSetPeriodType,
+            startPeriod.getStartDate(), endPeriod.getEndDate() ) );
+
+        periodInfo = "-1";
+        for ( Period p : periodList )
+            periodInfo += "," + p.getId();
+           
+        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;
+        Set<Source> dso = new HashSet<Source>();
+        Iterator<Period> periodIterator;
+        dso = selDataSet.getSources();
+        
+        while ( orgUnitListIterator.hasNext() )
+        {
+            o = (OrganisationUnit) orgUnitListIterator.next();
+            
+            // user phone no
+            userPhoneNo = "";
+            
+            List<User> users = new ArrayList<User>( userStore.getUsersByOrganisationUnit( o ) );
+            
+            for ( User user : users )
+            {
+                if ( user != null && user.getPhoneNumber() != null  && !user.getPhoneNumber().trim().equalsIgnoreCase( "" ) )
+                {
+                    userPhoneNo += user.getPhoneNumber() + ", ";
+                }
+            }    
+            
+            ouMapUserPhoneNo.put( o, userPhoneNo );    
+            
+            
+            
+            orgUnitInfo = "" + o.getId();
+
+            if ( maxOULevel < organisationUnitService.getLevelOfOrganisationUnit( o ) )
+                maxOULevel = organisationUnitService.getLevelOfOrganisationUnit( o );
+
+            if ( minOULevel > organisationUnitService.getLevelOfOrganisationUnit( o ) )
+                minOULevel = organisationUnitService.getLevelOfOrganisationUnit( o );
+
+            periodIterator = periodList.iterator();
+
+            Period p;
+
+            String storedby = null;           
+           // String userDetailInfo = null;
+            List<String> dsResults = new ArrayList<String>();
+            while ( periodIterator.hasNext() )
+            {
+                p = (Period) periodIterator.next();
+                periodInfo = "" + p.getId();
+
+                if ( dso == null )
+                {
+                    dsResults.add( -1, dsId);
+                    continue;
+                }
+                else if ( !dso.contains( o ) )
+                {
+                    orgUnitInfo = "-1";
+       
+                    dsResults.add( " " );
+                    continue;
+                }
+
+                orgUnitInfo = "" + o.getId();
+
+                SqlRowSet sqlResultSet = jdbcTemplate.queryForRowSet( "SELECT DISTINCT(storedby) FROM datavalue WHERE dataelementid IN (" + deInfo
+                    + ") AND sourceid IN (" + orgUnitInfo + ") AND periodid IN (" + periodInfo + ")" );
+
+                storedby = " ";
+                while ( sqlResultSet.next() )
+                {                   
+                    
+                    try
+                    {
+                        String tempUserName = sqlResultSet.getString( 1 );
+                        
+                        if( tempUserName != null)
+                        {                      
+                            UserCredentials userCredentials = userStore.getUserCredentialsByUsername( tempUserName );
+                            
+                            if( userCredentials != null )
+                            {
+                                User user = userStore.getUser( userCredentials.getId() );
+                                
+                                if( user != null )
+                                {
+                                    storedby += user.getFirstName() + " "+ user.getSurname() + " , ";
+                                }
+                                else
+                                {
+                                    storedby +=  tempUserName + " , ";
+                                }
+                            }
+                            else
+                            {
+                                storedby +=  tempUserName + " , ";
+                            }
+                        }
+                        else
+                        {
+                            storedby = " ";
+                        }
+                                               
+                    }
+                    catch ( Exception e )
+                    {
+                        storedby = "not known";
+                    }
+                } 
+                
+                if( storedby.trim().equals( "" ) )
+                {                   
+                }
+                else
+                {
+                    storedby = storedby.substring( 0, storedby.length()-2 );
+                }
+                
+                SqlRowSet sqlResultSet1 = jdbcTemplate.queryForRowSet( "SELECT DISTINCT(lastupdated) FROM datavalue WHERE dataelementid IN (" + deInfo
+                    + ") AND sourceid IN (" + orgUnitInfo + ") AND periodid IN (" + periodInfo + ")" );
+
+                String lastupdated = " ";
+                while ( sqlResultSet1.next() )
+                {                   
+                    try
+                    {
+                        if( lastupdated.compareTo( sqlResultSet1.getString( 1 ) ) < 0 )
+                            lastupdated = sqlResultSet1.getString( 1 );
+                    }
+                    catch ( Exception e )
+                    {
+                        lastupdated = "Not Known";
+                    }
+                }
+                
+                if( storedby.trim().equals( "" ) && lastupdated.trim().equals( "" ) )
+                {
+                    dsResults.add( " " );
+                }
+                else
+                {
+                    dsResults.add( storedby + " : " + lastupdated );
+                }
+            }
+
+            ouMapDataStatusResult.put( o, dsResults );
+        }
+
+        // For Level Names
+        String ouLevelNames[] = new String[organisationUnitService.getNumberOfOrganisationalLevels() + 1];
+        for ( int i = 0; i < ouLevelNames.length; i++ )
+        {
+            ouLevelNames[i] = "Level" + i;
+        }
+
+        List<OrganisationUnitLevel> ouLevels = new ArrayList<OrganisationUnitLevel>( organisationUnitService.getFilledOrganisationUnitLevels() );
+        for ( OrganisationUnitLevel ouL : ouLevels )
+        {
+            ouLevelNames[ouL.getLevel()] = ouL.getName();
+        }
+
+        levelNames = new ArrayList<String>();
+        int count1 = minOULevel;
+        while ( count1 <= maxOULevel )
+        {
+            levelNames.add( ouLevelNames[count1] );
+            count1++;
+        }
+
+        try
+        {
+
+        }
+        finally
+        {
+            try
+            {
+                //deleteDataView( dataViewName );               
+            }
+            catch ( Exception e )
+            {
+                System.out.println( "Exception while closing DB Connections : " + e.getMessage() );
+            }
+        }// finally block end
+
+        periodNameList = dashBoardService.getPeriodNamesByPeriodType( dataSetPeriodType, periodList );
+        
+        return SUCCESS;
+    }
+
+    public void getDataSetAssignedOrgUnitCount( OrganisationUnit organisationUnit, Set<Source> dso )
+    {
+        Collection<OrganisationUnit> children = organisationUnit.getChildren();
+
+        Iterator<OrganisationUnit> childIterator = children.iterator();
+        OrganisationUnit child;
+        while ( childIterator.hasNext() )
+        {
+            child = childIterator.next();
+            if ( dso.contains( child ) )
+            {
+                orgUnitCount++;
+            }
+            getDataSetAssignedOrgUnitCount( child, dso );
+        }
+    }
+
+    
+    public void deleteDataView( String dataViewName )
+    {
+        String query = "DROP VIEW IF EXISTS " + dataViewName;
+
+        try
+        {           
+            @SuppressWarnings("unused")
+                        int sqlResult = jdbcTemplate.update( query );
+            System.out.println( "View " + dataViewName + " dropped Successfully" );
+        } // try block end
+        catch ( Exception e )
+        {
+            System.out.println( "SQL Exception : " + e.getMessage() );
+        }
+        finally
+        {
+            try
+            {
+            }
+            catch ( Exception e )
+            {
+                System.out.println( "SQL Exception : " + e.getMessage() );
+            }
+        }// finally block end
+    }
+
+    // Returns the OrgUnitTree for which Root is the orgUnit
+    @SuppressWarnings( "unchecked" )
+    public List<OrganisationUnit> getChildOrgUnitTree( OrganisationUnit orgUnit )
+    {
+        List<OrganisationUnit> orgUnitTree = new ArrayList<OrganisationUnit>();
+        orgUnitTree.add( orgUnit );
+
+        List<OrganisationUnit> children = new ArrayList<OrganisationUnit>( orgUnit.getChildren() );
+        Collections.sort( children, new OrganisationUnitNameComparator() );
+
+        Iterator childIterator = children.iterator();
+        OrganisationUnit child;
+        while ( childIterator.hasNext() )
+        {
+            child = (OrganisationUnit) childIterator.next();
+            orgUnitTree.addAll( getChildOrgUnitTree( child ) );
+        }
+        return orgUnitTree;
+    }// getChildOrgUnitTree end
+
+    private void getOrgUnitInfo( OrganisationUnit organisationUnit )
+    {
+        Collection<OrganisationUnit> children = organisationUnit.getChildren();
+
+        Iterator<OrganisationUnit> childIterator = children.iterator();
+        OrganisationUnit child;
+        while ( childIterator.hasNext() )
+        {
+            child = childIterator.next();
+            orgUnitInfo += "," + child.getId();
+            getOrgUnitInfo( child );
+        }
+    }
+
+    @SuppressWarnings( "unused" )
+    private void getOrgUnitInfo( OrganisationUnit organisationUnit, Set<Source> 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" );
+
+        for ( DataElement de : dataElements )
+        {
+            deInfo.append( "," ).append( de.getId() );
+        }
+        return deInfo.toString();
+    }
+
+}// class end
+

=== added file 'local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ds/mobile/action/GenerateMobileDataStatusResultAction.java'
--- local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ds/mobile/action/GenerateMobileDataStatusResultAction.java	1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ds/mobile/action/GenerateMobileDataStatusResultAction.java	2010-11-25 07:50:13 +0000
@@ -0,0 +1,852 @@
+/*
+ * Copyright (c) 2004-2010, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ *   list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ *   this list of conditions and the following disclaimer in the documentation
+ *   and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ *   be used to endorse or promote products derived from this software without
+ *   specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.hisp.dhis.dashboard.ds.mobile.action;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.UUID;
+
+import org.hibernate.SessionFactory;
+import org.hisp.dhis.dashboard.util.DashBoardService;
+import org.hisp.dhis.dataelement.DataElement;
+import org.hisp.dhis.dataset.DataSet;
+import org.hisp.dhis.dataset.DataSetService;
+import org.hisp.dhis.options.displayproperty.DisplayPropertyHandler;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.organisationunit.OrganisationUnitLevel;
+import org.hisp.dhis.organisationunit.OrganisationUnitService;
+import org.hisp.dhis.organisationunit.comparator.OrganisationUnitNameComparator;
+import org.hisp.dhis.organisationunit.comparator.OrganisationUnitShortNameComparator;
+import org.hisp.dhis.period.Period;
+import org.hisp.dhis.period.PeriodService;
+import org.hisp.dhis.period.PeriodType;
+import org.hisp.dhis.source.Source;
+import org.hisp.dhis.user.User;
+import org.hisp.dhis.user.UserStore;
+import org.springframework.jdbc.core.JdbcTemplate;
+import org.springframework.jdbc.support.rowset.SqlRowSet;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Mithilesh Kumar Thakur
+ *
+ * @version GenerateMobileDataStatusResultAction.java Nov 24, 2010 5:17:22 PM
+ */
+public class GenerateMobileDataStatusResultAction
+implements Action
+{
+    // ---------------------------------------------------------------
+    // Dependencies
+    // ---------------------------------------------------------------
+    
+    private JdbcTemplate jdbcTemplate;
+
+    public void setJdbcTemplate( JdbcTemplate jdbcTemplate )
+    {
+        this.jdbcTemplate = jdbcTemplate;
+    }
+
+    @SuppressWarnings( "unused" )
+    private SessionFactory sessionFactory;
+
+    public void setSessionFactory( SessionFactory sessionFactory )
+    {
+        this.sessionFactory = sessionFactory;
+    }
+
+    private OrganisationUnitService organisationUnitService;
+
+    public void setOrganisationUnitService( OrganisationUnitService organisationUnitService )
+    {
+        this.organisationUnitService = organisationUnitService;
+    }
+
+    public OrganisationUnitService getOrganisationUnitService()
+    {
+        return organisationUnitService;
+    }
+
+    private PeriodService periodService;
+
+    public void setPeriodService( PeriodService periodService )
+    {
+        this.periodService = periodService;
+    }
+
+    private DataSetService dataSetService;
+
+    public void setDataSetService( DataSetService dataSetService )
+    {
+        this.dataSetService = dataSetService;
+    }
+
+    public DataSetService getDataSetService()
+    {
+        return dataSetService;
+    }
+
+    private DashBoardService dashBoardService;
+
+    public void setDashBoardService( DashBoardService dashBoardService )
+    {
+        this.dashBoardService = dashBoardService;
+    }
+
+    private DisplayPropertyHandler displayPropertyHandler;
+
+    public void setDisplayPropertyHandler( DisplayPropertyHandler displayPropertyHandler )
+    {
+        this.displayPropertyHandler = displayPropertyHandler;
+    }
+    
+    @SuppressWarnings("unused")
+    private Comparator<OrganisationUnit> orgUnitComparator;
+
+    public void setOrgUnitComparator( Comparator<OrganisationUnit> orgUnitComparator )
+    {
+        this.orgUnitComparator = orgUnitComparator;
+    }
+    
+    private UserStore userStore;
+
+    public void setUserStore( UserStore userStore )
+    {
+        this.userStore = userStore;
+    }
+    // ---------------------------------------------------------------
+    // Output Parameters
+    // ---------------------------------------------------------------
+
+    private Map<OrganisationUnit, List<Integer>> ouMapDataStatusResult;
+
+    public Map<OrganisationUnit, List<Integer>> getOuMapDataStatusResult()
+    {
+        return ouMapDataStatusResult;
+    }
+    
+    private Map<OrganisationUnit, String> ouMapUserPhoneNo;
+
+    public Map<OrganisationUnit, String> getOuMapUserPhoneNo()
+    {
+        return ouMapUserPhoneNo;
+    }
+
+    private Collection<Period> periodList;
+
+    public Collection<Period> getPeriodList()
+    {
+        return periodList;
+    }
+
+    private List<OrganisationUnit> orgUnitList;
+
+    public List<OrganisationUnit> getOrgUnitList()
+    {
+        return orgUnitList;
+    }
+
+    private List<DataSet> dataSetList;
+
+    public List<DataSet> getDataSetList()
+    {
+        return dataSetList;
+    }
+
+    private List<Integer> results;
+
+    public List<Integer> getResults()
+    {
+        return results;
+    }
+
+    private Map<DataSet, Map<OrganisationUnit, List<Integer>>> dataStatusResult;
+
+    public Map<DataSet, Map<OrganisationUnit, List<Integer>>> getDataStatusResult()
+    {
+        return dataStatusResult;
+    }
+
+    private Map<DataSet, Collection<Period>> dataSetPeriods;
+
+    public Map<DataSet, Collection<Period>> getDataSetPeriods()
+    {
+        return dataSetPeriods;
+    }
+
+    List<Period> selectedPeriodList;
+
+    public List<Period> getSelectedPeriodList()
+    {
+        return selectedPeriodList;
+    }
+
+    List<String> levelNames;
+
+    public List<String> getLevelNames()
+    {
+        return levelNames;
+    }
+
+    private int maxOULevel;
+
+    public int getMaxOULevel()
+    {
+        return maxOULevel;
+    }
+    
+    private String userPhoneNo;
+    
+    public String getUserPhoneNo()
+    {
+        return userPhoneNo;
+    }
+    
+    // ---------------------------------------------------------------
+    // Input Parameters
+    // ---------------------------------------------------------------
+
+
+
+    private String dsId;
+
+    public void setDsId( String dsId )
+    {
+        this.dsId = dsId;
+    }
+
+    private String includeZeros;
+
+    public void setIncludeZeros( String includeZeros )
+    {
+        this.includeZeros = includeZeros;
+    }
+    
+    public String getIncludeZeros()
+    {
+        return includeZeros;
+    }
+
+    private String selectedButton;
+
+    public void setselectedButton( String selectedButton )
+    {
+        this.selectedButton = selectedButton;
+    }
+
+    public String getSelectedButton()
+    {
+        return selectedButton;
+    }
+
+    private String ouId;
+
+    public void setOuId( String ouId )
+    {
+        this.ouId = ouId;
+    }
+
+    private String immChildOption;
+
+    public void setImmChildOption( String immChildOption )
+    {
+        this.immChildOption = immChildOption;
+    }
+
+    private int sDateLB;
+
+    public void setSDateLB( int dateLB )
+    {
+        sDateLB = dateLB;
+    }
+
+    public int getSDateLB()
+    {
+        return sDateLB;
+    }
+
+    private int eDateLB;
+
+    public void setEDateLB( int dateLB )
+    {
+        eDateLB = dateLB;
+    }
+
+    public int getEDateLB()
+    {
+        return eDateLB;
+    }
+
+    private String facilityLB;
+
+    public void setFacilityLB( String facilityLB )
+    {
+        this.facilityLB = facilityLB;
+    }
+
+    private List<String> orgUnitListCB;
+
+    public void setOrgUnitListCB( List<String> orgUnitListCB )
+    {
+        this.orgUnitListCB = orgUnitListCB;
+    }
+
+    private List<String> selectedDataSets;
+
+    public void setSelectedDataSets( List<String> selectedDataSets )
+    {
+        this.selectedDataSets = selectedDataSets;
+    }
+
+    public List<String> getSelectedDataSets()
+    {
+        return selectedDataSets;
+    }
+
+    private int minOULevel;
+
+    public int getMinOULevel()
+    {
+        return minOULevel;
+    }
+
+    private int number;
+
+    public int getNumber()
+    {
+        return number;
+    }
+
+    private DataSet selDataSet;
+
+    public DataSet getSelDataSet()
+    {
+        return selDataSet;
+    }
+
+    private List<String> periodNameList;
+
+    public List<String> getPeriodNameList()
+    {
+        return periodNameList;
+    }
+
+    String orgUnitInfo;
+
+    String periodInfo;
+
+    String deInfo;
+
+    int orgUnitCount;
+
+    private String dataViewName;
+
+    // ---------------------------------------------------------------
+    // Action Implementation
+    // ---------------------------------------------------------------
+//    @SuppressWarnings( { "deprecation", "unchecked" } )
+    public String execute()
+        throws Exception
+    {
+        
+        orgUnitCount = 0;
+        dataViewName = "";
+
+        // Intialization
+        periodNameList = new ArrayList<String>();
+        ouMapDataStatusResult = new HashMap<OrganisationUnit, List<Integer>>();
+        ouMapUserPhoneNo = new HashMap<OrganisationUnit,String>();//for User PhoneNo Map
+        
+        results = new ArrayList<Integer>();
+        maxOULevel = 1;
+        minOULevel = organisationUnitService.getNumberOfOrganisationalLevels();
+
+        if ( immChildOption != null && immChildOption.equalsIgnoreCase( "yes" ) )
+        {
+            orgUnitListCB = new ArrayList<String>();
+            orgUnitListCB.add( ouId );
+
+            facilityLB = "immChildren";
+
+            selectedDataSets = new ArrayList<String>();
+            selectedDataSets.add( dsId );
+
+        }
+
+        // DataSet Related Info
+        dataSetList = new ArrayList<DataSet>();
+
+        deInfo = "-1";
+        if ( selectedDataSets == null )
+        {
+            System.out.println( "slectedDataSets is empty" );
+        }
+        else
+        {
+            //System.out.println( "slectedDataSets is not empty" );
+        }
+        for ( String ds : selectedDataSets )
+        {
+            DataSet dSet = dataSetService.getDataSet( Integer.parseInt( ds ) );
+            selDataSet = dSet;
+            for ( DataElement de : dSet.getDataElements() )
+                deInfo += "," + de.getId();
+        }
+
+        // OrgUnit Related Info
+        OrganisationUnit selectedOrgUnit = new OrganisationUnit();
+        orgUnitList = new ArrayList<OrganisationUnit>();
+        if ( facilityLB.equals( "children" ) )
+        {
+            selectedOrgUnit = organisationUnitService.getOrganisationUnit( Integer.parseInt( orgUnitListCB.get( 0 ) ) );
+            orgUnitList = getChildOrgUnitTree( selectedOrgUnit );                     
+        }
+        else if ( facilityLB.equals( "immChildren" ) )
+        {
+            @SuppressWarnings( "unused" )
+            int number;
+
+            selectedOrgUnit = organisationUnitService.getOrganisationUnit( Integer.parseInt( orgUnitListCB.get( 0 ) ) );
+            number = selectedOrgUnit.getChildren().size();
+            orgUnitList = new ArrayList<OrganisationUnit>();
+
+            Iterator<String> orgUnitIterator = orgUnitListCB.iterator();
+            while ( orgUnitIterator.hasNext() )
+            {
+                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() );
+                orgUnitList.addAll( organisationUnits );              
+            }
+        }
+        else
+        {
+            Iterator<String> orgUnitIterator = orgUnitListCB.iterator();
+            OrganisationUnit o;
+            while ( orgUnitIterator.hasNext() )
+            {
+                o = organisationUnitService.getOrganisationUnit( Integer.parseInt( orgUnitIterator.next() ) );
+                orgUnitList.add( o );                
+                Collections.sort( orgUnitList, new OrganisationUnitShortNameComparator() );               
+                displayPropertyHandler.handle( orgUnitList );
+            }
+        }
+
+        Set<Source> dSetSource = selDataSet.getSources();
+        orgUnitInfo = "-1";
+        Iterator<OrganisationUnit> ouIt = orgUnitList.iterator();
+        while ( ouIt.hasNext() )
+        {
+            OrganisationUnit ou = ouIt.next();
+
+            orgUnitCount = 0;
+            if ( !dSetSource.contains( ou ) )
+            {
+                getDataSetAssignedOrgUnitCount( ou, dSetSource );
+
+                if ( orgUnitCount > 0 )
+                {
+                    orgUnitInfo += "," + ou.getId();
+                    getOrgUnitInfo( ou );
+                }
+                else
+                {
+                    ouIt.remove();
+                }
+            }
+            else
+            {
+                orgUnitInfo += "," + ou.getId();
+            }
+        }
+       
+        // Period Related Info
+        Period startPeriod = periodService.getPeriod( sDateLB );
+        Period endPeriod = periodService.getPeriod( eDateLB );
+
+        PeriodType dataSetPeriodType = selDataSet.getPeriodType();        
+        periodList = new ArrayList<Period>( periodService.getIntersectingPeriodsByPeriodType( dataSetPeriodType,
+            startPeriod.getStartDate(), endPeriod.getEndDate() ) );
+
+        periodInfo = "-1";
+        for ( Period p : periodList )
+            periodInfo += "," + p.getId();
+        
+        dataViewName = createDataView( orgUnitInfo, deInfo, periodInfo );
+      
+        String query = "";
+        query = "SELECT COUNT(*) FROM " + dataViewName + " WHERE dataelementid IN (?) AND sourceid IN (?) 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;
+        Set<Source> dso = new HashSet<Source>();
+        Iterator<Period> periodIterator;
+        dso = selDataSet.getSources();
+
+        while ( orgUnitListIterator.hasNext() )
+        {
+            o = (OrganisationUnit) orgUnitListIterator.next();
+            
+            // user phone no
+            userPhoneNo = "";
+            
+            List<User> users = new ArrayList<User>( userStore.getUsersByOrganisationUnit( o ) );
+            
+            for ( User user : users )
+            {
+                if ( user != null && user.getPhoneNumber() != null  && !user.getPhoneNumber().trim().equalsIgnoreCase( "" ) )
+                {
+                    userPhoneNo += user.getPhoneNumber() + ", ";
+                }
+            }    
+            
+            ouMapUserPhoneNo.put( o, userPhoneNo );            
+            
+            
+            
+            orgUnitInfo = "" + o.getId();
+
+            if ( maxOULevel < organisationUnitService.getLevelOfOrganisationUnit( o ) )
+                maxOULevel = organisationUnitService.getLevelOfOrganisationUnit( o );
+
+            if ( minOULevel > organisationUnitService.getLevelOfOrganisationUnit( o ) )
+                minOULevel = organisationUnitService.getLevelOfOrganisationUnit( o );
+
+            periodIterator = periodList.iterator();
+
+            Period p;
+
+            double dataStatusPercentatge;
+            List<Integer> dsResults = new ArrayList<Integer>();
+            while ( periodIterator.hasNext() )
+            {
+                p = (Period) periodIterator.next();
+                periodInfo = "" + p.getId();
+
+                if ( dso == null )
+                {
+                    dsResults.add( -1 );
+                    continue;
+                }
+                else if ( !dso.contains( o ) )
+                {
+                    orgUnitInfo = "-1";
+                    orgUnitCount = 0;
+                    getOrgUnitInfo( o, dso );
+
+                    if ( includeZeros == null )
+                    {
+                        query = "SELECT COUNT(*) FROM " + dataViewName + " WHERE dataelementid IN (" + deInfo
+                            + ") AND sourceid IN (" + orgUnitInfo + ") AND periodid IN (" + periodInfo
+                            + ") and value <> 0";
+                    }
+                    else
+                    {
+                        query = "SELECT COUNT(*) FROM " + dataViewName + " WHERE dataelementid IN (" + deInfo
+                            + ") AND sourceid IN (" + orgUnitInfo + ") AND periodid IN (" + periodInfo + ")";
+                    }
+
+                    SqlRowSet sqlResultSet = jdbcTemplate.queryForRowSet( query );
+
+                    if ( sqlResultSet.next() )
+                    {
+                        try
+                        {
+                            //System.out.println( "Result is : \t" + sqlResultSet.getLong( 1 ) );
+                            dataStatusPercentatge = ((double) sqlResultSet.getInt( 1 ) / (double) (dataSetMemberCount1 * orgUnitCount)) * 100.0;
+                        }
+                        catch ( Exception e )
+                        {
+                            dataStatusPercentatge = 0.0;
+                        }
+                    }
+                    else
+                        dataStatusPercentatge = 0.0;
+
+                    if ( dataStatusPercentatge > 100.0 )
+                        dataStatusPercentatge = 100;
+
+                    dataStatusPercentatge = Math.round( dataStatusPercentatge * Math.pow( 10, 0 ) ) / Math.pow( 10, 0 );
+
+                    dsResults.add( (int) dataStatusPercentatge );
+                    continue;
+                }
+
+                orgUnitInfo = "" + o.getId();
+
+                if ( includeZeros == null )
+                {
+                    query = "SELECT COUNT(*) FROM " + dataViewName + " WHERE dataelementid IN (" + deInfo
+                        + ") AND sourceid IN (" + orgUnitInfo + ") AND periodid IN (" + periodInfo + ") and value <> 0";
+                }
+                else
+                {
+                    query = "SELECT COUNT(*) FROM " + dataViewName + " WHERE dataelementid IN (" + deInfo
+                        + ") AND sourceid IN (" + orgUnitInfo + ") AND periodid IN (" + periodInfo + ")";
+                }
+
+                SqlRowSet sqlResultSet = jdbcTemplate.queryForRowSet( query );
+
+                if ( sqlResultSet.next() )
+                {
+                    try
+                    {
+                        dataStatusPercentatge = ((double) sqlResultSet.getInt( 1 ) / (double) dataSetMemberCount1) * 100.0;
+                    }
+                    catch ( Exception e )
+                    {
+                        dataStatusPercentatge = 0.0;
+                    }
+                }
+                else
+                    dataStatusPercentatge = 0.0;
+
+                if ( dataStatusPercentatge > 100.0 )
+                    dataStatusPercentatge = 100;
+
+                dataStatusPercentatge = Math.round( dataStatusPercentatge * Math.pow( 10, 0 ) ) / Math.pow( 10, 0 );
+
+                dsResults.add( (int) dataStatusPercentatge );
+            }
+
+            ouMapDataStatusResult.put( o, dsResults );
+        }
+
+        // For Level Names
+        String ouLevelNames[] = new String[organisationUnitService.getNumberOfOrganisationalLevels() + 1];
+        for ( int i = 0; i < ouLevelNames.length; i++ )
+        {
+            ouLevelNames[i] = "Level" + i;
+        }
+
+        List<OrganisationUnitLevel> ouLevels = new ArrayList<OrganisationUnitLevel>( organisationUnitService.getFilledOrganisationUnitLevels() );
+        for ( OrganisationUnitLevel ouL : ouLevels )
+        {
+            ouLevelNames[ouL.getLevel()] = ouL.getName();
+        }
+
+        levelNames = new ArrayList<String>();
+        int count1 = minOULevel;
+        while ( count1 <= maxOULevel )
+        {
+            levelNames.add( ouLevelNames[count1] );
+            count1++;
+        }
+
+        try
+        {
+
+        }
+        finally
+        {
+            try
+            {
+                deleteDataView( dataViewName );               
+            }
+            catch ( Exception e )
+            {
+                System.out.println( "Exception while closing DB Connections : " + e.getMessage() );
+            }
+        }// finally block end
+
+        periodNameList = dashBoardService.getPeriodNamesByPeriodType( dataSetPeriodType, periodList );
+        
+        //System.out.println("OrgUnit Size is :" + ouMapDataStatusResult.size() );
+
+        return SUCCESS;
+    }
+
+    public void getDataSetAssignedOrgUnitCount( OrganisationUnit organisationUnit, Set<Source> dso )
+    {
+        Collection<OrganisationUnit> children = organisationUnit.getChildren();
+
+        Iterator<OrganisationUnit> childIterator = children.iterator();
+        OrganisationUnit child;
+        while ( childIterator.hasNext() )
+        {
+            child = childIterator.next();
+            if ( dso.contains( child ) )
+            {
+                orgUnitCount++;
+            }
+            getDataSetAssignedOrgUnitCount( child, dso );
+        }
+    }
+
+    public String createDataView( String orgUnitInfo, String deInfo, String periodInfo )
+    {      
+        String dataViewName = "_ds_" + UUID.randomUUID().toString();
+        dataViewName = dataViewName.replaceAll( "-", "" );
+
+        String query = "DROP VIEW IF EXISTS " + dataViewName;
+
+        try
+        {
+            @SuppressWarnings("unused")
+                        int sqlResult = jdbcTemplate.update( query );
+
+            System.out.println( "View " + dataViewName + " dropped Successfully (if exists) " );
+            
+            query = "CREATE view " + dataViewName + " AS "
+            + " SELECT sourceid,dataelementid,periodid,value FROM datavalue " + " WHERE dataelementid in ("
+            + deInfo + ") AND " + " sourceid in (" + orgUnitInfo + ") AND " + " periodid in (" + periodInfo + ")";
+
+            sqlResult = jdbcTemplate.update( query );
+
+            System.out.println( "View " + dataViewName + " created Successfully" );
+        } // try block end
+        catch ( Exception e )
+        {
+            System.out.println( "SQL Exception : " + e.getMessage() );
+            return null;
+        }
+        finally
+        {
+            try
+            {              
+            }
+            catch ( Exception e )
+            {
+                System.out.println( "SQL Exception : " + e.getMessage() );
+                return null;
+            }
+        }// finally block end
+
+        return dataViewName;
+    }
+
+    public void deleteDataView( String dataViewName )
+    {
+        String query = "DROP VIEW IF EXISTS " + dataViewName;
+
+        try
+        {           
+            @SuppressWarnings("unused")
+                        int sqlResult = jdbcTemplate.update( query );
+            System.out.println( "View " + dataViewName + " dropped Successfully" );
+        } // try block end
+        catch ( Exception e )
+        {
+            System.out.println( "SQL Exception : " + e.getMessage() );
+        }
+        finally
+        {
+            try
+            {
+            }
+            catch ( Exception e )
+            {
+                System.out.println( "SQL Exception : " + e.getMessage() );
+            }
+        }// finally block end
+    }
+
+    // Returns the OrgUnitTree for which Root is the orgUnit
+    @SuppressWarnings( "unchecked" )
+    public List<OrganisationUnit> getChildOrgUnitTree( OrganisationUnit orgUnit )
+    {
+        List<OrganisationUnit> orgUnitTree = new ArrayList<OrganisationUnit>();
+        orgUnitTree.add( orgUnit );
+
+        List<OrganisationUnit> children = new ArrayList<OrganisationUnit>( orgUnit.getChildren() );
+        Collections.sort( children, new OrganisationUnitNameComparator() );
+
+        Iterator childIterator = children.iterator();
+        OrganisationUnit child;
+        while ( childIterator.hasNext() )
+        {
+            child = (OrganisationUnit) childIterator.next();
+            orgUnitTree.addAll( getChildOrgUnitTree( child ) );
+        }
+        return orgUnitTree;
+    }// getChildOrgUnitTree end
+
+    private void getOrgUnitInfo( OrganisationUnit organisationUnit )
+    {
+        Collection<OrganisationUnit> children = organisationUnit.getChildren();
+
+        Iterator<OrganisationUnit> childIterator = children.iterator();
+        OrganisationUnit child;
+        while ( childIterator.hasNext() )
+        {
+            child = childIterator.next();
+            orgUnitInfo += "," + child.getId();
+            getOrgUnitInfo( child );
+        }
+    }
+
+    private void getOrgUnitInfo( OrganisationUnit organisationUnit, Set<Source> 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" );
+
+        for ( DataElement de : dataElements )
+        {
+            deInfo.append( "," ).append( de.getId() );
+        }
+        return deInfo.toString();
+    }
+
+}// class end

=== added file 'local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ds/mobile/action/GenerateSummaryMobileDataStatusResultAction.java'
--- local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ds/mobile/action/GenerateSummaryMobileDataStatusResultAction.java	1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ds/mobile/action/GenerateSummaryMobileDataStatusResultAction.java	2010-11-25 07:50:13 +0000
@@ -0,0 +1,877 @@
+/*
+ * Copyright (c) 2004-2010, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ *   list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ *   this list of conditions and the following disclaimer in the documentation
+ *   and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ *   be used to endorse or promote products derived from this software without
+ *   specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.hisp.dhis.dashboard.ds.mobile.action;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.UUID;
+
+import org.hibernate.SessionFactory;
+import org.hisp.dhis.dashboard.util.DashBoardService;
+import org.hisp.dhis.dataelement.DataElement;
+import org.hisp.dhis.dataset.DataSet;
+import org.hisp.dhis.dataset.DataSetService;
+import org.hisp.dhis.options.displayproperty.DisplayPropertyHandler;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.organisationunit.OrganisationUnitLevel;
+import org.hisp.dhis.organisationunit.OrganisationUnitService;
+import org.hisp.dhis.organisationunit.comparator.OrganisationUnitNameComparator;
+import org.hisp.dhis.organisationunit.comparator.OrganisationUnitShortNameComparator;
+import org.hisp.dhis.period.Period;
+import org.hisp.dhis.period.PeriodService;
+import org.hisp.dhis.period.PeriodType;
+import org.hisp.dhis.source.Source;
+import org.hisp.dhis.user.User;
+import org.hisp.dhis.user.UserStore;
+import org.springframework.jdbc.core.JdbcTemplate;
+import org.springframework.jdbc.support.rowset.SqlRowSet;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Mithilesh Kumar Thakur
+ *
+ * @version GenerateSummaryMobileDataStatusResultAction.java Nov 24, 2010 4:32:00 PM
+ */
+public class GenerateSummaryMobileDataStatusResultAction
+implements Action
+{
+    // ---------------------------------------------------------------
+    // Dependencies
+    // ---------------------------------------------------------------
+   
+    private JdbcTemplate jdbcTemplate;
+
+    public void setJdbcTemplate( JdbcTemplate jdbcTemplate )
+    {
+        this.jdbcTemplate = jdbcTemplate;
+    }
+
+    @SuppressWarnings( "unused" )
+    private SessionFactory sessionFactory;
+
+    public void setSessionFactory( SessionFactory sessionFactory )
+    {
+        this.sessionFactory = sessionFactory;
+    }
+
+    private OrganisationUnitService organisationUnitService;
+
+    public void setOrganisationUnitService( OrganisationUnitService organisationUnitService )
+    {
+        this.organisationUnitService = organisationUnitService;
+    }
+
+    public OrganisationUnitService getOrganisationUnitService()
+    {
+        return organisationUnitService;
+    }
+
+    private PeriodService periodService;
+
+    public void setPeriodService( PeriodService periodService )
+    {
+        this.periodService = periodService;
+    }
+
+    private DataSetService dataSetService;
+
+    public void setDataSetService( DataSetService dataSetService )
+    {
+        this.dataSetService = dataSetService;
+    }
+
+    public DataSetService getDataSetService()
+    {
+        return dataSetService;
+    }
+
+    private DashBoardService dashBoardService;
+
+    public void setDashBoardService( DashBoardService dashBoardService )
+    {
+        this.dashBoardService = dashBoardService;
+    }
+
+    @SuppressWarnings("unused")
+        private DisplayPropertyHandler displayPropertyHandler;
+
+    public void setDisplayPropertyHandler( DisplayPropertyHandler displayPropertyHandler )
+    {
+        this.displayPropertyHandler = displayPropertyHandler;
+    }
+    
+    private UserStore userStore;
+
+    public void setUserStore( UserStore userStore )
+    {
+        this.userStore = userStore;
+    }
+    // ---------------------------------------------------------------
+    // Output Parameters
+    // ---------------------------------------------------------------
+
+    private Map<OrganisationUnit, List<Integer>> ouMapSummaryStatusResult;
+
+    public Map<OrganisationUnit, List<Integer>> getOuMapSummaryStatusResult()
+    {
+        return ouMapSummaryStatusResult;
+    }
+    
+    private Map<OrganisationUnit, String> ouMapUserPhoneNo;
+    
+    public Map<OrganisationUnit, String> getOuMapUserPhoneNo()
+    {
+        return ouMapUserPhoneNo;
+    }
+
+    private Collection<Period> periodList;
+
+    public Collection<Period> getPeriodList()
+    {
+        return periodList;
+    }
+
+    private List<OrganisationUnit> orgUnitList;
+
+    public List<OrganisationUnit> getOrgUnitList()
+    {
+        return orgUnitList;
+    }
+
+    private List<DataSet> dataSetList;
+
+    public List<DataSet> getDataSetList()
+    {
+        return dataSetList;
+    }
+
+    private List<Integer> results;
+
+    public List<Integer> getResults()
+    {
+        return results;
+    }
+
+    private Map<DataSet, Map<OrganisationUnit, List<Integer>>> dataStatusResult;
+
+    public Map<DataSet, Map<OrganisationUnit, List<Integer>>> getDataStatusResult()
+    {
+        return dataStatusResult;
+    }
+
+    private Map<DataSet, Collection<Period>> dataSetPeriods;
+
+    public Map<DataSet, Collection<Period>> getDataSetPeriods()
+    {
+        return dataSetPeriods;
+    }
+
+    List<Period> selectedPeriodList;
+
+    public List<Period> getSelectedPeriodList()
+    {
+        return selectedPeriodList;
+    }
+
+    List<String> levelNames;
+
+    public List<String> getLevelNames()
+    {
+        return levelNames;
+    }
+
+    private int maxOULevel;
+
+    public int getMaxOULevel()
+    {
+        return maxOULevel;
+    }
+    
+    private String userPhoneNo;
+    
+    public String getUserPhoneNo()
+    {
+        return userPhoneNo;
+    }
+    // ---------------------------------------------------------------
+    // Input Parameters
+    // ---------------------------------------------------------------
+
+
+
+    private String dsId;
+
+    public void setDsId( String dsId )
+    {
+        this.dsId = dsId;
+    }
+
+    private String includeZeros;
+
+    public void setIncludeZeros( String includeZeros )
+    {
+        this.includeZeros = includeZeros;
+    }
+    
+    public String getIncludeZeros()
+    {
+        return includeZeros;
+    }
+
+    private String ouId;
+
+    public void setOuId( String ouId )
+    {
+        this.ouId = ouId;
+    }
+
+    private String immChildOption;
+
+    public void setImmChildOption( String immChildOption )
+    {
+        this.immChildOption = immChildOption;
+    }
+
+    private int sDateLB;
+
+    public void setSDateLB( int dateLB )
+    {
+        sDateLB = dateLB;
+    }
+
+    public int getSDateLB()
+    {
+        return sDateLB;
+    }
+
+    private int eDateLB;
+
+    public void setEDateLB( int dateLB )
+    {
+        eDateLB = dateLB;
+    }
+
+    public int getEDateLB()
+    {
+        return eDateLB;
+    }
+
+    private String facilityLB;
+
+    public void setFacilityLB( String facilityLB )
+    {
+        this.facilityLB = facilityLB;
+    }
+
+    private List<String> orgUnitListCB;
+
+    public void setOrgUnitListCB( List<String> orgUnitListCB )
+    {
+        this.orgUnitListCB = orgUnitListCB;
+    }
+
+    private List<String> selectedDataSets;
+
+    public void setSelectedDataSets( List<String> selectedDataSets )
+    {
+        this.selectedDataSets = selectedDataSets;
+    }
+
+    public List<String> getSelectedDataSets()
+    {
+        return selectedDataSets;
+    }
+
+    private int minOULevel;
+
+    public int getMinOULevel()
+    {
+        return minOULevel;
+    }
+
+    private int number;
+
+    public int getNumber()
+    {
+        return number;
+    }
+
+    private DataSet selDataSet;
+
+    public DataSet getSelDataSet()
+    {
+        return selDataSet;
+    }
+
+    private List<String> periodNameList;
+
+    public List<String> getPeriodNameList()
+    {
+        return periodNameList;
+    }
+
+    String orgUnitInfo;
+
+    String periodInfo;
+
+    String deInfo;
+
+    int orgUnitCount;
+
+    private String dataViewName;
+
+    // ---------------------------------------------------------------
+    // Action Implementation
+    // ---------------------------------------------------------------
+//    @SuppressWarnings( { "deprecation", "unchecked" } )
+    public String execute()
+        throws Exception
+    {
+        orgUnitCount = 0;
+        dataViewName = "";
+
+        // Intialization
+        periodNameList = new ArrayList<String>();
+        ouMapSummaryStatusResult = new HashMap<OrganisationUnit, List<Integer>>();
+        ouMapUserPhoneNo = new HashMap<OrganisationUnit,String>();
+        
+        results = new ArrayList<Integer>();
+        maxOULevel = 1;
+        minOULevel = organisationUnitService.getNumberOfOrganisationalLevels();
+
+        //System.out.println( "BLABLA : " + immChildOption + " : " + dsId + " : " + ouId + " : " + sDateLB + " : " + eDateLB );
+        //System.out.println( "BLA : " + immChildOption + " : " + dsId + " : " + ouId + " : " + sDateLB + " : " + eDateLB );
+
+        if ( immChildOption != null && immChildOption.equalsIgnoreCase( "yes" ) )
+        {
+            orgUnitListCB = new ArrayList<String>();
+            orgUnitListCB.add( ouId );
+            facilityLB = "immChildren";
+            selectedDataSets = new ArrayList<String>();
+            selectedDataSets.add( dsId );
+        }
+
+        // DataSet Related Info
+        dataSetList = new ArrayList<DataSet>();
+
+        deInfo = "-1";
+        if ( selectedDataSets == null )
+        {
+            System.out.println( "slectedDataSets is empty" );
+        }
+        else
+        {
+            //System.out.println( "slectedDataSets is not empty" );
+        }
+        for ( String ds : selectedDataSets )
+        {
+            DataSet dSet = dataSetService.getDataSet( Integer.parseInt( ds ) );
+            selDataSet = dSet;
+            for ( DataElement de : dSet.getDataElements() )
+                deInfo += "," + de.getId();
+        }
+
+        // OrgUnit Related Info
+        OrganisationUnit selectedOrgUnit = new OrganisationUnit();
+        orgUnitList = new ArrayList<OrganisationUnit>();
+        if ( facilityLB.equals( "children" ) )
+        {
+            selectedOrgUnit = organisationUnitService.getOrganisationUnit( Integer.parseInt( orgUnitListCB.get( 0 ) ) );
+            orgUnitList = getChildOrgUnitTree( selectedOrgUnit );
+        }
+        else if ( facilityLB.equals( "immChildren" ) )
+        {
+            @SuppressWarnings( "unused" )
+            int number;
+            selectedOrgUnit = organisationUnitService.getOrganisationUnit( Integer.parseInt( orgUnitListCB.get( 0 ) ) );
+            number = selectedOrgUnit.getChildren().size();
+            orgUnitList = new ArrayList<OrganisationUnit>();
+            Iterator<String> orgUnitIterator = orgUnitListCB.iterator();
+            while ( orgUnitIterator.hasNext() )
+            {
+                OrganisationUnit o = organisationUnitService.getOrganisationUnit( Integer
+                    .parseInt( (String) orgUnitIterator.next() ) );
+                List<OrganisationUnit> organisationUnits = new ArrayList<OrganisationUnit>( o.getChildren() );
+                Collections.sort( organisationUnits, new OrganisationUnitShortNameComparator() );
+                orgUnitList.addAll( organisationUnits );
+                orgUnitList.add( 0, o );
+            }
+            //System.out.println( "Selected is immediate children" );
+        }
+        else
+        {
+            Iterator<String> orgUnitIterator = orgUnitListCB.iterator();
+            OrganisationUnit o;
+            while ( orgUnitIterator.hasNext() )
+            {
+                o = organisationUnitService.getOrganisationUnit( Integer.parseInt( orgUnitIterator.next() ) );
+                orgUnitList.add( o );
+            }
+        }
+
+        Set<Source> dSetSource = selDataSet.getSources();      
+        orgUnitInfo = "-1";
+        Iterator<OrganisationUnit> ouIt = orgUnitList.iterator();
+        while ( ouIt.hasNext() )
+        {
+            OrganisationUnit ou = ouIt.next();
+            orgUnitCount = 0;
+            if ( !dSetSource.contains( ou ) )
+            {
+                getDataSetAssignedOrgUnitCount( ou, dSetSource );
+                if ( orgUnitCount > 0 )
+                {
+                    orgUnitInfo += "," + ou.getId();
+                    getOrgUnitInfo( ou );
+                }
+                else
+                {
+                    ouIt.remove();
+                }
+            }
+            else
+            {
+                orgUnitInfo += "," + ou.getId();
+            }
+        }
+       
+        // Period Related Info
+        Period startPeriod = periodService.getPeriod( sDateLB );
+        Period endPeriod = periodService.getPeriod( eDateLB );
+
+        PeriodType dataSetPeriodType = selDataSet.getPeriodType();       
+        periodList = new ArrayList<Period>( periodService.getIntersectingPeriodsByPeriodType( dataSetPeriodType,
+            startPeriod.getStartDate(), endPeriod.getEndDate() ) );
+
+        periodInfo = "-1";
+        for ( Period p : periodList )
+            periodInfo += "," + p.getId();
+
+        dataViewName = createDataView( orgUnitInfo, deInfo, periodInfo );
+        String query = "";
+        String query2 = "";
+
+        query = "SELECT COUNT(*) FROM " + dataViewName
+            + " WHERE dataelementid IN (?) AND sourceid IN (?) AND periodid IN (?)";
+
+        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;
+        Set<Source> dso = new HashSet<Source>();
+        Iterator<Period> periodIterator;
+        dso = selDataSet.getSources();
+        String orgUnitId = "";
+        
+        while ( orgUnitListIterator.hasNext() )
+        {
+            //System.out.println( "Getting into first orgunit loop" );
+            o = (OrganisationUnit) orgUnitListIterator.next();
+           
+            // user phone no
+            userPhoneNo = "";
+            
+            List<User> users = new ArrayList<User>( userStore.getUsersByOrganisationUnit( o ) );
+            
+            for ( User user : users )
+            {
+                if ( user != null && user.getPhoneNumber() != null  && !user.getPhoneNumber().trim().equalsIgnoreCase( "" ) )
+                {
+                    userPhoneNo += user.getPhoneNumber() + ", ";
+                }
+            }    
+            
+            ouMapUserPhoneNo.put( o, userPhoneNo );
+            
+            
+            
+            
+            orgUnitInfo = "" + o.getId();
+
+            if ( maxOULevel < organisationUnitService.getLevelOfOrganisationUnit( o ) )
+                maxOULevel = organisationUnitService.getLevelOfOrganisationUnit( o );
+
+            if ( minOULevel > organisationUnitService.getLevelOfOrganisationUnit( o ) )
+                minOULevel = organisationUnitService.getLevelOfOrganisationUnit( o );
+
+            periodIterator = periodList.iterator();
+            Period p;
+            double dataStatusPercentatge;
+            List<Integer> dsResults = new ArrayList<Integer>();
+            List<Integer> dsSummaryResults = new ArrayList<Integer>();
+           
+            while ( periodIterator.hasNext() )
+            {
+                p = (Period) periodIterator.next();
+                periodInfo = "" + p.getId();
+                //System.out.println( "Getting into period loop" );
+
+                if ( dso == null )
+                {
+                    dsResults.add( -1 );
+                    dsSummaryResults.add( -1 );
+                    continue;
+                }
+                else if ( !dso.contains( o ) )
+                {
+                    List<OrganisationUnit> childOrgUnits = new ArrayList<OrganisationUnit>();
+                    childOrgUnits = filterChildOrgUnitsByDataSet( dataSetService.getDataSet( Integer
+                        .valueOf( selectedDataSets.get( 0 ) ) ), o );
+                    Iterator<OrganisationUnit> assignedChildrenIterator = childOrgUnits.iterator();
+                    int dataStatusCount = 0;
+
+                    while ( assignedChildrenIterator.hasNext() )
+                    {
+                        OrganisationUnit cUnit = (OrganisationUnit) assignedChildrenIterator.next();
+                        orgUnitInfo = "-1";
+                        orgUnitId = "-1,";
+                        orgUnitId += String.valueOf( cUnit.getId() );
+                        orgUnitCount = 0;
+                        getOrgUnitInfo( o, dso );
+
+                        if ( includeZeros == null )
+                        {
+                            query2 = "SELECT COUNT(*) FROM " + dataViewName + " WHERE dataelementid IN (" + deInfo
+                                + ") AND sourceid IN (" + orgUnitId + ") AND periodid IN (" + periodInfo
+                                + ") and value <> 0";
+                        }
+                        else
+                        {
+                            query2 = "SELECT COUNT(*) FROM " + dataViewName + " WHERE dataelementid IN (" + deInfo
+                                + ") AND sourceid IN (" + orgUnitId + ") AND periodid IN (" + periodInfo + ")";
+                        }
+
+                        SqlRowSet sqlResultSet = jdbcTemplate.queryForRowSet( query2 );
+
+                        if ( sqlResultSet.next() )
+                        {
+                            try
+                            {
+                                //System.out.println( "Result is : \t" + sqlResultSet.getLong( 1 ) );
+                                dataStatusPercentatge = ((double) sqlResultSet.getInt( 1 ) / (double) (dataSetMemberCount1)) * 100.0;
+                            }
+                            catch ( Exception e )
+                            {
+                                dataStatusPercentatge = 0.0;
+                            }
+                        }
+                        else
+                            dataStatusPercentatge = 0.0;
+
+                        if ( dataStatusPercentatge > 100.0 )
+                            dataStatusPercentatge = 100;
+
+                        dataStatusPercentatge = Math.round( dataStatusPercentatge * Math.pow( 10, 0 ) )
+                            / Math.pow( 10, 0 );
+
+                        if ( dataStatusPercentatge >= 5.0 )
+                        {
+                            dataStatusCount += 1;
+                        }
+                    }
+                    dsSummaryResults.add( dataStatusCount );
+
+                    continue;
+                }
+
+                orgUnitInfo = "" + o.getId();
+
+                if ( includeZeros == null )
+                {
+                    query = "SELECT COUNT(*) FROM " + dataViewName + " WHERE dataelementid IN (" + deInfo
+                        + ") AND sourceid IN (" + orgUnitInfo + ") AND periodid IN (" + periodInfo + ") and value <> 0";
+                }
+                else
+                {
+                    query = "SELECT COUNT(*) FROM " + dataViewName + " WHERE dataelementid IN (" + deInfo
+                        + ") AND sourceid IN (" + orgUnitInfo + ") AND periodid IN (" + periodInfo + ")";
+                }
+
+                SqlRowSet sqlResultSet = jdbcTemplate.queryForRowSet( query );
+
+                if ( sqlResultSet.next() )
+                {
+                    try
+                    {
+                        dataStatusPercentatge = ((double) sqlResultSet.getInt( 1 ) / (double) dataSetMemberCount1) * 100.0;
+                    }
+                    catch ( Exception e )
+                    {
+                        dataStatusPercentatge = 0.0;
+                    }
+                }
+                else
+                    dataStatusPercentatge = 0.0;
+
+                if ( dataStatusPercentatge > 100.0 )
+                    dataStatusPercentatge = 100;
+
+                dataStatusPercentatge = Math.round( dataStatusPercentatge * Math.pow( 10, 0 ) ) / Math.pow( 10, 0 );
+                dsResults.add( (int) dataStatusPercentatge );
+
+                if ( dataStatusPercentatge >= 5.0 )
+                {
+                    dsSummaryResults.add( 1 );
+                }
+                else
+                {
+                    dsSummaryResults.add( 0 );
+                }
+            }
+            ouMapSummaryStatusResult.put( o, dsSummaryResults );
+        }
+/*
+        Iterator orgUnitListIterator2 = orgUnitList.iterator();
+
+        while ( orgUnitListIterator2.hasNext() )
+        {
+           // OrganisationUnit oo = (OrganisationUnit) orgUnitListIterator2.next();
+            //System.out.println( "OrgUnit :\t" + oo.getShortName() + " \t and value : \t "
+            //    + ouMapSummaryStatusResult.get( oo ) );
+        }
+*/
+        // For Level Names
+        String ouLevelNames[] = new String[organisationUnitService.getNumberOfOrganisationalLevels() + 1];
+        
+        for ( int i = 0; i < ouLevelNames.length; i++ )
+        {
+            ouLevelNames[i] = "Level" + i;
+        }
+
+        List<OrganisationUnitLevel> ouLevels = new ArrayList<OrganisationUnitLevel>( organisationUnitService.getFilledOrganisationUnitLevels() );
+        
+        for ( OrganisationUnitLevel ouL : ouLevels )
+        {
+            ouLevelNames[ouL.getLevel()] = ouL.getName();
+        }
+
+        levelNames = new ArrayList<String>();
+        int count1 = minOULevel;
+        
+        while ( count1 <= maxOULevel )
+        {
+            levelNames.add( ouLevelNames[count1] );
+            count1++;
+        }
+
+        try
+        {
+
+        }
+        finally
+        {
+            try
+            {
+                deleteDataView( dataViewName );
+            }
+            catch ( Exception e )
+            {
+                System.out.println( "Exception while closing DB Connections : " + e.getMessage() );
+            }
+        }// finally block end
+
+        periodNameList = dashBoardService.getPeriodNamesByPeriodType( dataSetPeriodType, periodList );
+        return SUCCESS;
+    }
+
+    public void getDataSetAssignedOrgUnitCount( OrganisationUnit organisationUnit, Set<Source> dso )
+    {
+        Collection<OrganisationUnit> children = organisationUnit.getChildren();
+        Iterator<OrganisationUnit> childIterator = children.iterator();
+        OrganisationUnit child;
+        
+        while ( childIterator.hasNext() )
+        {
+            child = childIterator.next();
+            if ( dso.contains( child ) )
+            {
+                orgUnitCount++;
+            }
+            getDataSetAssignedOrgUnitCount( child, dso );
+        }
+    }
+
+    public String createDataView( String orgUnitInfo, String deInfo, String periodInfo )
+    {
+        String dataViewName = "_ds_" + UUID.randomUUID().toString();
+        dataViewName = dataViewName.replaceAll( "-", "" );
+        String query = "DROP VIEW IF EXISTS " + dataViewName;
+
+        try
+        {
+            @SuppressWarnings("unused")
+                        int sqlResult = jdbcTemplate.update( query );
+            System.out.println( "View " + dataViewName + " dropped Successfully (if exists) " );
+
+            query = "CREATE view " + dataViewName + " AS "
+                + " SELECT sourceid,dataelementid,periodid,value FROM datavalue " + " WHERE dataelementid in ("
+                + deInfo + ") AND " + " sourceid in (" + orgUnitInfo + ") AND " + " periodid in (" + periodInfo + ")";
+
+            sqlResult = jdbcTemplate.update( query );
+
+            System.out.println( "View " + dataViewName + " created Successfully" );
+        } // try block end
+        catch ( Exception e )
+        {
+            System.out.println( "SQL Exception : " + e.getMessage() );
+            return null;
+        }
+        finally
+        {
+            try
+            {
+
+            }
+            catch ( Exception e )
+            {
+                System.out.println( "SQL Exception : " + e.getMessage() );
+                return null;
+            }
+        }// finally block end
+
+        return dataViewName;
+    }
+
+    public void deleteDataView( String dataViewName )
+    {
+        String query = "DROP VIEW IF EXISTS " + dataViewName;
+
+        try
+        {
+            @SuppressWarnings("unused")
+                        int sqlResult = jdbcTemplate.update( query );
+            System.out.println( "View " + dataViewName + " dropped Successfully" );
+        } // try block end
+        catch ( Exception e )
+        {
+            System.out.println( "SQL Exception : " + e.getMessage() );
+        }
+        finally
+        {
+            try
+            {
+            }
+            catch ( Exception e )
+            {
+                System.out.println( "SQL Exception : " + e.getMessage() );
+            }
+        }// finally block end
+    }
+
+    // Returns the OrgUnitTree for which Root is the orgUnit
+    @SuppressWarnings( "unchecked" )
+    public List<OrganisationUnit> getChildOrgUnitTree( OrganisationUnit orgUnit )
+    {
+        List<OrganisationUnit> orgUnitTree = new ArrayList<OrganisationUnit>();
+        orgUnitTree.add( orgUnit );
+        List<OrganisationUnit> children = new ArrayList<OrganisationUnit>( orgUnit.getChildren() );
+        Collections.sort( children, new OrganisationUnitNameComparator() );
+        Iterator childIterator = children.iterator();
+        OrganisationUnit child;
+        
+        while ( childIterator.hasNext() )
+        {
+            child = (OrganisationUnit) childIterator.next();
+            orgUnitTree.addAll( getChildOrgUnitTree( child ) );
+        }
+        return orgUnitTree;
+    }// getChildOrgUnitTree end
+
+    private void getOrgUnitInfo( OrganisationUnit organisationUnit )
+    {
+        Collection<OrganisationUnit> children = organisationUnit.getChildren();
+        Iterator<OrganisationUnit> childIterator = children.iterator();
+        OrganisationUnit child;
+        while ( childIterator.hasNext() )
+        {
+            child = childIterator.next();
+            orgUnitInfo += "," + child.getId();
+            getOrgUnitInfo( child );
+        }
+    }
+
+    private void getOrgUnitInfo( OrganisationUnit organisationUnit, Set<Source> 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" );
+        for ( DataElement de : dataElements )
+        {
+            deInfo.append( "," ).append( de.getId() );
+        }
+        return deInfo.toString();
+    }
+
+    private List<OrganisationUnit> filterChildOrgUnitsByDataSet( DataSet selectedDataSet,
+        OrganisationUnit selectedOrganisationUnit )
+    {
+        List<OrganisationUnit> filteredOrganisationUnits = getChildOrgUnitTree( selectedOrganisationUnit );
+
+        @SuppressWarnings( "unused" )
+        List<OrganisationUnit> assignedOrganisationUnits = new ArrayList<OrganisationUnit>();
+        Set<Source> assignedSources = selectedDataSet.getSources();
+        filteredOrganisationUnits.retainAll( assignedSources );
+        return filteredOrganisationUnits;
+    }
+
+}// class end
+

=== modified file 'local/in/dhis-web-dashboard/src/main/resources/META-INF/dhis/beans.xml'
--- local/in/dhis-web-dashboard/src/main/resources/META-INF/dhis/beans.xml	2010-11-24 09:27:00 +0000
+++ local/in/dhis-web-dashboard/src/main/resources/META-INF/dhis/beans.xml	2010-11-25 07:50:13 +0000
@@ -436,6 +436,8 @@
             <ref bean="org.hisp.dhis.period.PeriodService"/>
         </property>-->
     </bean>	
+	
+	<!-- for Mobile Validation Status -->
     <bean id="org.hisp.dhis.dashboard.ds.mobile.action.GenerateValidationMobileStatusResultAction"
         class="org.hisp.dhis.dashboard.ds.mobile.action.GenerateValidationMobileStatusResultAction"
         scope="prototype">
@@ -455,7 +457,102 @@
 		<property name="userStore" ref="org.hisp.dhis.user.UserStore">
 		</property>
     </bean>
-    <!-- DataStatus For Mobile end  -->	
+   
+	<!--  for Mobile summary data status -->
+	
+	<bean id="org.hisp.dhis.dashboard.ds.mobile.action.GenerateSummaryMobileDataStatusResultAction"
+        class="org.hisp.dhis.dashboard.ds.mobile.action.GenerateSummaryMobileDataStatusResultAction"
+        scope="prototype">
+        <property name="dashBoardService">
+            <ref bean="org.hisp.dhis.dashboard.util.DashBoardService"/>
+        </property>
+        <property name="dataSetService">
+            <ref bean="org.hisp.dhis.dataset.DataSetService"/>
+        </property>
+        <property name="periodService">
+            <ref bean="org.hisp.dhis.period.PeriodService"/>
+        </property>
+        <property name="organisationUnitService">
+            <ref bean="org.hisp.dhis.organisationunit.OrganisationUnitService"/>
+        </property>
+        <property name="sessionFactory" ref="sessionFactory"/>
+        <property name="jdbcTemplate" ref="jdbcTemplate"/>
+		<property name="userStore" ref="org.hisp.dhis.user.UserStore">
+        </property>
+	</bean>
+	
+	<!--  for Mobile  dataStatus result -->
+    <bean id="org.hisp.dhis.dashboard.ds.mobile.action.GenerateMobileDataStatusResultAction"
+        class="org.hisp.dhis.dashboard.ds.mobile.action.GenerateMobileDataStatusResultAction"
+        scope="prototype">
+        <property name="dashBoardService">
+            <ref bean="org.hisp.dhis.dashboard.util.DashBoardService"/>
+        </property>
+        <property name="dataSetService">
+            <ref bean="org.hisp.dhis.dataset.DataSetService"/>
+        </property>
+        <property name="periodService">
+            <ref bean="org.hisp.dhis.period.PeriodService"/>
+        </property>
+        <property name="organisationUnitService">
+            <ref bean="org.hisp.dhis.organisationunit.OrganisationUnitService"/>
+        </property>
+        <property name="sessionFactory" ref="sessionFactory"/>
+        <property name="jdbcTemplate" ref="jdbcTemplate"/>
+		<property name="userStore" ref="org.hisp.dhis.user.UserStore">
+        </property>
+    </bean>	
+	
+	<!--  for Mobile Group wise data status -->    
+    <bean id="org.hisp.dhis.dashboard.ds.mobile.action.GenerateGroupWiseMobileDataStatusResultAction"
+        class="org.hisp.dhis.dashboard.ds.mobile.action.GenerateGroupWiseMobileDataStatusResultAction"
+        scope="prototype">
+        <property name="dashBoardService">
+            <ref bean="org.hisp.dhis.dashboard.util.DashBoardService"/>
+        </property>
+        <property name="dataSetService">
+            <ref bean="org.hisp.dhis.dataset.DataSetService"/>
+        </property>
+        <property name="dataElementService">
+            <ref bean="org.hisp.dhis.dataelement.DataElementService"/>
+        </property>
+        <property name="periodService">
+            <ref bean="org.hisp.dhis.period.PeriodService"/>
+        </property>
+        <property name="organisationUnitService">
+            <ref bean="org.hisp.dhis.organisationunit.OrganisationUnitService"/>
+        </property>
+        <property name="sessionFactory" ref="sessionFactory"/>
+        <property name="jdbcTemplate" ref="jdbcTemplate"/>
+		<property name="userStore" ref="org.hisp.dhis.user.UserStore">
+        </property>
+    </bean>	
+	
+    <!-- for Mobile Last Updated Status -->    	
+	<bean id="org.hisp.dhis.dashboard.ds.mobile.action.GenerateLastUpdatedMobileDataSetResultAction"
+        class="org.hisp.dhis.dashboard.ds.mobile.action.GenerateLastUpdatedMobileDataSetResultAction"
+        scope="prototype">
+
+        <property name="dashBoardService">
+            <ref bean="org.hisp.dhis.dashboard.util.DashBoardService"/>
+        </property>
+        <property name="dataSetService">
+            <ref bean="org.hisp.dhis.dataset.DataSetService"/>
+        </property>
+        <property name="periodService">
+            <ref bean="org.hisp.dhis.period.PeriodService"/>
+        </property>
+        <property name="organisationUnitService">
+            <ref bean="org.hisp.dhis.organisationunit.OrganisationUnitService"/>
+        </property>
+        <property name="userStore">
+            <ref bean="org.hisp.dhis.user.UserStore"/>
+        </property>
+        <property name="jdbcTemplate" ref="jdbcTemplate"/>
+<!--    <property name="dataValueService" ref="org.hisp.dhis.datavalue.DataValueService"/> -->
+    </bean>
+	
+	 <!-- DataStatus For Mobile end  -->	
 	
 	
 	

=== modified file 'local/in/dhis-web-dashboard/src/main/resources/org/hisp/dhis/dashboard/i18n_module.properties'
--- local/in/dhis-web-dashboard/src/main/resources/org/hisp/dhis/dashboard/i18n_module.properties	2010-11-24 09:27:00 +0000
+++ local/in/dhis-web-dashboard/src/main/resources/org/hisp/dhis/dashboard/i18n_module.properties	2010-11-25 07:50:13 +0000
@@ -69,6 +69,11 @@
 ds_mobile = Mobile DataSet
 ds_mobile_anm_name = ANM Name
 ds_mobile_anm_phone = ANM Mobile No.
+ds_summary_status_mobile = Summary Status For Mobile DataSet
+ds_dataEntry_status_mobile = Data Entry Status For Mobile DataSet
+ds_dataentry_dataelement_group_status_mobile = Mobile Data Entry Status by Data Element Groups
+ds_dataelement_group_mobile = Mobile Data Element Group
+ds_lastupdated_status_mobile = Last Updated Status For Mobile DataSet
 
 #-------DataStatusOrganisationUnitGroupWise---------------------------#
 

=== modified file 'local/in/dhis-web-dashboard/src/main/resources/struts.xml'
--- local/in/dhis-web-dashboard/src/main/resources/struts.xml	2010-11-24 09:27:00 +0000
+++ local/in/dhis-web-dashboard/src/main/resources/struts.xml	2010-11-25 07:50:13 +0000
@@ -267,15 +267,47 @@
             <param name="javascripts">../dhis-web-commons/ouwt/ouwt.js,../dhis-web-commons/lists/lists.js,javascript/ds.js,javascript/db.js,javascript/date.js,javascript/hashtable.js</param>
             <param name="stylesheets">css/StylesForTags.css</param>
             <interceptor-ref name="organisationUnitTreeStack"/>
-        </action>		
-		
+        </action>
+				
+		<!-- for Mobile Validation Status -->
        <action name="validationMobileStatusResult"
             class="org.hisp.dhis.dashboard.ds.mobile.action.GenerateValidationMobileStatusResultAction">
             <result name="success" type="velocity">/dhis-web-dashboard/validationMobileSatusResult.vm</result>
             <param name="javascripts">javascript/ds.js,javascript/hashtable.js</param>
             <param name="stylesheets">css/StylesForTags.css</param>
        </action>
-			
+		
+		<!--  for Mobile summary data status -->
+       <action name="summaryMobileStatusResult"
+            class="org.hisp.dhis.dashboard.ds.mobile.action.GenerateSummaryMobileDataStatusResultAction">        
+            <result name="success" type="velocity">/dhis-web-dashboard/summaryMobileSatusResult.vm</result>
+            <param name="javascripts">javascript/ds.js,javascript/hashtable.js</param>
+            <param name="stylesheets">css/StylesForTags.css</param>
+       </action>		
+		
+		<!--  for Mobile  dataStatus result -->
+       <action name="mobileDataStatusResult"
+            class="org.hisp.dhis.dashboard.ds.mobile.action.GenerateMobileDataStatusResultAction">
+            <result name="success" type="velocity">/dhis-web-dashboard/mobileDataStatusResult.vm</result>
+            <param name="javascripts">javascript/ds.js,javascript/hashtable.js</param>
+            <param name="stylesheets">css/StylesForTags.css</param>
+       </action>
+		
+	 <!--  for Mobile Group wise data status -->			
+	  <action name="groupWiseMobileDataStatusResult"
+		   class="org.hisp.dhis.dashboard.ds.mobile.action.GenerateGroupWiseMobileDataStatusResultAction">
+	       <result name="success" type="velocity">/dhis-web-dashboard/groupWiseMobileDataStatusResult.vm</result>
+	       <param name="javascripts">javascript/ds.js,javascript/hashtable.js,javascript/date.js</param>
+	       <param name="stylesheets">css/StylesForTags.css</param>
+     </action>
+		
+     <!-- for Mobile Last Updated Status -->    
+     <action name="lastUpdatedMobileDataSetResult"
+            class="org.hisp.dhis.dashboard.ds.mobile.action.GenerateLastUpdatedMobileDataSetResultAction">
+            <result name="success" type="velocity">/dhis-web-dashboard/lastUpdatedMobileDataSetSatusResult.vm</result>
+            <param name="javascripts">javascript/ds.js,javascript/hashtable.js</param>
+            <param name="stylesheets">css/StylesForTags.css</param>
+    </action>						
         <!-- DataStatus For Mobile end  -->	
 			
 		<action name="summaryStatusResult"

=== modified file 'local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/dataStatusMobileFront.vm'
--- local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/dataStatusMobileFront.vm	2010-11-24 09:27:00 +0000
+++ local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/dataStatusMobileFront.vm	2010-11-25 07:50:13 +0000
@@ -100,16 +100,16 @@
         <tr>
             <td>
                 
-                <input type="button" name="ViewSummary" value="View DataSummary" style="font-family: Arial; font-weight: bold; color: rgb(0, 0, 0);" onclick="textvalue('SummaryStatus')"/>
-                <input type="button" name="ViewStatus" value="View DataStatus" style="font-family: Arial; font-weight: bold; color: rgb(0, 0, 0);" onclick="textvalue('DataStatus')"/>
+                <input type="button" name="ViewSummary" value="View DataSummary" style="font-family: Arial; font-weight: bold; color: rgb(0, 0, 0);" onclick="textvalue('SummaryMobileStatus')"/>
+                <input type="button" name="ViewStatus" value="View DataStatus" style="font-family: Arial; font-weight: bold; color: rgb(0, 0, 0);" onclick="textvalue('MobileDataStatus')"/>
             </td>
             <td class="NormalB">
                 <br/><br/><br/><br/><br/>
-                <input type="button" name="LastUpdatedStatus" value="   User Details   " style="font-family: Arial; font-weight: bold; color: rgb(0, 0, 0);" onclick="textvalue('LastUpdatedStatus')"/>
+                <input type="button" name="LastUpdatedStatus" value="   User Details   " style="font-family: Arial; font-weight: bold; color: rgb(0, 0, 0);" onclick="textvalue('LastUpdatedMobileStatus')"/>
             </td>
             <td>
                 
-                <input type="button" name="ViewGroupWise" value="View By Data Element Group" style="font-family: Arial; font-weight: bold; color: rgb(0, 0, 0);" onclick="textvalue('GroupWiseStatus')"/>
+                <input type="button" name="ViewGroupWise" value="View By Data Element Group" style="font-family: Arial; font-weight: bold; color: rgb(0, 0, 0);" onclick="textvalue('GroupWiseMobileStatus')"/>
                 <input type="button" name="ValidationStatus" value="Validation Status" style="font-family: Arial; font-weight: bold; color: rgb(0, 0, 0);" onclick="textvalue('ValidationMobileStatus')"/>
             </td>
         </tr>

=== added file 'local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/groupWiseMobileDataStatusResult.vm'
--- local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/groupWiseMobileDataStatusResult.vm	1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/groupWiseMobileDataStatusResult.vm	2010-11-25 07:50:13 +0000
@@ -0,0 +1,124 @@
+
+<html>
+    <head>
+        <title>Mobile DataStatus Result(Data Element Group Wise)</title>
+        <link type="text/css" rel="stylesheet" media="screen" href="css/StylesForTags.css">
+        <script>
+            var startDate = "$sDateLB"; 
+            var endDate = "$eDateLB";
+            var dsType = "$selectedButton";
+            
+            function getImmChildInfo(evt, dsId, selOrgUnit)
+            {
+                immChildOption = "yes";             
+                
+                //evt.target.href = "groupWiseDataStatusResult.action?immChildOption="+immChildOption+"&dsId="+dsId+"&sDateLB="+startDate+"&eDateLB="+endDate+"&ouId="+selOrgUnit;
+                
+                if( document.getElementById('includeZeros').checked )
+                {
+                    evt.target.href = "groupWiseMobileDataStatusResult.action?immChildOption="+immChildOption+"&dsId="+dsId+"&sDateLB="+startDate+"&eDateLB="+endDate+"&ouId="+selOrgUnit+"&selectedButton="+dsType+"&includeZeros="+includeZeros;
+                }
+                else
+                {
+                    evt.target.href = "groupWiseMobileDataStatusResult.action?immChildOption="+immChildOption+"&dsId="+dsId+"&sDateLB="+startDate+"&eDateLB="+endDate+"&ouId="+selOrgUnit+"&selectedButton="+dsType;
+                }           
+            }
+            
+            function exportDataStatusResultToWorkBook()
+            {               
+                document.getElementById('htmlCode').value = document.getElementById('formResult').innerHTML;
+                
+                opener.focus();
+            
+                return true;                
+            }
+        </script>   
+    </head>
+    <body>
+
+        <form id="form1" name="form1" action="exportDataStatusToExcel.action" method="post" onsubmit="return exportDataStatusResultToWorkBook()" target="_newtab">
+            <input type="hidden" name="htmlCode" id="htmlCode" />
+            <div align="right" class="NormalB">
+                <input type="checkbox" name="includeZeros" id="includeZeros" #if($includeZeros) checked #end /> Include Zero<br />
+                <input type="submit" name="ExportToWorkBook" value="Export To WorkBook" style="width: 160; height: 25; font-family:Arial; font-weight:bold; color:#000000">
+            </div>
+            
+        <div id="formResult">               
+                <div align="center" class="NormalB">$i18n.getString( "ds_dataentry_dataelement_group_status_mobile" )</div>
+        <div align="right">
+                        <table width="30%">
+                                <tr class="TableHeadingCellStyles" >
+                                    <td bgcolor="#a0c0a0">&nbsp;</td>
+                                    <td align="left">&nbsp;Completed (75+)</td>
+                                </tr>
+                                <tr class="TableHeadingCellStyles">
+                                    <td bgcolor="#a0a0ff">&nbsp;</td>
+                                    <td align="left">&nbsp;Partially Completed (41 - 75)</td>
+                                </tr>
+                                <tr class="TableHeadingCellStyles">
+                                    <td bgcolor="#905090">&nbsp;</td>
+                                    <td align="left">&nbsp;Not Completed (1 - 40)</td>
+                                </tr>
+                                <tr class="TableHeadingCellStyles">
+                                    <td bgcolor="#ff0000">&nbsp;</td>
+                                    <td align="left">&nbsp;Not Entered ( 0 )</td>
+                                </tr>
+                        </table>
+                </div>
+                #set($count2 = 0)
+                    #foreach($dataElementGroup in $dataElementGroups)
+            <br />
+                        <div align="left" class="NormalB">$i18n.getString( "ds_dataelement_group_mobile" ) : $dataElementGroup.name</div>
+                        <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse; border-style: solid" bordercolor="black" width="100%">       
+                              <tr class="TableHeadingCellStyles" align="center">
+                                  #foreach($levelName in $levelNames)
+                                      <td class="TableHeadingCellStyles"  bgcolor="#C0C0C0"><strong>$!levelName</strong></td>
+                                  #end
+                                  <td class="TableHeadingCellStyles"  bgcolor="#C0C0C0"><strong>$i18n.getString( "ds_mobile_anm_name" )</strong></td>
+                                  <td class="TableHeadingCellStyles"  bgcolor="#C0C0C0"><strong>$i18n.getString( "ds_mobile_anm_phone" )</strong></td>
+                                  #foreach($periodname in $periodNameList)
+                                      <td class="TableHeadingCellStyles"  bgcolor="#C0C0C0"><strong>$periodname</strong></td>
+                                  #end                                    
+                              </tr>
+                              #foreach($chiildorgUnit in $orgUnitList)
+                                  #set($count1 = $minOULevel)
+                                  #set($curOrgUnitLevel = $organisationUnitService.getLevelOfOrganisationUnit($chiildorgUnit))
+                                  <tr class="TableHeadingCellStyles">
+                                      #foreach($levelName in $levelNames)
+                                          #if($count1 == $curOrgUnitLevel)
+                                              <td><a href="#" onclick="javascript:getImmChildInfo(event, '$selDataSet.id', '$chiildorgUnit.id')" target="_blank">$chiildorgUnit.name</a></td>
+                                          #else
+                                              <td>&nbsp;</td>
+                                          #end
+                                          #set($count1 = $count1 + 1)
+                                      #end
+                                      #set( $dsValidationPhoneNo = $ouMapUserPhoneNo.get($chiildorgUnit) )
+                        
+                                     <td class="TableHeadingCellStyles">$!chiildorgUnit.comment</td>
+                         
+                                     <td class="TableHeadingCellStyles">$dsValidationPhoneNo</td>
+                                     
+                                      #set($periods = $dataSetPeriods.get($selDataSet))
+                                        #foreach($period in $periods)
+                                        #set($result = $results.get($count2))
+                                        #set($count2 = $count2 + 1)
+                                             #if($result < 0)
+                                                <td  bgcolor="white">&nbsp;</td>
+                                             #elseif($result == 0)
+                                                <td align="center" bgcolor="#ff0000"><font color="#ffffff">$result</font></td>
+                                             #elseif($result > 75)
+                                                <td align="center" bgcolor="#a0c0a0"><font color="#ffffff">$result</font></td>
+                                             #elseif($result > 40 && $result <= 75 )
+                                                <td align="center" bgcolor="#a0a0ff"><font color="#ffffff">$result</font></td>
+                                             #else
+                                                <td align="center" bgcolor="#905090"><font color="#ffffff">$result</font></td>
+                                             #end
+                                      #end
+                             </tr>
+                         #end
+            </table>
+                  #end
+        </div>
+                </form>
+    </body>
+</html>

=== modified file 'local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/javascript/ds.js'
--- local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/javascript/ds.js	2010-11-24 09:27:00 +0000
+++ local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/javascript/ds.js	2010-11-25 07:50:13 +0000
@@ -69,9 +69,8 @@
 
 function textvalue(summary)
 {
-  
     document.getElementById("selectedButton").value = summary;
-   // alert(summary);
+  
     if(formValidationsForDataStatus())
     {
         if(summary == "SummaryStatus")
@@ -80,34 +79,60 @@
             document.ChartGenerationForm.action = "summaryStatusResult.action";
             document.ChartGenerationForm.submit();
         }
+       // for Mobile summary data status
+        else if(summary == "SummaryMobileStatus")
+        {
+        	document.ChartGenerationForm.action = "summaryMobileStatusResult.action";
+            document.ChartGenerationForm.submit();
+        }        
+        
         else if(summary == "GroupWiseStatus")
         {
             document.ChartGenerationForm.action = "groupWiseDataStatusResult.action";
             document.ChartGenerationForm.submit();
   	 	
         }
+        //for Mobile Group wise data status
+        else if(summary == "GroupWiseMobileStatus")
+        {
+        	document.ChartGenerationForm.action = "groupWiseMobileDataStatusResult.action";
+            document.ChartGenerationForm.submit();
+        }
+        
         else if(summary == "ValidationStatus")
         {
+        	
         	document.ChartGenerationForm.action = "validationStatusResult.action";
-        	//alert("inside validation status reult");
             document.ChartGenerationForm.submit();
         }
+        // for Mobile Validation Status
         else if(summary == "ValidationMobileStatus")
         {
-            document.ChartGenerationForm.action = "validationMobileStatusResult.action";
+        	document.ChartGenerationForm.action = "validationMobileStatusResult.action";
             document.ChartGenerationForm.submit();
         }
         else if(summary == "LastUpdatedStatus")
         {
-            document.ChartGenerationForm.action = "lastUpdatedDataSetResult.action";
-            document.ChartGenerationForm.submit();
-        }
+        	document.ChartGenerationForm.action = "lastUpdatedDataSetResult.action";
+            document.ChartGenerationForm.submit();
+        }
+        // for Mobile Last Updated Status
+        else if(summary == "LastUpdatedMobileStatus")
+        {
+        	document.ChartGenerationForm.action = "lastUpdatedMobileDataSetResult.action";
+            document.ChartGenerationForm.submit();
+        }
+        // for Mobile  dataStatus result
+        else if(summary == "MobileDataStatus")
+        {
+        	document.ChartGenerationForm.action = "mobileDataStatusResult.action";
+            document.ChartGenerationForm.submit();
+        }
+        
         else
         {
-  	 	
             document.ChartGenerationForm.action = "dataStatusResult.action";
             document.ChartGenerationForm.submit();
-  	 	
         }
     }
   	 
@@ -197,14 +222,14 @@
         alert("Please Select OrganisationUnit"); return false;
     }
 
-    /*
+   /*
 	var k=0;
 	
 	 for(k=0;k<selOUListIndex;k++)
 	 {
 	 	document.ChartGenerationForm.orgUnitListCB.options[k].selected = true;
 	 }
-	 */
+	*/
     var sWidth = 850;
     var sHeight = 650;
     var LeftPosition=(screen.width)?(screen.width-sWidth)/2:100;
@@ -214,11 +239,12 @@
 		
     return true;
 
-} // formValidations Function End	
-
-
-// 
-//
+} 
+// formValidations Function End	
+
+
+
+
 //  Getting corresponding Period List for Datasets. 
 function getdSetPeriods()
 {

=== added file 'local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/lastUpdatedMobileDataSetSatusResult.vm'
--- local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/lastUpdatedMobileDataSetSatusResult.vm	1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/lastUpdatedMobileDataSetSatusResult.vm	2010-11-25 07:50:13 +0000
@@ -0,0 +1,102 @@
+<html>
+	<head>
+		<title>Last Updated Mobile Data Set Result</title>
+		<link type="text/css" rel="stylesheet" media="screen" href="css/StylesForTags.css">
+		
+		<!-- <script type="text/javascript" src="javascript/ds.js"></script> -->
+		
+		<script>
+		    var startDate = "$sDateLB"; 
+		    var endDate = "$eDateLB";
+		    var dsType = "$selectedButton";
+		    
+		    function getImmChildInfo(evt, dsId, selOrgUnit)
+		    {
+		        immChildOption = "yes";             
+		        evt.target.href = "lastUpdatedMobileDataSetResult.action?immChildOption="+immChildOption+"&dsId="+dsId+"&sDateLB="+startDate+"&eDateLB="+endDate+"&ouId="+selOrgUnit+"&selectedButton="+dsType;
+		    }
+		    
+		   function exportDataStatusResultToWorkBook()
+		   {               
+		    document.getElementById('htmlCode').value = document.getElementById('formResult').innerHTML;
+		    return true;                
+		   }
+		   
+		</script>   
+	</head>
+<body>
+
+#if( "$!ouMapDataStatusResult" == "" || $ouMapDataStatusResult.isEmpty() || $ouMapDataStatusResult.size() == 0 )
+    
+    <div align="center" class="NormalB">Selected OrgUnit and its Children are Not assigned to $selDataSet.name</div>
+
+#else
+
+        <form id="form1" name="form1" action="exportDataStatusToExcel.action" method="post" onsubmit="return exportDataStatusResultToWorkBook()" target="_newtab">
+            <input type="hidden" name="htmlCode" id="htmlCode" />
+            
+            
+            <div align="right" class="NormalB">
+                <!--<input type="checkbox" name="includeZeros" id="includeZeros" #if($includeZeros) checked #end /> Include Zero<br />-->
+                <input type="submit" name="ExportToWorkBook" value="Export To WorkBook" style="width: 160; height: 25; font-family:Arial; font-weight:bold; color:#000000">
+            </div>
+            
+        <div id="formResult">               
+                <div align="center" class="NormalB">$i18n.getString( "ds_lastupdated_status_mobile" )</div>
+        <div align="right">
+                        
+                </div>
+                #set($count2 = 0)
+                    
+            <br />
+                        <div align="left" class="NormalB">$i18n.getString( "ds_mobile" ): $selDataSet.name</div>
+                        <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse; border-style: solid" bordercolor="black" width="100%">       
+                              <tr class="TableHeadingCellStyles" align="center">
+                                  #foreach($levelName in $levelNames)
+                                      <td class="TableHeadingCellStyles"  bgcolor="#C0C0C0"><strong>$!levelName</strong></td>
+                                  #end                                
+                                 <td class="TableHeadingCellStyles"  bgcolor="#C0C0C0"><strong>$i18n.getString( "ds_mobile_anm_name" )</strong></td>
+                                 <td class="TableHeadingCellStyles"  bgcolor="#C0C0C0"><strong>$i18n.getString( "ds_mobile_anm_phone" )</strong></td>    
+                                  #foreach($periodname in $periodNameList)
+                                      <td class="TableHeadingCellStyles"  bgcolor="#C0C0C0"><strong>$periodname</strong></td>
+                                  #end
+                              </tr>
+                              
+                              #foreach($chiildorgUnit in $orgUnitList)
+                                  #set($count1 = $minOULevel)
+                                  #set($curOrgUnitLevel = $organisationUnitService.getLevelOfOrganisationUnit($chiildorgUnit))
+                                  <tr class="TableHeadingCellStyles">
+                                      #foreach($levelName in $levelNames)
+                                          #if($count1 == $curOrgUnitLevel)
+                                              <td><a href="#" onclick="javascript:getImmChildInfo(event, '$selDataSet.id', '$chiildorgUnit.id')" target="_blank">$chiildorgUnit.name</a></td>
+                                          #else
+                                              <td>&nbsp;</td>
+                                          #end
+                                          #set($count1 = $count1 + 1)
+                                      #end
+                                          #set( $dsValidationPhoneNo = $ouMapUserPhoneNo.get($chiildorgUnit) )
+                        
+                                         <td class="TableHeadingCellStyles">$!chiildorgUnit.comment</td>
+                         
+                                         <td class="TableHeadingCellStyles">$dsValidationPhoneNo</td>
+                                         
+                                          #set($dsResults = $ouMapDataStatusResult.get($chiildorgUnit))
+                                          #foreach($result in $dsResults)
+                                              
+                                          #set($count2 = $count2 + 1)
+                                            #if($result < 0)
+                                                <td  bgcolor="white">&nbsp;</td>
+                                            #else
+                                                <td align="center" bgcolor="white"><font color="#000000">$result</font></td>
+                                            #end
+                                          #end
+                              </tr>
+                        #end
+            </table>
+                  
+        </div>
+                </form>
+                
+#end                
+    </body>
+</html>

=== added file 'local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/mobileDataStatusResult.vm'
--- local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/mobileDataStatusResult.vm	1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/mobileDataStatusResult.vm	2010-11-25 07:50:13 +0000
@@ -0,0 +1,128 @@
+
+<html>
+    <head>
+        <title>DataStatus Result</title>
+        <link type="text/css" rel="stylesheet" media="screen" href="css/StylesForTags.css"> 
+        <script>
+            var startDate = "$sDateLB"; 
+            var endDate = "$eDateLB";
+            var dsType = "$selectedButton";
+            
+            function getImmChildInfo(evt, dsId, selOrgUnit)
+            {
+
+                immChildOption = "yes";             
+                                if( document.getElementById('includeZeros').checked )
+                {
+                    evt.target.href = "mobileDataStatusResult.action?immChildOption="+immChildOption+"&dsId="+dsId+"&sDateLB="+startDate+"&eDateLB="+endDate+"&ouId="+selOrgUnit+"&selectedButton="+dsType+"&includeZeros="+includeZeros;
+                }
+                else
+                {
+                    evt.target.href = "mobileDataStatusResult.action?immChildOption="+immChildOption+"&dsId="+dsId+"&sDateLB="+startDate+"&eDateLB="+endDate+"&ouId="+selOrgUnit+"&selectedButton="+dsType;
+                }   
+            }
+            
+        function exportDataStatusResultToWorkBook()
+        {               
+            document.getElementById('htmlCode').value = document.getElementById('formResult').innerHTML;
+                        
+            return true;                
+        }
+        </script>   
+    </head>
+    <body>
+
+#if( "$!ouMapDataStatusResult" == "" || $ouMapDataStatusResult.isEmpty() || $ouMapDataStatusResult.size() == 0 )
+    
+    <div align="center" class="NormalB">Selected OrgUnit and its Children are Not assigned to $selDataSet.name</div>
+
+#else
+<form id="form1" name="form1" action="exportDataStatusToExcel.action" method="post" onsubmit="return exportDataStatusResultToWorkBook()" target="_newtab">
+    <input type="hidden" name="htmlCode" id="htmlCode" />
+	    <div align="right" class="NormalB">
+	        <input type="checkbox" name="includeZeros" id="includeZeros" #if($includeZeros) checked #end /> Include Zero<br /> 
+	        <input type="submit" name="ExportToWorkBook" value="Export To WorkBook" style="width: 160; height: 25; font-family:Arial; font-weight:bold; color:#000000">
+	    </div>
+            
+    <div id="formResult">               
+    <div align="center" class="NormalB">$i18n.getString( "ds_dataEntry_status_mobile" )</div>
+    <div align="right">
+        <table width="30%">
+            <tr class="TableHeadingCellStyles" >
+	            <td bgcolor="#a0c0a0">&nbsp;</td>
+	            <td align="left">&nbsp;Completed (75+)</td>
+            </tr>
+            <tr class="TableHeadingCellStyles">
+	            <td bgcolor="#a0a0ff">&nbsp;</td>
+	            <td align="left">&nbsp;Partially Completed (41 - 75)</td>
+            </tr>
+            <tr class="TableHeadingCellStyles">
+                <td bgcolor="#905090">&nbsp;</td>
+                <td align="left">&nbsp;Not Completed (1 - 40)</td>
+            </tr>
+            <tr class="TableHeadingCellStyles">
+                <td bgcolor="#ff0000">&nbsp;</td>
+                <td align="left">&nbsp;Not Entered ( 0 )</td>
+            </tr>
+        </table>
+    </div>
+    #set($count2 = 0)
+
+    <br/>
+    <div align="left" class="NormalB">$i18n.getString( "ds_mobile" ) : $selDataSet.name</div>
+        <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse; border-style: solid" bordercolor="black" width="100%">       
+            <tr class="TableHeadingCellStyles" align="center">
+                #foreach($levelName in $levelNames)
+                    <td class="TableHeadingCellStyles"  bgcolor="#C0C0C0"><strong>$!levelName</strong></td>
+                #end
+                <td class="TableHeadingCellStyles"  bgcolor="#C0C0C0"><strong>$i18n.getString( "ds_mobile_anm_name" )</strong></td>
+                <td class="TableHeadingCellStyles"  bgcolor="#C0C0C0"><strong>$i18n.getString( "ds_mobile_anm_phone" )</strong></td>                  
+	              
+	            #foreach($periodname in $periodNameList)
+	                <td class="TableHeadingCellStyles"  bgcolor="#C0C0C0"><strong>$periodname</strong></td>
+	            #end
+           </tr>
+                              
+           #foreach($chiildorgUnit in $orgUnitList)
+	          #set($count1 = $minOULevel)
+	          #set($curOrgUnitLevel = $organisationUnitService.getLevelOfOrganisationUnit($chiildorgUnit))
+              <tr class="TableHeadingCellStyles">
+	              #foreach($levelName in $levelNames)
+	                  #if($count1 == $curOrgUnitLevel)
+	                      <td><a href="#" onclick="javascript:getImmChildInfo(event, '$selDataSet.id', '$chiildorgUnit.id')" target="_blank">$chiildorgUnit.name</a></td>
+	                  #else
+	                      <td>&nbsp;</td>
+	                  #end
+	                  #set($count1 = $count1 + 1)
+	              #end
+                 #set( $dsValidationPhoneNo = $ouMapUserPhoneNo.get($chiildorgUnit) )
+                 
+                 <td class="TableHeadingCellStyles">$!chiildorgUnit.comment</td>
+                 
+                 <td class="TableHeadingCellStyles">$dsValidationPhoneNo</td>
+                               
+                #set($dsresultList = $ouMapDataStatusResult.get($chiildorgUnit))
+                    #foreach($result in $dsresultList)
+	                   #set($count2 = $count2 + 1)
+	                    #if($result < 0)
+	                        <td  bgcolor="white">&nbsp;</td>
+		                      #elseif($result == 0)
+		                          <td align="center" bgcolor="#ff0000"><font color="#ffffff">$result</font></td>
+		                      #elseif($result > 75)
+		                          <td align="center" bgcolor="#a0c0a0"><font color="#ffffff">$result</font></td>
+		                      #elseif($result > 40 && $result <= 75 )
+		                           <td align="center" bgcolor="#a0a0ff"><font color="#ffffff">$result</font></td>
+		                      #else
+		                           <td align="center" bgcolor="#905090"><font color="#ffffff">$result</font></td>
+	                  #end
+	              #end
+            </tr>
+          #end
+       </table>
+                  
+  </div>
+</form>
+                
+#end                
+    </body>
+</html>

=== added file 'local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/summaryMobileSatusResult.vm'
--- local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/summaryMobileSatusResult.vm	1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/summaryMobileSatusResult.vm	2010-11-25 07:50:13 +0000
@@ -0,0 +1,117 @@
+
+<html>
+    <head>
+        <title>Summary Mobile Status Result</title>
+        <link type="text/css" rel="stylesheet" media="screen" href="css/StylesForTags.css">
+        <script>
+            var startDate = "$sDateLB"; 
+            var endDate = "$eDateLB";
+            var dsType = "$selectedButton";
+
+            function getImmChildInfo(evt, dsId, selOrgUnit)
+            {
+                immChildOption = "yes";             
+    
+                //var urlForImmChild = "dataStatusResult.action?immChildOption="+immChildOption+"&dsId="+dsId+"&sDateLB="+startDate+"&eDateLB="+endDate+"&ouId="+selOrgUnit;
+            
+                //evt.target.href = "dataStatusResult.action?immChildOption="+immChildOption+"&dsId="+dsId+"&sDateLB="+startDate+"&eDateLB="+endDate+"&ouId="+selOrgUnit+"&selectedButton="+dsType;
+                
+                if( document.getElementById('includeZeros').checked )
+                {
+                    evt.target.href = "summaryMobileStatusResult.action?immChildOption="+immChildOption+"&dsId="+dsId+"&sDateLB="+startDate+"&eDateLB="+endDate+"&ouId="+selOrgUnit+"&selectedButton="+dsType+"&includeZeros="+includeZeros;
+                }
+                else
+                {
+                    evt.target.href = "summaryMobileStatusResult.action?immChildOption="+immChildOption+"&dsId="+dsId+"&sDateLB="+startDate+"&eDateLB="+endDate+"&ouId="+selOrgUnit+"&selectedButton="+dsType;
+                }           
+            }
+            
+            function exportDataStatusResultToWorkBook()
+            {               
+                document.getElementById('htmlCode').value = document.getElementById('formResult').innerHTML;
+                        
+                return true;                
+            }
+        </script>   
+    </head>
+    <body>
+
+        <form id="form1" name="form1" action="exportDataStatusToExcel.action" method="post" onsubmit="return exportDataStatusResultToWorkBook()" target="_newtab">
+            <input type="hidden" name="htmlCode" id="htmlCode" />
+            <div align="right" class="NormalB">
+                <input type="checkbox" name="includeZeros" id="includeZeros" #if($includeZeros) checked #end /> Include Zero<br />
+                <input type="submit" name="ExportToWorkBook" value="Export To WorkBook" style="width: 160; height: 25; font-family:Arial; font-weight:bold; color:#000000">
+            </div>
+            
+        <div id="formResult">               
+                <div align="center" class="NormalB">$i18n.getString( "ds_summary_status_mobile" )</div>
+        <div align="right">
+                        <table width="30%">
+                                <tr class="TableHeadingCellStyles" >
+                                    <td bgcolor="#a0c0a0">&nbsp;</td>
+                                    <td align="left">&nbsp;Completed (5+)</td>
+                                </tr>
+                                
+                                <tr class="TableHeadingCellStyles">
+                                    <td bgcolor="#ff0000">&nbsp;</td>
+                                    <td align="left">&nbsp;Not Entered ( 0-5 )</td>
+                                </tr>
+                        </table>
+                </div>
+                #set($count2 = 0)
+                    
+            <br/>
+                    <div align="left" class="NormalB">$i18n.getString( "ds_mobile" ) : $selDataSet.name</div>
+                        <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse; border-style: solid" bordercolor="black" width="100%">       
+                              <tr class="TableHeadingCellStyles" align="center">
+                                  #foreach($levelName in $levelNames)
+                                      <td class="TableHeadingCellStyles"  bgcolor="#C0C0C0"><strong>$!levelName</strong></td>
+                                  #end
+                                 <td class="TableHeadingCellStyles"  bgcolor="#C0C0C0"><strong>$i18n.getString( "ds_mobile_anm_name" )</strong></td>
+                                 <td class="TableHeadingCellStyles"  bgcolor="#C0C0C0"><strong>$i18n.getString( "ds_mobile_anm_phone" )</strong></td>
+                                  
+                                  #foreach($periodname in $periodNameList)
+                                      <td class="TableHeadingCellStyles"  bgcolor="#C0C0C0"><strong>$periodname</strong></td>
+                                  #end
+                              </tr>
+                              
+                                 #foreach($chiildorgUnit in $orgUnitList)
+                                  #set($count1 = $minOULevel)
+                                  #set($curOrgUnitLevel = $organisationUnitService.getLevelOfOrganisationUnit($chiildorgUnit))
+                                  <tr class="TableHeadingCellStyles">
+                                      #foreach($levelName in $levelNames)
+                                          #if($count1 == $curOrgUnitLevel)
+                                              <td><a href="#" onclick="javascript:getImmChildInfo(event, '$selDataSet.id', '$chiildorgUnit.id')" target="_blank">$chiildorgUnit.name</a></td>
+                                          #else
+                                              <td>&nbsp;</td>
+                                          #end
+                                          #set($count1 = $count1 + 1)
+                                     #end
+                                #set( $dsValidationPhoneNo = $ouMapUserPhoneNo.get($chiildorgUnit) )
+                        
+                                <td class="TableHeadingCellStyles">$!chiildorgUnit.comment</td>
+                         
+                                <td class="TableHeadingCellStyles">$dsValidationPhoneNo</td>
+                                   
+                                #set($dsSummaryResults = $ouMapSummaryStatusResult.get($chiildorgUnit))
+                                 #foreach($result in $dsSummaryResults)
+                                              
+                                 #set($count2 = $count2 + 1)
+                                   #if($result < 0)
+                                    <td  bgcolor="white">&nbsp;</td>
+	                               #elseif($result == 0)
+	                                <td align="center" bgcolor="#ff0000"><font color="#ffffff">0</font></td>
+	                               #elseif($result == 1)
+	                                <td align="center" bgcolor="#a0c0a0"><font color="#ffffff">1</font></td>
+	                               #elseif($result > 1)
+	                                <td align="center" bgcolor="#a0c0a0"><font color="#ffffff">$result</font></td>
+	                               #end
+                                 #end
+                              </tr>
+                         #end
+               </table>
+                  
+        </div>
+                </form>
+    </body>
+</html>