← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 7448: local vn - Put a temporary module "PhieuSanh" onto local. Added new feature that allow the user v...

 

------------------------------------------------------------
revno: 7448
committer: Hieu <hieu.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2012-06-28 15:17:52 +0700
message:
  local vn - Put a temporary module "PhieuSanh" onto local. Added new feature that allow the user view the ICD report inside of entry hospital module.
added:
  local/vn/dhis-web-dataentry-hospital/src/main/java/org/hisp/dhis/de/action/ExportResultAction.java
  local/vn/dhis-web-dataentry-hospital/src/main/java/org/hisp/dhis/de/action/ShowICDReportAction.java
  local/vn/dhis-web-dataentry-hospital/src/main/webapp/dhis-web-dataentry-hospital/htmlGrid.vm
  local/vn/dhis-web-phieusanh/
  local/vn/dhis-web-phieusanh/pom.xml
  local/vn/dhis-web-phieusanh/src/
  local/vn/dhis-web-phieusanh/src/main/
  local/vn/dhis-web-phieusanh/src/main/java/
  local/vn/dhis-web-phieusanh/src/main/java/org/
  local/vn/dhis-web-phieusanh/src/main/java/org/hisp/
  local/vn/dhis-web-phieusanh/src/main/java/org/hisp/dhis/
  local/vn/dhis-web-phieusanh/src/main/java/org/hisp/dhis/phieusanh/
  local/vn/dhis-web-phieusanh/src/main/java/org/hisp/dhis/phieusanh/action/
  local/vn/dhis-web-phieusanh/src/main/java/org/hisp/dhis/phieusanh/action/GetPureChildrenAction.java
  local/vn/dhis-web-phieusanh/src/main/java/org/hisp/dhis/phieusanh/action/ReregisterPatientLocationAction.java
  local/vn/dhis-web-phieusanh/src/main/resources/
  local/vn/dhis-web-phieusanh/src/main/resources/META-INF/
  local/vn/dhis-web-phieusanh/src/main/resources/META-INF/dhis/
  local/vn/dhis-web-phieusanh/src/main/resources/META-INF/dhis/beans.xml
  local/vn/dhis-web-phieusanh/src/main/resources/org/
  local/vn/dhis-web-phieusanh/src/main/resources/org/hisp/
  local/vn/dhis-web-phieusanh/src/main/resources/org/hisp/dhis/
  local/vn/dhis-web-phieusanh/src/main/resources/org/hisp/dhis/phieusanh/
  local/vn/dhis-web-phieusanh/src/main/resources/struts.xml
  local/vn/dhis-web-phieusanh/src/main/webapp/
  local/vn/dhis-web-phieusanh/src/main/webapp/WEB-INF/
  local/vn/dhis-web-phieusanh/src/main/webapp/WEB-INF/lib/
  local/vn/dhis-web-phieusanh/src/main/webapp/WEB-INF/web.xml
  local/vn/dhis-web-phieusanh/src/main/webapp/dhis-web-phieusanh/
  local/vn/dhis-web-phieusanh/src/main/webapp/dhis-web-phieusanh/images/
  local/vn/dhis-web-phieusanh/src/main/webapp/dhis-web-phieusanh/javascript/
  local/vn/dhis-web-phieusanh/src/main/webapp/dhis-web-phieusanh/secondUnitForPhieuSanh.vm
  local/vn/dhis-web-phieusanh/src/main/webapp/dhis-web-phieusanh/style/
modified:
  local/vn/dhis-web-dataentry-hospital/src/main/resources/META-INF/dhis/beans.xml
  local/vn/dhis-web-dataentry-hospital/src/main/resources/org/hisp/dhis/de/i18n_module.properties
  local/vn/dhis-web-dataentry-hospital/src/main/resources/org/hisp/dhis/de/i18n_module_vi_VN.properties
  local/vn/dhis-web-dataentry-hospital/src/main/resources/struts.xml
  local/vn/dhis-web-dataentry-hospital/src/main/webapp/dhis-web-dataentry-hospital/javascript/form.js
  local/vn/dhis-web-dataentry-hospital/src/main/webapp/dhis-web-dataentry-hospital/select.vm
  local/vn/dhis-web-spreadsheet-reporting/src/main/resources/META-INF/dhis/beans.xml


--
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
=== added file 'local/vn/dhis-web-dataentry-hospital/src/main/java/org/hisp/dhis/de/action/ExportResultAction.java'
--- local/vn/dhis-web-dataentry-hospital/src/main/java/org/hisp/dhis/de/action/ExportResultAction.java	1970-01-01 00:00:00 +0000
+++ local/vn/dhis-web-dataentry-hospital/src/main/java/org/hisp/dhis/de/action/ExportResultAction.java	2012-06-28 08:17:52 +0000
@@ -0,0 +1,84 @@
+package org.hisp.dhis.de.action;
+
+/*
+ * 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.
+ */
+
+import org.hisp.dhis.common.Grid;
+import org.hisp.dhis.util.SessionUtils;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Dang Duy Hieu
+ * @version $Id$
+ */
+public class ExportResultAction
+    implements Action
+{
+    protected static final String KEY_ICDREPORT = "icdreportresult";
+    
+    // -------------------------------------------------------------------------
+    // Input / Output
+    // -------------------------------------------------------------------------
+
+    private String type;
+
+    public String getType()
+    {
+        return type;
+    }
+
+    public void setType( String type )
+    {
+        this.type = type;
+    }
+
+    private Grid grid;
+
+    public Grid getGrid()
+    {
+        return grid;
+    }
+
+    // -------------------------------------------------------------------------
+    // Action implementation
+    // -------------------------------------------------------------------------
+
+    public String execute()
+    {
+        Grid _grid = (Grid) SessionUtils.getSessionVar( KEY_ICDREPORT );
+
+        if ( _grid != null && type != null )
+        {
+            grid = _grid;
+
+            return type;
+        }
+
+        return ERROR;
+    }
+}

=== added file 'local/vn/dhis-web-dataentry-hospital/src/main/java/org/hisp/dhis/de/action/ShowICDReportAction.java'
--- local/vn/dhis-web-dataentry-hospital/src/main/java/org/hisp/dhis/de/action/ShowICDReportAction.java	1970-01-01 00:00:00 +0000
+++ local/vn/dhis-web-dataentry-hospital/src/main/java/org/hisp/dhis/de/action/ShowICDReportAction.java	2012-06-28 08:17:52 +0000
@@ -0,0 +1,287 @@
+/*
+ * 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.de.action;
+
+import java.io.BufferedWriter;
+import java.io.FileWriter;
+import java.sql.Connection;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.amplecode.quick.StatementHolder;
+import org.amplecode.quick.StatementManager;
+import org.hisp.dhis.common.Grid;
+import org.hisp.dhis.common.GridHeader;
+import org.hisp.dhis.i18n.I18n;
+import org.hisp.dhis.system.grid.ListGrid;
+import org.hisp.dhis.util.SessionUtils;
+import org.hisp.dhis.period.Period;
+import org.hisp.dhis.period.PeriodStore;
+import org.hisp.dhis.period.PeriodType;
+
+import org.springframework.beans.factory.annotation.Autowired;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Dang Duy Hieu
+ * @version $Id$
+ */
+public class ShowICDReportAction
+    implements Action
+{
+    private static final String EMPTY = "";
+
+    private static final String KEY_ICDREPORT = "icdreportresult";
+
+    /**
+     * attribute_column_index is the name of an concrete attribute in database
+     * This key will be declared in one properties file only
+     */
+    private static final String ATTRIBUTE_COLUMN_INDEX = "attribute_column_index";
+
+    /**
+     * This would be the title showed in ICD REPORTING FORM
+     */
+    private static final String[] titles = { "icd_element_1", "icd_element_2", "icd_element_3", "icd_element_4",
+        "icd_element_5", "icd_element_6" };
+
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
+
+    @Autowired
+    private StatementManager statementManager;
+
+    @Autowired
+    private PeriodStore periodStore;
+
+    // -------------------------------------------------------------------------
+    // I18n
+    // -------------------------------------------------------------------------
+
+    private I18n i18n;
+
+    public void setI18n( I18n i18n )
+    {
+        this.i18n = i18n;
+    }
+
+    // -------------------------------------------------------------------------
+    // Output
+    // -------------------------------------------------------------------------
+
+    private Integer dataSetId;
+
+    public void setDataSetId( Integer dataSetId )
+    {
+        this.dataSetId = dataSetId;
+    }
+
+    private Integer sourceId;
+
+    public void setSourceId( Integer sourceId )
+    {
+        this.sourceId = sourceId;
+    }
+
+    private String periodId;
+
+    public void setPeriodId( String periodId )
+    {
+        this.periodId = periodId;
+    }
+
+    private Integer chapterId;
+
+    public void setChapterId( Integer chapterId )
+    {
+        this.chapterId = chapterId;
+    }
+
+    private Grid grid = new ListGrid();
+
+    public Grid getGrid()
+    {
+        return grid;
+    }
+
+    // -------------------------------------------------------------------------
+    // Action implementation
+    // -------------------------------------------------------------------------
+
+    public String execute()
+    {
+        Period period = periodStore.reloadPeriod( PeriodType.createPeriodExternalId( periodId ) );
+        periodId = String.valueOf( period.getId() );
+
+        this.setFixedHeaderStructure( grid );
+        this.getEnteredData();
+
+        SessionUtils.setSessionVar( KEY_ICDREPORT, grid );
+
+        return SUCCESS;
+    }
+
+    public String getOrderedDataElement()
+    {
+        String query = null;
+
+        query = "SELECT dataelementid, av.value AS column_index ";
+        query += "FROM dataelementattributevalues AS dav ";
+        query += "JOIN attributevalue AS av ON (dav.attributevalueid = av.attributevalueid) ";
+        query += "JOIN attribute AS a ON (av.attributeid = a.attributeid) ";
+        query += "WHERE a.name = '" + ATTRIBUTE_COLUMN_INDEX + "'";
+
+        return query;
+
+    }
+
+    public void getEnteredData()
+    {
+        StringBuffer sqlsb = new StringBuffer();
+
+        sqlsb
+            .append( "SELECT av.attributevalueid, av.value AS Disease, sorted_de.dataelementid, dv.value, 1 as col_index " );
+        sqlsb.append( "FROM datavalue AS dv " );
+        sqlsb.append( "JOIN (" + getOrderedDataElement() );
+        sqlsb.append( ") AS sorted_de ON (dv.dataelementid = sorted_de.dataelementid) " );
+        sqlsb.append( "JOIN datasetmembers AS dsm ON (sorted_de.dataelementid = dsm.dataelementid) " );
+        sqlsb.append( "JOIN dataelementattributevalues dav ON (dsm.dataelementid = dav.dataelementid) " );
+        sqlsb.append( "JOIN attributevalue av ON (dav.attributevalueid = av.attributevalueid) " );
+        sqlsb.append( "WHERE datasetid = " + this.dataSetId + " " );
+        sqlsb.append( "AND periodid = " + this.periodId + " " );
+        sqlsb.append( "AND sourceid = " + this.sourceId + " " );
+        sqlsb.append( "AND av.value IN (SELECT attributevalue FROM reportexcel_attributevalueorders " );
+        sqlsb.append( this.chapterId != null ? "WHERE id = " + this.chapterId + ") " : ") " );
+        sqlsb.append( "ORDER BY (av.value, sorted_de.column_index)" );
+
+        fillUpData( grid, sqlsb, statementManager );
+    }
+
+    public void setFixedHeaderStructure( Grid grid )
+    {
+        int column = 0;
+
+        grid.addHeader( new GridHeader( "", "-1", String.class.getName(), false, true ) );
+
+        for ( String title : titles )
+        {
+            grid.addHeader( new GridHeader( i18n.getString( title ), String.valueOf( column ), String.class.getName(), false, false ) );
+            column++;
+        }
+    }
+
+    public int fillUpData( Grid grid, StringBuffer sqlsb, StatementManager statementManager )
+    {
+        final StatementHolder holder = statementManager.getHolder();
+
+        int curRowIndex = -1;
+        int columnIndex = -1;
+        String rowKey = null;
+
+        List<String> metaList = new ArrayList<String>();
+
+        try
+        {
+            ResultSet rs = getScrollableResult( sqlsb.toString(), holder );
+
+            writeFile( sqlsb );
+
+            while ( rs.next() )
+            {
+                rowKey = rs.getString( 2 );
+
+                if ( rowKey != null && !metaList.contains( rowKey ) )
+                {
+                    this.initRow( rowKey );
+                    metaList.add( rowKey );
+                    curRowIndex++;
+                }
+
+                columnIndex = rs.getInt( 5 ); // Start at 1 -> n
+
+                grid.getRow( curRowIndex ).set( columnIndex, rs.getString( 4 ) );
+            }
+        }
+        catch ( SQLException e )
+        {
+            throw new RuntimeException( "Failed to get data value\n", e );
+        }
+        catch ( Exception e )
+        {
+            throw new RuntimeException( "Oops. Something else went wrong\n", e );
+        }
+        finally
+        {
+            holder.close();
+        }
+
+        return curRowIndex;
+    }
+
+    private void initRow( String rowKey )
+    {
+        grid.addRow().addValue( rowKey );
+
+        for ( int i = 0; i < titles.length; i++ )
+        {
+            grid.addValue( EMPTY );
+        }
+    }
+
+    private static ResultSet getScrollableResult( String sql, StatementHolder holder )
+        throws SQLException
+    {
+        Connection con = holder.getConnection();
+        Statement stm = con.createStatement( ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY );
+        stm.execute( sql );
+
+        return stm.getResultSet();
+    }
+
+    private void writeFile( StringBuffer sb )
+    {
+        try
+        {
+            // Create file
+            FileWriter fstream = new FileWriter( "C:\\Users\\hieu\\Desktop\\out.sql" );
+            BufferedWriter out = new BufferedWriter( fstream );
+            out.write( sb.toString() );
+            // Close the output stream
+            out.close();
+        }
+        catch ( Exception e )
+        {// Catch exception if any
+            System.err.println( "Error: " + e.getMessage() );
+        }
+    }
+}

=== modified file 'local/vn/dhis-web-dataentry-hospital/src/main/resources/META-INF/dhis/beans.xml'
--- local/vn/dhis-web-dataentry-hospital/src/main/resources/META-INF/dhis/beans.xml	2012-05-31 06:06:01 +0000
+++ local/vn/dhis-web-dataentry-hospital/src/main/resources/META-INF/dhis/beans.xml	2012-06-28 08:17:52 +0000
@@ -153,5 +153,11 @@
 	 <property name="dataSetService" ref="org.hisp.dhis.dataset.DataSetService" />
 	 <property name="localDataSetService" ref="org.hisp.dhis.dataset.LocalDataSetService" />
   </bean>
+  
+  <bean id="org.hisp.dhis.de.action.ShowICDReportAction" 
+	class="org.hisp.dhis.de.action.ShowICDReportAction" scope="prototype"/>
+  
+  <bean id="org.hisp.dhis.de.action.ExportResultAction" 
+	class="org.hisp.dhis.de.action.ExportResultAction" scope="prototype"/>
 
 </beans>

=== modified file 'local/vn/dhis-web-dataentry-hospital/src/main/resources/org/hisp/dhis/de/i18n_module.properties'
--- local/vn/dhis-web-dataentry-hospital/src/main/resources/org/hisp/dhis/de/i18n_module.properties	2012-05-23 09:36:45 +0000
+++ local/vn/dhis-web-dataentry-hospital/src/main/resources/org/hisp/dhis/de/i18n_module.properties	2012-06-28 08:17:52 +0000
@@ -106,4 +106,8 @@
 show_export_params = Show export params
 hide_export_params = Hide export params
 disconnect_server = Disconnect to server
-please_select_organisation_unit = Please select organisation unit
\ No newline at end of file
+please_select_organisation_unit = Please select organisation unit
+show_icd_report = Show ICD report
+get_report_as_csv = Get report as CSV
+get_report_as_xls = Get report as XLS
+get_report_as_pdf = Get report as PDF
\ No newline at end of file

=== modified file 'local/vn/dhis-web-dataentry-hospital/src/main/resources/org/hisp/dhis/de/i18n_module_vi_VN.properties'
--- local/vn/dhis-web-dataentry-hospital/src/main/resources/org/hisp/dhis/de/i18n_module_vi_VN.properties	2012-05-23 09:36:45 +0000
+++ local/vn/dhis-web-dataentry-hospital/src/main/resources/org/hisp/dhis/de/i18n_module_vi_VN.properties	2012-06-28 08:17:52 +0000
@@ -112,4 +112,20 @@
 show_export_params = Hi\u1ec3n th\u1ecb khung ch\u1ecdn
 hide_export_params = \u1ea8n khung ch\u1ecdn
 disconnect_server = Kh\u00f4ng th\u1ec3 k\u1ebft n\u1ed1i t\u1edbi m\u00e1y ch\u1ee7
-please_select_organisation_unit = H\u00e3y ch\u1ecdn \u0111\u01a1n v\u1ecb
\ No newline at end of file
+please_select_organisation_unit = H\u00e3y ch\u1ecdn \u0111\u01a1n v\u1ecb
+show_icd_report = Xu\u1ea5t b\u00e1o c\u00e1o ICD
+get_report_as_csv = Xu\u1ea5t b\u00e1o c\u00e1o d\u1ea1ng CSV
+get_report_as_xls = Xu\u1ea5t b\u00e1o c\u00e1o d\u1ea1ng XLS
+get_report_as_pdf = Xu\u1ea5t b\u00e1o c\u00e1o d\u1ea1ng PDF
+
+# attribute_column_index is the name of an concrete attribute in database 		#
+# This key is needed to declare in one properties file only    			  		#
+attribute_column_index = Ph\u00e2n lo\u1ea1i d\u1eef li\u1ec7u
+#-------------------------------------------------------------------------------#
+
+icd_element_1 = T\u1ed5ng s\u1ed1 b\u1ec7nh nh\u00e2n (M\u1eafc)
+icd_element_2 = T\u1ed5ng s\u1ed1 b\u1ec7nh nh\u00e2n (Ch\u1ebft)
+icd_element_3 = T\u1ed5ng s\u1ed1 tr\u1ebb em d\u01b0\u1edbi 15 (M\u1eafc)
+icd_element_4 = Tr\u1ebb em 0-4 tu\u1ed5i (M\u1eafc)
+icd_element_5 = T\u1ed5ng s\u1ed1 tr\u1ebb em d\u01b0\u1edbi 15 (Ch\u1ebft)
+icd_element_6 = Tr\u1ebb em 0-4 tu\u1ed5i (Ch\u1ebft)
\ No newline at end of file

=== modified file 'local/vn/dhis-web-dataentry-hospital/src/main/resources/struts.xml'
--- local/vn/dhis-web-dataentry-hospital/src/main/resources/struts.xml	2012-05-23 09:36:45 +0000
+++ local/vn/dhis-web-dataentry-hospital/src/main/resources/struts.xml	2012-06-28 08:17:52 +0000
@@ -109,5 +109,15 @@
 	   <result name="success" type="velocity-json">/dhis-web-dataentry-hospital/jsonDepartments.vm</result>
 	</action>
 
+    <action name="showICDReport" class="org.hisp.dhis.de.action.ShowICDReportAction">
+      <result name="success" type="velocity">/dhis-web-dataentry-hospital/htmlGrid.vm</result>
+    </action>
+
+    <action name="exportResult" class="org.hisp.dhis.de.action.ExportResultAction">
+      <result name="csv" type="gridCsvResult" />
+      <result name="xls" type="gridXlsResult" />
+      <result name="pdf" type="gridPdfResult" />
+    </action>
+
   </package>
 </struts>

=== added file 'local/vn/dhis-web-dataentry-hospital/src/main/webapp/dhis-web-dataentry-hospital/htmlGrid.vm'
--- local/vn/dhis-web-dataentry-hospital/src/main/webapp/dhis-web-dataentry-hospital/htmlGrid.vm	1970-01-01 00:00:00 +0000
+++ local/vn/dhis-web-dataentry-hospital/src/main/webapp/dhis-web-dataentry-hospital/htmlGrid.vm	2012-06-28 08:17:52 +0000
@@ -0,0 +1,56 @@
+<style type="text/css">
+	.gridTable th, .gridTable td
+	{
+	  text-align: center;
+	  width: 150px;
+	  line-height: 170%;
+	}
+</style>
+
+<div style="margin-bottom:15px">
+	<input type="button" value="$i18n.getString( 'get_report_as_csv' )" onclick="exportICDReport( 'csv' )" />
+	<input type="button" value="$i18n.getString( 'get_report_as_xls' )" onclick="exportICDReport( 'xls' )" />
+	<input type="button" value="$i18n.getString( 'get_report_as_pdf' )" onclick="exportICDReport( 'pdf' )" />
+</div>
+
+<br/>
+
+<h3>$!encoder.htmlEncode( $grid.title )</h3>
+
+<h5>$!encoder.htmlEncode( $grid.subtitle )</h5>
+
+<table class="listTable gridTable">
+
+<thead>
+	<tr>
+		#foreach( $header in $grid.getVisibleHeaders() )
+		<th #if( $header.meta )style="text-align:left"#end>$!encoder.htmlEncode( $i18n.getString( $header.name ) )</th>
+		#end
+	</tr>
+</thead>
+
+<tbody>
+	#foreach( $row in $grid.getVisibleRows() )
+	<tr>
+		#foreach( $col in $row )
+		#set( $index = ( $velocityCount - 1 ) )
+		#if( $grid.getVisibleHeaders().get( $index ).meta )
+		<td style="text-align:left">$!encoder.htmlEncode( $col )</td>
+		#else
+		<td>$!col</td>
+		#end
+		#end
+	</tr>
+	#end
+</tbody>
+
+</table>
+
+<script type="text/javascript">
+
+	function exportICDReport( _type )
+	{
+		window.location.href = "exportResult.action?type=" + _type;
+	}
+	
+</script>
\ No newline at end of file

=== modified file 'local/vn/dhis-web-dataentry-hospital/src/main/webapp/dhis-web-dataentry-hospital/javascript/form.js'
--- local/vn/dhis-web-dataentry-hospital/src/main/webapp/dhis-web-dataentry-hospital/javascript/form.js	2012-05-28 10:23:05 +0000
+++ local/vn/dhis-web-dataentry-hospital/src/main/webapp/dhis-web-dataentry-hospital/javascript/form.js	2012-06-28 08:17:52 +0000
@@ -230,6 +230,7 @@
 	{
 		if ( textStatus == "error" ) {
 			hideLoader();
+			hideById( 'showReportButton' );
 			clearEntryForm();
 			setHeaderDelayMessage( i18n_disconnect_server );
 			return;
@@ -516,6 +517,7 @@
     $( '#completeButton' ).removeAttr( 'disabled' );
     $( '#undoButton' ).attr( 'disabled', 'disabled' );
     $( '#infoDiv' ).css( 'display', 'none' );
+	showById( 'showReportButton' );
 
     insertDataValues( dataSetId );
     displayEntryFormCompleted();
@@ -1646,3 +1648,24 @@
 			input.focus();
 		});
 }
+
+function showICDReport()
+{
+	$('#showReportDiv').load( "showICDReport.action",
+	{
+		dataSetId: getFieldValue( 'selectedDataSetId' ),
+		periodId: getFieldValue( 'selectedPeriodId' ),
+		sourceId: currentOrganisationUnitId
+	}
+	, function(){
+
+	}).dialog({
+		title: 'ICD REPORTING FORM',
+		maximize: true, 
+		closable: true,
+		modal:false,
+		overlay:{background:'#000000', opacity:0.1},
+		width: 1160,
+		height: 520
+	});
+}
\ No newline at end of file

=== modified file 'local/vn/dhis-web-dataentry-hospital/src/main/webapp/dhis-web-dataentry-hospital/select.vm'
--- local/vn/dhis-web-dataentry-hospital/src/main/webapp/dhis-web-dataentry-hospital/select.vm	2012-05-23 09:36:45 +0000
+++ local/vn/dhis-web-dataentry-hospital/src/main/webapp/dhis-web-dataentry-hospital/select.vm	2012-06-28 08:17:52 +0000
@@ -97,10 +97,14 @@
 	<tr id='attributeDiv' style='display:none;'>
 		<td>
 			<label class='bold' for="attributeId">$i18n.getString( "attribute" )</label>
-			<select id='value' name='value' style='display:none;' /></select>
+			<select id='value' name='value' style='display:none;' ></select>
 			<input type="text" id="valueInput" style="width:330px" name="valueInput" />
 			<button type='button' id='valueButton' class='small-button' >&nbsp;</button>
 		</td>
+		<td><br/>
+			<input type="button" id="showReportButton" value="$i18n.getString( 'show_icd_report' )"
+				style="display:none" onclick="showICDReport();"/>
+		</td>
 	</tr>
 
 	<tr>
@@ -159,3 +163,5 @@
 	</tr>
 </table>
 </div>
+
+<div id="showReportDiv"></div>

=== added directory 'local/vn/dhis-web-phieusanh'
=== added file 'local/vn/dhis-web-phieusanh/pom.xml'
--- local/vn/dhis-web-phieusanh/pom.xml	1970-01-01 00:00:00 +0000
+++ local/vn/dhis-web-phieusanh/pom.xml	2012-06-28 08:17:52 +0000
@@ -0,0 +1,55 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0";
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd";>
+  <modelVersion>4.0.0</modelVersion>
+  
+  <parent>
+    <groupId>org.hisp.dhis</groupId>
+    <artifactId>dhis-web</artifactId>
+    <version>2.9-SNAPSHOT</version>
+  </parent>
+  
+  <artifactId>dhis-web-caseentry</artifactId>
+  <packaging>war</packaging>
+  <name>DHIS Case Entry</name>
+  
+  <build>
+    <finalName>dhis-web-caseentry</finalName>
+  </build>
+  
+  <dependencies>
+    
+    <dependency>
+      <groupId>javax.servlet</groupId>
+      <artifactId>servlet-api</artifactId>
+	</dependency>
+	
+    <!-- DHIS -->
+    
+    <dependency>
+      <groupId>org.hisp.dhis</groupId>
+      <artifactId>dhis-web-commons</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.hisp.dhis</groupId>
+      <artifactId>dhis-web-commons-resources</artifactId>
+      <type>war</type>
+    </dependency>
+    <dependency>
+      <groupId>org.hisp.dhis</groupId>
+      <artifactId>dhis-web-api</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.hisp.dhis</groupId>
+      <artifactId>dhis-service-core</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.hisp.dhis</groupId>
+      <artifactId>dhis-service-patient</artifactId>
+    </dependency>   
+    
+  </dependencies>
+  <properties>
+    <rootDir>../../</rootDir>
+  </properties>
+</project>

=== added directory 'local/vn/dhis-web-phieusanh/src'
=== added directory 'local/vn/dhis-web-phieusanh/src/main'
=== added directory 'local/vn/dhis-web-phieusanh/src/main/java'
=== added directory 'local/vn/dhis-web-phieusanh/src/main/java/org'
=== added directory 'local/vn/dhis-web-phieusanh/src/main/java/org/hisp'
=== added directory 'local/vn/dhis-web-phieusanh/src/main/java/org/hisp/dhis'
=== added directory 'local/vn/dhis-web-phieusanh/src/main/java/org/hisp/dhis/phieusanh'
=== added directory 'local/vn/dhis-web-phieusanh/src/main/java/org/hisp/dhis/phieusanh/action'
=== added file 'local/vn/dhis-web-phieusanh/src/main/java/org/hisp/dhis/phieusanh/action/GetPureChildrenAction.java'
--- local/vn/dhis-web-phieusanh/src/main/java/org/hisp/dhis/phieusanh/action/GetPureChildrenAction.java	1970-01-01 00:00:00 +0000
+++ local/vn/dhis-web-phieusanh/src/main/java/org/hisp/dhis/phieusanh/action/GetPureChildrenAction.java	2012-06-28 08:17:52 +0000
@@ -0,0 +1,118 @@
+package org.hisp.dhis.phieusanh.action;
+
+/*
+ * 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.
+ */
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.hisp.dhis.common.comparator.IdentifiableObjectNameComparator;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.organisationunit.OrganisationUnitGroup;
+import org.hisp.dhis.organisationunit.OrganisationUnitGroupService;
+import org.hisp.dhis.organisationunit.OrganisationUnitService;
+import org.hisp.dhis.paging.ActionPagingSupport;
+
+/**
+ * @author Dang Duy Hieu
+ */
+public class GetPureChildrenAction
+    extends ActionPagingSupport<OrganisationUnit>
+{
+    private static final String OFFICAL_UNIT_GROUP = "ĐƠN VỊ HÀNH CHÍNH";
+
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
+
+    private OrganisationUnitService organisationUnitService;
+
+    public void setOrganisationUnitService( OrganisationUnitService organisationUnitService )
+    {
+        this.organisationUnitService = organisationUnitService;
+    }
+
+    private OrganisationUnitGroupService organisationUnitGroupService;
+
+    public void setOrganisationUnitGroupService( OrganisationUnitGroupService organisationUnitGroupService )
+    {
+        this.organisationUnitGroupService = organisationUnitGroupService;
+    }
+
+    // -------------------------------------------------------------------------
+    // Input
+    // -------------------------------------------------------------------------
+
+    private Integer id;
+
+    public void setId( Integer organisationUnitId )
+    {
+        this.id = organisationUnitId;
+    }
+
+    // -------------------------------------------------------------------------
+    // Output
+    // -------------------------------------------------------------------------
+
+    private List<OrganisationUnit> organisationUnits;
+
+    public List<OrganisationUnit> getOrganisationUnits()
+    {
+        return organisationUnits;
+    }
+
+    // -------------------------------------------------------------------------
+    // Action implementation
+    // -------------------------------------------------------------------------
+
+    public String execute()
+        throws Exception
+    {
+        OrganisationUnit unit = organisationUnitService.getOrganisationUnit( id );
+
+        organisationUnits = new ArrayList<OrganisationUnit>( unit.getChildren() );
+
+        OrganisationUnitGroup group = organisationUnitGroupService.getOrganisationUnitGroupByName( OFFICAL_UNIT_GROUP );
+
+        if ( group != null )
+        {
+            organisationUnits.retainAll( group.getMembers() );
+        }
+
+        Collections.sort( organisationUnits, new IdentifiableObjectNameComparator() );
+
+        if ( usePaging )
+        {
+            this.paging = createPaging( organisationUnits.size() );
+
+            organisationUnits = organisationUnits.subList( paging.getStartPos(), paging.getEndPos() );
+        }
+
+        return SUCCESS;
+    }
+}

=== added file 'local/vn/dhis-web-phieusanh/src/main/java/org/hisp/dhis/phieusanh/action/ReregisterPatientLocationAction.java'
--- local/vn/dhis-web-phieusanh/src/main/java/org/hisp/dhis/phieusanh/action/ReregisterPatientLocationAction.java	1970-01-01 00:00:00 +0000
+++ local/vn/dhis-web-phieusanh/src/main/java/org/hisp/dhis/phieusanh/action/ReregisterPatientLocationAction.java	2012-06-28 08:17:52 +0000
@@ -0,0 +1,97 @@
+package org.hisp.dhis.phieusanh.action;
+
+/*
+ * 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.
+ */
+
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.organisationunit.OrganisationUnitService;
+import org.hisp.dhis.patient.Patient;
+import org.hisp.dhis.patient.PatientService;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Dang Duy Hieu
+ * @version $Id$
+ */
+public class ReregisterPatientLocationAction
+    implements Action
+{
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
+
+    private PatientService patientService;
+
+    public void setPatientService( PatientService patientService )
+    {
+        this.patientService = patientService;
+    }
+
+    private OrganisationUnitService organisationUnitService;
+
+    public void setOrganisationUnitService( OrganisationUnitService organisationUnitService )
+    {
+        this.organisationUnitService = organisationUnitService;
+    }
+
+    // -------------------------------------------------------------------------
+    // Action implementation
+    // -------------------------------------------------------------------------
+
+    private Integer patientId;
+
+    public void setPatientId( Integer patientId )
+    {
+        this.patientId = patientId;
+    }
+
+    private Integer newUnitId;
+
+    public void setNewUnitId( Integer newUnitId )
+    {
+        this.newUnitId = newUnitId;
+    }
+
+    // -------------------------------------------------------------------------
+    // Action implementation
+    // -------------------------------------------------------------------------
+
+    public String execute()
+        throws Exception
+    {
+        OrganisationUnit newUnit = organisationUnitService.getOrganisationUnit( newUnitId );
+        
+        Patient patient = patientService.getPatient( patientId );
+
+        patient.setOrganisationUnit( newUnit );
+
+        patientService.savePatient( patient );
+
+        return SUCCESS;
+    }
+}

=== added directory 'local/vn/dhis-web-phieusanh/src/main/resources'
=== added directory 'local/vn/dhis-web-phieusanh/src/main/resources/META-INF'
=== added directory 'local/vn/dhis-web-phieusanh/src/main/resources/META-INF/dhis'
=== added file 'local/vn/dhis-web-phieusanh/src/main/resources/META-INF/dhis/beans.xml'
--- local/vn/dhis-web-phieusanh/src/main/resources/META-INF/dhis/beans.xml	1970-01-01 00:00:00 +0000
+++ local/vn/dhis-web-phieusanh/src/main/resources/META-INF/dhis/beans.xml	2012-06-28 08:17:52 +0000
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans";
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+	xsi:schemaLocation="
+http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd";>
+
+	<bean id="org.hisp.dhis.phieusanh.action.GetPureChildrenAction"
+		class="org.hisp.dhis.phieusanh.action.GetPureChildrenAction"
+		scope="prototype">
+		<property name="organisationUnitService" ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
+		<property name="organisationUnitGroupService" ref="org.hisp.dhis.organisationunit.OrganisationUnitGroupService" />
+	</bean>
+
+	<bean id="org.hisp.dhis.phieusanh.action.ReregisterPatientLocationAction"
+		class="org.hisp.dhis.phieusanh.action.ReregisterPatientLocationAction"
+		scope="prototype">
+		<property name="patientService" ref="org.hisp.dhis.patient.PatientService" />
+		<property name="organisationUnitService" ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
+	</bean>
+	
+</beans>

=== added directory 'local/vn/dhis-web-phieusanh/src/main/resources/org'
=== added directory 'local/vn/dhis-web-phieusanh/src/main/resources/org/hisp'
=== added directory 'local/vn/dhis-web-phieusanh/src/main/resources/org/hisp/dhis'
=== added directory 'local/vn/dhis-web-phieusanh/src/main/resources/org/hisp/dhis/phieusanh'
=== added file 'local/vn/dhis-web-phieusanh/src/main/resources/struts.xml'
--- local/vn/dhis-web-phieusanh/src/main/resources/struts.xml	1970-01-01 00:00:00 +0000
+++ local/vn/dhis-web-phieusanh/src/main/resources/struts.xml	2012-06-28 08:17:52 +0000
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE struts PUBLIC
+"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
+"http://struts.apache.org/dtds/struts-2.0.dtd";>
+<struts>
+
+	<include file="dhis-web-commons.xml" />
+
+	<package name="dhis-web-phieusanh" extends="dhis-web-commons"
+		namespace="/dhis-web-phieusanh">
+
+		<action name="getPureChildren"
+			class="org.hisp.dhis.phieusanh.action.GetPureChildrenAction">
+			<result name="success" type="velocity-json">
+				../dhis-web-commons/ajax/jsonOrganisationUnits.vm
+			</result>
+			<param name="onExceptionReturn">plainTextError</param>
+		</action>
+
+		<action name="registerPatientLocation"
+			class="org.hisp.dhis.phieusanh.action.ReregisterPatientLocationAction">
+			<result name="success" type="velocity-json">
+				../dhis-web-commons/ajax/jsonResponseSuccess.vm
+			</result>
+			<param name="onExceptionReturn">plainTextError</param>
+		</action>
+		
+	</package>
+</struts>
\ No newline at end of file

=== added directory 'local/vn/dhis-web-phieusanh/src/main/webapp'
=== added directory 'local/vn/dhis-web-phieusanh/src/main/webapp/WEB-INF'
=== added directory 'local/vn/dhis-web-phieusanh/src/main/webapp/WEB-INF/lib'
=== added file 'local/vn/dhis-web-phieusanh/src/main/webapp/WEB-INF/web.xml'
--- local/vn/dhis-web-phieusanh/src/main/webapp/WEB-INF/web.xml	1970-01-01 00:00:00 +0000
+++ local/vn/dhis-web-phieusanh/src/main/webapp/WEB-INF/web.xml	2012-06-28 08:17:52 +0000
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
+  "http://java.sun.com/dtd/web-app_2_3.dtd";>
+<web-app>
+  <display-name>DHIS Web Spreadsheet Reporting</display-name>
+  
+  <context-param>
+    <param-name>contextConfigLocation</param-name>
+    <param-value>classpath*:/META-INF/dhis/beans.xml</param-value>
+  </context-param>
+  <context-param>
+    <param-name>automaticAccessType</param-name>
+    <param-value>ghostAdmin</param-value>
+  </context-param>
+  
+  <filter>
+    <filter-name>RedirectFilter</filter-name>
+    <filter-class>org.hisp.dhis.servlet.filter.HttpRedirectFilter</filter-class>
+    <init-param>
+      <param-name>redirectPath</param-name>
+      <param-value>dhis-web-spreadsheet-reporting/index.action</param-value>
+    </init-param>
+  </filter>
+  <filter>
+    <filter-name>OpenSessionInViewFilter</filter-name>
+    <filter-class>org.springframework.orm.hibernate4.support.OpenSessionInViewFilter</filter-class>
+  </filter>
+  <filter>
+    <filter-name>springSecurityFilterChain</filter-name>
+    <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
+  </filter>
+  <filter>
+    <filter-name>Struts</filter-name>
+    <filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
+  </filter>
+  
+  <filter-mapping>
+    <filter-name>RedirectFilter</filter-name>
+    <url-pattern>/</url-pattern>
+  </filter-mapping>
+  <filter-mapping>
+    <filter-name>OpenSessionInViewFilter</filter-name>
+    <url-pattern>*.action</url-pattern>
+  </filter-mapping>
+  <filter-mapping>
+    <filter-name>springSecurityFilterChain</filter-name>
+    <url-pattern>/*</url-pattern>
+  </filter-mapping>
+  <filter-mapping>
+    <filter-name>Struts</filter-name>
+    <url-pattern>*.action</url-pattern>
+  </filter-mapping>
+  
+  <listener>
+    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
+  </listener>
+  <listener>
+    <listener-class>org.hisp.dhis.system.startup.StartupListener</listener-class>
+  </listener>
+</web-app>

=== added directory 'local/vn/dhis-web-phieusanh/src/main/webapp/dhis-web-phieusanh'
=== added directory 'local/vn/dhis-web-phieusanh/src/main/webapp/dhis-web-phieusanh/images'
=== added directory 'local/vn/dhis-web-phieusanh/src/main/webapp/dhis-web-phieusanh/javascript'
=== added file 'local/vn/dhis-web-phieusanh/src/main/webapp/dhis-web-phieusanh/secondUnitForPhieuSanh.vm'
--- local/vn/dhis-web-phieusanh/src/main/webapp/dhis-web-phieusanh/secondUnitForPhieuSanh.vm	1970-01-01 00:00:00 +0000
+++ local/vn/dhis-web-phieusanh/src/main/webapp/dhis-web-phieusanh/secondUnitForPhieuSanh.vm	2012-06-28 08:17:52 +0000
@@ -0,0 +1,88 @@
+<script type="text/javascript">
+
+	var defaultName = "hồ chí minh";
+
+	jQuery(document).ready( function()
+	{
+		jQuery.ajax(
+		{
+			type: 'GET',
+			url: '../dhis-web-commons-ajax-json/getOrganisationUnits.action',
+			data: 'level=2',
+			dataType: 'json',
+			async: false,
+			success: function( json )
+			{
+				var selector = jQuery( "#provinceLevel" );
+				selector.empty();
+				selector.append( '<option value="-1">[ ' + i18n_label + ' ]</option>' );
+				
+				jQuery.each( json.organisationUnits , function( i, item )
+				{
+					if ( item.name.toLowerCase().indexOf( defaultName ) != -1 ) {
+						selector.append( "<option value='" + item.id + "' selected='true'>" + item.name + "</option>" );
+					} else {
+						selector.append( "<option value='" + item.id + "'>" + item.name + "</option>" );
+					}
+				} );
+
+				loadPureChildrens( getFieldValue( 'provinceLevel' ), 'districtLevel' );
+			}
+		} );
+	} );
+
+	function loadPureChildrens( id, elementId )
+	{
+		jQuery.get( "../dhis-web-spreadsheet-reporting/getPureChildren.action", { id: id },
+		function ( json ) { buildUpList( json.organisationUnits, elementId ); } );
+	}
+	
+	function buildUpList( elements, elementId )
+	{
+		var selector = jQuery( "#" + elementId );
+		selector.empty();
+		selector.append( '<option value="-1">[ ' + i18n_label + ' ]</option>' );
+		
+		jQuery.each( elements, function( i, item )
+		{
+			selector.append( "<option value='" + item.id + "'>" + item.name + "</option>" );
+		} );
+	}
+	
+	function addPatient( newUnitId )
+	{
+		if ( newUnitId && newUnitId != -1 )
+		{
+			jQuery.postUTF8( '../dhis-web-caseentry/addPatient.action',
+			{
+				fullName: getFieldValue( 'fullName' ),
+				age: getFieldValue( 'age' )
+			}, function( json )
+			{
+				if ( json.response == "success" )
+				{
+					jQuery.get( '../dhis-web-spreadsheet-reporting/registerPatientLocation.action',
+					{
+						patientId: json.message.split( "_" ),
+						newUnitId: newUnitId
+					}, function( json )
+					{
+						if ( json.response == "success" ) {
+							showSuccessMessage( i18n_register_patient_successfully );
+						}
+					} );
+				}
+			} );
+		} else {
+			showErrorMessage( i18n_please_select_unit );
+		}
+	}
+	
+	var i18n_label = '$encoder.jsEscape( $i18n.getString( "select_orgunit" ) , "'" )';
+	var i18n_please_select_unit = '$encoder.jsEscape( $i18n.getString( "please_select_unit" ) , "'" )';
+	var i18n_register_patient_successfully = '$encoder.jsEscape( $i18n.getString( "register_patient_successfully" ) , "'" )';
+</script>
+
+<select id="provinceLevel" name="provinceLevel" onchange="loadPureChildrens( this.value, 'districtLevel' )"></select>
+<select id="districtLevel" name="districtLevel" onchange="loadPureChildrens( this.value, 'wardLevel' )"></select>
+<select id="wardLevel" name="wardLevel" onchange="addPatient( this.value )"></select>
\ No newline at end of file

=== added directory 'local/vn/dhis-web-phieusanh/src/main/webapp/dhis-web-phieusanh/style'
=== modified file 'local/vn/dhis-web-spreadsheet-reporting/src/main/resources/META-INF/dhis/beans.xml'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/resources/META-INF/dhis/beans.xml	2012-05-12 06:21:13 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/resources/META-INF/dhis/beans.xml	2012-06-28 08:17:52 +0000
@@ -1520,5 +1520,5 @@
 		scope="prototype">
 		<property name="jchartDataService" ref="org.hisp.dhis.jchart.data.JChartDataService" />
 	</bean>
-	
+
 </beans>