← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2120: Work in progress for Bangladesh for Manpower Module

 

------------------------------------------------------------
revno: 2120
committer: Neeraj <neeraj.hisp@xxxxxxxxx>
branch nick: dhis2
timestamp: Sat 2010-11-20 17:46:50 +0530
message:
  Work in progress for Bangladesh for Manpower Module
modified:
  local/bd/dhis-web-linelisting-manpower/src/main/java/org/hisp/dhis/ll/action/lldataentry/SaveEmplyeePostAction.java
  local/bd/dhis-web-linelisting-manpower/src/main/java/org/hisp/dhis/ll/action/lldataentry/UpdateEmployeePostAction.java
  local/bd/dhis-web-linelisting-manpower/src/main/resources/META-INF/dhis/beans.xml
  local/bd/dhis-web-linelisting-manpower/src/main/webapp/dhis-web-linelisting-mp/employeePost.vm
  local/bd/dhis-web-linelisting-manpower/src/main/webapp/dhis-web-linelisting-mp/select.vm
  local/bd/dhis-web-linelisting-manpower/src/main/webapp/dhis-web-linelisting-mp/updateEmployeePostForm.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 'local/bd/dhis-web-linelisting-manpower/src/main/java/org/hisp/dhis/ll/action/lldataentry/SaveEmplyeePostAction.java'
--- local/bd/dhis-web-linelisting-manpower/src/main/java/org/hisp/dhis/ll/action/lldataentry/SaveEmplyeePostAction.java	2010-11-19 12:52:40 +0000
+++ local/bd/dhis-web-linelisting-manpower/src/main/java/org/hisp/dhis/ll/action/lldataentry/SaveEmplyeePostAction.java	2010-11-20 12:16:50 +0000
@@ -10,6 +10,8 @@
 import org.apache.struts2.ServletActionContext;
 import org.hisp.dhis.dbmanager.DataBaseManagerInterface;
 import org.hisp.dhis.i18n.I18nFormat;
+import org.hisp.dhis.linelisting.Employee;
+import org.hisp.dhis.linelisting.EmployeeService;
 import org.hisp.dhis.linelisting.LineListDataValue;
 import org.hisp.dhis.linelisting.LineListElement;
 import org.hisp.dhis.linelisting.LineListGroup;
@@ -27,9 +29,11 @@
     implements Action
 {
 
-    // ---------------------------------------------------------------------------
+    //--------------------------------------------------------------------------
+    // -
     // Dependencies
-    // ---------------------------------------------------------------------------
+    //--------------------------------------------------------------------------
+    // -
 
     private LineListService lineListService;
 
@@ -73,18 +77,27 @@
         this.periodService = periodService;
     }
 
-    // ---------------------------------------------------------------------------
+    private EmployeeService employeeService;
+
+    public void setEmployeeService( EmployeeService employeeService )
+    {
+        this.employeeService = employeeService;
+    }
+
+    //--------------------------------------------------------------------------
+    // -
     // Input/Output
-    // ---------------------------------------------------------------------------
+    //--------------------------------------------------------------------------
+    // -
     private String department;
 
     public void setDepartment( String department )
     {
         this.department = department;
     }
-    
+
     private String post;
-    
+
     public void setPost( String post )
     {
         this.post = post;
@@ -110,14 +123,14 @@
     {
         this.reportingDate = reportingDate;
     }
-    
+
     public String getReportingDate()
     {
         return reportingDate;
     }
-    
+
     private String dataValueMapKey;
-    
+
     public String getDataValueMapKey()
     {
         return dataValueMapKey;
@@ -140,12 +153,11 @@
         this.dataValue = dataValue;
     }
 
-
     private LineListGroup lineListGroup;
 
-    // --------------------------------------------------------------------------
+    //--------------------------------------------------------------------------
     // Action Implementation
-    // --------------------------------------------------------------------------
+    //--------------------------------------------------------------------------
 
     public String execute()
     {
@@ -156,6 +168,8 @@
         Collection<LineListElement> linelistElements = lineListService.getLineListGroup( groupid )
             .getLineListElements();
 
+        String pdsCode = "";
+
         lineListGroup = selectedStateManager.getSelectedLineListGroup();
 
         OrganisationUnit organisationUnit = selectedStateManager.getSelectedOrganisationUnit();
@@ -165,30 +179,39 @@
         int recordNo = dbManagerInterface.getMaxRecordNumber( department ) + 1;
 
         Map<String, String> llElementValuesMap = new HashMap<String, String>();
+
         LineListDataValue llDataValue = new LineListDataValue();
+        int i = 0;
         for ( LineListElement linelistElement : linelistElements )
         {
             String linelistElementValue = request.getParameter( linelistElement.getShortName() );
-            
-            System.out.println("Linelist Em=lement name is :" + linelistElement.getShortName() + " And Linlelist Value is:" + linelistElementValue );
-
-            if( linelistElementValue == null )
+
+            // Hardcoding to get PDSCode of Employee
+
+            if ( i == 0 )
+            {
+                pdsCode = linelistElementValue;
+            }
+
+            System.out.println( "Linelist Element name is :" + linelistElement.getShortName()
+                + " And Linlelist Value is:" + linelistElementValue );
+
+            if ( linelistElementValue == null )
             {
                 continue;
             }
-            
+
             if ( linelistElementValue != null && linelistElementValue.trim().equals( "" ) )
             {
-                linelistElementValue = "";                
+                linelistElementValue = "";
             }
             llElementValuesMap.put( linelistElement.getShortName(), linelistElementValue );
-            
+            i++;
         }
 
         String postColumnId = linelistElements.iterator().next().getShortName();
         llElementValuesMap.put( postColumnId, post );
-        System.out.println("*********"+postColumnId + " ------ " + post + "**********");
-        
+
         // add map in linelist data value
         llDataValue.setLineListValues( llElementValuesMap );
 
@@ -198,7 +221,6 @@
 
         // add recordNumber to pass to the update query
         llDataValue.setRecordNumber( recordNo );
-        
 
         // add stored by, timestamp in linelist data value
         storedBy = currentUserService.getCurrentUsername();
@@ -215,6 +237,13 @@
         {
             System.out.println( "Values Successfully Inserted in DB" );
         }
+        Employee employee = employeeService.getEmployeeByPDSCode( pdsCode );
+
+        if ( employee != null )
+        {
+            employee.setIsTransferred( false );
+            employeeService.updateEmployee( employee );
+        }
 
         return SUCCESS;
     }

=== modified file 'local/bd/dhis-web-linelisting-manpower/src/main/java/org/hisp/dhis/ll/action/lldataentry/UpdateEmployeePostAction.java'
--- local/bd/dhis-web-linelisting-manpower/src/main/java/org/hisp/dhis/ll/action/lldataentry/UpdateEmployeePostAction.java	2010-11-19 12:52:40 +0000
+++ local/bd/dhis-web-linelisting-manpower/src/main/java/org/hisp/dhis/ll/action/lldataentry/UpdateEmployeePostAction.java	2010-11-20 12:16:50 +0000
@@ -12,6 +12,8 @@
 import org.apache.struts2.ServletActionContext;
 import org.hisp.dhis.dbmanager.DataBaseManagerInterface;
 import org.hisp.dhis.i18n.I18nFormat;
+import org.hisp.dhis.linelisting.Employee;
+import org.hisp.dhis.linelisting.EmployeeService;
 import org.hisp.dhis.linelisting.LineListDataValue;
 import org.hisp.dhis.linelisting.LineListElement;
 import org.hisp.dhis.linelisting.LineListGroup;
@@ -38,6 +40,13 @@
     {
         this.lineListService = lineListService;
     }
+    
+    private EmployeeService employeeService;
+
+    public void setEmployeeService( EmployeeService employeeService )
+    {
+        this.employeeService = employeeService;
+    }
 
     private SelectedStateManager selectedStateManager;
 
@@ -141,15 +150,36 @@
 
         Map<String, String> llElementValuesMap = new HashMap<String, String>();
         LineListDataValue llDataValue = new LineListDataValue();
+        int i = 0;
+        int lineListElementsSize = linelistElements.size() - 1;
+        String leftReason = null;
+        String pdsCode = "";
         for ( LineListElement linelistElement : linelistElements )
         {
+            
             String linelistElementValue = request.getParameter( linelistElement.getShortName() );
-
+            System.out.println("i="+i+" The Linelist Element value is ::::::::: " + linelistElementValue );
+
+            if ( i == 1 )
+            {
+                pdsCode = linelistElementValue;
+            }
+            else if ( i == lineListElementsSize )
+            {
+                leftReason = linelistElementValue;
+            }
+
+            if ( linelistElementValue == null )
+            {
+                i++;
+                continue;
+            }
             if ( linelistElementValue != null && linelistElementValue.trim().equals( "" ) )
             {
                 linelistElementValue = "";
             }
             llElementValuesMap.put( linelistElement.getShortName(), linelistElementValue );
+            i++;
         }
 
         String postColumnId = linelistElements.iterator().next().getShortName();
@@ -173,15 +203,26 @@
 
         llDataValue.setStoredBy( storedBy );
         List<LineListDataValue> llDataValuesList = new ArrayList<LineListDataValue>();
-        
+
         llDataValuesList.add( llDataValue );
+        System.out.println("The values are ::::::::::" + llDataValuesList + " ----------and the table name is  " + department );
 
         boolean valueUpdated = dbManagerInterface.updateLLValue( llDataValuesList, department );
-        
+
         if ( valueUpdated )
         {
             System.out.println( "Values Successfully Updated in DB" );
         }
+        
+        Employee employee = employeeService.getEmployeeByPDSCode( pdsCode );
+        
+        System.out.println("The PDSCode is :" + pdsCode + " And LeftReason is :" + leftReason );
+        
+        if( employee != null && leftReason == "Transfer Reason" )
+        {
+            employee.setIsTransferred( true );
+            employeeService.updateEmployee( employee );
+        }
 
         return SUCCESS;
     }

=== modified file 'local/bd/dhis-web-linelisting-manpower/src/main/resources/META-INF/dhis/beans.xml'
--- local/bd/dhis-web-linelisting-manpower/src/main/resources/META-INF/dhis/beans.xml	2010-11-19 12:52:40 +0000
+++ local/bd/dhis-web-linelisting-manpower/src/main/resources/META-INF/dhis/beans.xml	2010-11-20 12:16:50 +0000
@@ -558,6 +558,9 @@
 		<property name="periodService">
             <ref bean="org.hisp.dhis.period.PeriodService"/>
         </property>
+		<property name="employeeService">
+            <ref bean="org.hisp.dhis.linelisting.EmployeeService"/>
+        </property>
     </bean>
 	
 	
@@ -588,6 +591,9 @@
 		<property name="periodService">
             <ref bean="org.hisp.dhis.period.PeriodService"/>
         </property>
+		<property name="employeeService">
+            <ref bean="org.hisp.dhis.linelisting.EmployeeService"/>
+        </property>
     </bean>
 	
  	

=== modified file 'local/bd/dhis-web-linelisting-manpower/src/main/webapp/dhis-web-linelisting-mp/employeePost.vm'
--- local/bd/dhis-web-linelisting-manpower/src/main/webapp/dhis-web-linelisting-mp/employeePost.vm	2010-11-19 12:52:40 +0000
+++ local/bd/dhis-web-linelisting-manpower/src/main/webapp/dhis-web-linelisting-mp/employeePost.vm	2010-11-20 12:16:50 +0000
@@ -65,7 +65,7 @@
 			<input type="hidden" id="reportedDate" name="reportedDate">&nbsp;		
 		</td>
 		<td>
-			<input type="button" value="Reset"> 
+			<input type="reset" value="Reset" onclick="window.location.href='showEmployeePostForm.action'" style="width:10em"> 
 		</td>
 	</tr>
 	</table>

=== modified file 'local/bd/dhis-web-linelisting-manpower/src/main/webapp/dhis-web-linelisting-mp/select.vm'
--- local/bd/dhis-web-linelisting-manpower/src/main/webapp/dhis-web-linelisting-mp/select.vm	2010-10-20 06:14:25 +0000
+++ local/bd/dhis-web-linelisting-manpower/src/main/webapp/dhis-web-linelisting-mp/select.vm	2010-11-20 12:16:50 +0000
@@ -7,17 +7,13 @@
 
 <form id="selectForm" name="selectForm" method="post" action="select.action">
 
-
+<!--
 <div id="actions" style="width:200px text-align:right">
     <br><br><br>
     <input type="button" value="Save Aggregated Data" onclick="saveLineListingAggData()" #if( $isLineListing.equals("no") ) disabled="disabled" #end disabled>
 </div>
-
+-->
 <table>
-	<!--
-	<col width="140">
-	<col width="200">
-	-->
 	<tr>
 		<td><label>$i18n.getString( "organisation_unit" )</label></td>
 		<td><input type="text" readonly="readonly" #if( $organisationUnit ) value="$encoder.htmlEncode( $organisationUnit.name )" #else value="[$i18n.getString( "select" )]" #end style="width:200px"></td>

=== modified file 'local/bd/dhis-web-linelisting-manpower/src/main/webapp/dhis-web-linelisting-mp/updateEmployeePostForm.vm'
--- local/bd/dhis-web-linelisting-manpower/src/main/webapp/dhis-web-linelisting-mp/updateEmployeePostForm.vm	2010-11-19 12:52:40 +0000
+++ local/bd/dhis-web-linelisting-manpower/src/main/webapp/dhis-web-linelisting-mp/updateEmployeePostForm.vm	2010-11-20 12:16:50 +0000
@@ -59,7 +59,7 @@
 			<input type="hidden" id="reportedDate" name="reportedDate">&nbsp;		
 		</td>
 		<td>
-			<input type="button" value="Reset"> 
+			<input type="reset" value="Reset"> 
 		</td>
 	</tr>