dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #15658
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 5730: (patient) Add Single-event reports.
------------------------------------------------------------
revno: 5730
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Sun 2012-01-15 09:14:29 +0700
message:
(patient) Add Single-event reports.
removed:
dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/GetEventsByProgramAction.java
added:
dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/GenerateSingleEventReportAction.java
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/htmlGrid.vm
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/singleEventReport.js
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/singleEventReportForm.vm
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientdatavalue/PatientDataValueService.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientdatavalue/PatientDataValueStore.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageDataElement.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageInstanceService.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageInstanceStore.java
dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/startup/TableAlteror.java
dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patientdatavalue/DefaultPatientDataValueService.java
dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patientdatavalue/hibernate/HibernatePatientDataValueStore.java
dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramStageInstanceService.java
dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramStageInstanceStore.java
dhis-2/dhis-services/dhis-service-patient/src/main/resources/META-INF/dhis/beans.xml
dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/program/hibernate/ProgramStageDataElement.hbm.xml
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/resources/struts.xml
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/anonymousRegistration.vm
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/historyAnonymousEvents.vm
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/index.vm
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/anonymousRegistration.js
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/menu.vm
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/reportsMenu.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/programstage/UpdateProgramStageAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/updateProgramStageForm.js
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/programStageList.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateProgramStageForm.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/patientdatavalue/PatientDataValueService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientdatavalue/PatientDataValueService.java 2011-07-15 03:35:57 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientdatavalue/PatientDataValueService.java 2012-01-15 02:14:29 +0000
@@ -99,5 +99,7 @@
Collection<PatientDataValue> getPatientDataValues( Patient patient, Collection<DataElement> dataElements,
Date startDate, Date endDate );
+ PatientDataValue getPatientDataValue( ProgramStageInstance programStageInstance, DataElement dataElement );
+
Collection<PatientDataValue> getAllPatientDataValues();
}
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientdatavalue/PatientDataValueStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientdatavalue/PatientDataValueStore.java 2011-07-08 05:52:59 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientdatavalue/PatientDataValueStore.java 2012-01-15 02:14:29 +0000
@@ -91,6 +91,6 @@
Collection<PatientDataValue> get( DataElement dataElement, boolean providedByAnotherFacility );
Collection<PatientDataValue> get( Patient patient, Collection<DataElement> dataElements, Date startDate, Date endDate );
-
-
+
+ PatientDataValue get( ProgramStageInstance programStageInstance, DataElement dataElement );
}
\ No newline at end of file
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageDataElement.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageDataElement.java 2011-06-02 02:34:04 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageDataElement.java 2012-01-15 02:14:29 +0000
@@ -58,7 +58,9 @@
* programStage
*/
private boolean compulsory = false;
-
+
+ private Boolean showOnReport = false;
+
private Integer sortOrder;
public ProgramStageDataElement( ProgramStage programStage, DataElement dataElement, boolean compulsory )
@@ -67,7 +69,7 @@
this.dataElement = dataElement;
this.compulsory = compulsory;
}
-
+
public ProgramStageDataElement( ProgramStage programStage, DataElement dataElement, boolean compulsory,
Integer sortOrder )
{
@@ -76,6 +78,17 @@
this.compulsory = compulsory;
this.sortOrder = sortOrder;
}
+
+ public ProgramStageDataElement( ProgramStage programStage, DataElement dataElement, boolean compulsory,
+ Boolean showOnReport, Integer sortOrder )
+ {
+ super();
+ this.programStage = programStage;
+ this.dataElement = dataElement;
+ this.compulsory = compulsory;
+ this.showOnReport = showOnReport;
+ this.sortOrder = sortOrder;
+ }
public ProgramStageDataElement()
{
@@ -110,7 +123,7 @@
{
this.compulsory = compulsory;
}
-
+
public Integer getSortOrder()
{
return sortOrder;
@@ -121,6 +134,16 @@
this.sortOrder = sortOrder;
}
+ public Boolean getShowOnReport()
+ {
+ return showOnReport;
+ }
+
+ public void setShowOnReport( Boolean showOnReport )
+ {
+ this.showOnReport = showOnReport;
+ }
+
// -------------------------------------------------------------------------
// hashCode, equals and toString
// -------------------------------------------------------------------------
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageInstanceService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageInstanceService.java 2012-01-06 04:56:54 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageInstanceService.java 2012-01-15 02:14:29 +0000
@@ -31,6 +31,9 @@
import java.util.List;
import java.util.Map;
+import org.hisp.dhis.common.Grid;
+import org.hisp.dhis.i18n.I18n;
+import org.hisp.dhis.i18n.I18nFormat;
import org.hisp.dhis.organisationunit.OrganisationUnit;
import org.hisp.dhis.patient.Patient;
@@ -83,8 +86,10 @@
List<ProgramStageInstance> getProgramStageInstances( Patient patient, Boolean completed );
- List<ProgramStageInstance> getProgramStageInstances( ProgramInstance programInstance, Date executionDate, int min, int max );
-
- int countProgramStageInstances( ProgramInstance programInstance, Date executionDate);
+ List<ProgramStageInstance> getProgramStageInstances( ProgramInstance programInstance, Date startDate, Date endDate , int min, int max );
+
+ int countProgramStageInstances( ProgramInstance programInstance, Date startDate, Date endDate );
+
+ Grid getSingleEventReport( ProgramInstance programInstance, Date startDate, Date endDate, int min, int max, I18nFormat format, I18n i18n );
}
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageInstanceStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageInstanceStore.java 2012-01-06 04:56:54 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageInstanceStore.java 2012-01-15 02:14:29 +0000
@@ -68,7 +68,7 @@
List<ProgramStageInstance> getProgramStageInstances( Patient patient, Boolean completed);
- List<ProgramStageInstance> getProgramStageInstances( ProgramInstance programInstance, Date executionDate, int min, int max );
+ List<ProgramStageInstance> getProgramStageInstances( ProgramInstance programInstance, Date startDate, Date endDate , int min, int max );
- int countProgramStageInstances( ProgramInstance programInstance, Date executionDate);
+ int countProgramStageInstances( ProgramInstance programInstance, Date startDate, Date endDate );
}
=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/startup/TableAlteror.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/startup/TableAlteror.java 2012-01-13 02:14:28 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/startup/TableAlteror.java 2012-01-15 02:14:29 +0000
@@ -119,6 +119,8 @@
updateStageInProgram();
executeSql( "UPDATE programvalidation SET dateType = false WHERE dateType is null");
+
+ executeSql( "UPDATE programstage_dataelements SET showOnReport = false WHERE showOnReport is null");
}
// -------------------------------------------------------------------------
=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patientdatavalue/DefaultPatientDataValueService.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patientdatavalue/DefaultPatientDataValueService.java 2011-07-08 05:52:59 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patientdatavalue/DefaultPatientDataValueService.java 2012-01-15 02:14:29 +0000
@@ -198,4 +198,10 @@
{
return patientDataValueStore.get( patient, dataElements, startDate, endDate );
}
+
+ public PatientDataValue getPatientDataValue( ProgramStageInstance programStageInstance, DataElement dataElement )
+ {
+ return patientDataValueStore.get( programStageInstance, dataElement );
+ }
+
}
=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patientdatavalue/hibernate/HibernatePatientDataValueStore.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patientdatavalue/hibernate/HibernatePatientDataValueStore.java 2011-12-21 08:50:50 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patientdatavalue/hibernate/HibernatePatientDataValueStore.java 2012-01-15 02:14:29 +0000
@@ -205,4 +205,12 @@
return getQuery( hql ).setParameterList( "dataElements", dataElements ).setEntity( "patient", patient )
.setDate( "startDate", startDate ).setDate( "endDate", endDate ).list();
}
+
+ public PatientDataValue get( ProgramStageInstance programStageInstance, DataElement dataElement )
+ {
+ return (PatientDataValue) getCriteria( Restrictions.eq( "programStageInstance", programStageInstance ),
+ Restrictions.eq( "dataElement", dataElement ) )
+ .uniqueResult();
+ }
+
}
=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramStageInstanceService.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramStageInstanceService.java 2012-01-11 05:31:53 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramStageInstanceService.java 2012-01-15 02:14:29 +0000
@@ -30,11 +30,20 @@
import java.util.Collection;
import java.util.Date;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.List;
import java.util.Map;
+import org.hisp.dhis.common.Grid;
+import org.hisp.dhis.common.GridHeader;
+import org.hisp.dhis.dataelement.DataElement;
+import org.hisp.dhis.i18n.I18n;
+import org.hisp.dhis.i18n.I18nFormat;
import org.hisp.dhis.organisationunit.OrganisationUnit;
import org.hisp.dhis.patient.Patient;
+import org.hisp.dhis.patientdatavalue.PatientDataValue;
+import org.hisp.dhis.patientdatavalue.PatientDataValueService;
+import org.hisp.dhis.system.grid.ListGrid;
import org.springframework.transaction.annotation.Transactional;
/**
@@ -56,6 +65,13 @@
this.programStageInstanceStore = programStageInstanceStore;
}
+ private PatientDataValueService patientDataValueService;
+
+ public void setPatientDataValueService( PatientDataValueService patientDataValueService )
+ {
+ this.patientDataValueService = patientDataValueService;
+ }
+
// -------------------------------------------------------------------------
// Implementation methods
// -------------------------------------------------------------------------
@@ -170,13 +186,80 @@
return programStageInstanceStore.getProgramStageInstances( patient, completed );
}
- public List<ProgramStageInstance> getProgramStageInstances( ProgramInstance programInstance, Date executionDate, int min, int max )
- {
- return programStageInstanceStore.getProgramStageInstances( programInstance, executionDate, min, max );
- }
-
- public int countProgramStageInstances( ProgramInstance programInstance, Date executionDate )
- {
- return programStageInstanceStore.countProgramStageInstances( programInstance, executionDate );
+ public List<ProgramStageInstance> getProgramStageInstances( ProgramInstance programInstance, Date startDate, Date endDate ,
+ int min, int max )
+ {
+ return programStageInstanceStore.getProgramStageInstances( programInstance, startDate, endDate , min, max );
+ }
+
+ public int countProgramStageInstances( ProgramInstance programInstance, Date startDate, Date endDate )
+ {
+ return programStageInstanceStore.countProgramStageInstances( programInstance, startDate, endDate );
+ }
+
+ public Grid getSingleEventReport( ProgramInstance programInstance, Date startDate, Date endDate , int min, int max,
+ I18nFormat format, I18n i18n )
+ {
+ List<ProgramStageInstance> programStageInstances = getProgramStageInstances( programInstance, startDate, endDate ,
+ min, max );
+
+ ProgramStage programStage = programInstance.getProgram().getProgramStages().iterator().next();
+
+ Collection<ProgramStageDataElement> psDataElements = programStage.getProgramStageDataElements();
+
+ Collection<DataElement> dataElements = new HashSet<DataElement>();
+ for ( ProgramStageDataElement psDataElement : psDataElements )
+ {
+ if ( psDataElement.getShowOnReport() )
+ {
+ dataElements.add( psDataElement.getDataElement() );
+ }
+ }
+
+ // ---------------------------------------------------------------------
+ // Create a grid
+ // ---------------------------------------------------------------------
+
+ Grid grid = new ListGrid().setTitle( programInstance.getProgram().getName() );
+ grid.setSubtitle( i18n.getString( "from" ) + " " + format.formatDate( startDate ) + " " + i18n.getString( "to" ) + " " + format.formatDate( endDate ) );
+
+ // ---------------------------------------------------------------------
+ // Headers
+ // ---------------------------------------------------------------------
+
+ for ( DataElement dataElement : dataElements )
+ {
+ grid.addHeader( new GridHeader( dataElement.getName(), false, false ) );
+ }
+
+ grid.addHeader( new GridHeader( i18n.getString( "operations" ), false, false ) );
+
+ // ---------------------------------------------------------------------
+ // Values
+ // ---------------------------------------------------------------------
+
+ for ( ProgramStageInstance programStageInstance : programStageInstances )
+ {
+ grid.addRow();
+
+ for ( DataElement dataElement : dataElements )
+ {
+ PatientDataValue patientDataValue = patientDataValueService.getPatientDataValue( programStageInstance,
+ dataElement );
+
+ if ( patientDataValue != null )
+ {
+ grid.addValue( patientDataValue.getValue() );
+ }
+ else
+ {
+ grid.addValue( "" );
+ }
+ }
+
+ grid.addValue( programStageInstance.getId() );
+ }
+
+ return grid;
}
}
=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramStageInstanceStore.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramStageInstanceStore.java 2012-01-11 06:17:35 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramStageInstanceStore.java 2012-01-15 02:14:29 +0000
@@ -147,17 +147,17 @@
}
@SuppressWarnings( "unchecked" )
- public List<ProgramStageInstance> getProgramStageInstances( ProgramInstance programInstance, Date executionDate,
+ public List<ProgramStageInstance> getProgramStageInstances( ProgramInstance programInstance, Date startDate, Date endDate,
int min, int max )
{
return getCriteria( Restrictions.eq( "programInstance.id", programInstance.getId() ),
- Restrictions.eq( "executionDate", executionDate ) ).setFirstResult( min ).setMaxResults( max ).list();
+ Restrictions.between( "executionDate", startDate, endDate ) ).setFirstResult( min ).setMaxResults( max ).list();
}
- public int countProgramStageInstances( ProgramInstance programInstance, Date executionDate )
+ public int countProgramStageInstances( ProgramInstance programInstance, Date startDate, Date endDate )
{
Number rs = (Number) getCriteria( Restrictions.eq( "programInstance.id", programInstance.getId() ),
- Restrictions.eq( "executionDate", executionDate ) ).setProjection( Projections.rowCount() ).uniqueResult();
+ Restrictions.between( "executionDate", startDate, endDate ) ).setProjection( Projections.rowCount() ).uniqueResult();
return rs != null ? rs.intValue() : 0;
}
=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-services/dhis-service-patient/src/main/resources/META-INF/dhis/beans.xml 2012-01-13 02:14:28 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/resources/META-INF/dhis/beans.xml 2012-01-15 02:14:29 +0000
@@ -208,6 +208,8 @@
class="org.hisp.dhis.program.DefaultProgramStageInstanceService">
<property name="programStageInstanceStore"
ref="org.hisp.dhis.program.ProgramStageInstanceStore" />
+ <property name="patientDataValueService"
+ ref="org.hisp.dhis.patientdatavalue.PatientDataValueService" />
</bean>
<bean id="org.hisp.dhis.program.ProgramInstanceService" class="org.hisp.dhis.program.DefaultProgramInstanceService">
=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/program/hibernate/ProgramStageDataElement.hbm.xml'
--- dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/program/hibernate/ProgramStageDataElement.hbm.xml 2011-06-02 02:34:04 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/program/hibernate/ProgramStageDataElement.hbm.xml 2012-01-15 02:14:29 +0000
@@ -16,6 +16,8 @@
<property name="compulsory" column="compulsory" not-null="true" />
<property name="sortOrder" column="sort_order" />
+
+ <property name="showOnReport" />
</class>
</hibernate-mapping>
=== removed file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/GetEventsByProgramAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/GetEventsByProgramAction.java 2012-01-11 05:31:53 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/GetEventsByProgramAction.java 1970-01-01 00:00:00 +0000
@@ -1,126 +0,0 @@
-/*
- * Copyright (c) 2004-2012, University of Oslo
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * * Neither the name of the HISP project nor the names of its contributors may
- * be used to endorse or promote products derived from this software without
- * specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package org.hisp.dhis.caseentry.action.caseentry;
-
-import java.util.Collection;
-import java.util.Date;
-
-import org.hisp.dhis.i18n.I18nFormat;
-import org.hisp.dhis.paging.ActionPagingSupport;
-import org.hisp.dhis.program.ProgramInstance;
-import org.hisp.dhis.program.ProgramInstanceService;
-import org.hisp.dhis.program.ProgramStageInstance;
-import org.hisp.dhis.program.ProgramStageInstanceService;
-
-/**
- * @author Chau Thu Tran
- *
- * @version $Id: GetEventsByProgramAction.java Jan 03, 2012 13:58:34 AM $
- */
-
-public class GetEventsByProgramAction
- extends ActionPagingSupport<ProgramStageInstance>
-{
- // -------------------------------------------------------------------------
- // Dependencies
- // -------------------------------------------------------------------------
-
- private ProgramInstanceService programInstanceService;
-
- public void setProgramInstanceService( ProgramInstanceService programInstanceService )
- {
- this.programInstanceService = programInstanceService;
- }
-
- private ProgramStageInstanceService programStageInstanceService;
-
- public void setProgramStageInstanceService( ProgramStageInstanceService programStageInstanceService )
- {
- this.programStageInstanceService = programStageInstanceService;
- }
-
- // -------------------------------------------------------------------------
- // Input/Output
- // -------------------------------------------------------------------------
-
- private Integer programInstanceId;
-
- public void setProgramInstanceId( Integer programInstanceId )
- {
- this.programInstanceId = programInstanceId;
- }
-
- private String executionDate;
-
- public void setExecutionDate( String executionDate )
- {
- this.executionDate = executionDate;
- }
-
- private I18nFormat format;
-
- public void setFormat( I18nFormat format )
- {
- this.format = format;
- }
-
- private Collection<ProgramStageInstance> programStageInstances;
-
- public Collection<ProgramStageInstance> getProgramStageInstances()
- {
- return programStageInstances;
- }
-
- private Integer total;
-
- public Integer getTotal()
- {
- return total;
- }
-
- // -------------------------------------------------------------------------
- // Implementation Action
- // -------------------------------------------------------------------------
-
- public String execute()
- throws Exception
- {
- ProgramInstance programInstance = programInstanceService.getProgramInstance( programInstanceId );
-
- Date dateValue = format.parseDate( executionDate );
-
- total = programStageInstanceService.countProgramStageInstances( programInstance, dateValue );
-
- this.paging = createPaging( total );
-
- programStageInstances = programStageInstanceService.getProgramStageInstances( programInstance, dateValue,
- paging.getStartPos(), paging.getPageSize() );
-
- return SUCCESS;
- }
-}
=== added file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/GenerateSingleEventReportAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/GenerateSingleEventReportAction.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/GenerateSingleEventReportAction.java 2012-01-15 02:14:29 +0000
@@ -0,0 +1,151 @@
+/*
+ * Copyright (c) 2004-2012, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package org.hisp.dhis.caseentry.action.report;
+
+import java.util.Collection;
+import java.util.Date;
+
+import org.hisp.dhis.common.Grid;
+import org.hisp.dhis.i18n.I18n;
+import org.hisp.dhis.i18n.I18nFormat;
+import org.hisp.dhis.paging.ActionPagingSupport;
+import org.hisp.dhis.program.ProgramInstance;
+import org.hisp.dhis.program.ProgramInstanceService;
+import org.hisp.dhis.program.ProgramStageInstance;
+import org.hisp.dhis.program.ProgramStageInstanceService;
+
+/**
+ * @author Chau Thu Tran
+ *
+ * @version $Id: GenerateSingleEventReportAction.java Jan 03, 2012 13:58:34 AM $
+ */
+
+public class GenerateSingleEventReportAction
+ extends ActionPagingSupport<ProgramStageInstance>
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private ProgramInstanceService programInstanceService;
+
+ public void setProgramInstanceService( ProgramInstanceService programInstanceService )
+ {
+ this.programInstanceService = programInstanceService;
+ }
+
+ private ProgramStageInstanceService programStageInstanceService;
+
+ public void setProgramStageInstanceService( ProgramStageInstanceService programStageInstanceService )
+ {
+ this.programStageInstanceService = programStageInstanceService;
+ }
+
+ // -------------------------------------------------------------------------
+ // Input/Output
+ // -------------------------------------------------------------------------
+
+ private Integer programInstanceId;
+
+ public void setProgramInstanceId( Integer programInstanceId )
+ {
+ this.programInstanceId = programInstanceId;
+ }
+
+ private String startDate;
+
+ public void setStartDate( String startDate )
+ {
+ this.startDate = startDate;
+ }
+
+ private String endDate;
+
+ public void setEndDate( String endDate )
+ {
+ this.endDate = endDate;
+ }
+
+ private Collection<ProgramStageInstance> programStageInstances;
+
+ public Collection<ProgramStageInstance> getProgramStageInstances()
+ {
+ return programStageInstances;
+ }
+
+ private Grid grid;
+
+ public Grid getGrid()
+ {
+ return grid;
+ }
+
+ private Integer total;
+
+ public Integer getTotal()
+ {
+ return total;
+ }
+
+ private I18n i18n;
+
+ public void setI18n( I18n i18n )
+ {
+ this.i18n = i18n;
+ }
+
+ private I18nFormat format;
+
+ public void setFormat( I18nFormat format )
+ {
+ this.format = format;
+ }
+
+ // -------------------------------------------------------------------------
+ // Implementation Action
+ // -------------------------------------------------------------------------
+
+ public String execute()
+ throws Exception
+ {
+ ProgramInstance programInstance = programInstanceService.getProgramInstance( programInstanceId );
+
+ Date startValue = format.parseDate( startDate );
+
+ Date endValue = format.parseDate( endDate );
+
+ total = programStageInstanceService.countProgramStageInstances( programInstance, startValue, endValue );
+
+ this.paging = createPaging( total );
+
+ grid = programStageInstanceService.getSingleEventReport( programInstance, startValue, endValue, paging.getStartPos(),
+ paging.getPageSize(), format, i18n );
+
+ return SUCCESS;
+ }
+}
=== 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-01-13 02:14:28 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml 2012-01-15 02:14:29 +0000
@@ -285,6 +285,14 @@
<property name="dataElementCategoryService"
ref="org.hisp.dhis.dataelement.DataElementCategoryService" />
</bean>
+
+ <bean id="org.hisp.dhis.caseentry.action.report.GenerateSingleEventReportAction"
+ class="org.hisp.dhis.caseentry.action.report.GenerateSingleEventReportAction" scope="prototype">
+ <property name="programInstanceService"
+ ref="org.hisp.dhis.program.ProgramInstanceService" />
+ <property name="programStageInstanceService"
+ ref="org.hisp.dhis.program.ProgramStageInstanceService" />
+ </bean>
<!-- Case Aggregation -->
@@ -399,14 +407,6 @@
<property name="programStageInstanceService"
ref="org.hisp.dhis.program.ProgramStageInstanceService" />
</bean>
-
- <bean id="org.hisp.dhis.caseentry.action.caseentry.GetEventsByProgramAction"
- class="org.hisp.dhis.caseentry.action.caseentry.GetEventsByProgramAction" scope="prototype">
- <property name="programInstanceService"
- ref="org.hisp.dhis.program.ProgramInstanceService" />
- <property name="programStageInstanceService"
- ref="org.hisp.dhis.program.ProgramStageInstanceService" />
- </bean>
<!-- Patient chart -->
=== 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-01-13 04:29:08 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties 2012-01-15 02:14:29 +0000
@@ -451,7 +451,6 @@
please_enter_report_date = Please enter report date
comfirm_delete_current_event = Are you sure you want to delete the current event ?
registered_by_orgunit = Registered by facility
-show_events = Show events
event_information = Event information
history_events = History events
integerValueOfAge = Age(years)
@@ -467,4 +466,5 @@
after_or_equals_to_due_date = After or equals to due date
leftSide = Left Side
rightSide = Right Side
-due_date_with_max_number_of_days_of_data_entry = Due date +/- Max number of days of data entry
\ No newline at end of file
+due_date_with_max_number_of_days_of_data_entry = Due date +/- Max number of days of data entry
+single_event_report = Single Event Report
\ No newline at end of file
=== 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-01-11 05:31:53 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/struts.xml 2012-01-15 02:14:29 +0000
@@ -227,6 +227,39 @@
<param name="page">/dhis-web-caseentry/records.vm</param>
</action>
+ <action name="getSingleEventReport"
+ class="org.hisp.dhis.caseentry.action.report.GenerateSingleEventReportAction">
+ <result name="success" type="velocity">/content.vm</result>
+ <param name="page">/dhis-web-caseentry/historyAnonymousEvents.vm</param>
+ <param name="javascripts">javascript/anonymousRegistration.js</param>
+ <param name="stylesheets">
+ ../dhis-web-caseentry/style/patient.css,
+ ../dhis-web-commons/paging/paging.css</param>
+ </action>
+
+ <action name="showSingleEventReportForm"
+ class="org.hisp.dhis.caseentry.action.caseentry.LoadAnonymousProgramsAction">
+ <result name="success" type="velocity">/main.vm</result>
+ <param name="page">/dhis-web-caseentry/singleEventReportForm.vm</param>
+ <param name="menu">/dhis-web-caseentry/reportsMenu.vm</param>
+ <param name="javascripts">../dhis-web-commons/ouwt/ouwt.js,javascript/singleEventReport.js</param>
+ </action>
+
+ <action name="generateSingleEventReport"
+ class="org.hisp.dhis.caseentry.action.report.GenerateSingleEventReportAction">
+ <result name="success" type="velocity">/content.vm</result>
+ <param name="page">/dhis-web-caseentry/historyAnonymousEvents.vm</param>
+ <param name="stylesheets">
+ ../dhis-web-caseentry/style/patient.css,
+ ../dhis-web-commons/paging/paging.css</param>
+ </action>
+
+ <action name="viewAnonymousEvents"
+ class="org.hisp.dhis.caseentry.action.caseentry.ProgramStageCustomDataEntryAction">
+ <result name="success" type="velocity">/content.vm</result>
+ <param name="page">/dhis-web-caseentry/dataEntryForm.vm</param>
+ </action>
+
<!-- Case Aggregation -->
<action name="caseAggregationForm"
@@ -455,22 +488,6 @@
<result name="error" type="velocity-json">
/dhis-web-commons/ajax/jsonResponseError.vm</result>
</action>
-
- <action name="getEventsByProgram"
- class="org.hisp.dhis.caseentry.action.caseentry.GetEventsByProgramAction">
- <result name="success" type="velocity">/content.vm</result>
- <param name="page">/dhis-web-caseentry/historyAnonymousEvents.vm</param>
- <param name="javascripts">javascript/anonymousRegistration.js</param>
- <param name="stylesheets">
- ../dhis-web-caseentry/style/patient.css,
- ../dhis-web-commons/paging/paging.css</param>
- </action>
-
- <action name="viewAnonymousEvents"
- class="org.hisp.dhis.caseentry.action.caseentry.ProgramStageCustomDataEntryAction">
- <result name="success" type="velocity">/content.vm</result>
- <param name="page">/dhis-web-caseentry/dataEntryForm.vm</param>
- </action>
<!-- Patient-Program Enrollment -->
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/anonymousRegistration.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/anonymousRegistration.vm 2012-01-06 04:56:54 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/anonymousRegistration.vm 2012-01-15 02:14:29 +0000
@@ -5,7 +5,6 @@
<input type="button" id="createEventBtn" value="$i18n.getString('create_new_event')" onClick="javascript: createNewEvent();" style="width:12em " disabled="disabled">
<input type="button" id="completeBtn" value="$i18n.getString('complete')" onClick="doComplete();" style="width:12em" disabled="disabled" >
<input type="button" id="deleteCurrentEventBtn" value="$i18n.getString('delete_current_event')" onClick="javascript: deleteCurrentEvent();" style="width:12em " disabled="disabled" >
- <input type="button" id="showEventBtn" value="$i18n.getString('show_events')" onClick="javascript: showHistoryEvents();" style="width:12em " disabled="disabled" >
</div>
<div id="dataRecordingSelectDiv" class="inputCriteria" style="width:420px;height:80px;">
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/historyAnonymousEvents.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/historyAnonymousEvents.vm 2012-01-06 04:56:54 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/historyAnonymousEvents.vm 2012-01-15 02:14:29 +0000
@@ -1,26 +1,9 @@
-<h2>$i18n.getString('history_events')</h2>
-
-<table width='100%'>
- #foreach( $programStageInstance in $programStageInstances)
- <tr>
- <td id='td$programStageInstance.id'></td>
- </tr>
- #end
-
- <tr>
- <td> </td>
- </tr>
- <tr>
- <td>
- <div class="paging-container">
- #parse( "/dhis-web-commons/paging/paging.vm" )
- </div>
- </td>
- </tr>
-</table>
-
-<script>
- #foreach( $programStageInstance in $programStageInstances)
- viewRecords( '$programStageInstance.id', 'td$programStageInstance.id' );
- #end
-</script>
\ No newline at end of file
+<div>
+ #parse( "dhis-web-caseentry/htmlGrid.vm" )
+</div>
+
+<div class="paging-container">
+ #parse( "/dhis-web-commons/paging/paging.vm" )
+</div>
+
+<div id='viewRecordsDiv'></div>
\ No newline at end of file
=== added file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/htmlGrid.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/htmlGrid.vm 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/htmlGrid.vm 2012-01-15 02:14:29 +0000
@@ -0,0 +1,49 @@
+<style type="text/css">
+.gridTable th, .gridTable td
+{
+ text-align: center;
+ width: 150px;
+ line-height: 170%;
+}
+</style>
+
+<h3>$!encoder.htmlEncode( $grid.title )</h3>
+
+<h5>$!encoder.htmlEncode( $grid.subtitle )</h5>
+
+<table class="listTable gridTable">
+
+ <thead>
+ <tr>
+ <th>#</th>
+ #foreach( $header in $grid.getVisibleHeaders() )
+ <th #if( $header.meta )style="text-align:left"#end>$!encoder.htmlEncode( $header.name )</th>
+ #end
+ </tr>
+ </thead>
+
+ <tbody>
+ #set( $mark = false )
+ #set( $i = 1 )
+ #foreach( $row in $grid.getVisibleRows() )
+ <tr #alternate($mark)>
+ <td>$i</td>
+ #foreach( $col in $row )
+ #set( $index = ( $velocityCount - 1 ) )
+ #if( $grid.getVisibleHeaders().get( $index ).meta )
+ <td style="text-align:left">$!encoder.htmlEncode( $col )</td>
+ #elseif( $index < $row.size() - 1 )
+ <td>$col</td>
+ #else
+ <td style="text-align:center">
+ <a href="javascript:showDetails( $col )" title="$i18n.getString( 'show_details' )"><img src="../images/information.png" alt="$i18n.getString( 'show_details' )"></a>
+ </td>
+ #end
+ #end
+ </tr>
+ #set( $mark = !$mark)
+ #set( $i = $i + 1 )
+ #end
+ </tbody>
+
+</table>
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/index.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/index.vm 2011-12-14 07:33:18 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/index.vm 2012-01-15 02:14:29 +0000
@@ -7,6 +7,7 @@
#introListImgItem( "dataEntrySelect.action" "data_entry" "dataentry" )
#introListImgItem( "multipledataEntrySelect.action" "multiple_dataentry" "dataentry" )
#introListImgItem( "reportSelect.action" "summary_report" "summaryreport" )
- #introListImgItem( "visitplan.action" "visit_plan" "visitplan" )
+ #introListImgItem( "showSingleEventReportForm.action" "single_event_report" "summaryreport" )
+ #introListImgItem( "visitplan.action" "visit_plan" "visitplan" )
#introListImgItem( "caseAggregationForm.action" "case_aggregation" "caseaggregation" )
</ul>
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/anonymousRegistration.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/anonymousRegistration.js 2012-01-06 04:56:54 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/anonymousRegistration.js 2012-01-15 02:14:29 +0000
@@ -197,28 +197,3 @@
});
}
}
-
-isAjax = true;
-function showHistoryEvents()
-{
- $('#executionDate').unbind('change');
- contentDiv = 'dataEntryFormDiv';
- $( '#dataEntryFormDiv' ).load( "getEventsByProgram.action",
- {
- programInstanceId: jQuery('select[id=programId] option:selected').attr('programInstanceId'),
- executionDate: getFieldValue('executionDate')
- },function( )
- {
- });
-}
-
-
-function viewRecords( programStageInstanceId, div )
-{
- $( '#' + div )
- .load( 'viewAnonymousEvents.action?programStageInstanceId=' + programStageInstanceId ,{}
- ,function( )
- {
- $('#executionDate').unbind('change');
- });
-}
\ No newline at end of file
=== added file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/singleEventReport.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/singleEventReport.js 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/singleEventReport.js 2012-01-15 02:14:29 +0000
@@ -0,0 +1,78 @@
+
+function organisationUnitSelected( orgUnits )
+{
+ hideById('contentDiv');
+ setFieldValue('startDate', '');
+ setFieldValue('endDate', '');
+
+ $.postJSON( 'loadAnonymousPrograms.action',{}
+ , function( json )
+ {
+ clearListById( 'programId' );
+ addOptionById( 'programId', '', i18n_please_select );
+
+ var preSelectedProgramId = getFieldValue('selectedProgramId');
+ for ( i in json.programInstances )
+ {
+ if( preSelectedProgramId == json.programInstances[i].id )
+ {
+ $('#programId').append('<option selected value=' + json.programInstances[i].id + ' singleevent="true" programInstanceId=' + json.programInstances[i].programInstanceId + '>' + json.programInstances[i].name + '</option>');
+ }
+ else
+ {
+ $('#programId').append('<option value=' + json.programInstances[i].id + ' singleevent="true" programInstanceId=' + json.programInstances[i].programInstanceId + '>' + json.programInstances[i].name + '</option>');
+ }
+ }
+
+ if( json.programInstances.length > 0 )
+ {
+ enable('generateBtn');
+ }
+ else
+ {
+ disable('generateBtn');
+ }
+
+ } );
+}
+
+selection.setListenerFunction( organisationUnitSelected );
+
+function loadGeneratedReport()
+{
+ showLoader();
+ isAjax = true;
+ jQuery( "#contentDiv" ).load( "generateSingleEventReport.action",
+ {
+ programInstanceId: jQuery('select[id=programId] option:selected').attr('programInstanceId'),
+ startDate: getFieldValue('startDate'),
+ endDate: getFieldValue('endDate')
+ }, function()
+ {
+ hideLoader();
+ hideById( 'message' );
+ showById( 'contentDiv' );
+ });
+
+ return false;
+}
+
+function showDetails( programStageInstanceId )
+{
+ $('#viewRecordsDiv' )
+
+ $( '#viewRecordsDiv' )
+ .load( 'viewAnonymousEvents.action?programStageInstanceId=' + programStageInstanceId ,{}
+ ,function( )
+ {
+
+ }).dialog({
+ title: i18n_reports,
+ maximize: true,
+ closable: true,
+ modal:true,
+ overlay:{background:'#000000', opacity:0.1},
+ width: 800,
+ height: 400
+ });
+}
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/menu.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/menu.vm 2011-12-14 07:33:18 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/menu.vm 2012-01-15 02:14:29 +0000
@@ -13,7 +13,9 @@
<h2>$i18n.getString( "reports" ) </h2>
<ul>
- <li><a href="reportSelect.action">$i18n.getString( "summary_report" ) </a></li>
+ <li><a href="reportSelect.action">$i18n.getString( "summary_report" ) </a></li>
+ <li><a href="showSingleEventReportForm.action"> $i18n.getString( "single_event_report" ) </a></li>
+
<li><a href="visitplan.action">$i18n.getString( "visit_plan" ) </a></li>
</ul>
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/reportsMenu.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/reportsMenu.vm 2011-08-04 06:25:28 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/reportsMenu.vm 2012-01-15 02:14:29 +0000
@@ -2,8 +2,9 @@
<a href="index.action"><h2>$i18n.getString( "reports" ) </h2></a>
<ul>
<li><a href="reportSelect.action">$i18n.getString( "summary_report" ) </a></li>
+ <li><a href="showSingleEventReportForm.action"> $i18n.getString( "single_event_report" ) </a></li>
<li><a href="visitplan.action">$i18n.getString( "visit_plan" ) </a></li>
</ul>
<br>
-#parse( "/dhis-web-commons/ouwt/orgunittree.vm" )
+#parse( "/dhis-web-commons/ouwt/orgunittree.vm" )
\ No newline at end of file
=== added file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/singleEventReportForm.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/singleEventReportForm.vm 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/singleEventReportForm.vm 2012-01-15 02:14:29 +0000
@@ -0,0 +1,69 @@
+<script>
+ jQuery(document).ready( function(){
+ validation( 'singleEventreportForm', function(form){
+ loadGeneratedReport();
+ });
+ });
+</script>
+
+<h3>$i18n.getString( "single_event_report" )</h3>
+<form id="singleEventreportForm" name="singleEventreportForm" method="post" action="generateSingleEventReport.action">
+
+<table>
+
+ <tr>
+ <td><label for="programId">$i18n.getString( "program" ) <em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
+ <td>
+ <select id="programId" name="programId" style="width:350px" class="{validate:{required:true}}" >
+ <option value="">[ $i18n.getString('please_select') ]</option>
+ #foreach( $programInstance in $programInstances)
+ <option value="$programInstance.program.id" singleevent='$programInstance.program.singleEvent' programInstanceId='$programInstance.id'>$programInstance.program.name</option>
+ #end
+ </select>
+ </td>
+ </tr>
+
+ <tr>
+ <td><label>$i18n.getString( "start_date" ) <em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
+ <td>
+ <input type="text" id="startDate" name="startDate" class="{validate:{required:true}}" style="width:350px"/>
+ <script type="text/javascript">
+ datePicker('startDate');
+ </script>
+ </td>
+ </tr>
+
+ <tr>
+ <td><label>$i18n.getString( "end_date" ) <em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
+ <td>
+ <input type="text" id="endDate" name="endDate" class="{validate:{required:true}}" style="width:350px"/>
+ <script type="text/javascript">
+ datePicker('endDate');
+ </script>
+ </td>
+ </tr>
+
+ <tr>
+ <td></td>
+ <td>
+ <input type="submit" id='generateBtn' name='generateBtn' value="$i18n.getString( 'generate' )" style="width:10em" #if( $!program.size() == 0 ) disabled #end/>
+ <input type="button" value="$i18n.getString( 'cancel' )" onclick="window.location.href='index.action'" style="width:10em"/>
+ </td>
+ </tr>
+
+</table>
+<p>
+
+<hr style="clear:both">
+
+#parse( "dhis-web-commons/loader/loader.vm" )
+
+<div id="contentDiv"></div>
+
+
+<script type="text/javascript">
+ var i18n_report_generation_failed = '$encoder.jsEscape( $i18n.getString( "report_generation_failed" ), "'")';
+ var i18n_please_select = '[' + '$encoder.jsEscape( $i18n.getString( "please_select" ), "'")' + ']';
+ var i18n_reports = '$encoder.jsEscape( $i18n.getString( "reports" ), "'")';
+ var i18n_patient_profile = '$encoder.jsEscape( $i18n.getString( "patient_profile" ), "'")';
+</script>
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/programstage/UpdateProgramStageAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/programstage/UpdateProgramStageAction.java 2011-11-07 02:53:47 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/programstage/UpdateProgramStageAction.java 2012-01-15 02:14:29 +0000
@@ -120,6 +120,13 @@
this.compulsories = compulsories;
}
+ private List<Boolean> showOnReport = new ArrayList<Boolean>();
+
+ public void setShowOnReport( List<Boolean> showOnReport )
+ {
+ this.showOnReport = showOnReport;
+ }
+
private int programId;
public int getProgramId()
@@ -164,15 +171,19 @@
ProgramStageDataElement programStageDataElement = programStageDataElementService.get( programStage,
dataElement );
+ Boolean isShow = ( showOnReport == null ) ? false : showOnReport.get( i );
+
if ( programStageDataElement == null )
{
programStageDataElement = new ProgramStageDataElement( programStage, dataElement, this.compulsories
- .get( i ), new Integer( i ) );
+ .get( i ), isShow, new Integer( i ) );
programStageDataElementService.addProgramStageDataElement( programStageDataElement );
}
else
{
programStageDataElement.setCompulsory( this.compulsories.get( i ) );
+
+ programStageDataElement.setShowOnReport( isShow );
programStageDataElement.setSortOrder( new Integer( i ) );
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties 2012-01-13 07:32:03 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties 2012-01-15 02:14:29 +0000
@@ -400,4 +400,5 @@
due_date_with_max_number_of_days_of_data_entry = Due date +/- Max number of days of data entry
data_element = Data element
condition = Condition
-no_date_data_element_in_selected_program_stage = No data elements with date-type in the selected program stage
\ No newline at end of file
+no_date_data_element_in_selected_program_stage = No data elements with date-type in the selected program stage
+shown_on_reports = Shown on reports
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/updateProgramStageForm.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/updateProgramStageForm.js 2011-07-05 03:55:54 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/updateProgramStageForm.js 2012-01-15 02:14:29 +0000
@@ -9,11 +9,19 @@
compulsories = jQuery( "#compulsories" );
compulsories.empty();
+ showOnReport = jQuery( "#showOnReport" );
+ showOnReport.empty();
+
jQuery("#selectedList").find("tr").each( function( i, item ){
selectedDataElementsValidator.append( "<option value='" + item.id + "' selected='true'>" + item.id + "</option>" );
var compulsory = jQuery( item ).find( "input[name='compulsory']:first");
+ var isShow = jQuery( item ).find( "input[name='isShow']:first");
+
var checked = compulsory.attr('checked') ? true : false;
compulsories.append( "<option value='" + checked + "' selected='true'>" + checked + "</option>" );
+
+ checked = isShow.attr('checked') ? true : false;
+ showOnReport.append( "<option value='" + checked + "' selected='true'>" + checked + "</option>" );
});
});
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/programStageList.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/programStageList.vm 2012-01-11 07:42:49 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/programStageList.vm 2012-01-15 02:14:29 +0000
@@ -41,7 +41,9 @@
<td style="text-align:center"#alternate( $mark )>
<a href="showUpdateProgramStageForm.action?id=$association.id" title="$i18n.getString( "edit" )"><img src="../images/edit.png" alt="$i18n.getString( "edit" )"></a>
- <a href="javascript:removeItem( '$association.id', '$encoder.jsEncode( $association.name )', i18n_confirm_delete , 'removeProgramStage.action' )" title="$i18n.getString( "remove" )"><img src="../images/delete.png" alt="$i18n.getString( "remove" )"></a>
+ #if( $association.program.singleEvent == 'false' )
+ <a href="javascript:removeItem( '$association.id', '$encoder.jsEncode( $association.name )', i18n_confirm_delete , 'removeProgramStage.action' )" title="$i18n.getString( "remove" )"><img src="../images/delete.png" alt="$i18n.getString( "remove" )"></a>
+ #end
<a href="javascript:showProgramStageDetails( $association.id )" title="$i18n.getString( "show_details" )"><img src="../images/information.png" alt="$i18n.getString( "show_details" )"></a>
<a href="viewDataEntryForm.action?programStageId=$association.id" title="$i18n.getString( "design_data_entry_form" )"><img src="../images/edit_layout.png" alt="$i18n.getString( "design_data_entry_form" )"></a>
</td>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateProgramStageForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateProgramStageForm.vm 2012-01-11 07:48:47 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateProgramStageForm.vm 2012-01-15 02:14:29 +0000
@@ -86,6 +86,7 @@
<th>$i18n.getString( "selected_data_elements" )
<select id="selectedDataElementsValidator" name='selectedDataElementsValidator' multiple="multiple" class="{validate:{required:true}}" style="display:none"> </select>
<select id="compulsories" name='compulsories' multiple="multiple" style="display:none"></select>
+ <select id="showOnReport" name='showOnReport' multiple="multiple" style="display:none"></select>
</th>
</tr>
</thead>
@@ -104,13 +105,20 @@
<div style="overflow:auto; height:20em; width:40em;border:1px solid #9DA1AA">
<table width="100%">
<thead>
- <tr><th>$i18n.getString( "dataelement" )</th><th width="20px">$i18n.getString( "compulsory" )</th>
+ <tr><th>$i18n.getString( "dataelement" )</th>
+ <th width="20px">$i18n.getString( "compulsory" )</th>
+ #if( $programStage.program.singleEvent == 'true' )
+ <th width="20px">$i18n.getString( "shown_on_reports" )</th>
+ #end
</thead>
<tbody id="selectedList">
#foreach ( $programStageDataElement in $programStageDataElements )
<tr ondblclick="unSelectDataElement( this )" id="$programStageDataElement.dataElement.id">
<td onclick="select(this)">$encoder.htmlEncode( $programStageDataElement.dataElement.name )</td>
- <td><input type="checkbox" name="compulsory" value="$programStageDataElement.dataElement.id" #if($programStageDataElement.compulsory == true ) checked #end /></td>
+ <td align="center"><input type="checkbox" name="compulsory" value="$programStageDataElement.dataElement.id" #if($programStageDataElement.compulsory == true ) checked #end /></td>
+ #if( $programStage.program.singleEvent == 'true' )
+ <td align="center"><input type="checkbox" name="isShow" value="$programStageDataElement.dataElement.id" #if($programStageDataElement.showOnReport == true ) checked #end /></td>
+ #end
</tr>
#end
</tbody>