=== modified 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 2010-12-02 11:15:31 +0000 +++ local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/action/GetWeeklyPeriodAction.java 2010-12-03 11:30:11 +0000 @@ -124,7 +124,7 @@ simpleDateFormat2 = new SimpleDateFormat("yyyy-MM-dd"); weeklyPeriodList = new ArrayList(); - System.out.println( "selected Year size : " + yearList.length()); + // System.out.println( "selected Year size : " + yearList.length()); //tempYearList = new ArrayList(); @@ -148,11 +148,11 @@ periods = new ArrayList( periodService.getPeriodsBetweenDates( periodType, startDate, endDate ) ); - System.out.println( "Period size : " + periods.size()); + // 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 ); + // System.out.println( "tempPeriodName : " + tempPeriodName ); weeklyPeriodList.add( tempPeriodName ); // System.out.println( "weekly period is : " + weeklyPeriodList ); } === 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-12-02 11:15:31 +0000 +++ local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ga/action/GenerateGraphicalAnalyserDataElementsFormAction.java 2010-12-03 11:30:11 +0000 @@ -112,6 +112,20 @@ return periodTypes; } + private String dailyPeriodTypeName; + + public String getDailyPeriodTypeName() + { + return dailyPeriodTypeName; + } + + private String weeklyPeriodTypeName; + + public String getWeeklyPeriodTypeName() + { + return weeklyPeriodTypeName; + } + private List monthlyPeriods; public List getMonthlyPeriods() @@ -194,6 +208,7 @@ periodTypes = new ArrayList( periodService.getAllPeriodTypes() ); Iterator ptIterator = periodTypes.iterator(); + /* while ( ptIterator.hasNext() ) { String pTName = ptIterator.next().getName(); @@ -204,8 +219,19 @@ 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(); + } + } + dailyPeriodTypeName = DailyPeriodType.NAME; + weeklyPeriodTypeName = WeeklyPeriodType.NAME; monthlyPeriods = new ArrayList( periodService.getPeriodsByPeriodType( new MonthlyPeriodType() ) ); periodNameList = new ArrayList(); Collections.sort( monthlyPeriods, new PeriodComparator() ); @@ -227,14 +253,17 @@ } } + Collections.sort( yearlyPeriods, new PeriodComparator() ); simpleDateFormat = new SimpleDateFormat( "yyyy" ); //System.out.println( monthlyPeriodTypeName ); - int year; + // int year; for ( Period p1 : yearlyPeriods ) { - year = Integer.parseInt( simpleDateFormat.format( p1.getStartDate() ) ) + 1; - periodNameList.add( simpleDateFormat.format( p1.getStartDate() ) + "-" + year ); + // year = Integer.parseInt( simpleDateFormat.format( p1.getStartDate() ) ) + 1; + // periodNameList.add( simpleDateFormat.format( p1.getStartDate() ) + "-" + year ); + + periodNameList.add( simpleDateFormat.format( p1.getStartDate() ) ); } /* Organisationunit Group */ === 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-12-02 11:15:31 +0000 +++ local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ga/action/IndicatorwiseGAFormAction.java 2010-12-03 11:30:11 +0000 @@ -112,6 +112,20 @@ return periodTypes; } + private String dailyPeriodTypeName; + + public String getDailyPeriodTypeName() + { + return dailyPeriodTypeName; + } + + private String weeklyPeriodTypeName; + + public String getWeeklyPeriodTypeName() + { + return weeklyPeriodTypeName; + } + private List monthlyPeriods; public List getMonthlyPeriods() @@ -194,6 +208,7 @@ periodTypes = new ArrayList( periodService.getAllPeriodTypes() ); Iterator ptIterator = periodTypes.iterator(); + /* while ( ptIterator.hasNext() ) { String pTName = ptIterator.next().getName(); @@ -204,8 +219,20 @@ 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(); + } + } + + + dailyPeriodTypeName = DailyPeriodType.NAME; + weeklyPeriodTypeName = WeeklyPeriodType.NAME; monthlyPeriods = new ArrayList( periodService.getPeriodsByPeriodType( new MonthlyPeriodType() ) ); periodNameList = new ArrayList(); Collections.sort( monthlyPeriods, new PeriodComparator() ); @@ -230,11 +257,13 @@ Collections.sort( yearlyPeriods, new PeriodComparator() ); simpleDateFormat = new SimpleDateFormat( "yyyy" ); //System.out.println( monthlyPeriodTypeName ); - int year; + // int year; for ( Period p1 : yearlyPeriods ) { - year = Integer.parseInt( simpleDateFormat.format( p1.getStartDate() ) ) + 1; - periodNameList.add( simpleDateFormat.format( p1.getStartDate() ) + "-" + year ); + // year = Integer.parseInt( simpleDateFormat.format( p1.getStartDate() ) ) + 1; + // periodNameList.add( simpleDateFormat.format( p1.getStartDate() ) + "-" + year ); + + periodNameList.add( simpleDateFormat.format( p1.getStartDate() ) ); } /* Organisationunit Group */ === modified file 'local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ga/action/charts/GenerateChartAction1.java' --- local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ga/action/charts/GenerateChartAction1.java 2010-11-22 13:02:23 +0000 +++ local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ga/action/charts/GenerateChartAction1.java 2010-12-03 11:30:11 +0000 @@ -316,7 +316,7 @@ { // System.out.println(objData[i][j]); data[i][j] = objData[i][j].doubleValue(); - System.out.print(categories1[j]+": "+data[i][j]+", "); + //System.out.print(categories1[j]+": "+data[i][j]+", "); } //System.out.println(""); } === modified file 'local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ga/action/charts/GenerateChartDataElementAction.java' --- local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ga/action/charts/GenerateChartDataElementAction.java 2010-11-22 13:02:23 +0000 +++ local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ga/action/charts/GenerateChartDataElementAction.java 2010-12-03 11:30:11 +0000 @@ -54,12 +54,14 @@ import org.hisp.dhis.organisationunit.OrganisationUnitGroup; import org.hisp.dhis.organisationunit.OrganisationUnitGroupService; import org.hisp.dhis.organisationunit.OrganisationUnitService; +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; @@ -403,9 +405,12 @@ // ouChildCountMap = new HashMap(); - String monthOrder[] = { "04", "05", "06", "07", "08", "09", "10", "11", "12", "01", "02", "03" }; - int monthDays[] = { 30, 31, 30, 31, 31, 30, 31, 30, 31, 31, 28, 31 }; + // String monthOrder[] = { "04", "05", "06", "07", "08", "09", "10", "11", "12", "01", "02", "03" }; + // int monthDays[] = { 30, 31, 30, 31, 31, 30, 31, 30, 31, 31, 28, 31 }; + String monthOrder[] = { "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12" }; + int monthDays[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; + /* Period Info */ String startD = ""; @@ -414,105 +419,153 @@ SimpleDateFormat simpleDateFormat = new SimpleDateFormat( "MMM-yyyy" ); periodNames = new ArrayList(); - - for ( String year : yearLB ) + + // for weekly period + if ( periodTypeLB.equalsIgnoreCase( WeeklyPeriodType.NAME ) ) { - int selYear = Integer.parseInt( year.split( "-" )[0] ); - - if ( periodTypeLB.equalsIgnoreCase( YearlyPeriodType.NAME ) ) + // System.out.println( " Inside weekly" ); + for ( String periodStr : periodLB ) { - - startD = "" + selYear + "-04-01"; - endD = "" + (selYear + 1) + "-03-31"; - + 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( "" + selYear + "-" + (selYear + 1) ); - - continue; + periodNames.add( periodStr ); + //System.out.println( startD + " : " + endD ); } - - for ( String periodStr : periodLB ) + } + else + { + for ( String year : yearLB ) { - int period = Integer.parseInt( periodStr ); - - if ( periodTypeLB.equalsIgnoreCase( MonthlyPeriodType.NAME ) ) - { - simpleDateFormat = new SimpleDateFormat( "MMM-yyyy" ); - - if ( period >= 9 ) - { - startD = "" + (selYear + 1) + "-" + monthOrder[period] + "-01"; - endD = "" + (selYear + 1) + "-" + monthOrder[period] + "-" + monthDays[period]; - - if ( (selYear + 1) % 4 == 0 && period == 10 ) - { - endD = "" + (selYear + 1) + "-" + monthOrder[period] + "-" + (monthDays[period] + 1); - } - } - else - { + //int selYear = Integer.parseInt( year.split( "-" )[0] ); + int selYear = Integer.parseInt( year ); + + if ( periodTypeLB.equalsIgnoreCase( YearlyPeriodType.NAME ) ) + { + startD = "" + selYear + "-01-01"; + endD = "" + selYear + "-12-31"; + + selStartPeriodList.add( format.parseDate( startD ) ); + selEndPeriodList.add( format.parseDate( endD ) ); + + // periodNames.add( "" + selYear + "-" + (selYear + 1) ); + + periodNames.add( "" + selYear ); + // System.out.println( "Start Date : " + startD + " , End Date : " + endD ); + continue; + + } + + for ( String periodStr : periodLB ) + { + // int period = Integer.parseInt( periodStr ); + + if ( periodTypeLB.equalsIgnoreCase( MonthlyPeriodType.NAME ) ) + { + int period = Integer.parseInt( periodStr ); + simpleDateFormat = new SimpleDateFormat( "MMM-yyyy" ); + startD = "" + selYear + "-" + monthOrder[period] + "-01"; - endD = "" + selYear + "-" + monthOrder[period] + "-" + monthDays[period]; - } - - selStartPeriodList.add( format.parseDate( startD ) ); - selEndPeriodList.add( format.parseDate( endD ) ); - periodNames.add( simpleDateFormat.format( format.parseDate( startD ) ) ); - } - else if ( periodTypeLB.equalsIgnoreCase( QuarterlyPeriodType.NAME ) ) - { - if ( period == 0 ) - { - startD = "" + selYear + "-04-01"; - endD = "" + selYear + "-06-30"; - periodNames.add( selYear + "-Q1" ); - } - else if ( period == 1 ) - { - startD = "" + selYear + "-07-01"; - endD = "" + selYear + "-09-30"; - periodNames.add( selYear + "-Q2" ); - } - else if ( period == 2 ) - { - startD = "" + selYear + "-10-01"; - endD = "" + selYear + "-12-31"; - periodNames.add( selYear + "-Q3" ); - } - else - { - startD = "" + (selYear + 1) + "-01-01"; - endD = "" + (selYear + 1) + "-03-31"; - periodNames.add( (selYear) + "-Q4" ); - } - selStartPeriodList.add( format.parseDate( startD ) ); - selEndPeriodList.add( format.parseDate( endD ) ); - } - else if ( periodTypeLB.equalsIgnoreCase( SixMonthlyPeriodType.NAME ) ) - { - if ( period == 0 ) - { - startD = "" + selYear + "-04-01"; - endD = "" + selYear + "-09-30"; - periodNames.add( selYear + "-HY1" ); - } - else - { - startD = "" + selYear + "-10-01"; - endD = "" + (selYear + 1) + "-03-31"; - periodNames.add( selYear + "-HY2" ); - } - selStartPeriodList.add( format.parseDate( startD ) ); - selEndPeriodList.add( format.parseDate( endD ) ); - } - - System.out.println( startD + " : " + endD ); + endD = "" + selYear + "-" + monthOrder[period] + "-" + monthDays[period]; + + //check for leapYear + if ( ((( selYear ) % 400 == 0 ) || ((( selYear) % 100 != 0 && ( selYear ) % 4 == 0))) && period == 1 ) + { + endD = "" + selYear + "-" + monthOrder[period] + "-" + ( monthDays[period] + 1 ); + } + selStartPeriodList.add( format.parseDate( startD ) ); + selEndPeriodList.add( format.parseDate( endD ) ); + periodNames.add( simpleDateFormat.format( format.parseDate( startD ) ) ); + // System.out.println( "Start Date : " + startD + " , End Date : " + endD ); + } + else if ( periodTypeLB.equalsIgnoreCase( QuarterlyPeriodType.NAME ) ) + { + int period = Integer.parseInt( periodStr ); + if ( period == 0 ) + { + startD = "" + selYear + "-01-01"; + endD = "" + selYear + "-03-31"; + periodNames.add( selYear + "-Q1" ); + } + else if ( period == 1 ) + { + startD = "" + selYear + "-04-01"; + endD = "" + selYear + "-06-30"; + periodNames.add( selYear + "-Q2" ); + } + else if ( period == 2 ) + { + startD = "" + selYear + "-07-01"; + endD = "" + selYear + "-09-30"; + periodNames.add( selYear + "-Q3" ); + } + else + { + startD = "" + selYear + "-10-01"; + endD = "" + selYear + "-12-31"; + periodNames.add( (selYear) + "-Q4" ); + } + selStartPeriodList.add( format.parseDate( startD ) ); + selEndPeriodList.add( format.parseDate( endD ) ); + // System.out.println( "Start Date : " + startD + " , End Date : " + endD ); + } + else if ( periodTypeLB.equalsIgnoreCase( SixMonthlyPeriodType.NAME ) ) + { + int period = Integer.parseInt( periodStr ); + if ( period == 0 ) + { + startD = "" + selYear + "-01-01"; + endD = "" + selYear + "-06-30"; + periodNames.add( selYear + "-HY1" ); + } + else + { + startD = "" + selYear + "-07-01"; + endD = "" + selYear + "-12-31"; + periodNames.add( selYear + "-HY2" ); + } + selStartPeriodList.add( format.parseDate( startD ) ); + selEndPeriodList.add( format.parseDate( endD ) ); + } + + else if ( periodTypeLB.equalsIgnoreCase( DailyPeriodType.NAME ) ) + { + String month = periodStr.split( "-" )[0] ; + String date = periodStr.split( "-" )[1] ; + + startD = selYear + "-" + periodStr; + endD = selYear + "-" + periodStr ; + + if ( selYear % 4 != 0 && month.trim().equalsIgnoreCase( "02" ) && date.trim().equalsIgnoreCase( "29" ) ) + { + startD = selYear + "-" + month + "-" + date; + endD = selYear + "-" + month + "-" + date; + continue; + } + + if ( (( selYear % 400 == 0) || (( selYear % 100 != 0 && selYear % 4 == 0))) && month.trim().equalsIgnoreCase( "02" ) && date.trim().equalsIgnoreCase( "29" ) ); + { + startD = selYear + "-" + month + "-" + date; + endD = selYear + "-" + month + "-" + date; + } + + selStartPeriodList.add( format.parseDate( startD ) ); + selEndPeriodList.add( format.parseDate( endD ) ); + + periodNames.add( startD ); + // System.out.println( startD + " : " + endD ); + } + System.out.println( startD + " : " + endD ); + } + } - - } + } // DataElement Information @@ -557,8 +610,6 @@ System.out.println( "Data Elenent name is : " + dElement.getName() + " categoryOptionCombo is : " + dataElementCategoryService.getDataElementCategoryOptionCombo( decoc1 ).getName() ); */ } - - } else { @@ -695,7 +746,7 @@ List orgUnitChildList = new ArrayList( organisationUnitService.getOrganisationUnitWithChildren( selectedOrgUnit.getId() ) ); int groupCount = 0; - System.out.println("\n\n ++++++++++++++++++++++ \n orgUnitGroup : " + orgUnitGroupList ); + // System.out.println("\n\n ++++++++++++++++++++++ \n orgUnitGroup : " + orgUnitGroupList ); for ( String orgUnitGroupId : orgUnitGroupList ) { OrganisationUnitGroup selOrgUnitGroup = organisationUnitGroupService.getOrganisationUnitGroup( Integer.parseInt( orgUnitGroupId ) ); @@ -704,7 +755,7 @@ selOUGroupMemberList.addAll( selectedOUGroupMemberList ); - System.out.println( "Total Size of " + groupCount + " : " + selOUGroupMemberList.size() ); + // System.out.println( "Total Size of " + groupCount + " : " + selOUGroupMemberList.size() ); groupCount++; === modified file 'local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ga/action/charts/GenerateChartIndicatorAction.java' --- local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ga/action/charts/GenerateChartIndicatorAction.java 2010-11-22 13:02:23 +0000 +++ local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ga/action/charts/GenerateChartIndicatorAction.java 2010-12-03 11:30:11 +0000 @@ -51,9 +51,11 @@ import org.hisp.dhis.organisationunit.OrganisationUnitGroup; import org.hisp.dhis.organisationunit.OrganisationUnitGroupService; import org.hisp.dhis.organisationunit.OrganisationUnitService; +import org.hisp.dhis.period.DailyPeriodType; import org.hisp.dhis.period.MonthlyPeriodType; 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 org.hisp.dhis.reports.ReportService; @@ -336,8 +338,11 @@ // ouChildCountMap = new HashMap(); - String monthOrder[] = { "04", "05", "06", "07", "08", "09", "10", "11", "12", "01", "02", "03" }; - int monthDays[] = { 30, 31, 30, 31, 31, 30, 31, 30, 31, 31, 28, 31 }; + // String monthOrder[] = { "04", "05", "06", "07", "08", "09", "10", "11", "12", "01", "02", "03" }; + //int monthDays[] = { 30, 31, 30, 31, 31, 30, 31, 30, 31, 31, 28, 31 }; + + String monthOrder[] = { "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12" }; + int monthDays[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; /* Period Info */ @@ -347,105 +352,154 @@ SimpleDateFormat simpleDateFormat = new SimpleDateFormat( "MMM-yyyy" ); periodNames = new ArrayList(); - - for ( String year : yearLB ) + + // for weekly period + if ( periodTypeLB.equalsIgnoreCase( WeeklyPeriodType.NAME ) ) { - int selYear = Integer.parseInt( year.split( "-" )[0] ); - - if ( periodTypeLB.equalsIgnoreCase( YearlyPeriodType.NAME ) ) + // System.out.println( " Inside weekly" ); + for ( String periodStr : periodLB ) { - - startD = "" + selYear + "-04-01"; - endD = "" + (selYear + 1) + "-03-31"; - + 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( "" + selYear + "-" + (selYear + 1) ); - - continue; - + + periodNames.add( periodStr ); + //System.out.println( startD + " : " + endD ); } - - for ( String periodStr : periodLB ) + } + else + { + for ( String year : yearLB ) { - int period = Integer.parseInt( periodStr ); - - if ( periodTypeLB.equalsIgnoreCase( MonthlyPeriodType.NAME ) ) - { - simpleDateFormat = new SimpleDateFormat( "MMM-yyyy" ); - - if ( period >= 9 ) - { - startD = "" + (selYear + 1) + "-" + monthOrder[period] + "-01"; - endD = "" + (selYear + 1) + "-" + monthOrder[period] + "-" + monthDays[period]; - - if ( (selYear + 1) % 4 == 0 && period == 10 ) - { - endD = "" + (selYear + 1) + "-" + monthOrder[period] + "-" + (monthDays[period] + 1); - } - } - else - { + // int selYear = Integer.parseInt( year.split( "-" )[0] ); + int selYear = Integer.parseInt( year ); + + if ( periodTypeLB.equalsIgnoreCase( YearlyPeriodType.NAME ) ) + { + startD = "" + selYear + "-01-01"; + endD = "" + selYear + "-12-31"; + + selStartPeriodList.add( format.parseDate( startD ) ); + selEndPeriodList.add( format.parseDate( endD ) ); + + //periodNames.add( "" + selYear + "-" + (selYear + 1) ); + + periodNames.add( "" + selYear ); + + continue; + + } + + for ( String periodStr : periodLB ) + { + //int period = Integer.parseInt( periodStr ); + + if ( periodTypeLB.equalsIgnoreCase( MonthlyPeriodType.NAME ) ) + { + int period = Integer.parseInt( periodStr ); + simpleDateFormat = new SimpleDateFormat( "MMM-yyyy" ); + startD = "" + selYear + "-" + monthOrder[period] + "-01"; - endD = "" + selYear + "-" + monthOrder[period] + "-" + monthDays[period]; - } - - selStartPeriodList.add( format.parseDate( startD ) ); - selEndPeriodList.add( format.parseDate( endD ) ); - periodNames.add( simpleDateFormat.format( format.parseDate( startD ) ) ); - } - else if ( periodTypeLB.equalsIgnoreCase( QuarterlyPeriodType.NAME ) ) - { - if ( period == 0 ) - { - startD = "" + selYear + "-04-01"; - endD = "" + selYear + "-06-30"; - periodNames.add( selYear + "-Q1" ); - } - else if ( period == 1 ) - { - startD = "" + selYear + "-07-01"; - endD = "" + selYear + "-09-30"; - periodNames.add( selYear + "-Q2" ); - } - else if ( period == 2 ) - { - startD = "" + selYear + "-10-01"; - endD = "" + selYear + "-12-31"; - periodNames.add( selYear + "-Q3" ); - } - else - { - startD = "" + (selYear + 1) + "-01-01"; - endD = "" + (selYear + 1) + "-03-31"; - periodNames.add( (selYear) + "-Q4" ); - } - selStartPeriodList.add( format.parseDate( startD ) ); - selEndPeriodList.add( format.parseDate( endD ) ); - } - else if ( periodTypeLB.equalsIgnoreCase( SixMonthlyPeriodType.NAME ) ) - { - if ( period == 0 ) - { - startD = "" + selYear + "-04-01"; - endD = "" + selYear + "-09-30"; - periodNames.add( selYear + "-HY1" ); - } - else - { - startD = "" + selYear + "-10-01"; - endD = "" + (selYear + 1) + "-03-31"; - periodNames.add( selYear + "-HY2" ); - } - selStartPeriodList.add( format.parseDate( startD ) ); - selEndPeriodList.add( format.parseDate( endD ) ); - } - - System.out.println( startD + " : " + endD ); + endD = "" + selYear + "-" + monthOrder[period] + "-" + monthDays[period]; + + //check for leapYear + if ( ((( selYear ) % 400 == 0 ) || ((( selYear) % 100 != 0 && ( selYear ) % 4 == 0))) && period == 1 ) + { + endD = "" + selYear + "-" + monthOrder[period] + "-" + ( monthDays[period] + 1 ); + } + + selStartPeriodList.add( format.parseDate( startD ) ); + selEndPeriodList.add( format.parseDate( endD ) ); + periodNames.add( simpleDateFormat.format( format.parseDate( startD ) ) ); + //System.out.println( "Start Date : " + startD + " , End Date : " + endD ); + } + else if ( periodTypeLB.equalsIgnoreCase( QuarterlyPeriodType.NAME ) ) + { + int period = Integer.parseInt( periodStr ); + if ( period == 0 ) + { + startD = "" + selYear + "-01-01"; + endD = "" + selYear + "-03-31"; + periodNames.add( selYear + "-Q1" ); + } + else if ( period == 1 ) + { + startD = "" + selYear + "-04-01"; + endD = "" + selYear + "-06-30"; + periodNames.add( selYear + "-Q2" ); + } + else if ( period == 2 ) + { + startD = "" + selYear + "-07-01"; + endD = "" + selYear + "-09-30"; + periodNames.add( selYear + "-Q3" ); + } + else + { + startD = "" + selYear + "-10-01"; + endD = "" + selYear + "-12-31"; + periodNames.add( (selYear) + "-Q4" ); + } + selStartPeriodList.add( format.parseDate( startD ) ); + selEndPeriodList.add( format.parseDate( endD ) ); + //System.out.println( "Start Date : " + startD + " , End Date : " + endD ); + } + else if ( periodTypeLB.equalsIgnoreCase( SixMonthlyPeriodType.NAME ) ) + { + int period = Integer.parseInt( periodStr ); + if ( period == 0 ) + { + startD = "" + selYear + "-01-01"; + endD = "" + selYear + "-06-30"; + periodNames.add( selYear + "-HY1" ); + } + else + { + startD = "" + selYear + "-07-01"; + endD = "" + selYear + "-12-31"; + periodNames.add( selYear + "-HY2" ); + } + selStartPeriodList.add( format.parseDate( startD ) ); + selEndPeriodList.add( format.parseDate( endD ) ); + } + + else if ( periodTypeLB.equalsIgnoreCase( DailyPeriodType.NAME ) ) + { + String month = periodStr.split( "-" )[0] ; + + String date = periodStr.split( "-" )[1] ; + + startD = selYear + "-" + periodStr; + endD = selYear + "-" + periodStr ; + + if ( selYear % 4 != 0 && month.trim().equalsIgnoreCase( "02" ) && date.trim().equalsIgnoreCase( "29" ) ) + { + startD = selYear + "-" + month + "-" + date; + endD = selYear + "-" + month + "-" + date; + continue; + } + if ( (( selYear % 400 == 0) || (( selYear % 100 != 0 && selYear % 4 == 0))) && month.trim().equalsIgnoreCase( "02" ) && date.trim().equalsIgnoreCase( "29" ) ); + { + startD = selYear + "-" + month + "-" + date; + endD = selYear + "-" + month + "-" + date; + } + + selStartPeriodList.add( format.parseDate( startD ) ); + selEndPeriodList.add( format.parseDate( endD ) ); + + periodNames.add( startD ); + // System.out.println( startD + " : " + endD ); + } + System.out.println( startD + " : " + endD ); + } + } - - } + } // Indicator Information List indicatorList = new ArrayList(); Iterator deIterator = selectedIndicators.iterator(); @@ -474,8 +528,7 @@ { System.out.println( "Inside PeriodWise Chart Data and group not selected" ); - System.out.println( "\n\nsize of OrgUnit List : " + selOUList.size() + " , size of Indicator List : " - + indicatorList.size() ); + //System.out.println( "\n\nsize of OrgUnit List : " + selOUList.size() + " , size of Indicator List : " + indicatorList.size() ); System.out.println( "Chart Generation Start Time is : \t" + new Date() ); indicatorChartResult = generateChartDataPeriodWise( selStartPeriodList, selEndPeriodList, periodNames, indicatorList, selOUList.iterator().next() ); @@ -543,7 +596,7 @@ .getOrganisationUnitWithChildren( selectedOrgUnit.getId() ) ); // int groupCount = 0; - System.out.println( "\n\n ++++++++++++++++++++++ \n orgUnitGroup : " + orgUnitGroupList ); + // System.out.println( "\n\n ++++++++++++++++++++++ \n orgUnitGroup : " + orgUnitGroupList ); for ( String orgUnitGroupId : orgUnitGroupList ) { OrganisationUnitGroup selOrgUnitGroup = organisationUnitGroupService.getOrganisationUnitGroup( Integer @@ -667,22 +720,6 @@ Double aggIndicatorDenumValue = 0.0; if ( aggDataCB != null ) { - - System.out.println( "aggDataCB checked " + aggDataCB ); - System.out.println( "inside aggIndicatorValue" ); - - // System.out.println( "\n\nsize of OrgUnit List : " + - // selOUList.size()+ " , size of Indicator List : " + - // indicatorList.size() + "\n\nStart date : " + startDate + - // " , End date : " + endDate ); - - System.out.println( "\n\norgUnit : " + orgUnit ); - System.out.println( "\n\nStart Date : " + startDate ); - System.out.println( "\n\nEnd date : " + endDate ); - - System.out.println( "\n\nIndicator : " + indicator ); - System.out.println( "\n\nIndicator Name : " + indicator.getName() ); - aggIndicatorValue = aggregationService.getAggregatedIndicatorValue( indicator, startDate, endDate, orgUnit ); @@ -700,12 +737,12 @@ aggIndicatorValue = dashBoardService.getIndividualIndicatorValue( indicator, orgUnit, startDate, endDate ); - System.out.println( " \nIndicator Numerator value : " + indicator.getNumerator() - + ", Start Date :- " + startDate + ", End Date :- " + endDate + ", Org Unit :- " + orgUnit ); + // System.out.println( " \nIndicator Numerator value : " + indicator.getNumerator() + // + ", Start Date :- " + startDate + ", End Date :- " + endDate + ", Org Unit :- " + orgUnit ); String tempStr = reportService.getIndividualResultDataValue( indicator.getNumerator(), startDate, endDate, orgUnit, "" ); - System.out.println( " \nIndicatorNumerator valu is " + tempStr ); + // System.out.println( " \nIndicatorNumerator valu is " + tempStr ); try { @@ -963,7 +1000,6 @@ aggIndicatorDenumValue += tempAggIndicatorDenumValue; } - } else { === 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-12-02 11:15:31 +0000 +++ local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ta/action/GenerateTabularAnalysisFormAction.java 2010-12-03 11:30:11 +0000 @@ -297,11 +297,12 @@ simpleDateFormat = new SimpleDateFormat( "yyyy" ); //System.out.println( monthlyPeriodTypeName ); // System.out.println( dailyPeriodTypeName ); - int year; + // int year; for ( Period p1 : yearlyPeriods ) { - year = Integer.parseInt( simpleDateFormat.format( p1.getStartDate() ) ) + 1; - periodNameList.add( simpleDateFormat.format( p1.getStartDate() ) + "-" + year ); + //year = Integer.parseInt( simpleDateFormat.format( p1.getStartDate() ) ) + 1; + // periodNameList.add( simpleDateFormat.format( p1.getStartDate() ) + "-" + year ); + periodNameList.add( simpleDateFormat.format( p1.getStartDate() ) ); } /* Organisationunit Levels */ === 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-12-02 11:15:31 +0000 +++ local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ta/action/GenerateTabularAnalysisResultAction.java 2010-12-03 11:30:11 +0000 @@ -296,9 +296,13 @@ ouChildCountMap = new HashMap(); - String monthOrder[] = { "04", "05", "06", "07", "08", "09", "10", "11", "12", "01", "02", "03" }; - int monthDays[] = { 30, 31, 30, 31, 31, 30, 31, 30, 31, 31, 28, 31 }; + // String monthOrder[] = { "04", "05", "06", "07", "08", "09", "10", "11", "12", "01", "02", "03" }; + // int monthDays[] = { 30, 31, 30, 31, 31, 30, 31, 30, 31, 31, 28, 31 }; + String monthOrder[] = { "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12" }; + int monthDays[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; + + /* Period Info */ String startD = ""; @@ -308,174 +312,11 @@ // SimpleDateFormat simpleDateFormat1 = new SimpleDateFormat( "yyyy-MM-dd" ); periodNames = new ArrayList(); - - for ( String year : yearLB ) - { - int selYear = Integer.parseInt( year.split( "-" )[0] ); - - if ( periodTypeLB.equalsIgnoreCase( YearlyPeriodType.NAME ) ) - { - - 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; - } - - for ( String periodStr : periodLB ) - { - // int period = Integer.parseInt( periodStr ); - - if ( periodTypeLB.equalsIgnoreCase( MonthlyPeriodType.NAME ) ) - { - int period = Integer.parseInt( periodStr ); - simpleDateFormat = new SimpleDateFormat( "MMM-yyyy" ); - - if ( period >= 9 ) - { - startD = "" + (selYear + 1) + "-" + monthOrder[period] + "-01"; - endD = "" + (selYear + 1) + "-" + monthOrder[period] + "-" + monthDays[period]; - - //( 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); - } - } - else - { - startD = "" + selYear + "-" + monthOrder[period] + "-01"; - 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"; - endD = "" + selYear + "-06-30"; - periodNames.add( selYear + "-Q1" ); - } - else if ( period == 1 ) - { - startD = "" + selYear + "-07-01"; - endD = "" + selYear + "-09-30"; - periodNames.add( selYear + "-Q2" ); - } - else if ( period == 2 ) - { - startD = "" + selYear + "-10-01"; - endD = "" + selYear + "-12-31"; - periodNames.add( selYear + "-Q3" ); - } - else - { - startD = "" + (selYear + 1) + "-01-01"; - endD = "" + (selYear + 1) + "-03-31"; - periodNames.add( (selYear) + "-Q4" ); - } - selStartPeriodList.add( format.parseDate( startD ) ); - selEndPeriodList.add( format.parseDate( endD ) ); - } - else if ( periodTypeLB.equalsIgnoreCase( SixMonthlyPeriodType.NAME ) ) - { - int period = Integer.parseInt( periodStr ); - if ( period == 0 ) - { - startD = "" + selYear + "-04-01"; - endD = "" + selYear + "-09-30"; - periodNames.add( selYear + "-HY1" ); - } - else - { - startD = "" + selYear + "-10-01"; - endD = "" + (selYear + 1) + "-03-31"; - periodNames.add( selYear + "-HY2" ); - } - selStartPeriodList.add( format.parseDate( startD ) ); - selEndPeriodList.add( format.parseDate( 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 ) ) { + System.out.println( " Inside weekly" ); for ( String periodStr : periodLB ) { String startWeekDate = periodStr.split( "To" )[0] ; //for start week @@ -488,37 +329,177 @@ selEndPeriodList.add( format.parseDate( endD ) ); periodNames.add( periodStr ); - System.out.println( startD + " : " + endD ); + //System.out.println( startD + " : " + endD ); } } + else + { + System.out.println( " Inside other than weekly" ); + for ( String year : yearLB ) + { + //int selYear = Integer.parseInt( year.split( "-" )[0] ); + + int selYear = Integer.parseInt( year ); + + if ( periodTypeLB.equalsIgnoreCase( YearlyPeriodType.NAME ) ) + { + + // startD = "" + selYear + "-04-01"; + // endD = "" + (selYear + 1) + "-03-31"; + + + startD = "" + selYear + "-01-01"; + endD = "" + selYear + "-12-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) ); + + periodNames.add( "" + selYear ); + + continue; + } + + for ( String periodStr : periodLB ) + { + // int period = Integer.parseInt( periodStr ); + + if ( periodTypeLB.equalsIgnoreCase( MonthlyPeriodType.NAME ) ) + { + int period = Integer.parseInt( periodStr ); + simpleDateFormat = new SimpleDateFormat( "MMM-yyyy" ); + + startD = "" + selYear + "-" + monthOrder[period] + "-01"; + endD = "" + selYear + "-" + monthOrder[period] + "-" + monthDays[period]; + + //check for leapYear + if ( ((( selYear ) % 400 == 0 ) || ((( selYear) % 100 != 0 && ( selYear ) % 4 == 0))) && period == 1 ) + { + endD = "" + selYear + "-" + monthOrder[period] + "-" + ( monthDays[period] + 1 ); + } + 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 ) ) ); + + } + else if ( periodTypeLB.equalsIgnoreCase( QuarterlyPeriodType.NAME ) ) + { + int period = Integer.parseInt( periodStr ); + if ( period == 0 ) + { + startD = "" + selYear + "-01-01"; + endD = "" + selYear + "-03-31"; + periodNames.add( selYear + "-Q1" ); + } + else if ( period == 1 ) + { + startD = "" + selYear + "-04-01"; + endD = "" + selYear + "-06-30"; + periodNames.add( selYear + "-Q2" ); + } + else if ( period == 2 ) + { + startD = "" + selYear + "-07-01"; + endD = "" + selYear + "-09-30"; + periodNames.add( selYear + "-Q3" ); + } + else + { + startD = "" + selYear + "-10-01"; + endD = "" + selYear + "-12-31"; + periodNames.add( (selYear) + "-Q4" ); + } + selStartPeriodList.add( format.parseDate( startD ) ); + selEndPeriodList.add( format.parseDate( endD ) ); + //System.out.println( "Start Date : " + startD + " , End Date : " + endD ); + } + else if ( periodTypeLB.equalsIgnoreCase( SixMonthlyPeriodType.NAME ) ) + { + int period = Integer.parseInt( periodStr ); + if ( period == 0 ) + { + startD = "" + selYear + "-01-01"; + endD = "" + selYear + "-06-30"; + periodNames.add( selYear + "-HY1" ); + } + else + { + startD = "" + selYear + "-07-01"; + endD = "" + selYear + "-12-31"; + periodNames.add( selYear + "-HY2" ); + } + + selStartPeriodList.add( format.parseDate( startD ) ); + selEndPeriodList.add( format.parseDate( endD ) ); + //System.out.println( "Start Date : " + startD + " , End Date : " + endD ); + } + else if ( periodTypeLB.equalsIgnoreCase( DailyPeriodType.NAME ) ) + { + String month = periodStr.split( "-" )[0] ; + String date = periodStr.split( "-" )[1] ; + + startD = selYear + "-" + periodStr; + endD = selYear + "-" + periodStr ; + + if ( selYear % 4 != 0 && month.trim().equalsIgnoreCase( "02" ) && date.trim().equalsIgnoreCase( "29" ) ) + { + startD = selYear + "-" + month + "-" + date; + endD = selYear + "-" + month + "-" + date; + continue; + } + if ( (( selYear % 400 == 0) || (( selYear % 100 != 0 && selYear % 4 == 0))) && month.trim().equalsIgnoreCase( "02" ) && date.trim().equalsIgnoreCase( "29" ) ); + { + startD = selYear + "-" + month + "-" + date; + endD = selYear + "-" + month + "-" + date; + } + selStartPeriodList.add( format.parseDate( startD ) ); + selEndPeriodList.add( format.parseDate( endD ) ); + + periodNames.add( startD ); + // System.out.println( startD + " : " + endD ); + } + } + } + } + // calling diffrent functions - - - if ( ouRadio.equalsIgnoreCase( ORGUNITSELECTED ) ) - { - System.out.println( "Report Generation Start Time is : \t" + new Date() ); - generateOrgUnitSelected(); - - } - else if ( ouRadio.equalsIgnoreCase( ORGUNITGRP ) ) - { - System.out.println( "Report Generation Start Time is : \t" + new Date() ); - generateOrgUnitGroup(); - - } - else if ( ouRadio.equalsIgnoreCase( ORGUNITLEVEL ) ) - { - System.out.println( "Report Generation Start Time is : \t" + new Date() ); - generateOrgUnitLevel(); - - } - - statementManager.destroy(); - System.out.println( "Report Generation End Time is : \t" + new Date() ); - - return SUCCESS; + + + if ( ouRadio.equalsIgnoreCase( ORGUNITSELECTED ) ) + { + System.out.println( "Report Generation Start Time is : \t" + new Date() ); + generateOrgUnitSelected(); + + } + else if ( ouRadio.equalsIgnoreCase( ORGUNITGRP ) ) + { + System.out.println( "Report Generation Start Time is : \t" + new Date() ); + generateOrgUnitGroup(); + + } + else if ( ouRadio.equalsIgnoreCase( ORGUNITLEVEL ) ) + { + System.out.println( "Report Generation Start Time is : \t" + new Date() ); + generateOrgUnitLevel(); + + } + + statementManager.destroy(); + System.out.println( "Report Generation End Time is : \t" + new Date() ); + + return SUCCESS; } // ------------------------------------------------------------------------- === modified file 'local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/graphicalAnalysisDataElementFront.vm' --- local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/graphicalAnalysisDataElementFront.vm 2010-11-02 11:35:05 +0000 +++ local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/graphicalAnalysisDataElementFront.vm 2010-12-03 11:30:11 +0000 @@ -7,6 +7,8 @@ // Global Variables + var dailyPeriodTypeName = '$dailyPeriodTypeName'; + var weeklyPeriodTypeName = '$weeklyPeriodTypeName'; var monthlyPeriodTypeName = '$monthlyPeriodTypeName'; var quarterlyPeriodTypeName = '$quarterlyPeriodTypeName'; var sixmonthPeriodTypeName = '$sixMonthPeriodTypeName'; @@ -17,10 +19,48 @@ var currentOrgUnitId; var currentOrgUnitName; - var monthNames = new Array("Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec","Jan","Feb","Mar"); + + + var monthDays = new Array(31,29,31,30,31,30,31,31,30,31,30,31); // for daily Period + var days = new Array(); + + //var monthNames = new Array("Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec","Jan","Feb","Mar"); + var monthNames = new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"); var quarterNames = new Array("Q1","Q2","Q3","Q4"); var halfYearNames = new Array("HY1","HY2"); + k = 0; + + for( i = 0; i< monthDays.length; i++ ) + { + var curMonthDays = monthDays[i]; + + 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++; + } + } var orgUnitGroupIds = new Array(); var orgUnitGroupNames = new Array(); @@ -149,7 +189,7 @@
$i18n.getString( "year" )
- #foreach($periodName in $periodNameList) #end @@ -159,7 +199,7 @@
      $i18n.getString( "period" )
-

=== modified file 'local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/graphicalAnalysisIndicatorFront.vm' --- local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/graphicalAnalysisIndicatorFront.vm 2010-11-22 13:02:23 +0000 +++ local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/graphicalAnalysisIndicatorFront.vm 2010-12-03 11:30:11 +0000 @@ -7,6 +7,8 @@ // Global Variables + var dailyPeriodTypeName = '$dailyPeriodTypeName'; + var weeklyPeriodTypeName = '$weeklyPeriodTypeName'; var monthlyPeriodTypeName = '$monthlyPeriodTypeName'; var quarterlyPeriodTypeName = '$quarterlyPeriodTypeName'; var sixmonthPeriodTypeName = '$sixMonthPeriodTypeName'; @@ -17,10 +19,47 @@ var currentOrgUnitId; var currentOrgUnitName; - var monthNames = new Array("Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec","Jan","Feb","Mar"); + var monthDays = new Array(31,29,31,30,31,30,31,31,30,31,30,31); // for daily Period + var days = new Array(); + + //var monthNames = new Array("Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec","Jan","Feb","Mar"); + var monthNames = new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"); var quarterNames = new Array("Q1","Q2","Q3","Q4"); var halfYearNames = new Array("HY1","HY2"); + + k = 0; + for( i = 0; i< monthDays.length; i++ ) + { + var curMonthDays = monthDays[i]; + + 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++; + } + } + var orgUnitGroupIds = new Array(); var orgUnitGroupNames = new Array(); @@ -146,7 +185,7 @@
$i18n.getString( "year" )
- #foreach($periodName in $periodNameList) #end @@ -156,7 +195,7 @@
      $i18n.getString( "period" )
-

=== 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-12-02 11:15:31 +0000 +++ local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/javascript/gadataelement.js 2010-12-03 11:30:11 +0000 @@ -68,13 +68,17 @@ } + // function for getting periods -function getPeriods() { +function getPeriods() +{ var periodTypeList = document.getElementById("periodTypeLB"); var periodTypeId = periodTypeList.options[periodTypeList.selectedIndex].value; var periodLB = document.getElementById("periodLB"); - + + var yearLB = document.getElementById("yearLB"); + periodLB.disabled = false; clearList(periodLB); @@ -86,6 +90,15 @@ 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++) @@ -104,9 +117,89 @@ { periodLB.disabled = true; } + else if( periodTypeId == weeklyPeriodTypeName ) + { + + if( yearLB.selectedIndex < 0 ) + { + alert("Please select Year(s) First"); + return false; + } + else + { + getWeeks(); + } + + } } // function for getting periods ends +//getting weekly Period +function getWeeklyPeriod() +{ + var periodTypeList = document.getElementById( "periodTypeLB" ); + var periodTypeId = periodTypeList.options[ periodTypeList.selectedIndex ].value; + + if( periodTypeId == weeklyPeriodTypeName ) + { + getWeeks(); + } + +} + +//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 ) +{ + 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 ); + } +} // OrgUnit GroupSet Change Function /* function orgUnitGroupSetCB1() { @@ -122,6 +215,7 @@ clearList(orgUnitList); } */ + function getOrgUnitGroupsDataElements() { var checked = byId('ougGroupSetCB').checked; @@ -146,17 +240,15 @@ } else { - //document.getElementById( "ougGroupSetCB" ).disabled = true; + //document.getElementById( "ougGroupSetCB" ).disabled = true; } //clearList( ouGroupId ); } - - - //Category ListBox Change function +//Category ListBox Change function function categoryChangeFunction1(evt) { - selCategory = $("select#categoryLB").val(); + selCategory = $("select#categoryLB").val(); if(selCategory == "period" || selCategory == "children" ) { @@ -165,9 +257,10 @@ } else { - // $('#facilityLB').removeAttr('disabled'); + // $('#facilityLB').removeAttr('disabled'); } -} // categoryChangeFunction end +} + // categoryChangeFunction end //Removes slected orgunits from the Organisation List function remOUFunction() @@ -179,12 +272,13 @@ if (document.ChartGenerationForm.orgUnitListCB.options[i].selected) document.ChartGenerationForm.orgUnitListCB.options[i] = null; } -}// remOUFunction end +} + // remOUFunction end // singleSelectionOption OrgUnitGroup function selectSingleOptionOrgUnitGroup() { - //alert("inside single selection"); + //alert("inside single selection"); var categoryObj = document.getElementById( 'categoryLB' );// view by var categoryVal = categoryObj.options[ categoryObj.selectedIndex ].value; @@ -206,7 +300,6 @@ } } - // singleSelectionOption OrgUnit /* function selectSingleOrgUnitOption() @@ -241,7 +334,6 @@ //Graphical Analysis Form Validations function formValidationsDataElement() { - //var selectedServices = document.getElementById("selectedServices"); var selOUListLength = document.ChartGenerationForm.orgUnitListCB.options.length;//alert(selOUListLength); @@ -330,13 +422,11 @@ window.open('','chartWindowDataElement','width=' + sWidth + ', height=' + sHeight + ', ' + 'left=' + LeftPosition + ', top=' + TopPosition + ', ' + 'location=no, menubar=no, ' + 'status=no, toolbar=no, scrollbars=yes, resizable=yes'); return true; } -// formValidations Function DataElements End - - -//Graphical Analysis Form Indicators + // formValidations Function DataElements End + +//Graphical Analysis Form Validation Indicators function formValidationsIndicator() { - //var selectedServices = document.getElementById("selectedServices"); var selOUListLength = document.ChartGenerationForm.orgUnitListCB.options.length;//alert(selOUListLength); @@ -426,4 +516,5 @@ return true; } + // formValidations Function Indicators End === 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-12-02 11:15:31 +0000 +++ local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/javascript/ta.js 2010-12-03 11:30:11 +0000 @@ -345,7 +345,6 @@ // If the list of available indicators is empty, an empty placeholder will be added //addOptionPlaceHolder( availableIndicators ); } - // getting period List function getPeriods() { @@ -420,7 +419,6 @@ } } - //getting weekly Period function getWeeklyPeriod() { @@ -485,7 +483,6 @@ getWeeklyPeriodReceived(data); },'xml'); } - // week rang received function getWeeklyPeriodReceived( xmlObject ) { @@ -508,7 +505,6 @@ periodList.add( option, null ); } } - /* function getPeriods() { === 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-12-02 11:15:31 +0000 +++ local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/tabularAnalysisFront.vm 2010-12-03 11:30:11 +0000 @@ -33,20 +33,19 @@ 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 monthDays = new Array(31,29,31,30,31,30,31,31,30,31,30,31); // for daily Period + //var monthNames = new Array("Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec","Jan","Feb","Mar"); + + var monthNames = new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"); 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 ) @@ -73,14 +72,7 @@ k++; } } - - w = 0; - for( i = 0 ; i< 53; i++ ) - { - weeks[w] = "W-" + (i+1); - w++; - } - + var orgUnitGroupIds = new Array(); var orgUnitGroupNames = new Array();