← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 7407: Add new function to enter registration information and data-values into one form for single event...

 

------------------------------------------------------------
revno: 7407
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2012-06-27 12:12:36 +0700
message:
  Add new function to enter registration information and data-values into one form for single event with registration program.
added:
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/GetSingleEventProrgramListAction.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/SaveValuesAction.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/ShowEventWithRegistrationFormAction.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/addSingleEventRegistration.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/singleEvent.js
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/singleEventPatient.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/singleEventSelect.vm
renamed:
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonAnonymousPrograms.vm => dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonSingleEventPrograms.vm
modified:
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/DataRecordingSelectAction.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/LoadDataEntryAction.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/LoadProgramStageInstancesAction.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/SaveValueAction.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties
  dhis-2/dhis-web/dhis-web-caseentry/src/main/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/dataEntryForm.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataEntryMenu.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataRecordingSelect.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/form.js
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/patient.js
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/listPatient.vm
  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/patientRegistrationList.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/searchPatientCriteria.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/select.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/selectPatient.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/style/style.css
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonSingleEventPrograms.vm


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/DataRecordingSelectAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/DataRecordingSelectAction.java	2012-05-24 10:44:17 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/DataRecordingSelectAction.java	2012-06-27 05:12:36 +0000
@@ -34,8 +34,6 @@
 import org.hisp.dhis.patient.Patient;
 import org.hisp.dhis.patient.PatientService;
 import org.hisp.dhis.program.Program;
-import org.hisp.dhis.program.ProgramInstance;
-import org.hisp.dhis.program.ProgramInstanceService;
 import org.hisp.dhis.program.ProgramService;
 
 import com.opensymphony.xwork2.Action;
@@ -72,13 +70,6 @@
         this.selectedStateManager = selectedStateManager;
     }
 
-    private ProgramInstanceService programInstanceService;
-
-    public void setProgramInstanceService( ProgramInstanceService programInstanceService )
-    {
-        this.programInstanceService = programInstanceService;
-    }
-
     // -------------------------------------------------------------------------
     // Input/Output
     // -------------------------------------------------------------------------
@@ -116,22 +107,6 @@
         patient = patientService.getPatient( patientId );
 
         // ---------------------------------------------------------------------
-        // Get single programs with un-completed program-instances
-        // ---------------------------------------------------------------------
-
-        Collection<ProgramInstance> programInstances = programInstanceService.getProgramInstances( patient, true );
-
-        Collection<Program> completedPrograms = new HashSet<Program>();
-
-        for ( ProgramInstance programInstance : programInstances )
-        {
-            if ( programInstance.getProgram().isSingleEvent() )
-            {
-                completedPrograms.add( programInstance.getProgram() );
-            }
-        }
-
-        // ---------------------------------------------------------------------
         // Get programs which patient enrolls
         // ---------------------------------------------------------------------
 
@@ -141,8 +116,6 @@
 
         programs.addAll( programService.getPrograms( Program.SINGLE_EVENT_WITH_REGISTRATION, orgunit ) );
 
-        programs.removeAll( completedPrograms );
-
         selectedStateManager.setSelectedPatient( patient );
 
         return SUCCESS;

=== added file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/GetSingleEventProrgramListAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/GetSingleEventProrgramListAction.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/GetSingleEventProrgramListAction.java	2012-06-27 05:12:36 +0000
@@ -0,0 +1,89 @@
+/*
+ * 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 org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager;
+import org.hisp.dhis.program.Program;
+import org.hisp.dhis.program.ProgramService;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Chau Thu Tran
+ * 
+ * @version $LoadSingleEventProrgramAction.java Jun 26, 2012 10:36:31 AM$
+ */
+public class GetSingleEventProrgramListAction
+    implements Action
+{
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
+    private OrganisationUnitSelectionManager selectionManager;
+
+    public void setSelectionManager( OrganisationUnitSelectionManager selectionManager )
+    {
+        this.selectionManager = selectionManager;
+    }
+
+    private ProgramService programService;
+
+    public void setProgramService( ProgramService programService )
+    {
+        this.programService = programService;
+    }
+
+    // -------------------------------------------------------------------------
+    // Output
+    // -------------------------------------------------------------------------
+
+    private Collection<Program> programs;
+
+    public Collection<Program> getPrograms()
+    {
+        return programs;
+    }
+
+    // -------------------------------------------------------------------------
+    // Implementation Action
+    // -------------------------------------------------------------------------
+
+    public String execute()
+        throws Exception
+    {
+        OrganisationUnit orgunit = selectionManager.getSelectedOrganisationUnit();
+
+        programs = programService.getPrograms( Program.SINGLE_EVENT_WITH_REGISTRATION, orgunit );
+
+        return SUCCESS;
+    }
+
+}

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/LoadDataEntryAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/LoadDataEntryAction.java	2012-06-23 11:05:13 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/LoadDataEntryAction.java	2012-06-27 05:12:36 +0000
@@ -165,6 +165,7 @@
         // ---------------------------------------------------------------------
         // Get program-stage-instance
         // ---------------------------------------------------------------------
+        
         if ( programStageInstanceId != null )
         { 
             programStageInstance = programStageInstanceService.getProgramStageInstance( programStageInstanceId );

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/LoadProgramStageInstancesAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/LoadProgramStageInstancesAction.java	2012-06-15 04:55:20 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/LoadProgramStageInstancesAction.java	2012-06-27 05:12:36 +0000
@@ -134,15 +134,19 @@
 
         List<ProgramInstance> programInstances = new ArrayList<ProgramInstance>();
 
-        if ( program.isRegistration() )
+        if ( program.getType() == Program.MULTIPLE_EVENTS_WITH_REGISTRATION)
         {
             programInstances = new ArrayList<ProgramInstance>( programInstanceService.getProgramInstances( patient,
                 program, false ) );
         }
+        else if ( program.getType() == Program.SINGLE_EVENT_WITH_REGISTRATION )
+        {
+            programInstances = new ArrayList<ProgramInstance>( programInstanceService.getProgramInstances( patient,
+                program ) );
+        }
         else
         {
-            programInstances = new ArrayList<ProgramInstance>( programInstanceService.getProgramInstances( program,
-                false ) );
+            programInstances = new ArrayList<ProgramInstance>( programInstanceService.getProgramInstances( program ) );
         }
 
         if ( programInstances != null && programInstances.size() > 0 )
@@ -172,7 +176,7 @@
                 }
             }
         }
-
+        
         return SUCCESS;
     }
 }

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/SaveValueAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/SaveValueAction.java	2012-06-18 09:40:23 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/SaveValueAction.java	2012-06-27 05:12:36 +0000
@@ -151,7 +151,7 @@
             programStageInstanceService.updateProgramStageInstance( programStageInstance );
         }
 
-        providedElsewhere = (providedElsewhere == null) ? false : true;
+        providedElsewhere = (providedElsewhere == null) ? false : providedElsewhere;
 
         if ( patientDataValue == null && value != null )
         {

=== added file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/SaveValuesAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/SaveValuesAction.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/SaveValuesAction.java	2012-06-27 05:12:36 +0000
@@ -0,0 +1,218 @@
+/*
+ * 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 javax.servlet.http.HttpServletRequest;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.struts2.ServletActionContext;
+import org.hisp.dhis.caseentry.state.SelectedStateManager;
+import org.hisp.dhis.patient.Patient;
+import org.hisp.dhis.patient.PatientService;
+import org.hisp.dhis.patientdatavalue.PatientDataValue;
+import org.hisp.dhis.patientdatavalue.PatientDataValueService;
+import org.hisp.dhis.program.Program;
+import org.hisp.dhis.program.ProgramInstance;
+import org.hisp.dhis.program.ProgramInstanceService;
+import org.hisp.dhis.program.ProgramService;
+import org.hisp.dhis.program.ProgramStage;
+import org.hisp.dhis.program.ProgramStageDataElement;
+import org.hisp.dhis.program.ProgramStageInstance;
+import org.hisp.dhis.program.ProgramStageInstanceService;
+import org.hisp.dhis.user.CurrentUserService;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Chau Thu Tran
+ * 
+ * @version $SaveValuesAction.java Jun 27, 2012 7:45:20 AM$
+ */
+public class SaveValuesAction
+    implements Action
+{
+
+    private static final Log LOG = LogFactory.getLog( SaveValueAction.class );
+
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
+
+    private ProgramService programService;
+
+    public void setProgramService( ProgramService programService )
+    {
+        this.programService = programService;
+    }
+
+    private PatientService patientService;
+
+    public void setPatientService( PatientService patientService )
+    {
+        this.patientService = patientService;
+    }
+
+    private PatientDataValueService patientDataValueService;
+
+    public void setPatientDataValueService( PatientDataValueService patientDataValueService )
+    {
+        this.patientDataValueService = patientDataValueService;
+    }
+
+    private ProgramStageInstanceService programStageInstanceService;
+
+    public void setProgramStageInstanceService( ProgramStageInstanceService programStageInstanceService )
+    {
+        this.programStageInstanceService = programStageInstanceService;
+    }
+
+    private ProgramInstanceService programInstanceService;
+
+    public void setProgramInstanceService( ProgramInstanceService programInstanceService )
+    {
+        this.programInstanceService = programInstanceService;
+    }
+
+    private SelectedStateManager selectedStateManager;
+
+    public void setSelectedStateManager( SelectedStateManager selectedStateManager )
+    {
+        this.selectedStateManager = selectedStateManager;
+    }
+
+    private CurrentUserService currentUserService;
+
+    public void setCurrentUserService( CurrentUserService currentUserService )
+    {
+        this.currentUserService = currentUserService;
+    }
+
+    // -------------------------------------------------------------------------
+    // Input/Output
+    // -------------------------------------------------------------------------
+
+    private Integer programId;
+
+    public void setProgramId( Integer programId )
+    {
+        this.programId = programId;
+    }
+
+    private Integer patientId;
+
+    public void setPatientId( Integer patientId )
+    {
+        this.patientId = patientId;
+    }
+
+    private int statusCode;
+
+    public int getStatusCode()
+    {
+        return statusCode;
+    }
+
+    // -------------------------------------------------------------------------
+    // Implementation Action
+    // -------------------------------------------------------------------------
+
+    public String execute()
+        throws Exception
+    {
+        Program program = programService.getProgram( programId );
+        ProgramStage programStage = program.getProgramStages().iterator().next();
+        Patient patient = patientService.getPatient( patientId );
+
+        // ---------------------------------------------------------------------
+        // Add a new program-instance
+        // ---------------------------------------------------------------------
+
+        ProgramInstance programInstance = new ProgramInstance();
+        Date currentDate = new Date();
+        programInstance.setEnrollmentDate( currentDate );
+        programInstance.setDateOfIncident( currentDate );
+        programInstance.setProgram( program );
+        programInstance.setCompleted( true );
+        programInstance.setPatient( patient );
+
+        patient.getPrograms().add( program );
+        patientService.updatePatient( patient );
+
+        programInstanceService.addProgramInstance( programInstance );
+
+        // ---------------------------------------------------------------------
+        // Add a new program-stage-instance
+        // ---------------------------------------------------------------------
+
+        String storedBy = currentUserService.getCurrentUsername();
+        ProgramStageInstance programStageInstance = new ProgramStageInstance();
+        programStageInstance.setProgramInstance( programInstance );
+        programStageInstance.setProgramStage( programStage );
+        programStageInstance.setStageInProgram( programStage.getStageInProgram() );
+        programStageInstance.setDueDate( currentDate );
+        programStageInstance.setExecutionDate( currentDate );
+        programStageInstance.setStoredBy( storedBy );
+        programStageInstance.setOrganisationUnit( selectedStateManager.getSelectedOrganisationUnit() );
+        programStageInstance.setCompleted( true );
+
+        programStageInstanceService.addProgramStageInstance( programStageInstance );
+
+        // ---------------------------------------------------------------------
+        // Save value
+        // ---------------------------------------------------------------------
+
+        HttpServletRequest request = ServletActionContext.getRequest();
+
+        Collection<ProgramStageDataElement> psDataElements = programStage.getProgramStageDataElements();
+        for ( ProgramStageDataElement psDataElement : psDataElements )
+        {
+            String dataElementFieldId = programStage.getId() + "-" + psDataElement.getDataElement().getId() + "-val";
+            String providedElsewhereId = programStage.getId() + "_" + psDataElement.getDataElement().getId()
+                + "_facility";
+            String value = request.getParameter( dataElementFieldId );
+            if ( value != null )
+            {
+                boolean providedElsewhere = (request.getParameter( providedElsewhereId ) == null) ? false : true;
+
+                PatientDataValue patientDataValue = new PatientDataValue( programStageInstance, psDataElement.getDataElement(), new Date(), value );
+                patientDataValue.setProvidedElsewhere( providedElsewhere );
+                patientDataValueService.savePatientDataValue( patientDataValue );
+
+                LOG.debug( "Adding PatientDataValue, value added" );
+            }
+        }
+
+        statusCode = 0;
+
+        return SUCCESS;
+    }
+}

=== added file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/ShowEventWithRegistrationFormAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/ShowEventWithRegistrationFormAction.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/ShowEventWithRegistrationFormAction.java	2012-06-27 05:12:36 +0000
@@ -0,0 +1,200 @@
+/*
+ * 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.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+
+import org.hisp.dhis.dataentryform.DataEntryForm;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager;
+import org.hisp.dhis.patient.PatientAttribute;
+import org.hisp.dhis.patient.PatientAttributeGroup;
+import org.hisp.dhis.patient.PatientAttributeGroupService;
+import org.hisp.dhis.patient.PatientAttributeService;
+import org.hisp.dhis.patient.PatientIdentifierType;
+import org.hisp.dhis.patient.PatientIdentifierTypeService;
+import org.hisp.dhis.patient.comparator.PatientAttributeGroupSortOrderComparator;
+import org.hisp.dhis.program.Program;
+import org.hisp.dhis.program.ProgramDataEntryService;
+import org.hisp.dhis.program.ProgramService;
+import org.hisp.dhis.program.ProgramStage;
+import org.hisp.dhis.program.ProgramStageDataElement;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Chau Thu Tran
+ * 
+ * @version $ShowEventWithRegistrationFormAction.java Jun 26, 2012 4:41:09 PM$
+ */
+public class ShowEventWithRegistrationFormAction
+    implements Action
+{
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
+
+    private OrganisationUnitSelectionManager selectionManager;
+
+    public void setSelectionManager( OrganisationUnitSelectionManager selectionManager )
+    {
+        this.selectionManager = selectionManager;
+    }
+
+    private PatientAttributeService patientAttributeService;
+
+    public void setPatientAttributeService( PatientAttributeService patientAttributeService )
+    {
+        this.patientAttributeService = patientAttributeService;
+    }
+
+    private PatientAttributeGroupService patientAttributeGroupService;
+
+    public void setPatientAttributeGroupService( PatientAttributeGroupService patientAttributeGroupService )
+    {
+        this.patientAttributeGroupService = patientAttributeGroupService;
+    }
+
+    private PatientIdentifierTypeService patientIdentifierTypeService;
+
+    public void setPatientIdentifierTypeService( PatientIdentifierTypeService patientIdentifierTypeService )
+    {
+        this.patientIdentifierTypeService = patientIdentifierTypeService;
+    }
+
+    private ProgramService programService;
+
+    public void setProgramService( ProgramService programService )
+    {
+        this.programService = programService;
+    }
+
+    private ProgramDataEntryService programDataEntryService;
+
+    public void setProgramDataEntryService( ProgramDataEntryService programDataEntryService )
+    {
+        this.programDataEntryService = programDataEntryService;
+    }
+
+    // -------------------------------------------------------------------------
+    // Input/Output
+    // -------------------------------------------------------------------------
+
+    private Integer programId;
+
+    private Collection<PatientAttribute> noGroupAttributes;
+
+    private List<PatientAttributeGroup> attributeGroups;
+
+    private Collection<PatientIdentifierType> identifierTypes;
+
+    private OrganisationUnit organisationUnit;
+
+    private String customDataEntryFormCode;
+
+    private List<ProgramStageDataElement> programStageDataElements = new ArrayList<ProgramStageDataElement>();
+
+    // -------------------------------------------------------------------------
+    // Action implementation
+    // -------------------------------------------------------------------------
+
+    public String execute()
+    {
+        identifierTypes = patientIdentifierTypeService.getPatientIdentifierTypesWithoutProgram();
+
+        noGroupAttributes = patientAttributeService.getPatientAttributes( null, null );
+
+        attributeGroups = new ArrayList<PatientAttributeGroup>( patientAttributeGroupService
+            .getPatientAttributeGroupsWithoutProgram() );
+        Collections.sort( attributeGroups, new PatientAttributeGroupSortOrderComparator() );
+
+        organisationUnit = selectionManager.getSelectedOrganisationUnit();
+
+        // Get data entry form
+
+        Program program = programService.getProgram( programId );
+
+        ProgramStage programStage = program.getProgramStages().iterator().next();
+
+        DataEntryForm dataEntryForm = programStage.getDataEntryForm();
+
+        if ( dataEntryForm != null )
+        {
+            customDataEntryFormCode = programDataEntryService.prepareDataEntryFormForEdit( dataEntryForm.getHtmlCode() );
+        }
+        else
+        {
+            programStageDataElements = new ArrayList<ProgramStageDataElement>( programStage
+                .getProgramStageDataElements() );
+        }
+
+        return SUCCESS;
+    }
+
+    // -------------------------------------------------------------------------
+    // Getter/Setter
+    // -------------------------------------------------------------------------
+
+    public Collection<PatientIdentifierType> getIdentifierTypes()
+    {
+        return identifierTypes;
+    }
+
+    public List<PatientAttributeGroup> getAttributeGroups()
+    {
+        return attributeGroups;
+    }
+
+    public void setProgramId( Integer programId )
+    {
+        this.programId = programId;
+    }
+
+    public Collection<PatientAttribute> getNoGroupAttributes()
+    {
+        return noGroupAttributes;
+    }
+
+    public OrganisationUnit getOrganisationUnit()
+    {
+        return organisationUnit;
+    }
+
+    public String getCustomDataEntryFormCode()
+    {
+        return customDataEntryFormCode;
+    }
+
+    public List<ProgramStageDataElement> getProgramStageDataElements()
+    {
+        return programStageDataElements;
+    }
+}

=== 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-06-25 15:09:16 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml	2012-06-27 05:12:36 +0000
@@ -45,7 +45,6 @@
 		<property name="selectedStateManager"
 			ref="org.hisp.dhis.caseentry.state.SelectedStateManager" />
 		<property name="programService" ref="org.hisp.dhis.program.ProgramService" />
-		<property name="programInstanceService" ref="org.hisp.dhis.program.ProgramInstanceService" />
 	</bean>
 
 	<bean
@@ -190,6 +189,56 @@
 		<property name="programStageInstanceService"
 			ref="org.hisp.dhis.program.ProgramStageInstanceService" />
 	</bean>
+	
+	<!-- Single-event DataEntry -->
+	
+	<bean
+		id="org.hisp.dhis.caseentry.action.caseentry.GetSingleEventProrgramListAction"
+		class="org.hisp.dhis.caseentry.action.caseentry.GetSingleEventProrgramListAction"
+		scope="prototype">
+		<property name="selectionManager"
+			ref="org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager" />
+		<property name="programService"
+			ref="org.hisp.dhis.program.ProgramService" />
+	</bean>
+	
+	<bean
+		id="org.hisp.dhis.caseentry.action.caseentry.ShowEventWithRegistrationFormAction"
+		class="org.hisp.dhis.caseentry.action.caseentry.ShowEventWithRegistrationFormAction"
+		scope="prototype">
+		<property name="selectionManager"
+			ref="org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager" />
+		<property name="patientAttributeService"
+			ref="org.hisp.dhis.patient.PatientAttributeService" />
+		<property name="patientAttributeGroupService"
+			ref="org.hisp.dhis.patient.PatientAttributeGroupService" />
+		<property name="patientIdentifierTypeService"
+			ref="org.hisp.dhis.patient.PatientIdentifierTypeService" />
+		<property name="programService"
+			ref="org.hisp.dhis.program.ProgramService" />
+		<property name="programDataEntryService"
+			ref="org.hisp.dhis.program.ProgramDataEntryService" />
+	</bean>
+	
+	<bean
+		id="org.hisp.dhis.caseentry.action.caseentry.SaveValuesAction"
+		class="org.hisp.dhis.caseentry.action.caseentry.SaveValuesAction"
+		scope="prototype">
+		<property name="programService"
+			ref="org.hisp.dhis.program.ProgramService" />
+		<property name="patientService"
+			ref="org.hisp.dhis.patient.PatientService" />
+		<property name="patientDataValueService"
+			ref="org.hisp.dhis.patientdatavalue.PatientDataValueService" />
+		<property name="programStageInstanceService"
+			ref="org.hisp.dhis.program.ProgramStageInstanceService" />
+		<property name="programInstanceService"
+			ref="org.hisp.dhis.program.ProgramInstanceService" />
+		<property name="selectedStateManager"
+			ref="org.hisp.dhis.caseentry.state.SelectedStateManager" />
+		<property name="currentUserService"
+			ref="org.hisp.dhis.user.CurrentUserService" />
+	</bean>
 
 	<!-- Visit Plan -->
 

=== 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-06-26 02:41:54 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties	2012-06-27 05:12:36 +0000
@@ -218,7 +218,7 @@
 representative_info=Representative's information
 relationship_for=Relationship for
 date_of_edit=Date of edit
-anonymous_events=Single events without registration
+anonymous_events=Single event without registration
 intro_anonymous_events=Register Single events without registration. The data to register is defined by a single event without registration program.
 create_new_event=Create new event
 delete_current_event=Delete current event
@@ -368,4 +368,4 @@
 no_patient_enrolled_the_program = No person enrolled the program
 complete_and_add_new_event = Complete & Add new
 no_compulsary_data_elements = No compulsary data elements
-single_event_with_registration = Single event with registration
\ No newline at end of file
+single_event_with_registration = Single event with registration

=== 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-06-25 15:09:16 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/struts.xml	2012-06-27 05:12:36 +0000
@@ -119,7 +119,7 @@
 		
 		<action name="anonymousPrograms"
 			class="org.hisp.dhis.caseentry.action.caseentry.LoadAnonymousProgramsAction">
-			<result name="success" type="velocity-json">/dhis-web-caseentry/jsonAnonymousPrograms.vm</result>
+			<result name="success" type="velocity-json">/dhis-web-caseentry/jsonSingleEventPrograms.vm</result>
 			<param name="requiredAuthorities">F_NAME_BASED_DATA_ENTRY</param>
 		</action>
 		
@@ -239,6 +239,44 @@
 			<param name="requiredAuthorities">F_PATIENT_DATAVALUE_ADD,F_PATIENT_DATAVALUE_UPDATE,F_PATIENT_DATAVALUE_DELETE</param>
 		</action>
 		
+		<!-- Single-event DataEntry -->
+		
+		<action name="singleEventSelect"
+			class="org.hisp.dhis.caseentry.action.patient.SelectAction">
+			<interceptor-ref name="organisationUnitTreeStack" />
+			<result name="success" type="velocity">/main.vm</result>
+			<param name="page">/dhis-web-caseentry/singleEventSelect.vm</param>
+			<param name="menu">/dhis-web-caseentry/dataEntryMenu.vm</param>
+			<param name="javascripts">../dhis-web-commons/ouwt/ouwt.js
+				,javascript/commons.js
+				,javascript/singleEvent.js
+				,javascript/form.js
+				,javascript/entry.js
+				,../dhis-web-commons/javascripts/date.js
+			</param>
+			<param name="stylesheets">style/style.css</param>
+			<param name="requiredAuthorities">F_NAME_BASED_DATA_ENTRY</param>
+		</action>
+		
+		<action name="singleEventPrograms"
+			class="org.hisp.dhis.caseentry.action.caseentry.GetSingleEventProrgramListAction">
+			<result name="success" type="velocity-json">/dhis-web-caseentry/jsonSingleEventPrograms.vm</result>
+			<param name="requiredAuthorities">F_NAME_BASED_DATA_ENTRY</param>
+		</action>
+		
+		<action name="showEventWithRegistrationForm"
+			class="org.hisp.dhis.caseentry.action.caseentry.ShowEventWithRegistrationFormAction">
+			<result name="success" type="velocity">/content.vm</result>
+			<param name="page">/dhis-web-caseentry/addSingleEventRegistration.vm</param>
+			<param name="stylesheets">style/style.css</param>
+		</action>
+		
+		<action name="saveValues"
+			class="org.hisp.dhis.caseentry.action.caseentry.SaveValuesAction">
+			<result name="success" type="velocity-xml">status.vm</result>
+			<param name="requiredAuthorities">F_PATIENT_DATAVALUE_ADD,F_PATIENT_DATAVALUE_UPDATE,F_PATIENT_DATAVALUE_DELETE</param>
+		</action>
+		
 		<!-- Visit Plan -->
 
 		<action name="visitplan"

=== added file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/addSingleEventRegistration.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/addSingleEventRegistration.vm	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/addSingleEventRegistration.vm	2012-06-27 05:12:36 +0000
@@ -0,0 +1,93 @@
+<script>
+	
+	jQuery(document).ready(	function(){
+
+		currentDiv = 'patientForm';
+		checkedDuplicate = false;
+		
+		jQuery("#patientForm").validate({
+				 meta:"validate"
+				,errorElement:"span"
+				,submitHandler: function(form)
+					{
+						validateAddPatient();
+					}
+				,beforeValidateHandler: function(form)
+					{
+						var dobType = $('#patientForm [id=dobType]').val();
+						
+						if( dobType=='V' || dobType=='D' ) 
+						{
+							var birthDate = $('#patientForm [id=birthDate]').val();
+							if( birthDate != '' ){
+								$("#patientForm [id=memberValidator]").val(birthDate);
+							}
+						}else{
+							var age = $('#patientForm [id=age]').val();
+							$("#patientForm [id=memberValidator]").val(age);
+						}
+					}
+			});
+		
+		datePickerValid( 'patientForm [id=registrationDate]' );
+		addEventForPatientForm( 'patientForm' );
+	});	
+	
+</script>
+
+<form id='singleEventForm'>
+
+	<h3>$i18n.getString( "add_new_patient" )</h3>	
+	<input type="hidden" id="representativeId" name="representativeId"/> 
+	<input type="hidden" id="relationshipTypeId" name="relationshipTypeId"/>
+	<table id='editPatientDiv'>
+		#parse( "/dhis-web-caseentry/patientForm.vm" )
+	</table>
+
+	<h3 id='entryName'></h3>
+	<div id='dataForm'>#parse( "/dhis-web-caseentry/dataEntryForm.vm" )</div>
+	<p>
+		<input type="submit" class="button" value="$i18n.getString( 'add' )" />
+		<input type="button" class="button" value="$i18n.getString( 'back' )" onclick="javascript:showSearchForm();"/>
+	</p>
+</form>
+
+<script>
+	var i18n_error_connect_to_server = '$encoder.jsEscape( $i18n.getString( "error_connect_to_server" ) , "'" )';
+	var i18n_add_person_successfully = '$encoder.jsEscape( $i18n.getString( "add_person_successfully" ) , "'" )';
+	setInnerHTML('entryName', jQuery('#programIdAddPatient').text() );
+	
+	jQuery(document).ready(	function(){
+
+		jQuery("#singleEventForm").validate({
+			 meta:"validate"
+			,errorElement:"span"
+			,submitHandler: function(form)
+				{
+					validateData();
+				}
+				,beforeValidateHandler: function(form)
+				{
+					var dobType = $('#singleEventForm [id=dobType]').val();
+					
+					if( dobType=='V' || dobType=='D' ) 
+					{
+						var birthDate = $('#singleEventForm [id=birthDate]').val();
+						if( birthDate != '' ){
+							$("#singleEventForm [id=memberValidator]").val(birthDate);
+						}
+					}else{
+						var age = $('#singleEventForm [id=age]').val();
+						$("#singleEventForm [id=memberValidator]").val(age);
+					}
+				}
+			});
+		
+		jQuery("#dataForm :input").each(function()
+		{
+			$( this ).unbind( 'focus' );
+			$( this ).unbind( 'blur' );
+			$( this ).unbind( 'change' );
+		});
+	});
+</script>
\ No newline at end of file

=== 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-06-26 02:48:25 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/anonymousRegistration.vm	2012-06-27 05:12:36 +0000
@@ -49,7 +49,7 @@
 					<input type="button" id='addBtn' value='$i18n.getString( "add_new" )' onclick="showAddEventForm();">
 				</td>
 				<td>
-					<input type="button" value='$i18n.getString( "advanced_search" )' onclick="jQuery('#advanced-search').slideToggle();">
+					<input type="button" value='$i18n.getString( "advanced_search" )' onclick="jQuery('#advanced-search').toggle();">
 				</td>
 			</tr>
 		</table>

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataEntryForm.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataEntryForm.vm	2012-06-24 01:28:50 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataEntryForm.vm	2012-06-27 05:12:36 +0000
@@ -1,9 +1,7 @@
 <script>
 	jQuery("#entryFormContainer").ready(function(){
 		setFieldValue('programStageId', "$!programStageInstance.programStage.id");
-		#if( $!programStageInstance.programStage.program.type=="3" && $!programStageInstance.completed=='true')
-			hideById('entryFormContainer');
-		#elseif( $programStageInstance )
+		#if( $programStageInstance )
 			setFieldValue( 'dueDate', "$!format.formatDate( $programStageInstance.dueDate )" );
 			setFieldValue( 'executionDate', "$!format.formatDate( $programStageInstance.executionDate )" );
 		#end
@@ -104,7 +102,7 @@
 	#end
 </div>
 
-<div id='inputCriteriaDiv' class="page inputCriteria" style="display:none;width:480px;height:29px;">	
+<div id='inputCriteriaDiv' class="page inputCriteria" style="display:none;width:490px;height:29px;">	
 	<input type="button" class='button' id="completeInBelowBtn" value="$i18n.getString('complete')" onClick="doComplete()" disabled="disabled">
 	<input type="button" class='button' id="validationInBelowBtn" value="$i18n.getString('run_validation')" onClick="javascript: runValidation();" >
 </div>

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataEntryMenu.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataEntryMenu.vm	2012-05-15 07:12:41 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataEntryMenu.vm	2012-06-27 05:12:36 +0000
@@ -5,6 +5,7 @@
 	<li><a href="dataEntrySelect.action">$i18n.getString( "name_based" )&nbsp;</a></li>
 	<li><a href="multipledataEntrySelect.action">$i18n.getString( "multiple_name_based" )&nbsp;</a></li>
 	<li><a href="anonymousRegistration.action">$i18n.getString( "anonymous_events" )</a></li>
+	<li><a href="singleEventSelect.action">$i18n.getString( "single_event_with_registration" )</a></li>
 </ul>
 
 <br>

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataRecordingSelect.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataRecordingSelect.vm	2012-06-14 03:58:46 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataRecordingSelect.vm	2012-06-27 05:12:36 +0000
@@ -60,7 +60,7 @@
 	<input type="button" class='button' value="$i18n.getString( 'back_to_search' )" id='backBtnFromEntry' onclick="javascript:showSearchForm();" >
 </div>
 		
-<div id='inputCriteria' class="page inputCriteria" style="width:480px;height:29px;">	
+<div id='inputCriteria' class="page inputCriteria" style="width:490px;height:29px;">	
 	<input type='hidden' id='programStageId' name='programStageId'>
 	<table>
 	   <tr id='programIdTR'>

=== 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	2012-04-15 08:08:22 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/index.vm	2012-06-27 05:12:36 +0000
@@ -6,6 +6,7 @@
     #introListImgItem( "dataEntrySelect.action" "name_based_data_entry" "dataentry" )
 	#introListImgItem( "multipledataEntrySelect.action" "multiple_name_based_data_entry" "dataentry" )
 	#introListImgItem( "anonymousRegistration.action" "anonymous_events" "dataentry" )
+	#introListImgItem( "singleEventSelect.action" "single_event_with_registration" "dataentry" )
     #introListImgItem( "reportSelect.action" "program_summary" "summaryreport" )
 	#introListImgItem( "app/index.html" "tabular_report" "summaryreport" )
 	#introListImgItem( "visitplan.action" "visit_plan" "visitplan" )

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/form.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/form.js	2012-06-25 02:11:55 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/form.js	2012-06-27 05:12:36 +0000
@@ -25,6 +25,7 @@
 	hideById('dataEntryFormDiv');
 	showById('searchDiv');
 	showById('contentDiv');
+	hideById('addNewDiv');
 	jQuery('#createNewEncounterDiv').dialog('close');
 }
 
@@ -42,28 +43,8 @@
 			hideById('dataRecordingSelectDiv');
 			hideById('dataEntryFormDiv');
 			showById('searchDiv');
-			hideLoader();
-		});
-}
-
-//--------------------------------------------------------------------------------------------
-// Show selected data-recording
-//--------------------------------------------------------------------------------------------
-
-function showSelectedDataRecoding( patientId )
-{
-	showLoader();
-	hideById('searchDiv');
-	hideById('dataEntryFormDiv');
-	jQuery('#dataRecordingSelectDiv').load( 'selectDataRecording.action', 
-		{
-			patientId: patientId
-		},
-		function()
-		{
-			showById('dataRecordingSelectDiv');
-			hideLoader();
-			hideById('contentDiv');
+			setInnerHTML('searchInforTD', i18n_list_all_patients );
+			hideLoader();
 		});
 }
 
@@ -145,6 +126,20 @@
 			showById('dataRecordingSelectDiv');
 			hideLoader();
 			hideById('contentDiv');
+			if( getFieldValue('isRegistration') )
+			{
+				jQuery("#dataRecordingSelectDiv [id=inputCriteria]").hide();
+				var singleProgramId = getFieldValue('programIdAddPatient');
+				jQuery("#dataRecordingSelectDiv select[id='programId'] option").each(function(){
+					if( jQuery(this).val()==singleProgramId){
+						jQuery(this).attr('selected', 'selected');
+						if( jQuery("#dataRecordingSelectDiv select[id='programId'] option").length > 2)
+						{
+							loadProgramStages();
+						}
+					}
+				});
+			}
 		});
 }
 
@@ -158,6 +153,7 @@
 				statusSearching = 1;
 				setInnerHTML( 'contentDiv', html );
 				showById('contentDiv');
+				setInnerHTML('searchInforTD', i18n_search_patients_by_attributes );
 				jQuery( "#loaderDiv" ).hide();
 			}
 		});

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/patient.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/patient.js	2012-06-25 14:15:51 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/patient.js	2012-06-27 05:12:36 +0000
@@ -1,9 +1,3 @@
-var COLOR_GREEN = '#b9ffb9';
-var COLOR_YELLOW = '#fffe8c';
-var COLOR_WHITE = '#ffffff';
-var COLOR_ORANGE = '#ff6600';
-var COLOR_RED = '#ff8a8a';
-var COLOR_GREY = '#cccccc';
 
 function organisationUnitSelected( orgUnits, orgUnitNames )
 {	

=== added file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/singleEvent.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/singleEvent.js	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/singleEvent.js	2012-06-27 05:12:36 +0000
@@ -0,0 +1,82 @@
+function orgunitSelected( orgUnits, orgUnitNames )
+{	
+	organisationUnitSelected( orgUnits, orgUnitNames );
+	clearListById('programIdAddPatient');
+	$.postJSON( 'singleEventPrograms.action', {}, function( json )
+		{
+			jQuery( '#programIdAddPatient').append( '<option value="" programStageId="">[' + i18n_please_select + ']</option>' );
+			for ( i in json.programs ) {
+				jQuery( '#programIdAddPatient').append( '<option value="' + json.programs[i].id +'" programStageId="' + json.programs[i].programStageId + '" type="' + json.programs[i].type + '">' + json.programs[i].name + '</option>' );
+			}
+		});
+}
+selection.setListenerFunction( orgunitSelected );
+
+function showAddPatientForm()
+{
+	hideById('contentDiv');
+	hideById('searchDiv');
+	hideById('advanced-search');
+	
+	jQuery('#loaderDiv').show();
+	jQuery('#addNewDiv').load('showEventWithRegistrationForm.action',
+		{
+			programId: getFieldValue('programIdAddPatient')
+		}, function()
+		{
+			showById('addNewDiv');
+			showById('entryForm');
+			jQuery('#loaderDiv').hide();
+		});
+}
+
+function addEventForPatientForm( divname )
+{
+	jQuery("#" + divname + " [id=searchPatientByNameBtn]").click(function() {
+		getPatientsByName( divname );
+	});
+	
+	jQuery("#" + divname + " [id=checkDuplicateBtn]").click(function() {
+		checkDuplicate( divname );
+	});
+	
+	jQuery("#" + divname + " [id=dobType]").change(function() {
+		dobTypeOnChange( divname );
+	});
+}
+
+function validateData()
+{
+	addPatient();
+}
+
+function addPatient()
+{
+	$.ajax({
+		type: "POST",
+		url: 'addPatient.action',
+		data: getParamsForDiv('editPatientDiv'),
+		success: function(json) {
+			var patientId = json.message.split('_')[0];
+			addData( getFieldValue('programIdAddPatient'), patientId )
+		}
+     });
+}
+
+function addData( programId, patientId )
+{		
+	var params = "programId=" + getFieldValue('programIdAddPatient');
+		params += "&patientId=" + patientId;
+		params += "&" + getParamsForDiv('dataForm');
+		
+	$.ajax({
+		type: "POST",
+		url: 'saveValues.action',
+		data: params,
+		success: function(json) {
+			showSuccessMessage( i18n_save_success );
+		  }
+     });
+    return false;
+}
+

=== renamed file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonAnonymousPrograms.vm' => 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonSingleEventPrograms.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonAnonymousPrograms.vm	2012-06-25 06:15:22 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonSingleEventPrograms.vm	2012-06-27 05:12:36 +0000
@@ -5,6 +5,7 @@
 		  {
 			"id":  ${program.id} ,
 			"name": "$!encoder.jsonEncode( ${program.name} )",
+			"type": "$program.type",
 			"programStageId": 
 				#foreach( $programStage in $program.programStages )
 					"$programStage.id"

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/listPatient.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/listPatient.vm	2012-05-24 13:53:25 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/listPatient.vm	2012-06-27 05:12:36 +0000
@@ -3,12 +3,12 @@
 		<td class='text-column' >$i18n.getString( "search_result_matching_the_search_criteria" ):</td>
 		<td>&nbsp;</td>
 		<td>&nbsp;</td>
-		<td>
-		#if($!listAll)
-			$i18n.getString( "list_all_patients" )
-		#else
-			$i18n.getString( "search_patients_by_attributes" )
-		#end
+		<td id='searchInforTD'>
+			#if($!listAll)
+				$i18n.getString( "list_all_patients" )
+			#else
+				$i18n.getString( "search_patients_by_attributes" )
+			#end
 		</td>
 	</tr>	
 	
@@ -101,4 +101,6 @@
 <span id="message"></span>
 <script>
 	var i18n_patient_details_and_history = '$encoder.jsEscape( $i18n.getString( "patient_details_and_history" ) , "'" )';
+	var i18n_list_all_patients = '$encoder.jsEscape( $i18n.getString( "list_all_patients" ) , "'" )';
+	var i18n_search_patients_by_attributes = '$encoder.jsEscape( $i18n.getString( "search_patients_by_attributes" ) , "'" )';
 </script>

=== 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	2012-04-15 08:08:22 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/menu.vm	2012-06-27 05:12:36 +0000
@@ -9,6 +9,7 @@
 	<li><a href="dataEntrySelect.action">$i18n.getString( "name_based" )&nbsp;</a></li>
 	<li><a href="multipledataEntrySelect.action">$i18n.getString( "multiple_name_based" )&nbsp;</a></li>
 	<li><a href="anonymousRegistration.action">$i18n.getString( "anonymous_events" )</a></li>
+	<li><a href="singleEventSelect.action">$i18n.getString( "single_event_with_registration" )</a></li>
 </ul>
 
 <h2>$i18n.getString( "reports" )&nbsp;</h2>

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientRegistrationList.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientRegistrationList.vm	2012-06-08 07:22:50 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientRegistrationList.vm	2012-06-27 05:12:36 +0000
@@ -95,10 +95,8 @@
 				#end
 				
 				<td>
-				  <a href="javascript:showProgramEnrollmentSelectForm( '$patient.id' )" title='$i18n.getString( "program_enrollment_management" )'><img src="../images/enroll.png" alt='$i18n.getString( "program_enrollment" )'></a>                  
+				  <a href="javascript:showSelectedDataRecoding('$patient.id');" title="$i18n.getString( 'data_entry' )"><img src="images/data_entry.png" alt="$i18n.getString( 'data_entry' )"></a>   
 				  <a href="javascript:showUpdatePatientForm( '$patient.id' )" title='$i18n.getString( "edit_profile" )'><img src="../images/edit.png" alt='$i18n.getString( "edit_profile" )'></a>
-				  <a href="javascript:setFieldValue( 'isShowPatientList', false ); showRelationshipList('$patient.id')" title='$i18n.getString( "manage_relationship" )'><img src="../images/relationship.png" alt='$i18n.getString( "manage_relationship" )'></a>
-				  <a href="javascript:getPatientLocation( '$patient.id' ); " title='$i18n.getString( "migration_patient" )'><img src="../icons/dataentry.png" alt='$i18n.getString( "migration_patient" )' style='width:25px; height:25px'></a>
 				  <a href="javascript:removePatient( '$patient.id', '$encoder.jsEncode( $patient.getFullName() )' )" title='$i18n.getString( "remove" )'><img src="../images/delete.png" alt='$i18n.getString( "remove" )'></a>
 				  <a href="javascript:showPatientHistory( '$patient.id' )" title='$i18n.getString( "patient_details_and_history" )'><img src="../images/information.png" alt='$i18n.getString( "patient_details_and_history" )'></a>
 				</td>

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/searchPatientCriteria.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/searchPatientCriteria.vm	2012-06-25 06:15:22 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/searchPatientCriteria.vm	2012-06-27 05:12:36 +0000
@@ -4,45 +4,61 @@
 			<label>$i18n.getString( "registering_unit" )</label>
 		</td>
 		<td>
-			<input type="text" id='orgunitName' readonly="readonly" #if( $organisationUnit ) value="$encoder.htmlEncode( $organisationUnit.name )" #else value="[$i18n.getString( "please_select_village" )]" #end style="min-width:350px">
+			<input type="text" id='orgunitName' readonly="readonly" #if( $organisationUnit ) value="$encoder.htmlEncode( $organisationUnit.name )" #else value="[$i18n.getString( 'please_select_village' )]" #end >
 		</td>
-		<td>
+		<td rowspan='2' valign='bottom'>
 			<input type="button" class='large-button' id='listPatientBtn' value="$i18n.getString( 'list_all_patients' )" onclick="javascript:listAllPatient();" #if($organisationUnit) #else disabled #end>
+		
+			<input type="button" id='addPatientBtn' name='addPatientBtn' class='large-button' value='$i18n.getString( "add_new" )' onclick="showAddPatientForm();">
+		
+			<input type="button" value='$i18n.getString( "advanced_search" )' onclick="jQuery('#advanced-search').toggle();">
 		</td>
-		<td><input type="button" id='addPatientBtn' name='addPatientBtn' class='large-button' value='$i18n.getString( "add_new" )' onclick="showAddPatientForm();"></td>        
 	</tr> 
+	<tr id='programAddPatientTR'class='hidden'>
+		<td>$i18n.getString('program')</td>
+		<td>
+			<select id='programIdAddPatient' name='programIdAddPatient'>
+				<option value=''>[$i18n.getString("please_select")]</option>
+				#foreach($program in $programs)
+					<option value="$program.id" type='$program.type'>$program.name</option>
+				#end
+			</select>
+		</td>
+	</tr>
 </table>
 
-<table id='advancedSearchTB'>	
-	<tbody>
-		<tr id='advSearchBox0'>	       
-			<td id='searchingAttributeIdTD'>
-			  <select id="searchObjectId" name="searchObjectId" #if( $patientAttributes.size() == 0 ) disabled="disabled" #end onchange="searchObjectOnChange(this)">
-				<option value="">$i18n.getString( "search_by_name_identifier" )</option>
-				<option value="0">$i18n.getString( "search_by_program" )</option>
-				<option value="-1">$i18n.getString( "date_of_birth" )</option>
-				<option value="-2">$i18n.getString( "gender" )</option>
-				<!-- option value="-3">$i18n.getString( "age" )</option -->
-				<option value="-4">$i18n.getString( "phone_number" )</option>
-				#foreach( $attribute in $patientAttributes )
-					<option value="$attribute.id" valueType='$attribute.valueType'>$encoder.htmlEncode( $attribute.name )</option>
-				#end
-			  </select>
-			  <em title="$i18n.getString( "required" )" class="required">*</em></label>
-			</td>		
-			<td>
-				<input type="text" id="searchText" name="searchText" value="$!searchText" onkeyup='searchPatientsOnKeyUp( event );' style='margin-right:30px;'>
-			</td>	
-			<td></td>
-			<td><input type="button" class='small-button' value='+' onclick='addAttributeOption();'>
-				<td>
-					$i18n.getString('search_by_selected_unit')
-					<input type='checkbox' id='searchBySelectedOrgunit' name='searchBySelectedOrgunit' value='true' />
-				</td>
-				<td>
-					<input type="button" class='large-button' value='$i18n.getString( "search" )' onclick='validateAdvancedPatients();'>
-				</td>
-			</td>
-		</tr>
-	</tbody>
-</table>
\ No newline at end of file
+<div id='advanced-search' class='hidden'>
+	<table id='advancedSearchTB'>	
+		<tbody>
+			<tr id='advSearchBox0'>	       
+				<td id='searchingAttributeIdTD'>
+				  <select id="searchObjectId" name="searchObjectId" #if( $patientAttributes.size() == 0 ) disabled="disabled" #end onchange="searchObjectOnChange(this)">
+					<option value="">$i18n.getString( "search_by_name_identifier" )</option>
+					<option value="0">$i18n.getString( "search_by_program" )</option>
+					<option value="-1">$i18n.getString( "date_of_birth" )</option>
+					<option value="-2">$i18n.getString( "gender" )</option>
+					<!-- option value="-3">$i18n.getString( "age" )</option -->
+					<option value="-4">$i18n.getString( "phone_number" )</option>
+					#foreach( $attribute in $patientAttributes )
+						<option value="$attribute.id" valueType='$attribute.valueType'>$encoder.htmlEncode( $attribute.name )</option>
+					#end
+				  </select>
+				  <em title="$i18n.getString( "required" )" class="required">*</em></label>
+				</td>		
+				<td>
+					<input type="text" id="searchText" name="searchText" value="$!searchText" onkeyup='searchPatientsOnKeyUp( event );' style='margin-right:30px;'>
+				</td>	
+				<td></td>
+				<td><input type="button" class='small-button' value='+' onclick='addAttributeOption();'>
+					<td>
+						$i18n.getString('search_by_selected_unit')
+						<input type='checkbox' id='searchBySelectedOrgunit' name='searchBySelectedOrgunit' value='true' />
+					</td>
+					<td>
+						<input type="button" class='large-button' value='$i18n.getString( "search" )' onclick='validateAdvancedPatients();'>
+					</td>
+				</td>
+			</tr>
+		</tbody>
+	</table>
+</div>
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/select.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/select.vm	2012-06-25 04:46:52 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/select.vm	2012-06-27 05:12:36 +0000
@@ -5,6 +5,7 @@
 </script>
 
 <h3>$i18n.getString( "name_based_data_entry" ) #openHelp('name_based_data_entry')</h3>
+<input type='hidden' id='isRegistration' name= 'isRegistration' value='false'>
 
 <div id='searchDiv'>
 	#parse( "dhis-web-caseentry/searchPatientCriteria.vm" )	
@@ -47,7 +48,8 @@
 	var i18n_events = '$encoder.jsEscape( $i18n.getString( "events" ) , "'")';
 	var i18n_male = '$encoder.jsEscape( $i18n.getString( "male" ) , "'")';
 	var i18n_female = '$encoder.jsEscape( $i18n.getString( "female" ) , "'")';
-	
+	var i18n_specify_search_criteria = '$encoder.jsEscape( $i18n.getString( "specify_search_criteria" ) , "'")';
+
 	selection.setListenerFunction( organisationUnitSelected );
 	
 	var searchTextBox = '<input type="text" id="searchText" name="searchText" onkeyup="searchPatientsOnKeyUp( event );">';

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/selectPatient.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/selectPatient.vm	2012-06-25 02:11:55 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/selectPatient.vm	2012-06-27 05:12:36 +0000
@@ -80,6 +80,7 @@
 	var i18n_date_is_greater_then_or_equals_due_date = '$encoder.jsEscape( $i18n.getString( "date_is_greater_then_or_equals_due_date" ) , "'")';
 	var i18n_male = '$encoder.jsEscape( $i18n.getString( "male" ) , "'")';
 	var i18n_female = '$encoder.jsEscape( $i18n.getString( "female" ) , "'")';
+	var 18n_specify_search_criteria = '$encoder.jsEscape( $i18n.getString( "specify_search_criteria" ) , "'")';
 	
 	var i18n_violate_validation = '$encoder.jsEscape( $i18n.getString( "violate_validation" ) , "'")';
 	var i18n_show_all_items = '$encoder.jsEscape( $i18n.getString( "show_all_items" ) , "'")';

=== added file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/singleEventPatient.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/singleEventPatient.vm	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/singleEventPatient.vm	2012-06-27 05:12:36 +0000
@@ -0,0 +1,104 @@
+<table>
+	<tr>
+		<td class='text-column' >$i18n.getString( "search_result_matching_the_search_criteria" ):</td>
+		<td>&nbsp;</td>
+		<td>&nbsp;</td>
+		<td>
+		#if($!listAll)
+			$i18n.getString( "list_all_patients" )
+		#else
+			$i18n.getString( "search_patients_by_attributes" )
+		#end
+		</td>
+	</tr>	
+	
+	<tr>
+		<td class='text-column' >$i18n.getString( "total_result" ):</td>
+		<td>&nbsp;</td>
+		<td>&nbsp;</td>
+		<td>$!total</td>
+	</tr>
+</table>
+
+<br>
+<table class="entryScreen">
+  <tr>
+    <td>    
+      <table class="listTable">                   
+          <col width="40"/>
+          <col/>
+          <col width="60"/>
+          <col width="90"/>
+          <col width="60"/>
+		  #if($mapPatientOrgunit.size()!=0)
+		  <col/>
+		  #end
+		  <col width="80"/>
+          <tr>
+			<th>#</th>
+            <th>$i18n.getString( "full_name" )</th>        
+            <th>$i18n.getString( "gender" )</th>
+            <th>$i18n.getString( "date_of_birth" )</th>
+            <th>$i18n.getString( "age" )</th>   
+			#if($mapPatientOrgunit.size()!=0)
+			<th>$i18n.getString( "hierachy_orgunit" )</th>
+			#end			
+            <th>$i18n.getString( "operations" )</th>
+          </tr>
+          
+          <tbody id="list">	
+          #set( $mark = false )
+          
+          #foreach( $patient in $patients )
+          	<tr #alternate( $mark )>
+				<td>
+					#set( $nr = ( ( $paging.getCurrentPage() - 1  ) * $paging.pageSize ) + $velocityCount )
+					$nr
+                </td>
+				<td>			
+					$encoder.htmlEncode( $patient.getFullName() )
+				</td>			
+				<td>			
+					$i18n.getString( $patient.gender )
+				</td>
+				<td>			
+					$format.formatDate( $patient.birthDate )
+				</td>
+				<td>            
+                    $encoder.htmlEncode( $patient.getAge() )
+                </td>	
+				#if($mapPatientOrgunit.size()!=0)
+				<td>$!mapPatientOrgunit.get($patient.id)</td>
+				#end
+				<td>
+					<a href="javascript:showSelectedDataRecoding('$patient.id');" title="$i18n.getString( 'data_entry' )"><img src="images/data_entry.png" alt="$i18n.getString( 'data_entry' )"></a>   
+					<a href="javascript:showPatientHistory( '$patient.id' )" title='$i18n.getString( "patient_details_and_history" )'><img src="../images/information.png" alt='$i18n.getString( "patient_details_and_history" )'></a>
+                </td>               				
+			</tr>
+			#if( $mark )
+				#set( $mark = false )
+			#else
+				#set( $mark = true )
+			#end
+    	#end
+    	</tbody>
+		<tr>
+		<td colspan="7">
+			<p></p>
+			<div class="paging-container">
+				#parse( "/dhis-web-commons/paging/paging.vm" )
+			</div>
+		</td>
+		<td></td>
+	  </tr>
+	  </table>
+    </td>
+  </tr>
+</table>
+
+<div id="detailsInfo"></div>
+
+<span id="message"></span>
+<script>
+	var i18n_patient_details_and_history = '$encoder.jsEscape( $i18n.getString( "patient_details_and_history" ) , "'" )';
+</script>

=== added file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/singleEventSelect.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/singleEventSelect.vm	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/singleEventSelect.vm	2012-06-27 05:12:36 +0000
@@ -0,0 +1,75 @@
+<script>
+	jQuery(document).ready(	function(){
+		showById('programAddPatientTR');
+		jQuery("#programIdAddPatient option").each(function(){
+			var item = jQuery(this);
+			if(item.attr('type')!=2){
+				item.remove();
+			}
+		});
+	});	
+</script>
+
+<h3>$i18n.getString( "single_event_with_registration" )</h3>
+<input type='hidden' id='isRegistration' name= 'isRegistration' value='true'>
+<input type='hidden' id='patientId' name= 'patientId' >
+
+<div id='searchDiv'>
+	#parse( "dhis-web-caseentry/searchPatientCriteria.vm" )	
+</div>
+
+<span id='message'></span>
+<div id='contentDiv'></div>
+<div id='addNewDiv'></div>
+<div id='dataRecordingSelectDiv'></div>
+<div id='dataEntryFormDiv'></div>
+<div class='hidden'>
+	<input id='executionDateNewEvent' name='executionDateNewEvent'>
+</div>
+
+
+#parse( "dhis-web-commons/loader/loader.vm" )
+
+<script type="text/javascript">
+	var i18n_id = '$encoder.jsEscape( $i18n.getString( "id" ), "'")';
+	var i18n_full_name = '$encoder.jsEscape( $i18n.getString( "full_name" ), "'")';
+	var i18n_gender = '$encoder.jsEscape( $i18n.getString( "gender" ), "'")';
+	var i18n_dob_type = '$encoder.jsEscape( $i18n.getString( "dob_type" ), "'")';
+	var i18n_date_of_birth = '$encoder.jsEscape( $i18n.getString( "date_of_birth" ), "'")';
+	var i18n_none = '$encoder.jsEscape( $i18n.getString( "none" ), "'")';
+	var i18n_select = '[' + '$encoder.jsEscape( $i18n.getString( "select" ), "'")' + ']';
+	var i18n_program_stages_history_plan = '$encoder.jsEscape( $i18n.getString( "program_stages_history_plan" ) , "'")';	
+	var i18n_value_must_integer = '$encoder.jsEscape( $i18n.getString( "value_must_integer" ) , "'")';
+	var i18n_value_must_number = '$encoder.jsEscape( $i18n.getString( "value_must_number" ) , "'")';
+	var i18n_value_must_positive_integer = '$encoder.jsEscape( $i18n.getString( "value_must_positive_integer" ) , "'")';
+	var i18n_value_must_negative_integer = '$encoder.jsEscape( $i18n.getString( "value_must_negative_integer" ) , "'")';
+    var i18n_invalid_date = '$encoder.jsEscape( $i18n.getString( "invalid_date" ) , "'")' + ".\n " + '$encoder.jsEscape( $i18n.getString( "format_date" ) , "'")' + " '" + dateFormat.replace('yy', 'yyyy') + " '" ; 
+    var i18n_saving_value_failed_status_code = '$encoder.jsEscape( $i18n.getString( "saving_value_failed_status_code" ) , "'")';
+    var i18n_saving_value_failed_error_code = '$encoder.jsEscape( $i18n.getString( "saving_value_failed_error_code" ) , "'")';
+    var i18n_searching_patient_failed = '$encoder.jsEscape( $i18n.getString( "searching_patient_failed" ) , "'")';
+    var i18n_complete_confirm_message = '$encoder.jsEscape( $i18n.getString( "complete_confirm_message" ) , "'")';
+    var i18n_error_required_field = '$encoder.jsEscape( $i18n.getString( "error_required_field" ) , "'")';
+	var i18n_violate_validation = '$encoder.jsEscape( $i18n.getString( "violate_validation" ) , "'")';
+	var i18n_date_is_greater_then_or_equals_due_date = '$encoder.jsEscape( $i18n.getString( "date_is_greater_then_or_equals_due_date" ) , "'")';	
+	var i18n_program_stage = '$encoder.jsEscape( $i18n.getString( "program_stage" ) , "'")';
+    var i18n_scheduled_for = '$encoder.jsEscape( $i18n.getString( "scheduled_for" ) , "'")';
+	var i18n_show_all_items = '$encoder.jsEscape( $i18n.getString( "show_all_items" ) , "'")';
+	var i18n_create_new_event = '$encoder.jsEscape( $i18n.getString( "create_new_event" ) , "'")';
+	var i18n_yes = '$encoder.jsEscape( $i18n.getString( "yes" ) , "'")';
+	var i18n_no = '$encoder.jsEscape( $i18n.getString( "no" ) , "'")';
+	var i18n_events = '$encoder.jsEscape( $i18n.getString( "events" ) , "'")';
+	var i18n_male = '$encoder.jsEscape( $i18n.getString( "male" ) , "'")';
+	var i18n_female = '$encoder.jsEscape( $i18n.getString( "female" ) , "'")';
+	var i18n_specify_search_criteria = '$encoder.jsEscape( $i18n.getString( "specify_search_criteria" ) , "'")';
+	i18n_please_select = '$encoder.jsEscape( $i18n.getString( "please_select" ) , "'")';
+	var i18n_save_success = '$encoder.jsEscape( $i18n.getString( "save_success" ) , "'")';
+	datePickerValid( 'executionDateNewEvent', true );
+	
+	var searchTextBox = '<input type="text" id="searchText" name="searchText" onkeyup="searchPatientsOnKeyUp( event );">';
+	var programComboBox = '<select id="searchText" name="searchText">';
+	#foreach ( $program in $programs ) 
+		programComboBox += '<option value="$program.id">$program.name</option>';
+	#end
+	programComboBox += '</select>';
+	
+</script>
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/style/style.css'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/style/style.css	2012-06-25 17:44:04 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/style/style.css	2012-06-27 05:12:36 +0000
@@ -3,7 +3,7 @@
 /*----------------------------------------------------------------------------*/
 
 input[type="button"], input[type="submit"] {
-    width: 150px;
+    width: 130px;
 }
 
 input.small-button[type="button"] {