dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #17226
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 6784: local vn - Fixed in exporting the value type as text.
------------------------------------------------------------
revno: 6784
committer: Hieu <hieu.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2012-04-27 17:13:06 +0700
message:
local vn - Fixed in exporting the value type as text.
modified:
local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/ExportReportPeriodColumnListing.java
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/action/GenerateReportNormalAction.java
local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exporting/action/GenerateReportPeriodColumnListingAction.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-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/ExportReportPeriodColumnListing.java'
--- local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/ExportReportPeriodColumnListing.java 2012-04-26 18:25:07 +0000
+++ local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/ExportReportPeriodColumnListing.java 2012-04-27 10:13:06 +0000
@@ -82,6 +82,7 @@
{
List<String> types = new ArrayList<String>();
types.add( ExportItem.TYPE.DATAELEMENT );
+ types.add( ExportItem.TYPE.DATAELEMENT_VALUETYPE_TEXT );
types.add( ExportItem.TYPE.INDICATOR );
return types;
=== 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-04-25 09:59:24 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exporting/AbstractGenerateExcelReportSupport.java 2012-04-27 10:13:06 +0000
@@ -26,7 +26,6 @@
* (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.DateUtils.getEndQuaterly;
import static org.hisp.dhis.reportsheet.utils.DateUtils.getEndSixMonthly;
import static org.hisp.dhis.reportsheet.utils.DateUtils.getFirstDayOfMonth;
@@ -42,7 +41,9 @@
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
+import java.util.ArrayList;
import java.util.Calendar;
+import java.util.Collection;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
@@ -210,27 +211,37 @@
protected String getTextValue( ExportItem exportItem, OrganisationUnit organisationUnit )
{
- Period p = null;
+ String result = "";
+ Collection<Period> periods = new ArrayList<Period>();
if ( exportItem.getPeriodType().equalsIgnoreCase( ExportItem.PERIODTYPE.DAILY ) )
{
- p = periodService.getPeriod( startDate, startDate, new DailyPeriodType() );
+ periods = periodService.getPeriodsBetweenDates( periodService.getPeriodTypeByName( DailyPeriodType.NAME ),
+ startDate, startDate );
}
else if ( exportItem.getPeriodType().equalsIgnoreCase( ExportItem.PERIODTYPE.SELECTED_MONTH ) )
{
- p = periodService.getPeriod( startDate, endDate, new MonthlyPeriodType() );
+ periods = periodService.getPeriodsBetweenDates(
+ periodService.getPeriodTypeByName( MonthlyPeriodType.NAME ), startDate, endDate );
}
else if ( exportItem.getPeriodType().equalsIgnoreCase( ExportItem.PERIODTYPE.QUARTERLY ) )
{
- p = periodService.getPeriod( startQuaterly, endQuaterly, new QuarterlyPeriodType() );
+ periods = periodService.getPeriodsBetweenDates( periodService
+ .getPeriodTypeByName( QuarterlyPeriodType.NAME ), startQuaterly, endQuaterly );
}
else if ( exportItem.getPeriodType().equalsIgnoreCase( ExportItem.PERIODTYPE.YEARLY ) )
{
- p = periodService.getPeriod( firstDayOfYear, endDateOfYear, new YearlyPeriodType() );
- }
-
- return generateExpression( exportItem, p, organisationUnit, dataElementService, categoryService,
- dataValueService );
+ periods = periodService.getPeriodsBetweenDates( periodService.getPeriodTypeByName( YearlyPeriodType.NAME ),
+ firstDayOfYear, endDateOfYear );
+ }
+
+ for ( Period p : periods )
+ {
+ result += generateExpression( exportItem, p, organisationUnit, dataElementService, categoryService,
+ dataValueService ) + "\n";
+ }
+
+ return result;
}
protected double getDataValue( ExportItem exportItem, OrganisationUnit organisationUnit )
=== 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-04-25 09:59:24 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exporting/action/GenerateReportNormalAction.java 2012-04-27 10:13:06 +0000
@@ -87,7 +87,7 @@
{
String value = getTextValue( reportItem, organisationUnit );
- ExcelUtils.writeValueByPOI( reportItem.getRow(), reportItem.getColumn(), value, ExcelUtils.NUMBER,
+ ExcelUtils.writeValueByPOI( reportItem.getRow(), reportItem.getColumn(), value, ExcelUtils.TEXT,
sheet, this.csText );
}
else if ( reportItem.getItemType().equalsIgnoreCase( ExportItem.TYPE.INDICATOR ) )
=== modified file 'local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exporting/action/GenerateReportPeriodColumnListingAction.java'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exporting/action/GenerateReportPeriodColumnListingAction.java 2012-04-06 08:44:30 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exporting/action/GenerateReportPeriodColumnListingAction.java 2012-04-27 10:13:06 +0000
@@ -89,6 +89,13 @@
{
value = this.getDataValue( reportItem, organisationUnit );
}
+ else if ( reportItem.getItemType().equalsIgnoreCase( ExportItem.TYPE.DATAELEMENT_VALUETYPE_TEXT ) )
+ {
+ String result = this.getTextValue( reportItem, organisationUnit );
+
+ ExcelUtils.writeValueByPOI( reportItem.getRow(), reportItem.getColumn(), result,
+ ExcelUtils.TEXT, sheet, this.csText );
+ }
else if ( reportItem.getItemType().equalsIgnoreCase( ExportItem.TYPE.INDICATOR ) )
{
value = this.getIndicatorValue( reportItem, organisationUnit );