dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #19832
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 8814: local vn - Fixed bug in generating the Org-unit listing
------------------------------------------------------------
revno: 8814
committer: Hieu <hieu.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2012-11-01 14:20:12 +0700
message:
local vn - Fixed bug in generating the Org-unit listing
modified:
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/action/GenerateMultiReportAction.java
local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exporting/action/GenerateReportCategoryAction.java
local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exporting/action/GenerateReportNormalAction.java
local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exporting/action/GenerateReportOrgGroupListingAction.java
local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exporting/action/GenerateReportVerticalCategoryAction.java
local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exporting/advance/action/GenerateAdvancedReportCategoryAction.java
local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exporting/advance/action/GenerateAdvancedReportOrgGroupListingAction.java
--
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/GenerateExcelReportGeneric.java'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exporting/GenerateExcelReportGeneric.java 2012-10-29 10:31:16 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exporting/GenerateExcelReportGeneric.java 2012-11-01 07:20:12 +0000
@@ -218,12 +218,16 @@
protected Font csFont10Normal;
protected Font csFont11Bold;
+
+ protected Font csFont11Normal;
protected Font csFont12NormalCenter;
protected CellStyle csNumber;
- protected CellStyle csFormula;
+ protected CellStyle csFormulaBold;
+
+ protected CellStyle csFormulaNormal;
protected CellStyle csText;
@@ -295,9 +299,11 @@
csFont8Normal = templateWorkbook.createFont();
csFont10Normal = templateWorkbook.createFont();
csFont11Bold = templateWorkbook.createFont();
+ csFont11Normal = templateWorkbook.createFont();
csFont12NormalCenter = templateWorkbook.createFont();
csNumber = templateWorkbook.createCellStyle();
- csFormula = templateWorkbook.createCellStyle();
+ csFormulaBold = templateWorkbook.createCellStyle();
+ csFormulaNormal = templateWorkbook.createCellStyle();
csText = templateWorkbook.createCellStyle();
csTextWithoutBorder = templateWorkbook.createCellStyle();
csText8Normal = templateWorkbook.createCellStyle();
@@ -322,13 +328,19 @@
IndexedColors.BLACK.getIndex() );
initPOIStylesManager.initFont( csFont11Bold, "Tahoma", (short) 11, Font.BOLDWEIGHT_BOLD,
IndexedColors.DARK_BLUE.getIndex() );
+ initPOIStylesManager.initFont( csFont11Normal, "Tahoma", (short) 11, Font.BOLDWEIGHT_NORMAL,
+ IndexedColors.DARK_BLUE.getIndex() );
initPOIStylesManager.initFont( csFont12NormalCenter, "Tahoma", (short) 12, Font.BOLDWEIGHT_NORMAL,
IndexedColors.BLUE.getIndex() );
initPOIStylesManager.initCellStyle( csNumber, csFont, this.CELLSTYLE_BORDER, this.CELLSTYLE_BORDER_COLOR,
this.CELLSTYLE_BORDER, this.CELLSTYLE_BORDER_COLOR, this.CELLSTYLE_BORDER, this.CELLSTYLE_BORDER_COLOR,
this.CELLSTYLE_BORDER, this.CELLSTYLE_BORDER_COLOR, this.CELLSTYLE_ALIGN_RIGHT, false );
- initPOIStylesManager.initCellStyle( csFormula, csFont11Bold, this.CELLSTYLE_BORDER,
+ initPOIStylesManager.initCellStyle( csFormulaBold, csFont11Bold, this.CELLSTYLE_BORDER,
+ this.CELLSTYLE_BORDER_COLOR, this.CELLSTYLE_BORDER, this.CELLSTYLE_BORDER_COLOR, this.CELLSTYLE_BORDER,
+ this.CELLSTYLE_BORDER_COLOR, this.CELLSTYLE_BORDER, this.CELLSTYLE_BORDER_COLOR,
+ this.CELLSTYLE_ALIGN_RIGHT, true );
+ initPOIStylesManager.initCellStyle( csFormulaNormal, csFont11Normal, this.CELLSTYLE_BORDER,
this.CELLSTYLE_BORDER_COLOR, this.CELLSTYLE_BORDER, this.CELLSTYLE_BORDER_COLOR, this.CELLSTYLE_BORDER,
this.CELLSTYLE_BORDER_COLOR, this.CELLSTYLE_BORDER, this.CELLSTYLE_BORDER_COLOR,
this.CELLSTYLE_ALIGN_RIGHT, true );
=== modified file 'local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exporting/action/GenerateMultiReportAction.java'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exporting/action/GenerateMultiReportAction.java 2012-10-29 10:31:16 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exporting/action/GenerateMultiReportAction.java 2012-11-01 07:20:12 +0000
@@ -133,7 +133,7 @@
this
.generatePeriodListing( reportInstance.getPeriodColumns(), exportItems, organisationUnit, sheet );
}
-
+
this.recalculatingFormula( sheet );
}
}
@@ -175,7 +175,7 @@
// EXCEL FORMULA
{
ExcelUtils.writeFormulaByPOI( reportItem.getRow(), reportItem.getColumn(), reportItem.getExpression(),
- sheet, this.csFormula, evaluatorFormula );
+ sheet, this.csFormulaBold, evaluatorFormula );
}
}
}
@@ -310,7 +310,7 @@
else if ( reportItem.getItemType().equalsIgnoreCase( ExportItem.TYPE.FORMULA_EXCEL ) )
{
ExcelUtils.writeFormulaByPOI( rowBegin, reportItem.getColumn(), ExcelUtils
- .generateExcelFormula( reportItem.getExpression(), run, run ), sheet, csFormula,
+ .generateExcelFormula( reportItem.getExpression(), run, run ), sheet, csFormulaNormal,
evaluatorFormula );
}
else
@@ -340,8 +340,8 @@
String columnName = ExcelUtils.convertColumnNumberToName( reportItem.getColumn() );
String formula = "SUM(" + columnName + (beginChapter + 1) + ":" + columnName + (rowBegin - 1) + ")";
- ExcelUtils.writeFormulaByPOI( beginChapter, reportItem.getColumn(), formula, sheet, this.csFormula,
- evaluatorFormula );
+ ExcelUtils.writeFormulaByPOI( beginChapter, reportItem.getColumn(), formula, sheet,
+ this.csFormulaBold, evaluatorFormula );
}
}
}
@@ -454,7 +454,7 @@
else if ( reportItem.getItemType().equalsIgnoreCase( ExportItem.TYPE.FORMULA_EXCEL ) )
{
ExcelUtils.writeFormulaByPOI( rowBegin, reportItem.getColumn(), ExcelUtils
- .generateExcelFormula( reportItem.getExpression(), run, run ), sheet, csFormula,
+ .generateExcelFormula( reportItem.getExpression(), run, run ), sheet, csFormulaNormal,
evaluatorFormula );
}
else
@@ -492,7 +492,7 @@
+ (rowBegin - 1) + ")";
ExcelUtils.writeFormulaByPOI( beginChapter, reportItem.getColumn(), formula, sheet,
- this.csFormula, evaluatorFormula );
+ this.csFormulaBold, evaluatorFormula );
}
}
}
@@ -590,7 +590,7 @@
// FORMULA_EXCEL
{
ExcelUtils.writeFormulaByPOI( rowBegin, reportItem.getColumn(), ExcelUtils
- .generateExcelFormula( reportItem.getExpression(), run, run ), sheet, this.csFormula,
+ .generateExcelFormula( reportItem.getExpression(), run, run ), sheet, this.csFormulaNormal,
evaluatorFormula );
}
@@ -609,7 +609,7 @@
formula = "SUM(" + columnName + (beginChapter + 1) + ":" + columnName + (rowBegin - 1) + ")";
ExcelUtils.writeFormulaByPOI( beginChapter, reportItem.getColumn(), formula, sheet,
- this.csFormula, evaluatorFormula );
+ this.csFormulaBold, evaluatorFormula );
totalFormula += columnName + beginChapter + ",";
}
@@ -618,7 +618,7 @@
formula = ExcelUtils.generateExcelFormula( reportItem.getExtraExpression(), next + 1, 0 );
ExcelUtils.writeFormulaByPOI( beginChapter, reportItem.getColumn(), formula, sheet,
- this.csFormula, evaluatorFormula );
+ this.csFormulaBold, evaluatorFormula );
}
}
@@ -630,15 +630,15 @@
{
totalFormula = totalFormula.substring( 0, totalFormula.length() - 1 ) + ")";
- ExcelUtils.writeFormulaByPOI( firstRow, reportItem.getColumn(), totalFormula, sheet, this.csFormula,
- evaluatorFormula );
+ ExcelUtils.writeFormulaByPOI( firstRow, reportItem.getColumn(), totalFormula, sheet,
+ this.csFormulaBold, evaluatorFormula );
}
else if ( reportItem.getItemType().equalsIgnoreCase( ExportItem.TYPE.INDICATOR ) )
{
totalFormula = ExcelUtils.generateExcelFormula( reportItem.getExtraExpression(), 0, 0 );
- ExcelUtils.writeFormulaByPOI( firstRow, reportItem.getColumn(), totalFormula, sheet, this.csFormula,
- evaluatorFormula );
+ ExcelUtils.writeFormulaByPOI( firstRow, reportItem.getColumn(), totalFormula, sheet,
+ this.csFormulaBold, evaluatorFormula );
}
}
}
=== modified file 'local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exporting/action/GenerateReportCategoryAction.java'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exporting/action/GenerateReportCategoryAction.java 2012-10-31 11:06:38 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exporting/action/GenerateReportCategoryAction.java 2012-11-01 07:20:12 +0000
@@ -167,7 +167,7 @@
else if ( reportItem.getItemType().equalsIgnoreCase( ExportItem.TYPE.FORMULA_EXCEL ) )
{
ExcelUtils.writeFormulaByPOI( rowBegin, reportItem.getColumn(), ExcelUtils
- .generateExcelFormula( reportItem.getExpression(), run, run ), sheet, csFormula,
+ .generateExcelFormula( reportItem.getExpression(), run, run ), sheet, csFormulaNormal,
evaluatorFormula );
}
else
@@ -197,8 +197,8 @@
String columnName = ExcelUtils.convertColumnNumberToName( reportItem.getColumn() );
String formula = "SUM(" + columnName + (beginChapter + 1) + ":" + columnName + (rowBegin - 1) + ")";
- ExcelUtils.writeFormulaByPOI( beginChapter, reportItem.getColumn(), formula, sheet, this.csFormula,
- evaluatorFormula );
+ ExcelUtils.writeFormulaByPOI( beginChapter, reportItem.getColumn(), formula, sheet,
+ this.csFormulaBold, evaluatorFormula );
}
}
=== modified file 'local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exporting/action/GenerateReportNormalAction.java'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exporting/action/GenerateReportNormalAction.java 2012-10-29 10:31:16 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exporting/action/GenerateReportNormalAction.java 2012-11-01 07:20:12 +0000
@@ -110,7 +110,7 @@
// EXCEL FORMULA
{
ExcelUtils.writeFormulaByPOI( reportItem.getRow(), reportItem.getColumn(), reportItem.getExpression(),
- sheet, this.csFormula, evaluatorFormula );
+ sheet, this.csFormulaBold, evaluatorFormula );
}
}
}
=== modified file 'local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exporting/action/GenerateReportOrgGroupListingAction.java'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exporting/action/GenerateReportOrgGroupListingAction.java 2012-11-01 02:12:05 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exporting/action/GenerateReportOrgGroupListingAction.java 2012-11-01 07:20:12 +0000
@@ -199,6 +199,7 @@
for ( OrganisationUnitGroup unitGroup : exportReport.getOrganisationUnitGroups() )
{
+ run++;
int beginChapter = rowBegin;
organisationUnits = childrenGroupMap.get( unitGroup.getId() );
@@ -223,15 +224,16 @@
else if ( reportItem.getItemType().equalsIgnoreCase( ExportItem.TYPE.FORMULA_EXCEL ) )
{
ExcelUtils.writeFormulaByPOI( rowBegin, reportItem.getColumn(), ExcelUtils.generateExcelFormula(
- reportItem.getExpression(), run + 1, run + 1 ), sheet, this.csFormula, evaluatorFormula );
+ reportItem.getExpression(), run, run ), sheet, this.csFormulaBold, evaluatorFormula );
}
- run++;
rowBegin++;
int serial = 1;
for ( OrganisationUnit o : organisationUnits )
{
+ run++;
+
if ( reportItem.getItemType().equalsIgnoreCase( ExportItem.TYPE.ORGANISATION ) )
{
ExcelUtils.writeValueByPOI( rowBegin, reportItem.getColumn(), o.getName(), ExcelUtils.TEXT,
@@ -260,11 +262,10 @@
// FORMULA_EXCEL
{
ExcelUtils.writeFormulaByPOI( rowBegin, reportItem.getColumn(), ExcelUtils
- .generateExcelFormula( reportItem.getExpression(), run, run ), sheet, this.csFormula,
+ .generateExcelFormula( reportItem.getExpression(), run, run ), sheet, this.csFormulaNormal,
evaluatorFormula );
}
- run++;
rowBegin++;
serial++;
}
@@ -279,7 +280,7 @@
formula = "SUM(" + columnName + (beginChapter + 1) + ":" + columnName + (rowBegin - 1) + ")";
ExcelUtils.writeFormulaByPOI( beginChapter, reportItem.getColumn(), formula, sheet,
- this.csFormula, evaluatorFormula );
+ this.csFormulaBold, evaluatorFormula );
totalFormula += columnName + beginChapter + ",";
}
@@ -288,7 +289,7 @@
formula = ExcelUtils.generateExcelFormula( reportItem.getExtraExpression(), next + 1, 0 );
ExcelUtils.writeFormulaByPOI( beginChapter, reportItem.getColumn(), formula, sheet,
- this.csFormula, evaluatorFormula );
+ this.csFormulaBold, evaluatorFormula );
}
}
else if ( reportItem.getItemType().equalsIgnoreCase( ExportItem.TYPE.DATAELEMENT )
@@ -307,15 +308,15 @@
{
totalFormula = totalFormula.substring( 0, totalFormula.length() - 1 ) + ")";
- ExcelUtils.writeFormulaByPOI( firstRow, reportItem.getColumn(), totalFormula, sheet, this.csFormula,
- evaluatorFormula );
+ ExcelUtils.writeFormulaByPOI( firstRow, reportItem.getColumn(), totalFormula, sheet,
+ this.csFormulaBold, evaluatorFormula );
}
else if ( reportItem.getItemType().equalsIgnoreCase( ExportItem.TYPE.INDICATOR ) )
{
totalFormula = ExcelUtils.generateExcelFormula( reportItem.getExtraExpression(), 0, 0 );
- ExcelUtils.writeFormulaByPOI( firstRow, reportItem.getColumn(), totalFormula, sheet, this.csFormula,
- evaluatorFormula );
+ ExcelUtils.writeFormulaByPOI( firstRow, reportItem.getColumn(), totalFormula, sheet,
+ this.csFormulaBold, evaluatorFormula );
}
isFirst = false;
@@ -334,14 +335,18 @@
for ( ExportItem reportItem : exportReportItems )
{
+ int run = 0;
int chapperNo = 0;
int firstRow = reportItem.getRow();
int rowBegin = firstRow + 1;
+
double value = 0;
double totalValue = 0;
for ( OrganisationUnitGroup unitGroup : exportReport.getOrganisationUnitGroups() )
{
+ run++;
+
organisationUnits = childrenGroupMap.get( unitGroup.getId() );
// Shift the number of rows - From start-row To end-row
@@ -385,7 +390,7 @@
// FORMULA_EXCEL
{
ExcelUtils.writeFormulaByPOI( rowBegin, reportItem.getColumn(), ExcelUtils.generateExcelFormula(
- reportItem.getExpression(), rowBegin, rowBegin ), sheet, this.csFormula, evaluatorFormula );
+ reportItem.getExpression(), run, run ), sheet, this.csFormulaNormal, evaluatorFormula );
}
rowBegin++;
=== modified file 'local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exporting/action/GenerateReportVerticalCategoryAction.java'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exporting/action/GenerateReportVerticalCategoryAction.java 2012-10-29 10:31:16 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exporting/action/GenerateReportVerticalCategoryAction.java 2012-11-01 07:20:12 +0000
@@ -73,7 +73,7 @@
exportReportItems = exportReportInstance.getExportItemBySheet( sheetNo );
this.generateVerticalOutPutFile( exportReportInstance, exportReportItems, unit, sheet );
-
+
this.recalculatingFormula( sheet );
}
@@ -137,8 +137,8 @@
else if ( reportItem.getItemType().equalsIgnoreCase( ExportItem.TYPE.FORMULA_EXCEL ) )
{
ExcelUtils.writeFormulaByPOI( rowBegin, reportItem.getColumn(), ExcelUtils
- .generateExcelFormula( reportItem.getExpression(), run, run ), sheet, csFormula,
- evaluatorFormula );
+ .generateExcelFormula( reportItem.getExpression(), run, run ), sheet,
+ csFormulaNormal, evaluatorFormula );
}
else
{
@@ -167,7 +167,7 @@
+ (rowBegin - 1) + ")";
ExcelUtils.writeFormulaByPOI( beginChapter, reportItem.getColumn(), formula, sheet,
- this.csFormula, evaluatorFormula );
+ this.csFormulaBold, evaluatorFormula );
}
break;
=== modified file 'local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exporting/advance/action/GenerateAdvancedReportCategoryAction.java'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exporting/advance/action/GenerateAdvancedReportCategoryAction.java 2012-10-29 10:31:16 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exporting/advance/action/GenerateAdvancedReportCategoryAction.java 2012-11-01 07:20:12 +0000
@@ -156,7 +156,7 @@
else if ( exportItem.getItemType().equalsIgnoreCase( ExportItem.TYPE.FORMULA_EXCEL ) )
{
ExcelUtils.writeFormulaByPOI( rowBegin, exportItem.getColumn(), ExcelUtils
- .generateExcelFormula( exportItem.getExpression(), iRow, iCol ), sheet, this.csFormula,
+ .generateExcelFormula( exportItem.getExpression(), iRow, iCol ), sheet, this.csFormulaNormal,
evaluatorFormula );
}
else
@@ -190,7 +190,7 @@
{
String columnName = ExcelUtils.convertColumnNumberToName( exportItem.getColumn() );
String formula = "SUM(" + columnName + (beginChapter + 1) + ":" + columnName + (rowBegin - 1) + ")";
- ExcelUtils.writeFormulaByPOI( beginChapter, exportItem.getColumn(), formula, sheet, this.csFormula,
+ ExcelUtils.writeFormulaByPOI( beginChapter, exportItem.getColumn(), formula, sheet, this.csFormulaBold,
evaluatorFormula );
}
}
=== modified file 'local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exporting/advance/action/GenerateAdvancedReportOrgGroupListingAction.java'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exporting/advance/action/GenerateAdvancedReportOrgGroupListingAction.java 2012-10-29 10:31:16 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exporting/advance/action/GenerateAdvancedReportOrgGroupListingAction.java 2012-11-01 07:20:12 +0000
@@ -157,7 +157,7 @@
else if ( exportItem.getItemType().equalsIgnoreCase( ExportItem.TYPE.FORMULA_EXCEL ) )
{
ExcelUtils.writeFormulaByPOI( rowBegin, exportItem.getColumn(), ExcelUtils.generateExcelFormula(
- exportItem.getExpression(), iRow, iCol ), sheet, this.csFormula, evaluatorFormula );
+ exportItem.getExpression(), iRow, iCol ), sheet, this.csFormulaNormal, evaluatorFormula );
}
rowBegin++;
@@ -170,7 +170,7 @@
{
String columnName = ExcelUtils.convertColumnNumberToName( exportItem.getColumn() );
String formula = "SUM(" + columnName + (beginChapter + 1) + ":" + columnName + (rowBegin - 1) + ")";
- ExcelUtils.writeFormulaByPOI( beginChapter, exportItem.getColumn(), formula, sheet, this.csFormula,
+ ExcelUtils.writeFormulaByPOI( beginChapter, exportItem.getColumn(), formula, sheet, this.csFormulaBold,
evaluatorFormula );
}
}