← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 7541: local vn - Added new relative period type as "3, 6, 9, 12 month".

 

------------------------------------------------------------
revno: 7541
committer: Hieu <hieu.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2012-07-09 16:16:24 +0700
message:
  local vn - Added new relative period type as "3,6,9,12 month".
modified:
  local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/ExportItem.java
  local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exporting/GenerateExcelReportGeneric.java
  local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exportitem/action/SetupExportItemFormAction.java
  local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/utils/DateUtils.java
  local/vn/dhis-web-spreadsheet-reporting/src/main/resources/org/hisp/dhis/reportsheet/i18n_module.properties
  local/vn/dhis-web-spreadsheet-reporting/src/main/resources/org/hisp/dhis/reportsheet/i18n_module_vi_VN.properties


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

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/ExportItem.java'
--- local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/ExportItem.java	2012-04-25 09:59:24 +0000
+++ local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/ExportItem.java	2012-07-09 09:16:24 +0000
@@ -4,7 +4,7 @@
 import java.util.List;
 
 /*
- * Copyright (c) 2004-2011, University of Oslo
+ * Copyright (c) 2004-2012, University of Oslo
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -184,7 +184,7 @@
 
         public static final String SO_FAR_THIS_QUARTER = "so_far_this_quarter";
 
-        // Used for other report
+        // Used for other reports
         public static final String SELECTED_MONTH = "selected_month";
 
         public static final String LAST_3_MONTH = "last_3_month";
@@ -196,6 +196,8 @@
         public static final String SIX_MONTH = "6_month";
 
         public static final String SO_FAR_THIS_YEAR = "so_far_this_year";
+        
+        public static final String THREE_SIX_NINE_TWELVE_MONTH = "3_6_9_12_month";
 
         public static final String YEARLY = "yealy";
 
@@ -205,12 +207,13 @@
             list.add( DAILY );
             list.add( SO_FAR_THIS_MONTH );
             list.add( SO_FAR_THIS_QUARTER );
+            list.add( SO_FAR_THIS_YEAR );
             list.add( SELECTED_MONTH );
             list.add( LAST_3_MONTH );
-            list.add( SO_FAR_THIS_YEAR );
             list.add( LAST_6_MONTH );
             list.add( QUARTERLY );
             list.add( SIX_MONTH );
+            list.add( THREE_SIX_NINE_TWELVE_MONTH );
             list.add( YEARLY );
 
             return list;

=== modified file 'local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exporting/GenerateExcelReportGeneric.java'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exporting/GenerateExcelReportGeneric.java	2012-06-25 06:46:16 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exporting/GenerateExcelReportGeneric.java	2012-07-09 09:16:24 +0000
@@ -382,13 +382,6 @@
         last3MonthStartDate = getTimeRoll( last3MonthStartDate, Calendar.DATE, -1 );
         last3MonthEndDate = period.getEndDate();
 
-        // So far this year period
-        calendar.setTime( endDate );
-
-        firstDayOfYear = getFirstDayOfYear( calendar.get( Calendar.YEAR ) );
-        firstDayOfYear = getTimeRoll( firstDayOfYear, Calendar.DATE, -1 );
-        endDateOfYear = getLastDayOfYear( calendar.get( Calendar.YEAR ) );
-
         // Last 6 month period
         // Last 5 months + this month = last 6 month
         last6MonthStartDate = getTimeRoll( startDate, Calendar.MONTH, -5 );
@@ -404,6 +397,13 @@
         startSixMonthly = getStartSixMonthly( startDate );
         startSixMonthly = getTimeRoll( startSixMonthly, Calendar.DATE, -1 );
         endSixMonthly = getEndSixMonthly( startDate );
+
+        // So far this year period
+        calendar.setTime( endDate );
+
+        firstDayOfYear = getFirstDayOfYear( calendar.get( Calendar.YEAR ) );
+        firstDayOfYear = getTimeRoll( firstDayOfYear, Calendar.DATE, -1 );
+        endDateOfYear = getLastDayOfYear( calendar.get( Calendar.YEAR ) );
     }
 
     protected void installReadTemplateFile( ExportReport exportReport, Period period, Object object )
@@ -582,6 +582,11 @@
             value = calculateExpression( generateExpression( exportItem, startSixMonthly, endSixMonthly,
                 organisationUnit, dataElementService, categoryService, aggregationService ) );
         }
+        else if ( exportItem.getPeriodType().equalsIgnoreCase( ExportItem.PERIODTYPE.THREE_SIX_NINE_TWELVE_MONTH ) )
+        {
+            value = calculateExpression( generateExpression( exportItem, firstDayOfYear, endQuaterly, organisationUnit,
+                dataElementService, categoryService, aggregationService ) );
+        }
         else if ( exportItem.getPeriodType().equalsIgnoreCase( ExportItem.PERIODTYPE.YEARLY ) )
         {
             value = calculateExpression( generateExpression( exportItem, firstDayOfYear, endDateOfYear,
@@ -609,26 +614,26 @@
             value = calculateExpression( generateIndicatorExpression( exportItem, startDate, endDate, organisationUnit,
                 indicatorService, aggregationService ) );
         }
+        else if ( exportItem.getPeriodType().equalsIgnoreCase( ExportItem.PERIODTYPE.SO_FAR_THIS_QUARTER ) )
+        {
+            value = calculateExpression( generateIndicatorExpression( exportItem, startQuaterly, endDate,
+                organisationUnit, indicatorService, aggregationService ) );
+        }
+        else if ( exportItem.getPeriodType().equalsIgnoreCase( ExportItem.PERIODTYPE.SO_FAR_THIS_YEAR ) )
+        {
+            value = calculateExpression( generateIndicatorExpression( exportItem, firstDayOfYear, endDate,
+                organisationUnit, indicatorService, aggregationService ) );
+        }
         else if ( exportItem.getPeriodType().equalsIgnoreCase( ExportItem.PERIODTYPE.LAST_3_MONTH ) )
         {
             value = calculateExpression( generateIndicatorExpression( exportItem, last3MonthStartDate,
                 last3MonthEndDate, organisationUnit, indicatorService, aggregationService ) );
         }
-        else if ( exportItem.getPeriodType().equalsIgnoreCase( ExportItem.PERIODTYPE.SO_FAR_THIS_YEAR ) )
-        {
-            value = calculateExpression( generateIndicatorExpression( exportItem, firstDayOfYear, endDate,
-                organisationUnit, indicatorService, aggregationService ) );
-        }
         else if ( exportItem.getPeriodType().equalsIgnoreCase( ExportItem.PERIODTYPE.LAST_6_MONTH ) )
         {
             value = calculateExpression( generateIndicatorExpression( exportItem, last6MonthStartDate,
                 last6MonthEndDate, organisationUnit, indicatorService, aggregationService ) );
         }
-        else if ( exportItem.getPeriodType().equalsIgnoreCase( ExportItem.PERIODTYPE.YEARLY ) )
-        {
-            value = calculateExpression( generateIndicatorExpression( exportItem, firstDayOfYear, endDateOfYear,
-                organisationUnit, indicatorService, aggregationService ) );
-        }
         else if ( exportItem.getPeriodType().equalsIgnoreCase( ExportItem.PERIODTYPE.QUARTERLY ) )
         {
             value = calculateExpression( generateIndicatorExpression( exportItem, startQuaterly, endQuaterly,
@@ -639,6 +644,16 @@
             value = calculateExpression( generateIndicatorExpression( exportItem, startSixMonthly, endSixMonthly,
                 organisationUnit, indicatorService, aggregationService ) );
         }
+        else if ( exportItem.getPeriodType().equalsIgnoreCase( ExportItem.PERIODTYPE.THREE_SIX_NINE_TWELVE_MONTH ) )
+        {
+            value = calculateExpression( generateIndicatorExpression( exportItem, firstDayOfYear, endQuaterly,
+                organisationUnit, indicatorService, aggregationService ) );
+        }
+        else if ( exportItem.getPeriodType().equalsIgnoreCase( ExportItem.PERIODTYPE.YEARLY ) )
+        {
+            value = calculateExpression( generateIndicatorExpression( exportItem, firstDayOfYear, endDateOfYear,
+                organisationUnit, indicatorService, aggregationService ) );
+        }
 
         return value;
     }

=== modified file 'local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exportitem/action/SetupExportItemFormAction.java'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exportitem/action/SetupExportItemFormAction.java	2012-02-03 08:38:42 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exportitem/action/SetupExportItemFormAction.java	2012-07-09 09:16:24 +0000
@@ -110,11 +110,9 @@
         return exportReport;
     }
 
-    private List<String> periodTypes;
-
     public List<String> getPeriodTypes()
     {
-        return periodTypes;
+        return ExportItem.PERIODTYPE.getPeriodTypes();
     }
 
     private List<DataElementGroup> dataElementGroups;
@@ -149,8 +147,6 @@
 
         Collections.sort( indicatorGroups, new IdentifiableObjectNameComparator() );
 
-        periodTypes = ExportItem.PERIODTYPE.getPeriodTypes();
-
         if ( exportItemId != null )
         {
             exportItem = exportReportService.getExportItem( this.exportItemId );

=== modified file 'local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/utils/DateUtils.java'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/utils/DateUtils.java	2011-10-13 03:03:58 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/utils/DateUtils.java	2012-07-09 09:16:24 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004-2011, University of Oslo
+ * Copyright (c) 2004-2012, University of Oslo
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -34,24 +34,24 @@
  * @version $Id$
  */
 public class DateUtils
-{    
-    @SuppressWarnings("deprecation")
+{
+    @SuppressWarnings( "deprecation" )
     public static Date getFirstDayOfMonth( Date date )
     {
         Calendar result = Calendar.getInstance();
-        
+
         Calendar calendar = Calendar.getInstance();
         calendar.set( Calendar.YEAR, date.getYear() + 1900 );
         calendar.set( Calendar.MONTH, date.getMonth() );
         calendar.set( Calendar.DATE, date.getDate() );
-        
+
         result.set( Calendar.DATE, calendar.getActualMinimum( Calendar.DATE ) );
         result.set( Calendar.MONTH, calendar.get( Calendar.MONTH ) );
         result.set( Calendar.YEAR, calendar.get( Calendar.YEAR ) );
-        
+
         return result.getTime();
     }
-    
+
     public static Date getFirstDayOfYear( int year )
     {
         Calendar calendar = Calendar.getInstance();
@@ -178,13 +178,13 @@
                 calendar.roll( field, numberOfRoll );
             }
         }
-
-        if ( field == Calendar.MONTH )
+        else if ( field == Calendar.MONTH )
         {
             if ( (numberOfRoll + calendar.get( Calendar.MONTH ) + 1) <= 0 )
             {
                 calendar.roll( Calendar.YEAR, -1 );
             }
+
             if ( calendar.get( Calendar.MONTH ) == Calendar.JANUARY )
             {
                 if ( numberOfRoll < 0 )

=== modified file 'local/vn/dhis-web-spreadsheet-reporting/src/main/resources/org/hisp/dhis/reportsheet/i18n_module.properties'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/resources/org/hisp/dhis/reportsheet/i18n_module.properties	2012-07-04 10:12:19 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/resources/org/hisp/dhis/reportsheet/i18n_module.properties	2012-07-09 09:16:24 +0000
@@ -30,11 +30,12 @@
 daily						= Daily
 so_far_this_month			= So far this month
 so_far_this_quarter			= So far this quarter
-last_6_month				= Last 6 month
+selected_month				= Selected Month
 quaterly					= Quarterly
 6_month						= Six monthly
+last_6_month				= Last 6 month
+3_6_9_12_month				= 3,6,9,12 month
 yealy						= Yearly
-selected_month				= Selected Month
 last_3_month				= Last 3 Month
 so_far_this_year			= So Far This year
 calculation					= Calculation

=== modified file 'local/vn/dhis-web-spreadsheet-reporting/src/main/resources/org/hisp/dhis/reportsheet/i18n_module_vi_VN.properties'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/resources/org/hisp/dhis/reportsheet/i18n_module_vi_VN.properties	2012-07-04 10:12:19 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/resources/org/hisp/dhis/reportsheet/i18n_module_vi_VN.properties	2012-07-09 09:16:24 +0000
@@ -11,7 +11,6 @@
 ATTRIBUTE=Li\u1ec7t k\u00ea theo thu\u1ed9c t\u00ednh
 category_option_combo=Danh s\u00e1ch t\u1eadp ph\u00e2n lo\u1ea1i
 period_=theo th\u1eddi gian
-6_month=H\u1eb1ng 6 th\u00e1ng
 dataelement_name=T\u00ean ph\u1ea7n t\u1eed d\u1eef li\u1ec7u
 report_excel=B\u00e1o c\u00e1o excel
 line=\u0110\u01b0\u1eddng
@@ -73,9 +72,9 @@
 missing_template=C\u1ea3nh b\u00e1o! T\u1eadp tin b\u1ea3ng b\u1ecb thi\u1ebfu.
 no_group_order_created_for_category=Kh\u00f4ng c\u00f3 nh\u00f3m ph\u1ea7n t\u1eed th\u1ee9 t\u1ef1 \u0111\u01b0\u1ee3c t\u1ea1o cho lo\u1ea1i b\u00e1o c\u00e1o n\u00e0y
 dataelements=Ph\u1ea7n t\u1eed d\u1eef li\u1ec7u
-so_far_this_month=D\u1eef li\u1ec7u t\u1eeb \u0111\u1ea7u th\u00e1ng \u0111\u1ebfn ng\u00e0y \u0111\u01b0\u1ee3c ch\u1ecdn
+
 basic=C\u01a1 b\u1ea3n
-yearly=H\u00e0ng n\u0103m
+
 confirm_rename=B\u1ea1n c\u00f3 mu\u1ed1n \u0111\u1ed5i t\u00ean n\u00f3 kh\u00f4ng?
 line_=\u0111\u01b0\u1eddng
 specify_template_directory=H\u00e3y x\u00e1c \u0111\u1ecbnh th\u01b0 m\u1ee5c m\u1eabu
@@ -131,7 +130,7 @@
 bookmark_success=\u0110\u00e3 \u0111\u00e1nh d\u1ea5u
 export_items=Danh s\u00e1ch ph\u1ea7n t\u1eed b\u00e1o c\u00e1o
 dhis-web-chr-form=Phi\u1ebfu s\u1ee9c kh\u1ecfe tr\u1ebb em
-selected_month=th\u00e1ng \u0111\u01b0\u1ee3c ch\u1ecdn
+
 show_legend=Hi\u1ec3n th\u1ecb ch\u00fa th\u00edch
 selected_=\u0111\u01b0\u1ee3c ch\u1ecdn
 update_report_import_item=Ch\u1ec9nh s\u1eeda ph\u1ea7n t\u1eed b\u00e1o c\u00e1o
@@ -148,10 +147,17 @@
 filter_by_sheet=L\u1ecdc theo b\u1ea3ng t\u00ednh
 improt_report=B\u00e1o c\u00e1o Nh\u1eadp
 report_roles=B\u00e1o c\u00e1o v\u00e0 ph\u00e2n quy\u1ec1n
-so_far_this_quarter=D\u1eef li\u1ec7u t\u1eeb \u0111\u1ea7u qu\u00fd \u0111\u1ebfn ng\u00e0y \u0111\u01b0\u1ee3c ch\u1ecdn
 pie_char=Bi\u1ec3u \u0111\u1ed3 tr\u00f2n
 number_datavalue=S\u1ed1 d\u1eef li\u1ec7u
 daily=H\u00e0ng ng\u00e0y
+so_far_this_month=D\u1eef li\u1ec7u t\u1eeb \u0111\u1ea7u th\u00e1ng \u0111\u1ebfn ng\u00e0y \u0111\u01b0\u1ee3c ch\u1ecdn
+so_far_this_quarter=D\u1eef li\u1ec7u t\u1eeb \u0111\u1ea7u qu\u00fd \u0111\u1ebfn ng\u00e0y \u0111\u01b0\u1ee3c ch\u1ecdn
+selected_month=th\u00e1ng \u0111\u01b0\u1ee3c ch\u1ecdn
+quaterly=H\u1eb1ng qu\u00fd
+6_month=H\u1eb1ng 6 th\u00e1ng
+last_6_month=6 th\u00e1ng g\u1ea7n nh\u1ea5t
+3_6_9_12_month=3,6,9,12 th\u00e1ng
+yearly=H\u00e0ng n\u0103m
 copy_export_item_to_exportreport=Sao ch\u00e9p ph\u1ea7n t\u1eed Xu\u1ea5t t\u1edbi b\u00e1o c\u00e1o Xu\u1ea5t
 selected_dataelements=Ph\u1ea7n t\u1eed c\u00f3 s\u1eb5n
 LOAD_PERIOD_SELECTED=T\u1ea3i th\u1eddi \u0111i\u1ec3m t\u1eeb ch\u1ecdn l\u1ef1a
@@ -221,7 +227,7 @@
 plus=Ph\u00e9p c\u1ed9ng
 column_is_null=Vui l\u00f2ng nh\u1eadp s\u1ed1 c\u1ed9t!
 update_sorted_dataelement=C\u1eadp nh\u1eadt th\u1ee9 t\u1ef1 d\u1eef li\u1ec7u
-last_6_month=6 th\u00e1ng g\u1ea7n nh\u1ea5t
+
 organisation_chart=Bi\u1ec3u \u0111\u1ed3 \u0111\u01a1n v\u1ecb
 intro_design_export_reports=T\u1ea1o m\u1edbi, c\u1eadp nh\u1eadt, xem v\u00e0 x\u00f3a c\u00e1c b\u00e1o c\u00e1o b\u1ea3ng. M\u1ed9t b\u00e1o c\u00e1o b\u1ea3ng ch\u1ee9a nhi\u1ec1u ph\u1ea7n t\u1eed. B\u00e1o c\u00e1o b\u1ea3ng c\u00f3 th\u1ec3 thu\u1ed9c nhi\u1ec1u lo\u1ea1i b\u00e1o c\u00e1o kh\u00e1c nhau. Cho ph\u00e9p g\u00e1n b\u00e1o c\u00e1o cho m\u1ed9t hay nhi\u1ec1u \u0111\u01a1n v\u1ecb ho\u1eb7c nh\u00f3m \u0111\u01a1n v\u1ecb v\u00e0 m\u1ed9t s\u1ed1 t\u00f9y ch\u1ecdn kh\u00e1c.
 intro_design_import_reports=T\u1ea1o m\u1edbi, c\u1eadp nh\u1eadt, x\u00f3a v\u00e0 xem c\u00e1c ph\u1ea7n t\u1eed \u0111\u1ec3 t\u00edch h\u1ee3p d\u1eef li\u1ec7u t\u1eeb c\u00e1c t\u1eadp tin b\u1ea3ng. C\u00e1c ph\u1ea7n t\u1eed n\u00e0y t\u01b0\u01a1ng \u0111\u01b0\u01a1ng v\u1edbi c\u00e1c ph\u1ea7n t\u1eed b\u00e1o c\u00e1o.
@@ -234,7 +240,6 @@
 CATEGORY=Ph\u00e2n lo\u1ea1i
 CATEGORY_VERTICAL=Ph\u00e2n lo\u1ea1i theo h\u00e0ng d\u1ecdc
 the_specified_report_is_not_exist=C\u1ea3nh b\u00e1o! B\u00e1o c\u00e1o n\u00e0y hi\u1ec7n t\u1ea1i kh\u00f4ng c\u00f2n hi\u1ec7u l\u1ef1c/t\u1ed3n t\u1ea1i.
-yealy=H\u1eb1ng n\u0103m
 export_reports=B\u00e1o c\u00e1o Xu\u1ea5t
 design_export_reports=Thi\u1ebft k\u1ebf b\u00e1o c\u00e1o Xu\u1ea5t
 design_import_reports=Thi\u1ebft k\u1ebf b\u00e1o c\u00e1o Nh\u1eadp
@@ -309,7 +314,7 @@
 load_period_by=Th\u1eddi \u0111i\u1ec3m theo
 grouplisting=Danh s\u00e1ch nh\u00f3m
 config_path_invalid=C\u1ea5u h\u00ecnh kh\u00f4ng h\u1ee3p l\u1ec7! Ch\u1ec9 cho ph\u00e9p nh\u1eadp ch\u1eef c\u00e1i, ch\u1eef s\u1ed1, k\u00fd t\u1ef1 g\u1ea1ch d\u01b0\u1edbi, g\u1ea1ch ngang v\u00e0 kho\u1ea3ng tr\u1eafng.
-quaterly=H\u1eb1ng qu\u00fd
+
 confirm_override=B\u1ea1n c\u00f3 mu\u1ed1n ghi \u0111\u00e8 l\u00ean t\u1eadp tin \u0111\u00e3 c\u00f3?
 dataset_is_null=H\u00e3y ch\u1ecdn t\u1eadp d\u1eef li\u1ec7u!
 there_is_no_import_report=Kh\u00f4ng c\u00f3 ph\u1ea7n t\u1eed t\u00edch h\u1ee3p/b\u00e1o c\u00e1o n\u00e0o trong h\u1ec7 th\u1ed1ng