← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 9139: local vn - Minor fixed

 

------------------------------------------------------------
revno: 9139
committer: Hieu <hieu.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2012-11-28 14:09:29 +0700
message:
  local vn - Minor fixed
modified:
  local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exporting/AbstractGenerateExcelReportSupport.java
  local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exporting/AbstractGenerateMultiExcelReportSupport.java
  local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/utils/ExcelUtils.java
  local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/javascript/preview.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-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exporting/AbstractGenerateExcelReportSupport.java'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exporting/AbstractGenerateExcelReportSupport.java	2012-11-26 09:12:15 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exporting/AbstractGenerateExcelReportSupport.java	2012-11-28 07:09:29 +0000
@@ -26,6 +26,12 @@
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
+import static org.hisp.dhis.reportsheet.utils.NumberUtils.PATTERN_DECIMAL_FORMAT1;
+import static org.hisp.dhis.reportsheet.utils.NumberUtils.applyPatternDecimalFormat;
+import static org.hisp.dhis.reportsheet.utils.NumberUtils.resetDecimalFormatByLocale;
+
+import java.util.Locale;
+
 import org.hisp.dhis.period.PeriodType;
 import org.hisp.dhis.reportsheet.ExportReport;
 
@@ -54,6 +60,9 @@
 
         this.installPeriod();
 
+        resetDecimalFormatByLocale( Locale.GERMAN );
+        applyPatternDecimalFormat( PATTERN_DECIMAL_FORMAT1 );
+        
         executeGenerateOutputFile( exportReport );
 
         this.complete();

=== modified file 'local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exporting/AbstractGenerateMultiExcelReportSupport.java'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exporting/AbstractGenerateMultiExcelReportSupport.java	2012-11-26 09:12:15 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exporting/AbstractGenerateMultiExcelReportSupport.java	2012-11-28 07:09:29 +0000
@@ -26,8 +26,13 @@
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
+import static org.hisp.dhis.reportsheet.utils.NumberUtils.PATTERN_DECIMAL_FORMAT1;
+import static org.hisp.dhis.reportsheet.utils.NumberUtils.applyPatternDecimalFormat;
+import static org.hisp.dhis.reportsheet.utils.NumberUtils.resetDecimalFormatByLocale;
+
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Locale;
 
 import org.hisp.dhis.dataelement.LocalDataElementService;
 import org.hisp.dhis.organisationunit.OrganisationUnitService;
@@ -80,6 +85,9 @@
             reports.add( exportReportService.getExportReport( Integer.parseInt( id ) ) );
         }
 
+        resetDecimalFormatByLocale( Locale.GERMAN );
+        applyPatternDecimalFormat( PATTERN_DECIMAL_FORMAT1 );
+        
         executeGenerateOutputFile( reports );
 
         this.complete();

=== modified file 'local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/utils/ExcelUtils.java'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/utils/ExcelUtils.java	2012-10-29 10:31:16 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/utils/ExcelUtils.java	2012-11-28 07:09:29 +0000
@@ -27,6 +27,9 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+import static org.hisp.dhis.reportsheet.utils.NumberUtils.getFormattedNumber;
+import static org.apache.poi.ss.usermodel.ErrorConstants.getText;
+
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
@@ -48,7 +51,6 @@
 import org.apache.poi.ss.usermodel.CellStyle;
 import org.apache.poi.ss.usermodel.DataFormatter;
 import org.apache.poi.ss.usermodel.DateUtil;
-import org.apache.poi.ss.usermodel.ErrorConstants;
 import org.apache.poi.ss.usermodel.FormulaEvaluator;
 
 /**
@@ -179,7 +181,7 @@
                 break;
 
             case org.apache.poi.ss.usermodel.Cell.CELL_TYPE_ERROR:
-                value = ErrorConstants.getText( cellPOI.getErrorCellValue() );
+                value = getText( cellPOI.getErrorCellValue() );
                 break;
 
             case org.apache.poi.ss.usermodel.Cell.CELL_TYPE_FORMULA:
@@ -228,17 +230,17 @@
                 break;
 
             case org.apache.poi.ss.usermodel.Cell.CELL_TYPE_ERROR:
-                value = ErrorConstants.getText( cellPOI.getErrorCellValue() );
+                value = getText( cellPOI.getErrorCellValue() );
                 break;
 
             case org.apache.poi.ss.usermodel.Cell.CELL_TYPE_FORMULA:
                 try
                 {
-                    value = NumberUtils.getFormattedNumber( dataFormatter.formatCellValue( cellPOI, evaluator ) );
+                    value = getFormattedNumber( dataFormatter.formatCellValue( cellPOI, evaluator ) );
                 }
                 catch ( Exception ex )
                 {
-                    value = ErrorConstants.getText( cellPOI.getErrorCellValue() );
+                    value = getText( cellPOI.getErrorCellValue() );
                 }
                 break;
             case org.apache.poi.ss.usermodel.Cell.CELL_TYPE_NUMERIC:
@@ -248,7 +250,7 @@
                 }
                 else
                 {
-                    value = NumberUtils.getFormattedNumber( dataFormatter.formatCellValue( cellPOI ) );
+                    value = getFormattedNumber( dataFormatter.formatCellValue( cellPOI ) );
                 }
                 break;
 
@@ -341,7 +343,8 @@
                 }
                 else
                 {
-                    cellPOI.setCellValue( Double.parseDouble( value ) );
+                    // cellPOI.setCellValue( Double.parseDouble( value ) );
+                    cellPOI.setCellValue( getFormattedNumber( value ) );
                 }
             }
         }
@@ -384,7 +387,8 @@
                 }
                 else
                 {
-                    cellPOI.setCellValue( Double.parseDouble( value ) );
+                    // cellPOI.setCellValue( Double.parseDouble( value ) );
+                    cellPOI.setCellValue( getFormattedNumber( value ) );
                 }
             }
         }
@@ -439,7 +443,7 @@
             org.apache.poi.ss.usermodel.Cell cellPOI = rowPOI.createCell( column - 1 );
             cellPOI.setCellStyle( cellStyle );
             cellPOI.setCellFormula( formula );
-            
+
             evaluator.evaluateFormulaCell( cellPOI );
         }
     }

=== modified file 'local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/javascript/preview.js'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/javascript/preview.js	2012-11-27 11:50:14 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/javascript/preview.js	2012-11-28 07:09:29 +0000
@@ -2,6 +2,8 @@
  * Global variables
  */
 
+spreadsheetTreePath = '../dhis-web-spreadsheet-reporting/';
+ 
 isImport = false;
 idTemp = null;
 importlist = null;
@@ -41,7 +43,7 @@
 		return;
 	}
 	
-	var url = 'validateGenerateReport.action?';
+	var url = spreadsheetTreePath + 'validateGenerateReport.action?';
 	
 	jQuery.each( exportReports, function ( i, item )
 	{
@@ -82,7 +84,7 @@
 
 function previewExportReport()
 {
-	jQuery.get( "previewExportReport.action",
+	jQuery.get( spreadsheetTreePath + "previewExportReport.action",
 	{
 		showSubItem: !isChecked( 'showSubItem' ),
 		generateByDefault: getFieldValue( 'generateByDefault' )
@@ -91,7 +93,7 @@
 
 function previewAdvandReport() 
 {	
-	jQuery.get( "previewAdvancedExportReport.action",
+	jQuery.get( spreadsheetTreePath + "previewAdvancedExportReport.action",
 	{
 		organisationGroupId: getFieldValue( 'availableOrgunitGroups' )
 	}, previewExportReportReceived );
@@ -123,7 +125,7 @@
 		_sHTMLBUTTONS.push( "</div>" );
 	}
 	else {
-		_sHTMLBUTTONS.push( "&nbsp;&nbsp;<a href='downloadFile.action' title='Download'><img src='images/download.png'/></a></div>" );
+		_sHTMLBUTTONS.push( "&nbsp;&nbsp;<a href='../dhis-web-spreadsheet-reporting/downloadFile.action' title='Download'><img src='images/download.png'/></a></div>" );
 	}
 	
 	var tabsHTML 	= [ _sHTMLBUTTONS.join('') + '<div id="tabs"><ul>' ];