← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2257: Added Daily and Weekly Period in Tabular Analysis in Dashboard

 

------------------------------------------------------------
revno: 2257
committer: Mithilesh Kumar Thakur<mithilesh.hisp@xxxxxxxxx>
branch nick: trunk
timestamp: Thu 2010-12-02 16:45:31 +0530
message:
  Added Daily and Weekly Period in Tabular Analysis in Dashboard
added:
  local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/action/GetWeeklyPeriodAction.java
  local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/responseWeeklyPeriods.vm
modified:
  local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ga/action/GenerateGraphicalAnalyserDataElementsFormAction.java
  local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ga/action/IndicatorwiseGAFormAction.java
  local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ta/action/GenerateTabularAnalysisFormAction.java
  local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ta/action/GenerateTabularAnalysisResultAction.java
  local/in/dhis-web-dashboard/src/main/resources/META-INF/dhis/beans.xml
  local/in/dhis-web-dashboard/src/main/resources/struts.xml
  local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/javascript/gadataelement.js
  local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/javascript/ta.js
  local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/tabularAnalysisFront.vm


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

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== added file 'local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/action/GetWeeklyPeriodAction.java'
--- local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/action/GetWeeklyPeriodAction.java	1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/action/GetWeeklyPeriodAction.java	2010-12-02 11:15:31 +0000
@@ -0,0 +1,167 @@
+/*
+ * 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.action;
+
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+import org.hisp.dhis.i18n.I18nFormat;
+import org.hisp.dhis.period.Period;
+import org.hisp.dhis.period.PeriodService;
+import org.hisp.dhis.period.PeriodType;
+import org.hisp.dhis.period.WeeklyPeriodType;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Mithilesh Kumar Thakur
+ *
+ * @version GetWeeklyPeriodAction.java Nov 30, 2010 12:14:31 PM
+ */
+public class GetWeeklyPeriodAction implements Action
+{
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
+
+    private PeriodService periodService;
+
+    public void setPeriodService( PeriodService periodService )
+    {
+        this.periodService = periodService;
+    } 
+    
+    private I18nFormat format;
+    
+    public void setFormat( I18nFormat format )
+    {
+        this.format = format;
+    }
+
+
+    // -------------------------------------------------------------------------
+    // Input & Output
+    // -------------------------------------------------------------------------
+    
+
+    private String yearList;
+    
+    public void setYearList( String yearList )
+    {
+        this.yearList = yearList;
+    }
+
+/*        
+    private List<String> yearList;
+    
+    public void setYearList( List<String> yearList )
+    {
+        this.yearList = yearList;
+    }
+*/    
+    private String weeklyPeriodTypeName;
+    
+    public void setWeeklyPeriodTypeName( String weeklyPeriodTypeName )
+    {
+        this.weeklyPeriodTypeName = weeklyPeriodTypeName;
+    }
+    
+    private List<String> weeklyPeriodList;
+    
+    public List<String> getWeeklyPeriodList()
+    {
+        return weeklyPeriodList;
+    }
+    
+    private List<Period> periods;
+    
+    public List<Period> getPeriods()
+    {
+        return periods;
+    }
+   
+    String[] yearListArray;
+   
+    private SimpleDateFormat simpleDateFormat1;
+    private SimpleDateFormat simpleDateFormat2;
+    // -------------------------------------------------------------------------
+    // Action implementation
+    // -------------------------------------------------------------------------
+
+
+    public String execute()
+        throws Exception
+    {
+       
+        simpleDateFormat1 = new SimpleDateFormat( "yyyy-MM-dd" );
+        
+        simpleDateFormat2 = new SimpleDateFormat("yyyy-MM-dd");
+        weeklyPeriodList = new ArrayList<String>();
+        
+        System.out.println( "selected Year  size : " + yearList.length());
+        
+        //tempYearList = new ArrayList<String>();
+        
+        weeklyPeriodTypeName = WeeklyPeriodType.NAME;
+        PeriodType periodType = periodService.getPeriodTypeByName( weeklyPeriodTypeName );
+        
+        yearListArray = yearList.split( ";" ) ;
+       // int j = yearListArray.length;
+        for ( int i = 0 ; i < yearListArray.length ; i++ )
+        {
+           // int selYear = Integer.parseInt( year.split( "-" )[0] );
+            
+           
+            String selYear = yearListArray[i].split( "-" )[0];
+            
+            String tempStartDate = selYear+"-01-01";
+            String tempEndDate = selYear+"-12-31";
+            
+            Date startDate = format.parseDate( tempStartDate );
+            Date endDate   = format.parseDate( tempEndDate );
+            
+            periods = new ArrayList<Period>( periodService.getPeriodsBetweenDates( periodType, startDate, endDate ) );
+            
+            System.out.println( "Period  size : " + periods.size());
+            for ( Period period : periods )
+            {
+                String tempPeriodName = simpleDateFormat1.format( period.getStartDate() ) + " To " + simpleDateFormat2.format( period.getEndDate() );
+                System.out.println( "tempPeriodName : " + tempPeriodName );
+                weeklyPeriodList.add( tempPeriodName );
+               // System.out.println( "weekly period is  : " + weeklyPeriodList );
+            }
+            
+        }
+        
+        //Collection<PeriodType> periodTypes = periodService.getAllPeriodTypes();
+        //PeriodType periodType = periodService.;
+        
+        return SUCCESS;   
+    }
+}

=== modified file 'local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ga/action/GenerateGraphicalAnalyserDataElementsFormAction.java'
--- local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ga/action/GenerateGraphicalAnalyserDataElementsFormAction.java	2010-10-28 09:25:22 +0000
+++ local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ga/action/GenerateGraphicalAnalyserDataElementsFormAction.java	2010-12-02 11:15:31 +0000
@@ -41,6 +41,7 @@
 import org.hisp.dhis.organisationunit.OrganisationUnitGroup;
 import org.hisp.dhis.organisationunit.OrganisationUnitGroupService;
 import org.hisp.dhis.period.DailyPeriodType;
+import org.hisp.dhis.period.FinancialAprilPeriodType;
 import org.hisp.dhis.period.MonthlyPeriodType;
 import org.hisp.dhis.period.OnChangePeriodType;
 import org.hisp.dhis.period.Period;
@@ -198,7 +199,7 @@
             String pTName = ptIterator.next().getName();
             if ( pTName.equalsIgnoreCase( DailyPeriodType.NAME ) || pTName.equalsIgnoreCase( TwoYearlyPeriodType.NAME )
                 || pTName.equalsIgnoreCase( OnChangePeriodType.NAME )
-                || pTName.equalsIgnoreCase( WeeklyPeriodType.NAME ) )
+                || pTName.equalsIgnoreCase( WeeklyPeriodType.NAME ) || pTName.equalsIgnoreCase( FinancialAprilPeriodType.NAME) )
             {
                 ptIterator.remove();
             }

=== modified file 'local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ga/action/IndicatorwiseGAFormAction.java'
--- local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ga/action/IndicatorwiseGAFormAction.java	2010-11-03 09:50:21 +0000
+++ local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ga/action/IndicatorwiseGAFormAction.java	2010-12-02 11:15:31 +0000
@@ -41,6 +41,7 @@
 import org.hisp.dhis.organisationunit.OrganisationUnitGroup;
 import org.hisp.dhis.organisationunit.OrganisationUnitGroupService;
 import org.hisp.dhis.period.DailyPeriodType;
+import org.hisp.dhis.period.FinancialAprilPeriodType;
 import org.hisp.dhis.period.MonthlyPeriodType;
 import org.hisp.dhis.period.OnChangePeriodType;
 import org.hisp.dhis.period.Period;
@@ -198,7 +199,7 @@
             String pTName = ptIterator.next().getName();
             if ( pTName.equalsIgnoreCase( DailyPeriodType.NAME ) || pTName.equalsIgnoreCase( TwoYearlyPeriodType.NAME )
                 || pTName.equalsIgnoreCase( OnChangePeriodType.NAME )
-                || pTName.equalsIgnoreCase( WeeklyPeriodType.NAME ) )
+                || pTName.equalsIgnoreCase( WeeklyPeriodType.NAME ) || pTName.equalsIgnoreCase( FinancialAprilPeriodType.NAME) )
             {
                 ptIterator.remove();
             }

=== modified file 'local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ta/action/GenerateTabularAnalysisFormAction.java'
--- local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ta/action/GenerateTabularAnalysisFormAction.java	2010-09-04 13:07:00 +0000
+++ local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ta/action/GenerateTabularAnalysisFormAction.java	2010-12-02 11:15:31 +0000
@@ -46,6 +46,7 @@
 import org.hisp.dhis.indicator.comparator.IndicatorNameComparator;
 import org.hisp.dhis.organisationunit.OrganisationUnitService;
 import org.hisp.dhis.period.DailyPeriodType;
+import org.hisp.dhis.period.FinancialAprilPeriodType;
 import org.hisp.dhis.period.MonthlyPeriodType;
 import org.hisp.dhis.period.OnChangePeriodType;
 import org.hisp.dhis.period.Period;
@@ -158,6 +159,20 @@
         return simpleDateFormat;
     }
 
+    private String dailyPeriodTypeName;
+   
+    public String getDailyPeriodTypeName()
+    {
+    return dailyPeriodTypeName;
+    }
+    
+    private String weeklyPeriodTypeName;
+    
+    public String getWeeklyPeriodTypeName()
+    {
+        return weeklyPeriodTypeName;
+    }
+
     private String monthlyPeriodTypeName;
 
     public String getMonthlyPeriodTypeName()
@@ -233,7 +248,7 @@
         periodTypes = new ArrayList<PeriodType>( periodService.getAllPeriodTypes() );
 
         Iterator<PeriodType> ptIterator = periodTypes.iterator();
-        while ( ptIterator.hasNext() )
+/*        while ( ptIterator.hasNext() )
         {
             String pTName = ptIterator.next().getName();
             if ( pTName.equalsIgnoreCase( DailyPeriodType.NAME ) || pTName.equalsIgnoreCase( TwoYearlyPeriodType.NAME )
@@ -243,11 +258,24 @@
                 ptIterator.remove();
             }
         }
-
+*/        
+        while ( ptIterator.hasNext() )
+        {
+            String pTName = ptIterator.next().getName();
+            if ( pTName.equalsIgnoreCase( FinancialAprilPeriodType.NAME ) || pTName.equalsIgnoreCase( TwoYearlyPeriodType.NAME )
+                || pTName.equalsIgnoreCase( OnChangePeriodType.NAME ) )
+            {
+                ptIterator.remove();
+            }
+        }
+        
         monthlyPeriods = new ArrayList<Period>( periodService.getPeriodsByPeriodType( new MonthlyPeriodType() ) );
         periodNameList = new ArrayList<String>();
         Collections.sort( monthlyPeriods, new PeriodComparator() );
         simpleDateFormat = new SimpleDateFormat( "MMM-yyyy" );
+        
+        dailyPeriodTypeName = DailyPeriodType.NAME;
+        weeklyPeriodTypeName = WeeklyPeriodType.NAME;
         monthlyPeriodTypeName = MonthlyPeriodType.NAME;
         quarterlyPeriodTypeName = QuarterlyPeriodType.NAME;
         sixMonthPeriodTypeName = SixMonthlyPeriodType.NAME;
@@ -268,6 +296,7 @@
         Collections.sort( yearlyPeriods, new PeriodComparator() );
         simpleDateFormat = new SimpleDateFormat( "yyyy" );
         //System.out.println( monthlyPeriodTypeName );
+       // System.out.println( dailyPeriodTypeName );
         int year;
         for ( Period p1 : yearlyPeriods )
         {

=== modified file 'local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ta/action/GenerateTabularAnalysisResultAction.java'
--- local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ta/action/GenerateTabularAnalysisResultAction.java	2010-11-02 11:35:05 +0000
+++ local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ta/action/GenerateTabularAnalysisResultAction.java	2010-12-02 11:15:31 +0000
@@ -33,6 +33,7 @@
 import java.io.InputStream;
 import java.text.SimpleDateFormat;
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.Date;
 import java.util.HashMap;
 import java.util.Iterator;
@@ -69,18 +70,18 @@
 import org.hisp.dhis.organisationunit.OrganisationUnitGroupService;
 import org.hisp.dhis.organisationunit.OrganisationUnitService;
 import org.hisp.dhis.organisationunit.comparator.OrganisationUnitNameComparator;
+import org.hisp.dhis.period.DailyPeriodType;
 import org.hisp.dhis.period.MonthlyPeriodType;
 import org.hisp.dhis.period.Period;
 import org.hisp.dhis.period.PeriodService;
 import org.hisp.dhis.period.PeriodType;
 import org.hisp.dhis.period.QuarterlyPeriodType;
 import org.hisp.dhis.period.SixMonthlyPeriodType;
+import org.hisp.dhis.period.WeeklyPeriodType;
 import org.hisp.dhis.period.YearlyPeriodType;
 
 import com.opensymphony.xwork2.Action;
 
-import java.util.Collections;
-
 public class GenerateTabularAnalysisResultAction
     implements Action
 {
@@ -304,7 +305,7 @@
         String endD = "";
 
         SimpleDateFormat simpleDateFormat = new SimpleDateFormat( "MMM-yyyy" );
-
+       // SimpleDateFormat simpleDateFormat1 = new SimpleDateFormat( "yyyy-MM-dd" );
        
         periodNames = new ArrayList<String>();
 
@@ -317,10 +318,16 @@
 
                 startD = "" + selYear + "-04-01";
                 endD = "" + (selYear + 1) + "-03-31";
-
+                
+                System.out.println( " Start Peroid  : " + format.parseDate( startD ) + " , End Peroid : " + format.parseDate( endD ) );
+                
                 selStartPeriodList.add( format.parseDate( startD ) );
                 selEndPeriodList.add( format.parseDate( endD ) );
-
+                
+                System.out.println( "Size of Start Peroid List : " + selStartPeriodList.size() + " , Size of End Peroid List : " + selEndPeriodList.size() );
+                
+                System.out.println( " Start Peroid List : " + selStartPeriodList + " , End Peroid List : " + selEndPeriodList );
+                
                 periodNames.add( "" + selYear + "-" + (selYear + 1) );
 
                 continue;
@@ -328,10 +335,11 @@
 
             for ( String periodStr : periodLB )
             {
-                int period = Integer.parseInt( periodStr );
+               // int period = Integer.parseInt( periodStr );
 
                 if ( periodTypeLB.equalsIgnoreCase( MonthlyPeriodType.NAME ) )
                 {
+                    int period = Integer.parseInt( periodStr );
                     simpleDateFormat = new SimpleDateFormat( "MMM-yyyy" );
 
                     if ( period >= 9 )
@@ -339,7 +347,8 @@
                         startD = "" + (selYear + 1) + "-" + monthOrder[period] + "-01";
                         endD = "" + (selYear + 1) + "-" + monthOrder[period] + "-" + monthDays[period];
 
-                        if ( (selYear + 1) % 4 == 0 && period == 10 )
+                        //( selYear % 400 == 0) || (( selYear % 100 != 0 && selYear % 4 == 0))
+                        if ( ((selYear + 1) % 400 == 0 ) || ((( selYear+1) % 100 != 0 && ( selYear+1 ) % 4 == 0)) && period == 10 )
                         {
                             endD = "" + (selYear + 1) + "-" + monthOrder[period] + "-" + (monthDays[period] + 1);
                         }
@@ -350,12 +359,25 @@
                         endD = "" + selYear + "-" + monthOrder[period] + "-" + monthDays[period];
                     }
 
+                   
+                    System.out.println( "Start Date : " + startD + " , End Date : " + endD );
+                    
                     selStartPeriodList.add( format.parseDate( startD ) );
                     selEndPeriodList.add( format.parseDate( endD ) );
+                    
+                    System.out.println( "Size of Start Date List : " + selStartPeriodList.size() + " , Size of End Date List : " + selEndPeriodList.size() );
+                    
                     periodNames.add( simpleDateFormat.format( format.parseDate( startD ) ) );
+                    
+                    System.out.println( "Size of Period Name List  : " + periodNames.size() );
+                    //Date startDate = simpleDateFormat1.parse( startD );
+                    //Date endDate = simpleDateFormat1.parse( tempEndDate );
+                    //periodNames.add( startD );
+                    
                 }
                 else if ( periodTypeLB.equalsIgnoreCase( QuarterlyPeriodType.NAME ) )
                 {
+                    int period = Integer.parseInt( periodStr );
                     if ( period == 0 )
                     {
                         startD = "" + selYear + "-04-01";
@@ -385,6 +407,7 @@
                 }
                 else if ( periodTypeLB.equalsIgnoreCase( SixMonthlyPeriodType.NAME ) )
                 {
+                    int period = Integer.parseInt( periodStr );
                     if ( period == 0 )
                     {
                         startD = "" + selYear + "-04-01";
@@ -400,13 +423,79 @@
                     selStartPeriodList.add( format.parseDate( startD ) );
                     selEndPeriodList.add( format.parseDate( endD ) );
                 }
-
-                // selStartPeriodList.add( format.parseDate( startD ) );
-                // selEndPeriodList.add( format.parseDate( endD ) );
-                // System.out.println( startD + " : " + endD );
-            }
-        }
-
+                else if ( periodTypeLB.equalsIgnoreCase( DailyPeriodType.NAME ) )
+                {
+                    //int month = Integer.parseInt( periodStr.split( "-" )[0] );
+                   String  month = periodStr.split( "-" )[0] ;
+                   //System.out.println( " Month : " + month );
+                   String  date = periodStr.split( "-" )[1] ;
+                    //int day = Integer.parseInt( periodStr.split( "-" )[1] );
+                   // System.out.println( " Day : " + date );
+                    
+                    startD = selYear + "-" + periodStr;
+                    endD = selYear + "-" + periodStr ;
+                   
+                   // System.out.println( "selectedYear" + " : " + selYear );
+                   // System.out.println( "selectedYear+1" + " : " + ( selYear + 1 ) );
+                   
+                   // if( year%400 ==0 || (year%100 != 0 && year%4 == 0))// leap year for centure year
+                    
+                    if ( selYear  % 4 != 0 && month.trim().equalsIgnoreCase( "02" )  && date.trim().equalsIgnoreCase( "29" ) )
+                    {
+                       // System.out.println( " Inside Non-leap Year " );
+                        startD = selYear + "-" + month + "-" + date;
+                        endD = selYear + "-" + month + "-" + date;
+                       // selStartPeriodList.remove( format.parseDate( startD ));
+                        //selEndPeriodList.remove( format.parseDate( endD ));
+                        continue;
+                        
+                       // endD = "" + (selYear + 1) + "-" + monthOrder[period] + "-" + (monthDays[period] + 1);
+                    }
+                    
+                    
+                    if ( (( selYear % 400 == 0) || (( selYear % 100 != 0 && selYear % 4 == 0))) && month.trim().equalsIgnoreCase( "02" )  && date.trim().equalsIgnoreCase( "29" ) ); 
+                    {
+                       // System.out.println( " Inside Leap Year " );
+                        startD = selYear + "-" + month + "-" + date;
+                        endD = selYear  + "-" + month + "-" + date;
+                       // endD = "" + (selYear + 1) + "-" + monthOrder[period] + "-" + (monthDays[period] + 1);
+                    }
+                    
+                   
+                    
+                    selStartPeriodList.add( format.parseDate( startD ) );
+                    selEndPeriodList.add( format.parseDate( endD ) );
+                    
+                    periodNames.add( startD );
+                    System.out.println( startD + " : " + endD );
+                }
+            }
+        }
+        
+        // for weekly period
+        
+        if ( periodTypeLB.equalsIgnoreCase( WeeklyPeriodType.NAME ) )
+        {
+            for ( String periodStr : periodLB )
+            {
+                String  startWeekDate = periodStr.split( "To" )[0] ; //for start week
+                String  endWeekDate = periodStr.split( "To" )[1] ; //for end week
+                
+                startD = startWeekDate.trim();
+                endD = endWeekDate.trim();
+                
+                selStartPeriodList.add( format.parseDate( startD ) );
+                selEndPeriodList.add( format.parseDate( endD ) );
+                
+                periodNames.add( periodStr );
+                System.out.println( startD + " : " + endD );
+            }
+        }
+        
+        
+ // calling diffrent functions       
+        
+        
         if ( ouRadio.equalsIgnoreCase( ORGUNITSELECTED ) )
         {
             System.out.println( "Report Generation Start Time is : \t" + new Date() );

=== 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-30 05:48:19 +0000
+++ local/in/dhis-web-dashboard/src/main/resources/META-INF/dhis/beans.xml	2010-12-02 11:15:31 +0000
@@ -899,8 +899,17 @@
 	<!-- OrganisationUnit Profile -->
 	
 	<!-- Ajax -->
-	
-    <bean id="org.hisp.dhis.dashboard.action.GetDataElementsAction"
+	<!-- GetWeekly Period List for Tabular Analysis -->
+	
+	<bean id="org.hisp.dhis.dashboard.action.GetWeeklyPeriodAction"
+        class="org.hisp.dhis.dashboard.action.GetWeeklyPeriodAction"
+        scope="prototype">
+		<property name="periodService" ref="org.hisp.dhis.period.PeriodService">
+		</property>
+    </bean>
+	
+	
+	<bean id="org.hisp.dhis.dashboard.action.GetDataElementsAction"
 		class="org.hisp.dhis.dashboard.action.GetDataElementsAction"
 		scope="prototype">
         <property name="dataElementService">

=== modified file 'local/in/dhis-web-dashboard/src/main/resources/struts.xml'
--- local/in/dhis-web-dashboard/src/main/resources/struts.xml	2010-11-26 12:48:06 +0000
+++ local/in/dhis-web-dashboard/src/main/resources/struts.xml	2010-12-02 11:15:31 +0000
@@ -573,6 +573,15 @@
 		
 		<!-- Ajax requests -->
 		
+		<!-- Getting Weekly Period -->
+		<action name="getWeeklyPeriod"
+            class="org.hisp.dhis.dashboard.action.GetWeeklyPeriodAction">
+            <result name="success" type="velocity-xml">/dhis-web-dashboard/responseWeeklyPeriods.vm</result>
+            <!--<interceptor-ref name="transactionStack"/>-->
+            <param name="onExceptionReturn">plainTextError</param>
+        </action>
+		
+		
 		<action name="getDataElements"
 			class="org.hisp.dhis.dashboard.action.GetDataElementsAction">
 			<result name="success" type="velocity-xml">

=== modified file 'local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/javascript/gadataelement.js'
--- local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/javascript/gadataelement.js	2010-11-22 13:02:23 +0000
+++ local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/javascript/gadataelement.js	2010-12-02 11:15:31 +0000
@@ -79,23 +79,33 @@
 
 	clearList(periodLB);
 
-	if (periodTypeId == monthlyPeriodTypeName) {
-		for (i = 0; i < monthNames.length; i++) {
+	if (periodTypeId == monthlyPeriodTypeName) 
+	{
+		for (i = 0; i < monthNames.length; i++) 
+		{
 			periodLB.options[i] = new Option(monthNames[i], i, false, false);
 		}
-	} else if (periodTypeId == quarterlyPeriodTypeName) {
-		for (i = 0; i < quarterNames.length; i++) {
+	}
+	else if (periodTypeId == quarterlyPeriodTypeName)
+	{
+		for (i = 0; i < quarterNames.length; i++) 
+		{
 			periodLB.options[i] = new Option(quarterNames[i], i, false, false);
 		}
-	} else if (periodTypeId == sixmonthPeriodTypeName) {
-		for (i = 0; i < halfYearNames.length; i++) {
+	} 
+	else if (periodTypeId == sixmonthPeriodTypeName) 
+	{
+		for (i = 0; i < halfYearNames.length; i++)
+		{
 			periodLB.options[i] = new Option(halfYearNames[i], i, false, false);
 		}
-	} else if (periodTypeId == yearlyPeriodTypeName) {
+	} 
+	else if (periodTypeId == yearlyPeriodTypeName) 
+	{
 		periodLB.disabled = true;
 	}
 }
-//function for getting periods ends
+// function for getting periods ends
 
 // OrgUnit GroupSet Change Function
 /*

=== modified file 'local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/javascript/ta.js'
--- local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/javascript/ta.js	2010-11-03 09:17:15 +0000
+++ local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/javascript/ta.js	2010-12-02 11:15:31 +0000
@@ -286,7 +286,8 @@
         }
     }
     
-}// getDataElementsReceived end
+}
+// getDataElementsReceived end
 
 function getIndicators()
 {
@@ -345,12 +346,16 @@
 //addOptionPlaceHolder( availableIndicators );
 }
 
-
+// getting period List
 function getPeriods()
 {
     var periodTypeList = document.getElementById( "periodTypeLB" );
     var periodTypeId = periodTypeList.options[ periodTypeList.selectedIndex ].value;
 	
+    var yearLB = document.getElementById("yearLB");
+    
+    
+   // alert( periodTypeId );
     var periodLB = document.getElementById( "periodLB" );
 	
     periodLB.disabled = false;
@@ -364,6 +369,16 @@
             periodLB.options[i] = new Option(monthNames[i],i,false,false);
         }
     }
+    
+    else if( periodTypeId == dailyPeriodTypeName )
+    {
+       // alert( monthDays.length );
+    	//alert( days.length );
+    	for( i= 0; i < days.length; i++ )
+        {
+            periodLB.options[i] = new Option(days[i],days[i],false,false);
+        }
+    }
     else if( periodTypeId == quarterlyPeriodTypeName )
     {
         for( i= 0; i < quarterNames.length; i++ )
@@ -382,7 +397,117 @@
     {
         periodLB.disabled = true;
     }
-}
+    
+    else if( periodTypeId == weeklyPeriodTypeName )
+    {
+    	//alert(periodTypeId);
+    	
+        if( yearLB.selectedIndex < 0 ) 
+        {
+            alert("Please select Year(s) First");
+            return false;
+        }
+        else
+        {
+        	getWeeks();
+        }
+        /*
+    	for( i= 0; i < weeks.length; i++ )
+        {
+    		periodLB.options[i] = new Option(weeks[i],weeks[i],false,false);
+        }
+    	getWeeks();*/
+    }
+
+}
+
+//getting weekly Period
+function getWeeklyPeriod()
+{
+    var periodTypeList = document.getElementById( "periodTypeLB" );
+    var periodTypeId = periodTypeList.options[ periodTypeList.selectedIndex ].value;
+    
+    if( periodTypeId == weeklyPeriodTypeName )
+    {
+    	getWeeks();
+    }
+    
+}
+//singleSelectionOption yearList
+/*
+function selectSingleOptionYearList()
+{
+	var periodTypeObj = document.getElementById( 'periodTypeLB' );
+	
+    var periodTypeVal = periodTypeObj.options[ periodTypeObj.selectedIndex ].value;
+    if( periodTypeVal == weeklyPeriodTypeName  )
+    {
+        var yearListObj = document.getElementById('yearLB');
+	
+        for( var i = 0; i < yearListObj.length; i++ )
+        {
+            if( i != yearListObj.selectedIndex )
+            {
+            	yearListObj.options[i].selected = false;
+            }
+        }
+    }
+}
+*/
+//get week period Ajax calling
+function getWeeks()
+{
+	//var periodTypeName = weeklyPeriodTypeName;
+	var yearListObj = document.getElementById('yearLB');
+	var yearListval = yearListObj.options[ yearListObj.selectedIndex ].value;
+	//alert(yearListval); 
+	var year = yearListval.split( "-" )[0] ;
+	var yearList = "" ;
+	
+	var yearLB = document.getElementById("yearLB");
+    for(k = 0; k < yearLB.options.length; k++)
+    {
+    	if ( yearLB.options[k].selected == true )
+    	{
+    		yearList += yearLB.options[k].value + ";" ;
+    	}
+     //yearLB.add[yearLB.selectedIndex];
+    }
+    // alert( "Year List is : " +yearList );
+	
+	$.post("getWeeklyPeriod.action",
+			{
+			 //periodTypeName:weeklyPeriodTypeName,
+				yearList:yearList
+			},
+			function (data)
+			{
+				getWeeklyPeriodReceived(data);
+			},'xml');
+}
+
+// week rang received
+function getWeeklyPeriodReceived( xmlObject )
+{	
+	//alert("Inside Result");
+	
+	var periodList = document.getElementById( "periodLB" );
+	
+	clearList( periodList );
+	
+	var weeklyperiodList = xmlObject.getElementsByTagName( "weeklyPeriod" );
+	
+	for ( var i = 0; i < weeklyperiodList.length; i++ )
+	{
+	    var weeklyPeriodName = weeklyperiodList[ i ].getElementsByTagName( "name" )[0].firstChild.nodeValue;
+		
+	        var option = document.createElement( "option" );
+	        option.value = weeklyPeriodName;
+	        option.text = weeklyPeriodName;
+	        option.title = weeklyPeriodName;
+	        periodList.add( option, null );
+	}
+}	
 
 /*
 function getPeriods()

=== added file 'local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/responseWeeklyPeriods.vm'
--- local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/responseWeeklyPeriods.vm	1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/responseWeeklyPeriods.vm	2010-12-02 11:15:31 +0000
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<weeklyPeriodList>
+#foreach( $weeklyPeriodName in $weeklyPeriodList )
+    <weeklyPeriod>
+        <name>$weeklyPeriodName</name>
+    </weeklyPeriod>
+#end
+</weeklyPeriodList>
\ No newline at end of file

=== modified file 'local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/tabularAnalysisFront.vm'
--- local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/tabularAnalysisFront.vm	2010-11-03 09:17:15 +0000
+++ local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/tabularAnalysisFront.vm	2010-12-02 11:15:31 +0000
@@ -18,10 +18,11 @@
 <div id="overlayImg"><img  width="50" height="50" src="images/ajax-loader.gif" /></div>
 </div>
 
-
 <script>
 	
 	// Global Variables
+	var dailyPeriodTypeName = '$dailyPeriodTypeName';
+	var weeklyPeriodTypeName = '$weeklyPeriodTypeName';
 	var monthlyPeriodTypeName = '$monthlyPeriodTypeName';
 	var quarterlyPeriodTypeName = '$quarterlyPeriodTypeName';
 	var sixmonthPeriodTypeName = '$sixMonthPeriodTypeName';
@@ -30,10 +31,56 @@
 	var maxOrgUnitLevels = $maxOrgUnitLevels;
 	var selOrgUnitId="NONE";
 	
+	var days = new Array();
+	
+	var monthDays = new Array(31,29,31,30,31,30,31,31,30,31,30,31);
 	var monthNames = new Array("Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec","Jan","Feb","Mar");
 	var quarterNames = new Array("Q1","Q2","Q3","Q4");
 	var halfYearNames = new Array("HY1","HY2");
-
+	
+    var weeks = new Array();
+    
+    k = 0;
+   // m = 0;
+   // alert( monthDays.length );
+    for( i = 0; i< monthDays.length; i++ )
+    {
+        var curMonthDays = monthDays[i];
+       // alert( curMonthDays );
+        for( j = 1; j<=curMonthDays; j++ )
+        {
+            if( (i+1) <= 9 )
+            {
+               // i = "0"+(i+1);
+               days[k]=  "0"+ (i+1);
+               
+            }
+            else
+            {
+            days[k]=  i+1;
+            }
+            if( j <= 9 )
+            {
+                days[k] += "-0"+j;
+            }
+            else
+            {
+            days[k] +=  "-"+j;
+            }    
+        
+            //days[k]= (i+1)+"-"+j;
+            //  days[k]=  i+"-"+j;
+            k++;
+         }
+    }
+    
+    w = 0;
+    for( i = 0 ; i< 53; i++ )
+    {
+        weeks[w] = "W-" + (i+1);
+        w++;
+    }
+  
     var orgUnitGroupIds = new Array();
 	var orgUnitGroupNames = new Array();
 
@@ -206,7 +253,7 @@
 					<tr>
 						<td class="NormalB">
 							Year : <br>
-							<select id="yearLB" name="yearLB" size="5" multiple style="width: 150px;">																				
+							<select id="yearLB" name="yearLB" onchange="getWeeklyPeriod()"  size="5" multiple style="width: 150px;">																				
 								#foreach($periodName in $periodNameList)
 									<option value="$periodName">$periodName</option>								
 							    #end
@@ -215,7 +262,7 @@
 						<td>&nbsp;</td>
 						<td class="NormalB">
 							Period : <br>
-							<select id="periodLB" name="periodLB" size="5" multiple style="width: 150px;">								
+							<select id="periodLB" name="periodLB" size="5" multiple style="width: 175px;">								
 							</select>
 						</td>
 					</tr>