dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #18842
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 8007: Program Summary Improvements.
------------------------------------------------------------
revno: 8007
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2012-09-06 10:50:03 +0700
message:
Program Summary Improvements.
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramInstanceService.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramInstanceStore.java
dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramInstanceService.java
dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramInstanceStore.java
dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/GenerateReportAction.java
dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml
dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/report.js
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programStageDataEntryForm.vm
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programStageInstanceFlow.vm
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/report.vm
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/reportSelect.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-api/src/main/java/org/hisp/dhis/program/ProgramInstanceService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramInstanceService.java 2012-09-04 10:10:05 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramInstanceService.java 2012-09-06 03:50:03 +0000
@@ -79,7 +79,7 @@
Collection<ProgramInstance> getProgramInstances( Program program, OrganisationUnit organisationUnit, Date startDate, Date endDate );
- Collection<ProgramInstance> getProgramInstances( Program program, OrganisationUnit organisationUnit, Date startDate, Date endDate,
+ Collection<ProgramInstance> getProgramInstances( Program program, Collection<Integer> orgunitIds, Date startDate, Date endDate,
int min, int max );
int countProgramInstances( Program program, OrganisationUnit organisationUnit );
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramInstanceStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramInstanceStore.java 2011-07-15 08:07:54 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramInstanceStore.java 2012-09-06 03:50:03 +0000
@@ -66,7 +66,7 @@
Collection<ProgramInstance> get( Program program, OrganisationUnit organisationUnit, Date startDate, Date endDate );
- Collection<ProgramInstance> get( Program program, OrganisationUnit organisationUnit, Date startDate, Date endDate,
+ Collection<ProgramInstance> get( Program program, Collection<Integer> orgunitIds, Date startDate, Date endDate,
int min, int max );
int count( Program program, OrganisationUnit organisationUnit );
=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramInstanceService.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramInstanceService.java 2012-09-04 10:10:05 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramInstanceService.java 2012-09-06 03:50:03 +0000
@@ -172,10 +172,10 @@
return programInstanceStore.get( program, organisationUnit, startDate, endDate );
}
- public Collection<ProgramInstance> getProgramInstances( Program program, OrganisationUnit organisationUnit,
+ public Collection<ProgramInstance> getProgramInstances( Program program, Collection<Integer> orgunitIds,
Date startDate, Date endDate, int min, int max )
{
- return programInstanceStore.get( program, organisationUnit, startDate, endDate, min, max );
+ return programInstanceStore.get( program, orgunitIds, startDate, endDate, min, max );
}
public int countProgramInstances( Program program, OrganisationUnit organisationUnit )
=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramInstanceStore.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramInstanceStore.java 2011-07-15 08:07:54 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramInstanceStore.java 2012-09-06 03:50:03 +0000
@@ -130,7 +130,7 @@
}
@SuppressWarnings( "unchecked" )
- public Collection<ProgramInstance> get( Program program, OrganisationUnit organisationUnit, Date startDate,
+ public Collection<ProgramInstance> get( Program program, Collection<Integer> orgunitIds, Date startDate,
Date endDate, int min, int max )
{
return getCriteria( Restrictions.eq( "program", program ),
@@ -138,7 +138,8 @@
Restrictions.ge( "enrollmentDate", startDate ),
Restrictions.le( "enrollmentDate", endDate ) )
.createAlias( "patient", "patient" )
- .add(Restrictions.eq( "patient.organisationUnit", organisationUnit ) )
+ .createAlias( "patient.organisationUnit", "organisationUnit" )
+ .add(Restrictions.in( "organisationUnit.id", orgunitIds ) )
.addOrder( Order.asc( "patient.id" ) ).setFirstResult( min ).setMaxResults( max ).list();
}
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/GenerateReportAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/GenerateReportAction.java 2012-06-07 04:23:40 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/GenerateReportAction.java 2012-09-06 03:50:03 +0000
@@ -31,10 +31,12 @@
import java.util.Collection;
import java.util.Date;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.Map;
import org.hisp.dhis.i18n.I18nFormat;
import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.organisationunit.OrganisationUnitService;
import org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager;
import org.hisp.dhis.paging.ActionPagingSupport;
import org.hisp.dhis.program.Program;
@@ -43,6 +45,7 @@
import org.hisp.dhis.program.ProgramService;
import org.hisp.dhis.program.ProgramStageInstance;
import org.hisp.dhis.program.ProgramStageInstanceService;
+import org.hisp.dhis.system.util.ConversionUtils;
/**
* @author Abyot Asalefew Gizaw
@@ -83,6 +86,13 @@
this.programStageInstanceService = programStageInstanceService;
}
+ private OrganisationUnitService organisationUnitService;
+
+ public void setOrganisationUnitService( OrganisationUnitService organisationUnitService )
+ {
+ this.organisationUnitService = organisationUnitService;
+ }
+
private I18nFormat format;
public void setFormat( I18nFormat format )
@@ -115,6 +125,13 @@
this.endDate = endDate;
}
+ private String facilityLB;
+
+ public void setFacilityLB( String facilityLB )
+ {
+ this.facilityLB = facilityLB;
+ }
+
private OrganisationUnit organisationUnit;
public OrganisationUnit getOrganisationUnit()
@@ -159,6 +176,27 @@
Date eDate = format.parseDate( endDate );
// ---------------------------------------------------------------------
+ // Get orgunitIds
+ // ---------------------------------------------------------------------
+
+ Collection<Integer> orgunitIds = new HashSet<Integer>();
+
+ if ( facilityLB.equals( "selected" ) )
+ {
+ orgunitIds.add( organisationUnit.getId() );
+ }
+ else if ( facilityLB.equals( "childrenOnly" ) )
+ {
+ orgunitIds = new HashSet<Integer>( ConversionUtils.getIdentifiers( OrganisationUnit.class,
+ organisationUnit.getChildren() ) );
+ }
+ else
+ {
+ orgunitIds.add( organisationUnit.getId() );
+ orgunitIds.addAll( organisationUnitService.getOrganisationUnitHierarchy().getChildren( organisationUnit.getId() ) );
+ }
+
+ // ---------------------------------------------------------------------
// Program instances for the selected program
// ---------------------------------------------------------------------
@@ -166,8 +204,8 @@
this.paging = createPaging( total );
- programInstances = programInstanceService.getProgramInstances( program, organisationUnit, sDate, eDate, paging
- .getStartPos(), paging.getPageSize() );
+ programInstances = programInstanceService.getProgramInstances( program, orgunitIds, sDate, eDate,
+ paging.getStartPos(), paging.getPageSize() );
Collection<ProgramStageInstance> programStageInstances = new ArrayList<ProgramStageInstance>();
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml 2012-09-05 14:30:23 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml 2012-09-06 03:50:03 +0000
@@ -286,6 +286,8 @@
<property name="programInstanceService" ref="org.hisp.dhis.program.ProgramInstanceService" />
<property name="programStageInstanceService"
ref="org.hisp.dhis.program.ProgramStageInstanceService" />
+ <property name="organisationUnitService"
+ ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
</bean>
<bean id="org.hisp.dhis.caseentry.action.report.ViewRecordsAction"
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties 2012-09-05 14:30:23 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties 2012-09-06 03:50:03 +0000
@@ -430,4 +430,7 @@
completed_date = Completed date
find_and_add_person = Find/Add Person
add_person = Add Person
-identifiers_and_attributes = Identifiers / attributes
\ No newline at end of file
+identifiers_and_attributes = Identifiers / attributes
+at = at
+on_date = on
+no_records = No records
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/report.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/report.js 2012-08-16 02:08:22 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/report.js 2012-09-06 03:50:03 +0000
@@ -44,7 +44,8 @@
{
programId: getFieldValue( 'programId' ),
startDate: getFieldValue( 'startDate' ),
- endDate: getFieldValue( 'endDate' )
+ endDate: getFieldValue( 'endDate' ),
+ facilityLB: $('input[name=facilityLB]:checked').val()
}, function()
{
jQuery( "[name=newEncounterBtn]" ).addClass("hidden");
@@ -56,8 +57,30 @@
function loadDataEntry( programStageInstanceId )
{
- $('#viewRecordsDiv' )
- .load( 'viewRecords.action?id=' + programStageInstanceId )
+ setInnerHTML('viewRecordsDiv', '' );
+ jQuery('#viewRecordsDiv' )
+ .load( 'viewProgramStageRecords.action?programStageInstanceId=' + programStageInstanceId
+ ,function(){
+ jQuery( "#viewRecordsDiv :input").each(function(){
+ disable(this.id);
+ });
+ hideById('inputCriteriaDiv');
+
+ var programStageInstance = jQuery("#ps_" + programStageInstanceId);
+ var header = "";
+ if( programStageInstance.attr("reportDate")=='')
+ {
+ header = "<h4>" + i18n_no_records + "</h4>";
+ }
+ else
+ {
+ header = "<h4>" + i18n_records_for + " " + programStageInstance.attr("orgunit")
+ + " " + i18n_at + " " + programStageInstance.attr("psname")
+ + " " + i18n_on_date + " " + programStageInstance.attr("reportDate") + "</h4><hr>";
+ }
+
+ setInnerHTML('patientInforTB', header );
+ })
.dialog({
title: i18n_reports,
maximize: true,
@@ -68,3 +91,5 @@
height: 400
});
}
+
+function entryFormContainerOnReady(){}
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programStageDataEntryForm.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programStageDataEntryForm.vm 2012-08-02 13:10:04 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programStageDataEntryForm.vm 2012-09-06 03:50:03 +0000
@@ -1,5 +1,5 @@
-
-<table>
+<div id='patientInforTB'>
+ <table>
#if( $patient )
<tr>
<td>
@@ -41,21 +41,21 @@
#if( $programStageInstance )
<tr>
- <th><label for="executionDate">$i18n.getString( "report_date" ) </label></th>
- <th><input type="text" id="executionDate" name="executionDate" value="$!format.formatDate( $programStageInstance.executionDate )" onchange="saveExecutionDate( $programStageInstance.id, getFieldValue('executionDate') )" ></th>
- <script type="text/javascript">
- datePickerValid( 'executionDate', false );
- </script>
+ <th><label for="executionDate">$i18n.getString( "report_date" ) </label></th>
+ <th><input type="text" id="executionDate" name="executionDate" value="$!format.formatDate( $programStageInstance.executionDate )" onchange="saveExecutionDate( $programStageInstance.id, getFieldValue('executionDate') )" ></th>
+ <script type="text/javascript">
+ datePickerValid( 'executionDate', false );
+ </script>
<th><label for="dueDate">$i18n.getString( "due_date" ) </label></th>
- <th><input type="text" id="dueDate" name="dueDate" value="$!format.formatDate( $programStageInstance.dueDate )" disabled="disabled"></th>
- </tr>
+ <th><input type="text" id="dueDate" name="dueDate" value="$!format.formatDate( $programStageInstance.dueDate )" disabled="disabled"></th>
+ </tr>
#end
</table>
+</div>
<input type='hidden' id="programId" name="programId" type="text" readonly="readonly" value="$encoder.htmlEncode( $program.name )" style="min-width:350px">
<input id="programStageId" name="programStageId" type="hidden" value="$programStage.id" style="min-width:350px">
-</form>
<p></p>
#parse( "dhis-web-commons/loader/loader.vm" )
<form id='dataEntryFormDiv' name='dataEntryFormDiv' >
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programStageInstanceFlow.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programStageInstanceFlow.vm 2012-09-04 10:10:05 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programStageInstanceFlow.vm 2012-09-06 03:50:03 +0000
@@ -13,8 +13,10 @@
<input type="button" name="programStageBtn"
id="ps_$!programStageInstance.id"
psid="$programStageInstance.programStage.id"
- psname="$programStageName.programStage.name"
+ psname="$programStageInstance.programStage.name"
+ orgunit="$!programStageInstance.organisationUnit.name"
programType='$programInstance.program.type'
+ reportDate="$!format.formatDate( $!programStageInstance.executionDate )"
dueDate="$format.formatDate( $programStageInstance.dueDate )"
class="stage-object"
value="$programStageInstance.programStage.name $format.formatDate( $programStageInstance.dueDate )"
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/report.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/report.vm 2012-09-06 02:31:30 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/report.vm 2012-09-06 03:50:03 +0000
@@ -1,3 +1,18 @@
+<table>
+ <tr>
+ <td class='text-column' >$i18n.getString( "search_result_matching_the_search_criteria" ):</td>
+ <td> </td>
+ <td> </td>
+ <td>$i18n.getString( "list_all_patients" )</td>
+ </tr>
+ <tr>
+ <td class='text-column' >$i18n.getString( "total_result" )</td>
+ <td> </td>
+ <td> </td>
+ <td>$!total</td>
+ </tr>
+</table>
+
#if( $programInstances && $programInstances.size() > 0 )
<table class="mainPageTable">
<tr>
@@ -54,4 +69,8 @@
#end
<script>
var i18n_patient_details_and_history = '$encoder.jsEscape( $i18n.getString( "patient_details_and_history" ) , "'" )';
+ var i18n_records_for = '$encoder.jsEscape( $i18n.getString( "records_for" ) , "'" )';
+ var i18n_at = '$encoder.jsEscape( $i18n.getString( "at" ) , "'" )';
+ var i18n_on_date = '$encoder.jsEscape( $i18n.getString( "on_date" ) , "'" )';
+ var i18n_no_records = '$encoder.jsEscape( $i18n.getString( "no_records" ) , "'" )';
</script>
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/reportSelect.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/reportSelect.vm 2012-08-02 13:10:04 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/reportSelect.vm 2012-09-06 03:50:03 +0000
@@ -10,7 +10,7 @@
<h3>$i18n.getString( "program_summary_report" ) #openHelp('program_summary_report')</h3>
<form id="reportForm" name="reportForm" method="post">
-<div class="inputCriteria" style="width:600px;height:150px;margin-bottom:20px;">
+<div class="inputCriteria" style="width:600px;height:180px;margin-bottom:20px;">
<table>
<tr>
@@ -43,6 +43,15 @@
<input type="text" id="endDate" name="endDate" />
</td>
</tr>
+
+ <tr>
+ <td>$i18n.getString('use_data_from_level')</td>
+ <td>
+ <input type="radio" id='facilityLB1' name="facilityLB" value="selected" checked> $i18n.getString('selected')
+ <input type="radio" id='facilityLB2' name="facilityLB" value="childrenOnly"> $i18n.getString('children_only')
+ <input type="radio" id='facilityLB3' name="facilityLB" value="all"> $i18n.getString('all')
+ </td>
+ </tr>
<tr>
<td></td>
@@ -68,4 +77,5 @@
var i18n_please_select_a_program = '[' + '$encoder.jsEscape( $i18n.getString( "please_select_a_program" ), "'")' + ']';
var i18n_reports = '$encoder.jsEscape( $i18n.getString( "reports" ), "'")';
var i18n_patient_profile = '$encoder.jsEscape( $i18n.getString( "patient_profile" ), "'")';
+ var i18n_show_all_items = '$encoder.jsEscape( $i18n.getString( "show_all_items" ), "'")';
</script>