← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 7377: local vn - Temporary disabling in "multi-report" option. And rollback the period list as Monthly ...

 

------------------------------------------------------------
revno: 7377
committer: Hieu <hieu.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2012-06-25 13:46:16 +0700
message:
  local vn - Temporary disabling in "multi-report" option. And rollback the period list as Monthly and Dialy only.
added:
  local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/javascript/autoSum.js
modified:
  local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/impl/DefaultExportReportService.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/webapp/dhis-web-spreadsheet-reporting/generateReportForm.vm
  local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/javascript/export.js


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

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/impl/DefaultExportReportService.java'
--- local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/impl/DefaultExportReportService.java	2012-05-12 15:59:33 +0000
+++ local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/impl/DefaultExportReportService.java	2012-06-25 06:46:16 +0000
@@ -506,29 +506,37 @@
                     idMap.put( exportReport.getId(), DailyPeriodType.NAME );
                     break;
                 }
-                else if ( periodTypeName.equalsIgnoreCase( ExportItem.PERIODTYPE.SELECTED_MONTH )
-                    || periodTypeName.equalsIgnoreCase( ExportItem.PERIODTYPE.LAST_3_MONTH )
-                    || periodTypeName.equalsIgnoreCase( ExportItem.PERIODTYPE.LAST_6_MONTH )
-                    || periodTypeName.equalsIgnoreCase( ExportItem.PERIODTYPE.SO_FAR_THIS_YEAR ) )
-                {
-                    idMap.put( exportReport.getId(), MonthlyPeriodType.NAME );
-                    break;
-                }
-                else if ( periodTypeName.equalsIgnoreCase( ExportItem.PERIODTYPE.QUARTERLY ) )
-                {
-                    idMap.put( exportReport.getId(), QuarterlyPeriodType.NAME );
-                    break;
-                }
-                else if ( periodTypeName.equalsIgnoreCase( ExportItem.PERIODTYPE.SIX_MONTH ) )
-                {
-                    idMap.put( exportReport.getId(), SixMonthlyPeriodType.NAME );
-                    break;
-                }
-                else if ( periodTypeName.equalsIgnoreCase( ExportItem.PERIODTYPE.YEARLY ) )
-                {
-                    idMap.put( exportReport.getId(), YearlyPeriodType.NAME );
-                    break;
-                }
+                // else if ( periodTypeName.equalsIgnoreCase(
+                // ExportItem.PERIODTYPE.SELECTED_MONTH )
+                // || periodTypeName.equalsIgnoreCase(
+                // ExportItem.PERIODTYPE.LAST_3_MONTH )
+                // || periodTypeName.equalsIgnoreCase(
+                // ExportItem.PERIODTYPE.LAST_6_MONTH )
+                // || periodTypeName.equalsIgnoreCase(
+                // ExportItem.PERIODTYPE.SO_FAR_THIS_YEAR ) )
+                // {
+                // idMap.put( exportReport.getId(), MonthlyPeriodType.NAME );
+                // break;
+                // }
+                // else if ( periodTypeName.equalsIgnoreCase(
+                // ExportItem.PERIODTYPE.QUARTERLY ) )
+                // {
+                // idMap.put( exportReport.getId(), QuarterlyPeriodType.NAME );
+                // break;
+                // }
+                // else if ( periodTypeName.equalsIgnoreCase(
+                // ExportItem.PERIODTYPE.SIX_MONTH ) )
+                // {
+                // idMap.put( exportReport.getId(), SixMonthlyPeriodType.NAME );
+                // break;
+                // }
+                // else if ( periodTypeName.equalsIgnoreCase(
+                // ExportItem.PERIODTYPE.YEARLY ) )
+                // {
+                // idMap.put( exportReport.getId(), YearlyPeriodType.NAME );
+                // break;
+                // }
+
             }
         }
 

=== 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-07 06:25:18 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exporting/GenerateExcelReportGeneric.java	2012-06-25 06:46:16 +0000
@@ -26,16 +26,17 @@
  */
 package org.hisp.dhis.reportsheet.exporting;
 
-import static org.hisp.dhis.reportsheet.utils.ExpressionUtils.generateExpression;
-import static org.hisp.dhis.reportsheet.utils.ExpressionUtils.generateIndicatorExpression;
-import static org.hisp.dhis.reportsheet.utils.DateUtils.getTimeRoll;
 import static org.hisp.dhis.reportsheet.utils.DateUtils.getFirstDayOfMonth;
+import static org.hisp.dhis.reportsheet.utils.DateUtils.getFirstDayOfYear;
+import static org.hisp.dhis.reportsheet.utils.DateUtils.getLastDayOfYear;
 import static org.hisp.dhis.reportsheet.utils.DateUtils.getStartQuaterly;
 import static org.hisp.dhis.reportsheet.utils.DateUtils.getEndQuaterly;
 import static org.hisp.dhis.reportsheet.utils.DateUtils.getStartSixMonthly;
 import static org.hisp.dhis.reportsheet.utils.DateUtils.getEndSixMonthly;
-import static org.hisp.dhis.reportsheet.utils.DateUtils.getFirstDayOfYear;
-import static org.hisp.dhis.reportsheet.utils.DateUtils.getLastDayOfYear;
+import static org.hisp.dhis.reportsheet.utils.DateUtils.getTimeRoll;
+
+import static org.hisp.dhis.reportsheet.utils.ExpressionUtils.generateExpression;
+import static org.hisp.dhis.reportsheet.utils.ExpressionUtils.generateIndicatorExpression;
 import static org.hisp.dhis.reportsheet.utils.FileUtils.checkingExtensionExcelFile;
 import static org.hisp.dhis.system.util.MathUtils.calculateExpression;
 
@@ -491,7 +492,8 @@
         return result;
     }
 
-    protected String getTextValue( ExportItem exportItem, OrganisationUnit organisationUnit, Date startDate, Date endDate )
+    protected String getTextValue( ExportItem exportItem, OrganisationUnit organisationUnit, Date startDate,
+        Date endDate )
     {
         String result = "";
         Collection<Period> periods = new ArrayList<Period>();

=== modified file 'local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/generateReportForm.vm'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/generateReportForm.vm	2012-06-07 07:59:17 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/generateReportForm.vm	2012-06-25 06:46:16 +0000
@@ -46,9 +46,9 @@
 			</select>
 		</td>
     </tr>
-	<tr>
-		<td><label class='bold'>$i18n.getString( 'export_multi' )</label>&nbsp;&nbsp;<input type="checkbox" id="exportTypeCB" onchange="changeExportType( this );"/></td>
-	</tr>
+	<!--tr>
+		<td><label class='bold'>$i18n.getString('export_multi')</label>&nbsp;&nbsp;<input type="checkbox" id="exportTypeCB" onchange="changeExportType( this );"/></td>
+	</tr-->
 	<tr>
 		<td><label class='bold'>$i18n.getString( 'export_reports' )<em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
 		<td><label class='bold'>$i18n.getString( 'period' )<em title="$i18n.getString( 'required' )" class="required">*</em></label></td>

=== added file 'local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/javascript/autoSum.js'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/javascript/autoSum.js	1970-01-01 00:00:00 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/javascript/autoSum.js	2012-06-25 06:46:16 +0000
@@ -0,0 +1,51 @@
+function getValue( fieldId )
+{
+	var value = '';
+	var element = byId( fieldId );
+
+	if ( element ) {
+		value = element.getElementsByTagName('input')[0].value;
+	}
+	else {
+		value = jQuery( '#' + fieldId.split('.')[0] + '-' + fieldId.split('.')[1] + '-val').val();
+	}
+	
+	if ( value == '' ) {
+		return 0;
+	}
+	
+	return value;
+}
+
+// Assign value and save to database
+function assignValue( fieldId, value )
+{	
+	value = (value == 0) ? "" : value;
+	
+	var element = byId( fieldId );
+
+	if ( element ) {
+		element.getElementsByTagName('input')[0].value = value;
+	}
+	else {
+		setFieldValue( fieldId.split('.')[0] + '-' + fieldId.split('.')[1] + '-val', value );
+	}
+	
+	saveVal( fieldId.split('.')[0], fieldId.split('.')[1] );
+}
+
+// Sum for two
+function sum2( targetField, field1, field2 )
+{
+	var sumValue = eval( getValue(field1) ) + eval( getValue(field2) );
+	
+	assignValue( targetField, sumValue );
+}
+
+// Sum for three
+function sum( targetField, field1, field2, field3 )
+{
+	var sumValue = eval( getValue(field1) ) + eval( getValue(field2) ) + eval( getValue(field3) );
+	
+	assignValue( targetField, sumValue );
+}
\ No newline at end of file

=== modified file 'local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/javascript/export.js'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/javascript/export.js	2012-05-16 07:25:34 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/javascript/export.js	2012-06-25 06:46:16 +0000
@@ -85,7 +85,7 @@
 
 		if ( value && value != null )
 		{
-			currentPeriodTypeName = value.split( '_' )[1];
+			currentPeriodTypeName = value.split( '_' )[1] == "" ? "Monthly" : value.split( '_' )[1];
 			currentReportTypeName = value.split( '_' )[2];
 
 			if ( currentReportTypeName == "P" ) {
@@ -129,7 +129,7 @@
 		var periodType = value.split( "_" )[0];
 		var date = value.split( "_" )[1];
 		var submitDateId = "";
-		
+
 		if ( periodType == "Weekly" )
 		{
 		}