dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #13820
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 4538: Impl export to XLS for custom data set reports
------------------------------------------------------------
revno: 4538
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2011-09-07 14:03:18 +0200
message:
Impl export to XLS for custom data set reports
modified:
dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/dataset/action/GenerateDataSetReportAction.java
dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/dataSetReport.js
dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/renderCustomDataSetReportForm.vm
--
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 'dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/dataset/action/GenerateDataSetReportAction.java'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/dataset/action/GenerateDataSetReportAction.java 2011-08-19 12:08:26 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/dataset/action/GenerateDataSetReportAction.java 2011-09-07 12:03:18 +0000
@@ -206,10 +206,17 @@
}
String dataSetType = selectedDataSet.getDataSetType();
-
+
if ( TYPE_CUSTOM.equals( dataSetType ) )
{
- customDataEntryFormCode = dataSetReportService.getCustomDataSetReport( selectedDataSet, selectedOrgunit, selectedPeriod, selectedUnitOnly, format );
+ if ( useLast )
+ {
+ grid = dataSetReportService.getDefaultDataSetReport( selectedDataSet, selectedPeriod, selectedOrgunit, selectedUnitOnly, format, i18n );
+ }
+ else
+ {
+ customDataEntryFormCode = dataSetReportService.getCustomDataSetReport( selectedDataSet, selectedOrgunit, selectedPeriod, selectedUnitOnly, format );
+ }
}
else if ( TYPE_SECTION.equals( dataSetType ) )
{
=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/dataSetReport.js'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/dataSetReport.js 2011-08-19 12:09:20 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/dataSetReport.js 2011-09-07 12:03:18 +0000
@@ -1,9 +1,15 @@
+
+// -----------------------------------------------------------------------------
+// Global variables
+// ----------------------------------------------------------------------------
+
+var selectedOrganisationUnitIds = null;
+var currentParams = null;
+
// -----------------------------------------------------------------------------
// Validation
// ----------------------------------------------------------------------------
-var selectedOrganisationUnitIds = null;
-
function setSelectedOrganisationUnitIds( ids )
{
selectedOrganisationUnitIds = ids;
@@ -46,8 +52,11 @@
var dataSetId = $( "#dataSetId" ).val();
var periodId = $( "#periodId" ).val();
-
- $( '#content' ).load( 'generateDataSetReport.action', { dataSetId: dataSetId, periodId: periodId }, function() {
+ var selectedUnitOnly = $( "#selectedUnitOnly" ).is( ":checked" );
+
+ currentParams = { dataSetId: dataSetId, periodId: periodId, selectedUnitOnly: selectedUnitOnly };
+
+ $( '#content' ).load( 'generateDataSetReport.action', currentParams, function() {
hideLoader();
showContent();
pageInit();
@@ -56,8 +65,16 @@
function exportDataSetReport( type )
{
- var url = "generateDataSetReport.action?useLast=true&dataSetId=" + $( "#dataSetId" ).val() + "&type=" + type;
- window.location.href = url;
+ if ( currentParams != null )
+ {
+ var url = "generateDataSetReport.action?useLast=true" +
+ "&dataSetId=" + currentParams.dataSetId +
+ "&periodId=" + currentParams.periodId +
+ "&selectedUnitOnly=" + currentParams.selectedUnitOnly +
+ "&type=" + type;
+
+ window.location.href = url;
+ }
}
function showCriteria()
=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/renderCustomDataSetReportForm.vm'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/renderCustomDataSetReportForm.vm 2011-08-24 21:57:52 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/renderCustomDataSetReportForm.vm 2011-09-07 12:03:18 +0000
@@ -1,6 +1,13 @@
+<input type="hidden" id="dataSetId" value="${selectedDataSet.id}">
+
<h3>$i18n.getString('reporting_unit'): $encoder.htmlEncode( $selectedOrgunit.name ) $i18n.getString('reporting_period'): $format.formatPeriod( $selectedPeriod )</h3>
+<div style="margin-bottom:15px">
+<input type="button" value="$i18n.getString( 'get_report_as_xls' )" onclick="exportDataSetReport( 'xls' )" style="width:140px">
+<input type="button" value="$i18n.getString( 'get_report_as_pdf' )" onclick="exportDataSetReport( 'pdf' )" style="width:140px">
+</div>
+
<div>
$customDataEntryFormCode
</div>