dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #20511
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 9386: Add buttons to export program history of person to XLS and PDF file.
------------------------------------------------------------
revno: 9386
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2012-12-21 20:42:06 +0700
message:
Add buttons to export program history of person to XLS and PDF file.
modified:
dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/GetProgramInstanceHistoryAction.java
dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/struts.xml
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/commons.js
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programEnrollmentForm.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-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/GetProgramInstanceHistoryAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/GetProgramInstanceHistoryAction.java 2012-09-04 10:10:05 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/GetProgramInstanceHistoryAction.java 2012-12-21 13:42:06 +0000
@@ -103,12 +103,7 @@
ProgramInstance programInstance = programInstanceService.getProgramInstance( programInstanceId );
grid = programInstanceService.getProgramInstanceReport( programInstance, i18n, format );
-
- if ( type == null )
- {
- return SUCCESS;
- }
-
- return type;
+
+ return ( type == null ) ? SUCCESS : type;
}
}
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/struts.xml 2012-12-17 02:42:30 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/struts.xml 2012-12-21 13:42:06 +0000
@@ -534,6 +534,8 @@
<action name="getProgramReportHistory"
class="org.hisp.dhis.caseentry.action.patient.GetProgramInstanceHistoryAction">
<result name="success" type="velocity">/content.vm</result>
+ <result name="xls" type="gridXlsResult" />
+ <result name="pdf" type="gridPdfResult" />
<param name="page">/dhis-web-caseentry/programInstanceHistory.vm</param>
</action>
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/commons.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/commons.js 2012-12-18 05:41:39 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/commons.js 2012-12-21 13:42:06 +0000
@@ -1605,6 +1605,12 @@
$('#programReportDiv').load("getProgramReportHistory.action", {programInstanceId:programInstanceId});
}
+// export program instance history
+function exportProgramReports( programInstanceId, type )
+{
+ window.location.href='getProgramReportHistory.action?programInstanceId=' + programInstanceId + "&type=" + type;
+}
+
// load SMS message and comments
function getEventMessages( programInstanceId )
{
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programEnrollmentForm.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programEnrollmentForm.vm 2012-12-10 12:54:54 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programEnrollmentForm.vm 2012-12-21 13:42:06 +0000
@@ -122,7 +122,13 @@
</div>
#end
- <div id='tab-5'><div id='programReportDiv'></div></div>
+ <div id='tab-5'>
+ <p>
+ <input type="button" onclick="exportProgramReports( '$programInstance.id', 'xls' )" value="$i18n.getString('get_report_as_xls')">
+ <input type="button" onclick="exportProgramReports( '$programInstance.id', 'pdf' )" value="$i18n.getString('get_report_as_pdf')">
+ </p>
+ <div id='programReportDiv'></div>
+ </div>
</div>
#end