=== 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 getPatientDataValues( Patient patient, Collection dataElements, Date startDate, Date endDate ); + PatientDataValue getPatientDataValue( ProgramStageInstance programStageInstance, DataElement dataElement ); + Collection 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 get( DataElement dataElement, boolean providedByAnotherFacility ); Collection get( Patient patient, Collection 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 getProgramStageInstances( Patient patient, Boolean completed ); - List getProgramStageInstances( ProgramInstance programInstance, Date executionDate, int min, int max ); - - int countProgramStageInstances( ProgramInstance programInstance, Date executionDate); + List 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 getProgramStageInstances( Patient patient, Boolean completed); - List getProgramStageInstances( ProgramInstance programInstance, Date executionDate, int min, int max ); + List 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 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 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 programStageInstances = getProgramStageInstances( programInstance, startDate, endDate , + min, max ); + + ProgramStage programStage = programInstance.getProgram().getProgramStages().iterator().next(); + + Collection psDataElements = programStage.getProgramStageDataElements(); + + Collection dataElements = new HashSet(); + 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 getProgramStageInstances( ProgramInstance programInstance, Date executionDate, + public List 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"> + === 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 @@ + + === 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 -{ - // ------------------------------------------------------------------------- - // 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 programStageInstances; - - public Collection 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 +{ + // ------------------------------------------------------------------------- + // 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 programStageInstances; + + public Collection 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 @@ + + + + + @@ -399,14 +407,6 @@ - - - - - === 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 @@ /dhis-web-caseentry/records.vm + + /content.vm + /dhis-web-caseentry/historyAnonymousEvents.vm + javascript/anonymousRegistration.js + + ../dhis-web-caseentry/style/patient.css, + ../dhis-web-commons/paging/paging.css + + + + /main.vm + /dhis-web-caseentry/singleEventReportForm.vm + /dhis-web-caseentry/reportsMenu.vm + ../dhis-web-commons/ouwt/ouwt.js,javascript/singleEventReport.js + + + + /content.vm + /dhis-web-caseentry/historyAnonymousEvents.vm + + ../dhis-web-caseentry/style/patient.css, + ../dhis-web-commons/paging/paging.css + + + + /content.vm + /dhis-web-caseentry/dataEntryForm.vm + + /dhis-web-commons/ajax/jsonResponseError.vm - - - /content.vm - /dhis-web-caseentry/historyAnonymousEvents.vm - javascript/anonymousRegistration.js - - ../dhis-web-caseentry/style/patient.css, - ../dhis-web-commons/paging/paging.css - - - - /content.vm - /dhis-web-caseentry/dataEntryForm.vm - === 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 @@ -
=== 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 @@ -

$i18n.getString('history_events')

- - - #foreach( $programStageInstance in $programStageInstances) - - - - #end - - - - - - - -
 
-
- #parse( "/dhis-web-commons/paging/paging.vm" ) -
-
- - \ No newline at end of file +
+ #parse( "dhis-web-caseentry/htmlGrid.vm" ) +
+ +
+ #parse( "/dhis-web-commons/paging/paging.vm" ) +
+ +
\ 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 @@ + + +

$!encoder.htmlEncode( $grid.title )

+ +
$!encoder.htmlEncode( $grid.subtitle )
+ + + + + + + #foreach( $header in $grid.getVisibleHeaders() ) + + #end + + + + + #set( $mark = false ) + #set( $i = 1 ) + #foreach( $row in $grid.getVisibleRows() ) + + + #foreach( $col in $row ) + #set( $index = ( $velocityCount - 1 ) ) + #if( $grid.getVisibleHeaders().get( $index ).meta ) + + #elseif( $index < $row.size() - 1 ) + + #else + + #end + #end + + #set( $mark = !$mark) + #set( $i = $i + 1 ) + #end + + +
#$!encoder.htmlEncode( $header.name )
$i$!encoder.htmlEncode( $col )$col + $i18n.getString( 'show_details' ) +
\ 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" ) \ 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(''); + } + else + { + $('#programId').append(''); + } + } + + 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 @@

$i18n.getString( "reports" ) 

=== 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 @@

$i18n.getString( "reports" ) 


-#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 @@ + + +

$i18n.getString( "single_event_report" )

+
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + +
+ + +
+ + +
+

+ +


+ +#parse( "dhis-web-commons/loader/loader.vm" ) + +
+ + + \ 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 showOnReport = new ArrayList(); + + public void setShowOnReport( List 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( "" ); 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( "" ); + + checked = isShow.attr('checked') ? true : false; + showOnReport.append( "" ); }); }); === 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 @@ $i18n.getString( - $i18n.getString( + #if( $association.program.singleEvent == 'false' ) + $i18n.getString( + #end $i18n.getString( $i18n.getString( === 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 @@ $i18n.getString( "selected_data_elements" ) + @@ -104,13 +105,20 @@
- + + + #if( $programStage.program.singleEvent == 'true' ) + + #end #foreach ( $programStageDataElement in $programStageDataElements ) - + + #if( $programStage.program.singleEvent == 'true' ) + + #end #end
$i18n.getString( "dataelement" )$i18n.getString( "compulsory" )
$i18n.getString( "dataelement" )$i18n.getString( "compulsory" )$i18n.getString( "shown_on_reports" )
$encoder.htmlEncode( $programStageDataElement.dataElement.name )