dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #12749
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 3983: Fixed bug in orgunitwise progress report
------------------------------------------------------------
revno: 3983
committer: Bharath <chbharathk@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2011-06-22 17:02:06 +0530
message:
Fixed bug in orgunitwise progress report
modified:
local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/ouwiseprogress/action/GenerateOuWiseProgressReportResultAction.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/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/ouwiseprogress/action/GenerateOuWiseProgressReportResultAction.java'
--- local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/ouwiseprogress/action/GenerateOuWiseProgressReportResultAction.java 2011-04-29 13:45:23 +0000
+++ local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/ouwiseprogress/action/GenerateOuWiseProgressReportResultAction.java 2011-06-22 11:32:06 +0000
@@ -25,6 +25,7 @@
import jxl.format.Alignment;
import jxl.format.Border;
import jxl.format.BorderLineStyle;
+import jxl.format.Colour;
import jxl.format.VerticalAlignment;
import jxl.write.Formula;
import jxl.write.Label;
@@ -219,10 +220,14 @@
orgUnitList = new ArrayList<OrganisationUnit>( selectedOrgUnit.getChildren() );
Collections.sort( orgUnitList, new OrganisationUnitShortNameComparator() );
+ orgUnitList.add( selectedOrgUnit );
+
+ /*
if( orgUnitList == null || orgUnitList.size() == 0 )
{
orgUnitList.add( selectedOrgUnit );
}
+ */
}
System.out.println( selectedOrgUnit.getName()+ " : " + selReportObj.getName()+" : Report Generation Start Time is : " + new Date() );
@@ -232,7 +237,7 @@
Workbook templateWorkbook = Workbook.getWorkbook( new File( inputTemplatePath ) );
WritableWorkbook outputReportWorkbook = Workbook.createWorkbook( new File( outputReportPath ), templateWorkbook );
- WritableFont arialBold = new WritableFont( WritableFont.ARIAL, 10, WritableFont.BOLD );
+
WritableCellFormat wCellformat = new WritableCellFormat();
wCellformat.setBorder( Border.ALL, BorderLineStyle.THIN );
wCellformat.setAlignment( Alignment.CENTRE );
@@ -381,11 +386,25 @@
try
{
- sheet0.addCell( new Number( tempColNo, tempRowNo, Double.parseDouble( tempStr ), wCellformat ) );
+ if( orgUnitCount == orgUnitList.size()-1 )
+ {
+ sheet0.addCell( new Number( tempColNo, tempRowNo, Double.parseDouble( tempStr ), getCellFormat1() ) );
+ }
+ else
+ {
+ sheet0.addCell( new Number( tempColNo, tempRowNo, Double.parseDouble( tempStr ), wCellformat ) );
+ }
}
catch( Exception e )
{
- sheet0.addCell( new Label( tempColNo, tempRowNo, tempStr, wCellformat ) );
+ if( orgUnitCount == orgUnitList.size()-1 )
+ {
+ sheet0.addCell( new Label( tempColNo, tempRowNo, tempStr, getCellFormat1() ) );
+ }
+ else
+ {
+ sheet0.addCell( new Label( tempColNo, tempRowNo, tempStr, wCellformat ) );
+ }
}
}
@@ -397,6 +416,7 @@
// ---------------------------------------------------------------------
// Writing Total Values
// ---------------------------------------------------------------------
+ /*
WritableCellFormat totalCellformat = new WritableCellFormat( arialBold );
totalCellformat.setBorder( Border.ALL, BorderLineStyle.THIN );
totalCellformat.setAlignment( Alignment.CENTRE );
@@ -445,7 +465,7 @@
totalSheet.addCell( new Formula( tempColNo+orgUnitCount, tempRowNo, tempFormula, totalCellformat ) );
}
}
-
+*/
outputReportWorkbook.write();
outputReportWorkbook.close();
@@ -464,6 +484,21 @@
return SUCCESS;
}
+ public WritableCellFormat getCellFormat1() throws Exception
+ {
+ WritableFont arialBold = new WritableFont( WritableFont.ARIAL, 10, WritableFont.BOLD );
+ WritableCellFormat wCellformat = new WritableCellFormat( arialBold );
+
+ wCellformat.setBorder( Border.ALL, BorderLineStyle.THIN );
+ wCellformat.setAlignment( Alignment.CENTRE );
+ wCellformat.setBackground( Colour.GRAY_25 );
+ wCellformat.setVerticalAlignment( VerticalAlignment.CENTRE );
+ wCellformat.setWrap( true );
+
+ return wCellformat;
+ }
+
+
private String getAggVal( String expression, Map<String, String> aggDeMap )
{
try