← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 17545: loca/in Add Partner Management in Maintenance RBF

 

------------------------------------------------------------
revno: 17545
committer: Mithilesh Kumar Thakur <mithilesh.hisp@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2014-11-20 06:34:00 +0000
message:
  loca/in Add Partner Management in Maintenance RBF
added:
  local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/partner/action/GetPartnerDateListAction.java
  local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/partner/action/RemovePartnerAction.java
  local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/partner/action/UpdatePartnerFormAction.java
  local/in/dhis-web-maintenance-rbf/src/main/webapp/dhis-web-maintenance-rbf/partnerDateList.vm
  local/in/dhis-web-maintenance-rbf/src/main/webapp/dhis-web-maintenance-rbf/partnerFundManagement_old.vm
  local/in/dhis-web-maintenance-rbf/src/main/webapp/dhis-web-maintenance-rbf/updatePartnerForm.vm
modified:
  local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/api/PartnerService.java
  local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/api/PartnerStore.java
  local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/impl/DefaultPartnerService.java
  local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/impl/HibernatePartnerStore.java
  local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/partner/action/PartnerDataListAction.java
  local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/partner/action/SavePartnerDetailsResultAction.java
  local/in/dhis-web-maintenance-rbf/src/main/resources/META-INF/dhis/beans.xml
  local/in/dhis-web-maintenance-rbf/src/main/resources/org/hisp/dhis/rbf/i18n_module.properties
  local/in/dhis-web-maintenance-rbf/src/main/resources/struts.xml
  local/in/dhis-web-maintenance-rbf/src/main/webapp/dhis-web-maintenance-rbf/javascript/partner.js
  local/in/dhis-web-maintenance-rbf/src/main/webapp/dhis-web-maintenance-rbf/javascript/utilizationRule.js
  local/in/dhis-web-maintenance-rbf/src/main/webapp/dhis-web-maintenance-rbf/loadDataEntryForm.vm
  local/in/dhis-web-maintenance-rbf/src/main/webapp/dhis-web-maintenance-rbf/menu.vm
  local/in/dhis-web-maintenance-rbf/src/main/webapp/dhis-web-maintenance-rbf/partnerForm.vm
  local/in/dhis-web-maintenance-rbf/src/main/webapp/dhis-web-maintenance-rbf/partnerFundManagement.vm
  local/in/dhis-web-maintenance-rbf/src/main/webapp/dhis-web-maintenance-rbf/welcome.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/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/api/PartnerService.java'
--- local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/api/PartnerService.java	2014-11-15 11:24:03 +0000
+++ local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/api/PartnerService.java	2014-11-20 06:34:00 +0000
@@ -3,6 +3,7 @@
 import java.util.Collection;
 import java.util.Date;
 import java.util.Map;
+import java.util.Set;
 
 import org.hisp.dhis.dataelement.DataElement;
 import org.hisp.dhis.dataset.DataSet;
@@ -31,4 +32,8 @@
     
     Map<String, Integer> getOrgUnitCountFromPartner( Integer dataSetId, Integer dataElementId, Integer optionId, String startDate, String endDate );
     
+    Map<String, Integer> getOrgUnitCountFromPartner( Integer dataSetId, Integer dataElementId, Integer optionId );
+    
+    Set<OrganisationUnit> getPartnerOrganisationUnits( Integer dataSetId, Integer dataElementId, Integer optionId, String startDate, String endDate );
+    
 }

=== modified file 'local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/api/PartnerStore.java'
--- local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/api/PartnerStore.java	2014-11-15 11:24:03 +0000
+++ local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/api/PartnerStore.java	2014-11-20 06:34:00 +0000
@@ -3,10 +3,10 @@
 import java.util.Collection;
 import java.util.Date;
 import java.util.Map;
+import java.util.Set;
 
 import org.hisp.dhis.dataelement.DataElement;
 import org.hisp.dhis.dataset.DataSet;
-import org.hisp.dhis.option.Option;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 
 /**
@@ -32,4 +32,8 @@
     
     Map<String, Integer> getOrgUnitCountFromPartner( Integer dataSetId, Integer dataElementId, Integer optionId, String startDate, String endDate );
     
+    Map<String, Integer> getOrgUnitCountFromPartner( Integer dataSetId, Integer dataElementId, Integer optionId );
+    
+    Set<OrganisationUnit> getPartnerOrganisationUnits( Integer dataSetId, Integer dataElementId, Integer optionId, String startDate, String endDate );
+    
 }

=== modified file 'local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/impl/DefaultPartnerService.java'
--- local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/impl/DefaultPartnerService.java	2014-11-17 05:54:11 +0000
+++ local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/impl/DefaultPartnerService.java	2014-11-20 06:34:00 +0000
@@ -3,6 +3,7 @@
 import java.util.Collection;
 import java.util.Date;
 import java.util.Map;
+import java.util.Set;
 
 import org.hisp.dhis.dataelement.DataElement;
 import org.hisp.dhis.dataset.DataSet;
@@ -71,15 +72,24 @@
     }
 
 
+    public Collection<String> getStartAndEndDate( Integer dataSetId, Integer dataElementId, Integer optionId )
+    {
+        return partnerStore.getStartAndEndDate( dataSetId, dataElementId, optionId );
+    }
+    
     public Map<String, Integer> getOrgUnitCountFromPartner( Integer dataSetId, Integer dataElementId, Integer optionId, String startDate, String endDate )
     {
         return partnerStore.getOrgUnitCountFromPartner( dataSetId, dataElementId, optionId, startDate, endDate );
     }    
     
-    public Collection<String> getStartAndEndDate( Integer dataSetId, Integer dataElementId, Integer optionId )
+    public Map<String, Integer> getOrgUnitCountFromPartner( Integer dataSetId, Integer dataElementId, Integer optionId )
     {
-        return partnerStore.getStartAndEndDate( dataSetId, dataElementId, optionId );
-    }
+        return partnerStore.getOrgUnitCountFromPartner( dataSetId, dataElementId, optionId );
+    }     
     
+    public Set<OrganisationUnit> getPartnerOrganisationUnits( Integer dataSetId, Integer dataElementId, Integer optionId, String startDate, String endDate )
+    {
+        return partnerStore.getPartnerOrganisationUnits( dataSetId, dataElementId, optionId, startDate, endDate );
+    }   
     
 }

=== modified file 'local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/impl/HibernatePartnerStore.java'
--- local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/impl/HibernatePartnerStore.java	2014-11-15 11:24:03 +0000
+++ local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/impl/HibernatePartnerStore.java	2014-11-20 06:34:00 +0000
@@ -1,19 +1,26 @@
 package org.hisp.dhis.rbf.impl;
 
 import java.text.SimpleDateFormat;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
 
 import org.hibernate.Criteria;
 import org.hibernate.Session;
 import org.hibernate.SessionFactory;
-import org.hibernate.criterion.Order;
 import org.hibernate.criterion.Restrictions;
 import org.hisp.dhis.dataelement.DataElement;
 import org.hisp.dhis.dataset.DataSet;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.organisationunit.OrganisationUnitService;
 import org.hisp.dhis.rbf.api.Partner;
 import org.hisp.dhis.rbf.api.PartnerStore;
-import org.jfree.data.general.Dataset;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.jdbc.core.JdbcTemplate;
 import org.springframework.jdbc.support.rowset.SqlRowSet;
 import org.springframework.transaction.annotation.Transactional;
@@ -22,9 +29,10 @@
  * @author Mithilesh Kumar Thakur
  */
 @Transactional
-public class HibernatePartnerStore implements PartnerStore
+public class HibernatePartnerStore
+    implements PartnerStore
 {
-    
+
     // -------------------------------------------------------------------------
     // Dependencies
     // -------------------------------------------------------------------------
@@ -35,18 +43,21 @@
     {
         this.sessionFactory = sessionFactory;
     }
-    
+
     private JdbcTemplate jdbcTemplate;
 
     public void setJdbcTemplate( JdbcTemplate jdbcTemplate )
     {
         this.jdbcTemplate = jdbcTemplate;
     }
-   
+
+    @Autowired
+    private OrganisationUnitService organisationUnitService;
+
     // -------------------------------------------------------------------------
     // Partner
     // -------------------------------------------------------------------------
-  
+
     @Override
     public void addPartner( Partner partner )
     {
@@ -70,22 +81,23 @@
 
         session.delete( partner );
     }
-    
+
     @Override
-    public Partner getPartner( OrganisationUnit organisationUnit, DataSet dataSet, DataElement dataElement, Date startDate, Date endDate )
+    public Partner getPartner( OrganisationUnit organisationUnit, DataSet dataSet, DataElement dataElement,
+        Date startDate, Date endDate )
     {
         Session session = sessionFactory.getCurrentSession();
 
         Criteria criteria = session.createCriteria( Partner.class );
         criteria.add( Restrictions.eq( "organisationUnit", organisationUnit ) );
         criteria.add( Restrictions.eq( "dataSet", dataSet ) );
-        criteria.add( Restrictions.eq( "dataElement", dataElement ) );        
+        criteria.add( Restrictions.eq( "dataElement", dataElement ) );
         criteria.add( Restrictions.eq( "startDate", startDate ) );
         criteria.add( Restrictions.eq( "endDate", endDate ) );
 
         return (Partner) criteria.uniqueResult();
-    }    
-    
+    }
+
     @SuppressWarnings( "unchecked" )
     @Override
     public Collection<Partner> getAllPartner()
@@ -96,7 +108,7 @@
 
         return criteria.list();
     }
-   
+
     @SuppressWarnings( "unchecked" )
     @Override
     public Collection<Partner> getPartner( OrganisationUnit organisationUnit, DataSet dataSet )
@@ -108,87 +120,180 @@
         criteria.add( Restrictions.eq( "dataSet", dataSet ) );
 
         return criteria.list();
-    }    
-    
-    @SuppressWarnings( "unchecked" )
+    }
+
     @Override
     public Collection<String> getStartAndEndDate( Integer dataSetId, Integer dataElementId, Integer optionId )
     {
         List<String> dateList = new ArrayList<String>();
-        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat( "yyyy-MM-dd" );
 
         try
         {
-            String query = "SELECT startdate, enddate FROM (" +
-                    "  SELECT Distinct (startdate , enddate),startdate , enddate FROM partner WHERE" +
-                    " datasetid = " + dataSetId + " AND " +
-                    " dataelementid = " + dataElementId + " AND " +
-                    " optionid = " + optionId +") asd" ;
+            String query = "SELECT startdate, enddate FROM ("
+                + "  SELECT Distinct (startdate , enddate),startdate , enddate FROM partner WHERE" + " datasetid = "
+                + dataSetId + " AND " + " dataelementid = " + dataElementId + " AND " + " optionid = " + optionId
+                + ") asd";
 
             SqlRowSet rs = jdbcTemplate.queryForRowSet( query );
             while ( rs.next() )
             {
                 String startDate = simpleDateFormat.format( rs.getDate( 1 ) );
-                String endDate = simpleDateFormat.format(rs.getDate(2));
-
-                String date = startDate+":"+endDate;
-
-                dateList.add(date);
-            }
-        }
-        catch (Exception ex){
-            System.out.println(" In Partner Data Exception :"+ ex.getMessage() );
-            ex.printStackTrace();
-        }
-    return dateList;
-
-    }    
-
-        
-    // get OrgUnit Count FromPartner
-    public Map<String, Integer> getOrgUnitCountFromPartner( Integer dataSetId, Integer dataElementId, Integer optionId, String startDate, String endDate )
-    {
-        Map<String, Integer> partnerOrgUnitCountMap = new HashMap<String, Integer>();
-        
-        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
-        //String curPeriod = simpleDateFormat.format( period.getEndDate() );
-        
-        try
-        {
-            String query = "SELECT datasetid, dataelementid, optionid, startdate, enddate ,COUNT( organisationunitid ) FROM partner " +
-                            " WHERE " +
-                                " datasetid = " + dataSetId + " AND " +
-                                " dataelementid = " + dataElementId + " AND " +
-                                " optionid = " + optionId + " AND " +
-                                " startdate >= '" + startDate + "' AND  enddate <= '" + endDate +"' GROUP BY datasetid, dataelementid, startdate, enddate, optionid ";
-            
-            
-            SqlRowSet rs = jdbcTemplate.queryForRowSet( query );
-            while ( rs.next() )
-            {
-                Integer dataSetID = rs.getInt( 1 );
-                Integer dataElementID = rs.getInt( 2 );
-                Integer optionID = rs.getInt( 3 );
-                String sDate = simpleDateFormat.format( rs.getDate( 4 ) );
-                String eDate = simpleDateFormat.format( rs.getDate( 5 ) );
-                Integer orgUnitCount = rs.getInt( 6 );
-                
-                if( orgUnitCount != null && orgUnitCount > 0  )
-                {
-                    
-                    String key = dataSetID + ":" + dataElementID + ":" + optionID + ":" + sDate + ":" + eDate;
-                    partnerOrgUnitCountMap.put( key, orgUnitCount );
-                }
-            }
-        }
-        catch( Exception e )
-        {
-            System.out.println(" In Partner Data Exception :"+ e.getMessage() );
-            e.printStackTrace();
-        }
-        
-        return partnerOrgUnitCountMap;
-    }
-        
-    
+                String endDate = simpleDateFormat.format( rs.getDate( 2 ) );
+
+                if ( startDate != null && endDate != null )
+                {
+                    String date = startDate + ":" + endDate;
+
+                    dateList.add( date );
+                }
+            }
+        }
+        catch ( Exception ex )
+        {
+            System.out.println( " In Partner Data Exception :" + ex.getMessage() );
+            ex.printStackTrace();
+        }
+        return dateList;
+
+    }
+
+    // get OrgUnit Count FromPartner
+    public Map<String, Integer> getOrgUnitCountFromPartner( Integer dataSetId, Integer dataElementId, Integer optionId,
+        String startDate, String endDate )
+    {
+        Map<String, Integer> partnerOrgUnitCountMap = new HashMap<String, Integer>();
+
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat( "yyyy-MM-dd" );
+        // String curPeriod = simpleDateFormat.format( period.getEndDate() );
+
+        try
+        {
+            String query = "SELECT datasetid, dataelementid, optionid, startdate, enddate ,COUNT( organisationunitid ) FROM partner "
+                + " WHERE "
+                + " datasetid = "
+                + dataSetId
+                + " AND "
+                + " dataelementid = "
+                + dataElementId
+                + " AND "
+                + " optionid = "
+                + optionId
+                + " AND "
+                + " startdate >= '"
+                + startDate
+                + "' AND  enddate <= '"
+                + endDate
+                + "' GROUP BY datasetid, dataelementid, startdate, enddate, optionid ";
+
+            SqlRowSet rs = jdbcTemplate.queryForRowSet( query );
+            while ( rs.next() )
+            {
+                Integer dataSetID = rs.getInt( 1 );
+                Integer dataElementID = rs.getInt( 2 );
+                Integer optionID = rs.getInt( 3 );
+                String sDate = simpleDateFormat.format( rs.getDate( 4 ) );
+                String eDate = simpleDateFormat.format( rs.getDate( 5 ) );
+                Integer orgUnitCount = rs.getInt( 6 );
+
+                if ( orgUnitCount != null && orgUnitCount > 0 )
+                {
+
+                    String key = dataSetID + ":" + dataElementID + ":" + optionID + ":" + sDate + ":" + eDate;
+                    partnerOrgUnitCountMap.put( key, orgUnitCount );
+                }
+            }
+        }
+        catch ( Exception e )
+        {
+            System.out.println( " In Partner Data Exception :" + e.getMessage() );
+            e.printStackTrace();
+        }
+
+        return partnerOrgUnitCountMap;
+    }
+
+    // get OrgUnit Count FromPartner
+    public Map<String, Integer> getOrgUnitCountFromPartner( Integer dataSetId, Integer dataElementId, Integer optionId )
+    {
+        Map<String, Integer> partnerOrgUnitCountMap = new HashMap<String, Integer>();
+
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat( "yyyy-MM-dd" );
+        // String curPeriod = simpleDateFormat.format( period.getEndDate() );
+
+        try
+        {
+            String query = "SELECT datasetid, dataelementid, optionid, startdate, enddate ,COUNT( organisationunitid ) FROM partner "
+                + " WHERE "
+                + " datasetid = "
+                + dataSetId
+                + " AND "
+                + " dataelementid = "
+                + dataElementId
+                + " AND "
+                + " optionid = " + optionId + " GROUP BY datasetid, dataelementid, startdate, enddate, optionid ";
+
+            SqlRowSet rs = jdbcTemplate.queryForRowSet( query );
+            while ( rs.next() )
+            {
+                Integer dataSetID = rs.getInt( 1 );
+                Integer dataElementID = rs.getInt( 2 );
+                Integer optionID = rs.getInt( 3 );
+                String sDate = simpleDateFormat.format( rs.getDate( 4 ) );
+                String eDate = simpleDateFormat.format( rs.getDate( 5 ) );
+                Integer orgUnitCount = rs.getInt( 6 );
+
+                if ( orgUnitCount != null && orgUnitCount > 0 )
+                {
+
+                    String key = dataSetID + ":" + dataElementID + ":" + optionID + ":" + sDate + ":" + eDate;
+                    partnerOrgUnitCountMap.put( key, orgUnitCount );
+                }
+            }
+        }
+        catch ( Exception e )
+        {
+            System.out.println( " In Partner Data Exception :" + e.getMessage() );
+            e.printStackTrace();
+        }
+
+        return partnerOrgUnitCountMap;
+    }
+
+    public Set<OrganisationUnit> getPartnerOrganisationUnits( Integer dataSetId, Integer dataElementId,
+        Integer optionId, String startDate, String endDate )
+    {
+        Set<OrganisationUnit> organisationUnits = new HashSet<OrganisationUnit>();
+
+        try
+        {
+
+            String query = "SELECT organisationunitid FROM partner " + " WHERE " + " datasetid = " + dataSetId
+                + " AND " + " dataelementid = " + dataElementId + " AND " + " optionid = " + optionId + " AND "
+                + " startdate >= '" + startDate + "' AND  enddate <= '" + endDate + "' ";
+
+            SqlRowSet rs = jdbcTemplate.queryForRowSet( query );
+            while ( rs.next() )
+            {
+                Integer organisationUnitId = rs.getInt( 1 );
+
+                if ( organisationUnitId != null )
+                {
+                    OrganisationUnit organisationUnit = organisationUnitService
+                        .getOrganisationUnit( organisationUnitId );
+                    organisationUnits.add( organisationUnit );
+                }
+            }
+        }
+
+        catch ( Exception ex )
+        {
+            System.out.println( " In Partner Data Exception :" + ex.getMessage() );
+            ex.printStackTrace();
+        }
+
+        return organisationUnits;
+
+    }
+
 }

=== added file 'local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/partner/action/GetPartnerDateListAction.java'
--- local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/partner/action/GetPartnerDateListAction.java	1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/partner/action/GetPartnerDateListAction.java	2014-11-20 06:34:00 +0000
@@ -0,0 +1,103 @@
+package org.hisp.dhis.rbf.partner.action;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.hisp.dhis.rbf.api.PartnerService;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Mithilesh Kumar Thakur
+ */
+public class GetPartnerDateListAction implements Action
+{
+
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
+
+    @Autowired
+    private PartnerService partnerService;
+
+    // -------------------------------------------------------------------------
+    // Input & Output Getter and Setter
+    // -------------------------------------------------------------------------
+
+    private Integer dataSetId;
+
+    public void setDataSetId( Integer dataSetId )
+    {
+        this.dataSetId = dataSetId;
+    }
+    
+    public Integer getDataSetId()
+    {
+        return dataSetId;
+    }
+
+    private Integer optionSetId;
+
+    public void setOptionSetId( Integer optionSetId )
+    {
+        this.optionSetId = optionSetId;
+    }
+
+    public Integer getOptionSetId()
+    {
+        return optionSetId;
+    }
+    
+    private Integer dataElementId;
+
+    public void setDataElementId( Integer dataElementId )
+    {
+        this.dataElementId = dataElementId;
+    }
+
+    public Integer getDataElementId()
+    {
+        return dataElementId;
+    }
+    
+    private List<String> partnerDateList = new ArrayList<String>();
+    
+    public List<String> getPartnerDateList()
+    {
+        return partnerDateList;
+    }
+    
+    private Map<String, Integer> partnerOrgUnitCountMap = new HashMap<String, Integer>();
+    
+    public Map<String, Integer> getPartnerOrgUnitCountMap()
+    {
+        return partnerOrgUnitCountMap;
+    }
+    
+    // -------------------------------------------------------------------------
+    // Action Implementation
+    // -------------------------------------------------------------------------
+
+    public String execute() throws Exception
+    {
+        partnerDateList = new ArrayList<String>();
+        partnerOrgUnitCountMap = new HashMap<String, Integer>();
+        
+        if( dataSetId != null && optionSetId != null && dataElementId != null )
+        {
+            partnerDateList = new ArrayList<String>( partnerService.getStartAndEndDate( dataSetId, dataElementId, optionSetId ) );
+            
+            partnerOrgUnitCountMap = new HashMap<String, Integer>( partnerService.getOrgUnitCountFromPartner( dataSetId, dataElementId, optionSetId ) );
+            
+            //this.paging = createPaging( partnerDateList.size() );
+            //partnerDateList = getBlockElement( partnerDateList, paging.getStartPos(), paging.getPageSize() );
+            
+        }
+        
+        return SUCCESS;
+    }
+}
+

=== modified file 'local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/partner/action/PartnerDataListAction.java'
--- local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/partner/action/PartnerDataListAction.java	2014-11-17 06:08:27 +0000
+++ local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/partner/action/PartnerDataListAction.java	2014-11-20 06:34:00 +0000
@@ -5,8 +5,9 @@
 /**
  * Created by Ganesh on 15/11/14.
  */
-public class PartnerDataListAction implements Action {
-
+public class PartnerDataListAction
+    implements Action
+{
 
     // -------------------------------------------------------------------------
     // Input & Output
@@ -33,9 +34,10 @@
         this.dataElementId = dataElementId;
     }
 
-
     @Override
-    public String execute() throws Exception {
+    public String execute()
+        throws Exception
+    {
         return SUCCESS;
     }
 }

=== added file 'local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/partner/action/RemovePartnerAction.java'
--- local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/partner/action/RemovePartnerAction.java	1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/partner/action/RemovePartnerAction.java	2014-11-20 06:34:00 +0000
@@ -0,0 +1,186 @@
+package org.hisp.dhis.rbf.partner.action;
+
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.hisp.dhis.dataelement.DataElement;
+import org.hisp.dhis.dataelement.DataElementService;
+import org.hisp.dhis.dataset.DataSet;
+import org.hisp.dhis.dataset.DataSetService;
+import org.hisp.dhis.option.OptionService;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.organisationunit.OrganisationUnitService;
+import org.hisp.dhis.period.Period;
+import org.hisp.dhis.period.PeriodService;
+import org.hisp.dhis.rbf.api.PBFDataValue;
+import org.hisp.dhis.rbf.api.PBFDataValueService;
+import org.hisp.dhis.rbf.api.Partner;
+import org.hisp.dhis.rbf.api.PartnerService;
+import org.hisp.dhis.user.CurrentUserService;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Mithilesh Kumar Thakur
+ */
+public class RemovePartnerAction implements Action
+{
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
+    
+    @Autowired
+    private PBFDataValueService pbfDataValueService;
+    
+    @Autowired
+    private OrganisationUnitService organisationUnitService;
+    
+    @Autowired
+    private PartnerService partnerService;
+
+    @Autowired
+    private CurrentUserService currentUserService;
+
+    @Autowired
+    private DataSetService dataSetService;
+    
+    @Autowired
+    private DataElementService dataElementService;
+    
+    @Autowired
+    private PeriodService periodService;
+    
+    @Autowired
+    private OptionService optionService;
+    
+    
+    // -------------------------------------------------------------------------
+    // Input & Output
+    // -------------------------------------------------------------------------
+    
+    private Integer dataSetId;
+    
+    public void setDataSetId( Integer dataSetId )
+    {
+        this.dataSetId = dataSetId;
+    }
+    
+    private Integer optionSetId;
+    
+    public void setOptionSetId( Integer optionSetId )
+    {
+        this.optionSetId = optionSetId;
+    }
+    
+    private Integer dataElementId;
+    
+    public void setDataElementId( Integer dataElementId )
+    {
+        this.dataElementId = dataElementId;
+    }
+    
+    private String startDate;
+    
+    public void setStartDate( String startDate )
+    {
+        this.startDate = startDate;
+    }
+    
+    private String endDate;
+    
+    public void setEndDate( String endDate )
+    {
+        this.endDate = endDate;
+    }
+
+    
+    // -------------------------------------------------------------------------
+    // Action
+    // -------------------------------------------------------------------------
+
+    public String execute() throws Exception
+    {
+        System.out.println( " Inside Delete partner" );
+        
+        SimpleDateFormat dateFormat = new SimpleDateFormat( "yyyy-MM-dd" );
+        
+        DataSet dataSet = dataSetService.getDataSet( dataSetId );
+        
+        DataElement dataElement = dataElementService.getDataElement( dataElementId );
+        
+        Date sDate = dateFormat.parse( startDate );
+        Date eDate = dateFormat.parse( endDate );
+        
+        //Period period = periodService.getPeriod( periodId );
+        
+        //Period period = periodService.getPeriod( sDate, eDate, dataSet.getPeriodType() );
+        
+        List<Period> periodsBetweenDates = new ArrayList<Period>();
+        
+        periodsBetweenDates =  new ArrayList<Period>( periodService.getPeriodsBetweenDates( dataSet.getPeriodType(), sDate, eDate ) );
+        
+        //periodService.getPeriod( arg0, arg1, arg2 )
+        
+        //Option option = optionService.getOption( optionSetId );
+        
+        Set<OrganisationUnit> partnerOrgUnits = new HashSet<OrganisationUnit>( partnerService.getPartnerOrganisationUnits( dataSetId, dataElementId, optionSetId, startDate, endDate ) );
+
+        for ( OrganisationUnit organisationUnit : partnerOrgUnits )
+        {
+            //System.out.println( " Period Id " + period.getId() );
+            
+            if( periodsBetweenDates!= null  && periodsBetweenDates.size() > 0 )
+            {
+                for( Period period : periodsBetweenDates )
+                {
+                    if( period!= null )
+                    {
+                        //System.out.println( " Inside delete partner from PBF Data Value" );
+                        // Delete partner in pbf datavalue
+                        
+                        //System.out.println( " Inside Delete partner PBF Data Value Period Id is : " + period.getIsoDate() );
+                        
+                        PBFDataValue pbfDataValue = pbfDataValueService.getPBFDataValue( organisationUnit, dataSet, period, dataElement );
+                        
+                        if ( pbfDataValue != null )
+                        {
+                            pbfDataValue.setOption( null );
+                            pbfDataValue.setTimestamp( new Date() );
+
+                            pbfDataValueService.updatePBFDataValue( pbfDataValue );
+                        }
+                    }
+                }
+            }
+            
+            //System.out.println( " orgUnit name -- " + organisationUnit.getName() );
+        }
+        
+        // Delete partner from partner
+      
+        //System.out.println( " partner source size "  + partnerOrgUnits.size() );
+        
+        for ( OrganisationUnit organisationUnit : partnerOrgUnits )
+        {
+            //System.out.println( " Inside Delete Partner from Partner Table" );
+            
+            Partner partner = partnerService.getPartner( organisationUnit, dataSet, dataElement, sDate, eDate );
+            
+            if ( partner != null )
+            {
+                partnerService.deletePartner( partner );
+                
+            }
+        }
+        
+        //System.out.println( " Size of orgUnitList First -- " + orgUnitList.size() );
+        
+        return SUCCESS;
+    }
+    
+}

=== modified file 'local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/partner/action/SavePartnerDetailsResultAction.java'
--- local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/partner/action/SavePartnerDetailsResultAction.java	2014-11-15 09:02:15 +0000
+++ local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/partner/action/SavePartnerDetailsResultAction.java	2014-11-20 06:34:00 +0000
@@ -140,14 +140,16 @@
         
         //Period period = periodService.getPeriod( periodId );
         
-        Period period = periodService.getPeriod( sDate, eDate, dataSet.getPeriodType() );
+        //Period period = periodService.getPeriod( sDate, eDate, dataSet.getPeriodType() );
         //periodService.getPeriod( arg0, arg1, arg2 )
         
         
+        List<Period> periodsBetweenDates = new ArrayList<Period>();
+        
+        periodsBetweenDates =  new ArrayList<Period>( periodService.getPeriodsBetweenDates( dataSet.getPeriodType(), sDate, eDate ) );
+        
         Option option = optionService.getOption( optionSetId );
         
-        
-        
         /*
         System.out.println( " Option name -- " + option.getName() );
         System.out.println( " dataSet name -- " + dataSet.getName() );
@@ -156,6 +158,9 @@
         */
         
         Set<OrganisationUnit> selectedOrgUnitList = new HashSet<OrganisationUnit>( selectionTreeManager.getReloadedSelectedOrganisationUnits() );
+        
+        //System.out.println( " selectedOrgUnitList " + selectedOrgUnitList.size() );
+        
         List<OrganisationUnit> orgUnitList = new ArrayList<OrganisationUnit>();
         
         for ( OrganisationUnit organisationUnit : selectedOrgUnitList )
@@ -163,21 +168,49 @@
             orgUnitList.addAll( organisationUnitService.getOrganisationUnitWithChildren( organisationUnit.getId() )  );
         }
         
+        //System.out.println( " Size of Children " + orgUnitList.size() );
+        
+        //System.out.println( " Size of Period List is  " + periodsBetweenDates.size() );
 
         for ( OrganisationUnit organisationUnit : orgUnitList )
         {
-            if( period!= null )
+            if( periodsBetweenDates!= null  && periodsBetweenDates.size() > 0 )
             {
-                System.out.println( " Inside save partner PBF Data Value" );
-             // save partner in pbf datavalue
-                PBFDataValue pbfDataValue = pbfDataValueService.getPBFDataValue( organisationUnit, dataSet, period, dataElement );
-                
-                if ( pbfDataValue != null )
+                for( Period period : periodsBetweenDates )
                 {
-                    pbfDataValue.setOption( option );
-                    pbfDataValue.setTimestamp( new Date() );
-
-                    pbfDataValueService.updatePBFDataValue( pbfDataValue );
+                    if( period != null )
+                    {
+                        //System.out.println( " Inside add partner PBF Data Value Period Id is : " + period.getIsoDate() );
+                        // save partner in pbf datavalue
+                        PBFDataValue pbfDataValue = pbfDataValueService.getPBFDataValue( organisationUnit, dataSet, period, dataElement );
+                        
+                        if( pbfDataValue == null )
+                        {
+                            pbfDataValue = new PBFDataValue();
+                            
+                            pbfDataValue.setDataSet( dataSet );
+                            pbfDataValue.setDataElement( dataElement );
+                            pbfDataValue.setPeriod( period );
+                            pbfDataValue.setOrganisationUnit( organisationUnit );
+                            
+                            pbfDataValue.setOption( option );
+                            pbfDataValue.setTimestamp( new Date() );
+                            
+                            
+                            pbfDataValueService.addPBFDataValue( pbfDataValue );
+                        }
+
+                        else
+                        {
+                            //System.out.println( " Inside update partner PBF Data Value Period Id is : " + period.getIsoDate() );
+                            
+                            pbfDataValue.setOption( option );
+                            pbfDataValue.setTimestamp( new Date() );
+
+                            pbfDataValueService.updatePBFDataValue( pbfDataValue );
+                        }
+                    }
+                    
                 }
             }
             
@@ -189,11 +222,11 @@
         
         dataSetSources.retainAll( orgUnitList );
         
-        System.out.println( " Data Set source size "  + dataSetSources.size() );
+        //System.out.println( " Data Set source size "  + dataSetSources.size() );
         
         for ( OrganisationUnit organisationUnit : dataSetSources )
         {
-            System.out.println( " Inside save partner Partner Table"  + dataSetSources.size() );
+            //System.out.println( " Inside save partner Partner Table"  + dataSetSources.size() );
             Partner partner = partnerService.getPartner( organisationUnit, dataSet, dataElement, sDate, eDate );
             
             if ( partner == null )

=== added file 'local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/partner/action/UpdatePartnerFormAction.java'
--- local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/partner/action/UpdatePartnerFormAction.java	1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/partner/action/UpdatePartnerFormAction.java	2014-11-20 06:34:00 +0000
@@ -0,0 +1,143 @@
+package org.hisp.dhis.rbf.partner.action;
+
+import org.hisp.dhis.dataelement.DataElement;
+import org.hisp.dhis.dataelement.DataElementService;
+import org.hisp.dhis.dataset.DataSet;
+import org.hisp.dhis.dataset.DataSetService;
+import org.hisp.dhis.option.Option;
+import org.hisp.dhis.option.OptionService;
+import org.hisp.dhis.oust.manager.SelectionTreeManager;
+import org.hisp.dhis.rbf.api.PartnerService;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Mithilesh Kumar Thakur
+ */
+public class UpdatePartnerFormAction implements Action
+{
+    //private final String OPTION_SET_PARTNER = "Partner";
+    
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
+    
+    private SelectionTreeManager selectionTreeManager;
+
+    public void setSelectionTreeManager( SelectionTreeManager selectionTreeManager )
+    {
+        this.selectionTreeManager = selectionTreeManager;
+    }
+    
+    @Autowired
+    private OptionService optionService;
+    
+    @Autowired
+    private DataSetService dataSetService;
+    
+    @Autowired
+    private DataElementService dataElementService;
+    
+    @Autowired
+    private PartnerService partnerService;
+    
+    // -------------------------------------------------------------------------
+    // Input & Output
+    // -------------------------------------------------------------------------
+
+    private Integer dataSetId;
+
+    public void setDataSetId( Integer dataSetId )
+    {
+        this.dataSetId = dataSetId;
+    }
+
+    private Integer optionSetId;
+
+    public void setOptionSetId( Integer optionSetId )
+    {
+        this.optionSetId = optionSetId;
+    }
+
+    private Integer dataElementId;
+
+    public void setDataElementId( Integer dataElementId )
+    {
+        this.dataElementId = dataElementId;
+    }
+
+    private String startDate;
+    
+    public void setStartDate( String startDate )
+    {
+        this.startDate = startDate;
+    }
+    
+    public String getStartDate()
+    {
+        return startDate;
+    }
+    
+    private String endDate;
+    
+    public void setEndDate( String endDate )
+    {
+        this.endDate = endDate;
+    }
+
+    public String getEndDate()
+    {
+        return endDate;
+    }
+
+    private DataSet dataSet;
+    
+    public DataSet getDataSet()
+    {
+        return dataSet;
+    }
+
+    private DataElement dataElement;
+    
+    public DataElement getDataElement()
+    {
+        return dataElement;
+    }
+
+    private Option option;
+    
+    public Option getOption()
+    {
+        return option;
+    }
+    
+    
+    // -------------------------------------------------------------------------
+    // Action Implementation
+    // -------------------------------------------------------------------------
+
+    public String execute() throws Exception
+    {
+        
+        dataSet = dataSetService.getDataSet( dataSetId );
+        
+        dataElement = dataElementService.getDataElement( dataElementId );
+        
+        option = optionService.getOption( optionSetId );
+        
+        selectionTreeManager.setSelectedOrganisationUnits( partnerService.getPartnerOrganisationUnits( dataSetId, dataElementId, optionSetId, startDate, endDate ) );
+        
+        /*
+        for ( Option option : options )
+        {       
+            option.getId();
+            
+            System.out.println( " Option Id -- " + option.getId() + " Option name -- " + option.getName() );
+        }
+        */
+        
+        return SUCCESS;
+    }
+}
+

=== modified file 'local/in/dhis-web-maintenance-rbf/src/main/resources/META-INF/dhis/beans.xml'
--- local/in/dhis-web-maintenance-rbf/src/main/resources/META-INF/dhis/beans.xml	2014-11-15 11:24:03 +0000
+++ local/in/dhis-web-maintenance-rbf/src/main/resources/META-INF/dhis/beans.xml	2014-11-20 06:34:00 +0000
@@ -800,38 +800,69 @@
 -->	
 	
 	
-    <!-- Partner Form -->
+    <!-- PBF Partner Fund Management -->
 
     <bean id="org.hisp.dhis.rbf.partner.action.PartnerFundManagement"
           class="org.hisp.dhis.rbf.partner.action.PartnerFundManagement"
           scope="prototype">
     </bean>
-
-    <bean id="org.hisp.dhis.rbf.partner.action.PartnerDataListAction"
-          class="org.hisp.dhis.rbf.partner.action.PartnerDataListAction"
+	
+	<!--  Load Partner List -->
+	
+    <bean id="org.hisp.dhis.rbf.partner.action.GetPartnerDateListAction"
+          class="org.hisp.dhis.rbf.partner.action.GetPartnerDateListAction"
           scope="prototype">
-    </bean>
+    </bean>	
 
+	<!--  Show Add Partner form -->	
     <bean id="org.hisp.dhis.rbf.partner.action.PartnerFormAction"
         class="org.hisp.dhis.rbf.partner.action.PartnerFormAction"
         scope="prototype">
     </bean>	
+	
+    <!-- Add/ Update Partner -->
+    <bean id="org.hisp.dhis.rbf.partner.action.SavePartnerDetailsResultAction"
+        class="org.hisp.dhis.rbf.partner.action.SavePartnerDetailsResultAction"
+        scope="prototype">
+        <property name="selectionTreeManager" ref="org.hisp.dhis.oust.manager.SelectionTreeManager" />
+        <property name="pbfDataValueService" ref="org.hisp.dhis.rbf.api.PBFDataValueService" />
+    </bean>		
+	
+
+	<!--  Show Update Partner form -->
+    <bean id="org.hisp.dhis.rbf.partner.action.UpdatePartnerFormAction"
+        class="org.hisp.dhis.rbf.partner.action.UpdatePartnerFormAction"
+        scope="prototype">
+        <property name="selectionTreeManager"
+            ref="org.hisp.dhis.oust.manager.SelectionTreeManager">
+        </property>        
+    </bean>	
+
+	<!--  Remove Partner -->
+	
+    <bean id="org.hisp.dhis.rbf.partner.action.RemovePartnerAction"
+          class="org.hisp.dhis.rbf.partner.action.RemovePartnerAction"
+          scope="prototype">
+    </bean>		
+
 
     <!-- Get DataElements and Periods List-->
     <bean id="org.hisp.dhis.rbf.partner.action.GetDataElementAndPeriodListAction"
         class="org.hisp.dhis.rbf.partner.action.GetDataElementAndPeriodListAction"
         scope="prototype">
+    </bean>	
+	
+	
+	<!-- 
+    <bean id="org.hisp.dhis.rbf.partner.action.PartnerDataListAction"
+          class="org.hisp.dhis.rbf.partner.action.PartnerDataListAction"
+          scope="prototype">
     </bean>
-
-	
-    <!-- Partner Form Save -->
-    <bean id="org.hisp.dhis.rbf.partner.action.SavePartnerDetailsResultAction"
-        class="org.hisp.dhis.rbf.partner.action.SavePartnerDetailsResultAction"
-        scope="prototype">
-        <property name="selectionTreeManager" ref="org.hisp.dhis.oust.manager.SelectionTreeManager" />
-        <property name="pbfDataValueService" ref="org.hisp.dhis.rbf.api.PBFDataValueService" />
-    </bean>		
-	
+	-->
+
+
+
+
 	
 	
 	

=== modified file 'local/in/dhis-web-maintenance-rbf/src/main/resources/org/hisp/dhis/rbf/i18n_module.properties'
--- local/in/dhis-web-maintenance-rbf/src/main/resources/org/hisp/dhis/rbf/i18n_module.properties	2014-10-24 11:05:35 +0000
+++ local/in/dhis-web-maintenance-rbf/src/main/resources/org/hisp/dhis/rbf/i18n_module.properties	2014-11-20 06:34:00 +0000
@@ -118,4 +118,22 @@
 dataSet = DataSet
 partner = Partner
 dataElement = DataElement
-
+confirm_delete_partner = Are you sure you want to delete Partner
+
+report_management = Report Management
+lookup = Lookup
+
+intro_pbf_dataentry = Introduction to PBF Data Entry
+intro_quality_score_entry = 
+intro_quality_max_entry = 
+intro_dataelement_tariff_target_management = 
+intro_partner_management =
+intro_bank_details_management = 
+intro_utilization_rule_management = 
+intro_quality_score_payment = 
+intro_manual_aggregation = 
+intro_aggregation_query_list = 
+intro_pbf_report = 
+intro_report_management = 
+intro_lookup =
+intro_payment_adjustment = 
\ No newline at end of file

=== modified file 'local/in/dhis-web-maintenance-rbf/src/main/resources/struts.xml'
--- local/in/dhis-web-maintenance-rbf/src/main/resources/struts.xml	2014-11-15 11:24:03 +0000
+++ local/in/dhis-web-maintenance-rbf/src/main/resources/struts.xml	2014-11-20 06:34:00 +0000
@@ -648,24 +648,50 @@
 	-->	
 
 
-   <!-- PBF Reports -->
-   <action name="partnerForm" class="org.hisp.dhis.rbf.partner.action.PartnerFormAction">
+   <!-- PBF Partner Fund Management -->
+   
+	<action name="partnerFundManagementForm" class="org.hisp.dhis.rbf.partner.action.PartnerFundManagement">
+		<result name="success" type="velocity">/main.vm</result>
+		<param name="page">/dhis-web-maintenance-rbf/partnerFundManagement.vm</param>
+		<param name="javascripts">../dhis-web-commons/oust/oust.js,javascript/partner.js</param>
+		<param name="menu">/dhis-web-maintenance-rbf/menu.vm</param>
+		<param name="requiredAuthorities">F_PBF_PARTNER</param>
+	</action>   
+
+	<!--  Load Partner List -->
+	<action name="getpartnerDateList" class="org.hisp.dhis.rbf.partner.action.GetPartnerDateListAction">
+	    <result name="success" type="velocity">/content.vm</result>
+	    <param name="page">/dhis-web-maintenance-rbf/partnerDateList.vm</param>
+	</action>
+	
+	<!--  Show Add Partner form -->	
+   	<action name="showAddPartnerForm" class="org.hisp.dhis.rbf.partner.action.PartnerFormAction">
        <result name="success" type="velocity">/content.vm</result>
         <param name="page">/dhis-web-maintenance-rbf/partnerForm.vm</param>
     </action>
 
-        <action name="partnerDataList" class="org.hisp.dhis.rbf.partner.action.PartnerDataListAction">
-            <result name="success" type="velocity">/content.vm</result>
-            <param name="page">/dhis-web-maintenance-rbf/partnerDataList.vm</param>
-        </action>
-   
-   <action name="partnerFundManagementForm" class="org.hisp.dhis.rbf.partner.action.PartnerFundManagement">
-        <result name="success" type="velocity">/main.vm</result>
-        <param name="page">/dhis-web-maintenance-rbf/partnerFundManagement.vm</param>
-        <param name="javascripts">javascript/partner.js</param>
-        <param name="menu">/dhis-web-maintenance-rbf/menu.vm</param>
-        <param name="requiredAuthorities">F_PBF_PARTNER</param>
-   </action>
+   	<!-- Add Partner -->
+   	<action name="addPartnerForm" class="org.hisp.dhis.rbf.partner.action.SavePartnerDetailsResultAction">
+   		<result name="success" type="velocity-json">/dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
+   	</action>
+   	
+	<!--  Show Update Partner form -->	
+   	<action name="showUpdatePartnerForm" class="org.hisp.dhis.rbf.partner.action.UpdatePartnerFormAction">
+       <result name="success" type="velocity">/content.vm</result>
+        <param name="page">/dhis-web-maintenance-rbf/updatePartnerForm.vm</param>
+    </action>   	
+
+   	<!-- Update Partner -->
+   	<action name="updatePartnerForm" class="org.hisp.dhis.rbf.partner.action.SavePartnerDetailsResultAction">
+   		<result name="success" type="velocity-json">/dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
+   	</action>
+   	
+   	
+	<!--  Remove Partner -->
+	<action name="removePartner" class="org.hisp.dhis.rbf.partner.action.RemovePartnerAction">
+		<result name="success" type="velocity-json">/dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
+		<result name="error" type="velocity-json">/dhis-web-commons/ajax/jsonResponseError.vm</result>
+	</action>    	
 
 
 	<!-- Get DataElements and Periods List-->
@@ -677,11 +703,26 @@
 
 
 
+
+
+
+	<!-- 
+	<action name="partnerDataList" class="org.hisp.dhis.rbf.partner.action.PartnerDataListAction">
+	    <result name="success" type="velocity">/content.vm</result>
+	    <param name="page">/dhis-web-maintenance-rbf/partnerDataList.vm</param>
+	</action>
+   	
+   	<action name="partnerForm" class="org.hisp.dhis.rbf.partner.action.PartnerFormAction">
+       <result name="success" type="velocity">/content.vm</result>
+        <param name="page">/dhis-web-maintenance-rbf/partnerForm.vm</param>
+    </action>
+	
     <action name="partnerFormResult" class="org.hisp.dhis.rbf.partner.action.SavePartnerDetailsResultAction">
         <result name="success" type="redirect">index.action</result>
         <param name="requiredAuthorities">F_PBF_PARTNER</param>
     </action>
-
+	
+	-->
 
 	</package>
 </struts>
\ No newline at end of file

=== modified file 'local/in/dhis-web-maintenance-rbf/src/main/webapp/dhis-web-maintenance-rbf/javascript/partner.js'
--- local/in/dhis-web-maintenance-rbf/src/main/webapp/dhis-web-maintenance-rbf/javascript/partner.js	2014-11-14 10:26:48 +0000
+++ local/in/dhis-web-maintenance-rbf/src/main/webapp/dhis-web-maintenance-rbf/javascript/partner.js	2014-11-20 06:34:00 +0000
@@ -1,8 +1,304 @@
 
+window.onload=function()
+{
+	jQuery('#addUpdatePartnerDiv').dialog({autoOpen: false});
+}
+
+// load partner list
+function loadPartnerList()
+{
+	$( '#partnerListDiv' ).html('');
+	
+	
+	var dataSetId = $( "#dataSetId" ).val();
+   	var optionSetId = $( "#optionSetId" ).val();
+	var dataElementId = $( "#dataElementId" ).val();
+	
+	if ( dataSetId == "-1" )
+	{
+		$( '#partnerListDiv' ).html('');
+		showWarningMessage( "Please Select DataSet" );
+		return false;
+	}	
+	
+	else if ( optionSetId == "-1" )
+	{
+		$( '#partnerListDiv' ).html('');
+		showWarningMessage( "Please Select Partner" );
+		return false;
+	}
+	
+	else if ( dataElementId == "-1" )
+	{
+		$( '#partnerListDiv' ).html('');
+		showWarningMessage( "Please Select DataElement" );
+		return false;
+	}
+	
+	else
+	{
+	    document.getElementById('overlayPartner').style.visibility = 'visible';
+		jQuery('#partnerListDiv').load('getpartnerDateList.action',
+			{
+				dataSetId:dataSetId,
+				optionSetId:optionSetId,
+				dataElementId:dataElementId
+			}, function()
+			{
+				showById('partnerListDiv');
+				document.getElementById('overlayPartner').style.visibility = 'hidden';
+			});
+	}
+}
+
+// show add partner form
+function showAddParentForm()
+{
+  //  jQuery('#addNewPeriod').dialog('destroy').remove();
+
+	var dataSetId = $( "#dataSetId" ).val();
+   	var optionSetId = $( "#optionSetId" ).val();
+	var dataElementId = $( "#dataElementId" ).val();
+
+	if ( dataSetId == "-1" )
+    {
+        showWarningMessage( "Please Select DataSet" );
+
+        return false;
+    }
+
+    else if( optionSetId == "-1" )
+    {
+        showWarningMessage( "Please Select Partner" );
+        return false;
+    }
+
+    else if( dataElementId == "-1" )
+    {
+        showWarningMessage( "Please Select DataElement" );
+        return false;
+    }
+	else
+	{ 		
+		jQuery('#addUpdatePartnerDiv').dialog('destroy').remove();
+		jQuery('<div id="addUpdatePartnerDiv">' ).load( 'showAddPartnerForm.action?dataSetId='+ dataSetId + "&optionSetId=" + optionSetId + "&dataElementId=" + dataElementId).dialog({
+			title: 'Add Partner Information',
+	        maximize: true,
+	        closable: true,
+	        modal:true,
+	        overlay:{background:'#000000', opacity:0.1},
+	        width: 600,
+	        height: 500
+		});
+	}
+    
+}
+
+
+function addPartner()
+{	
+	//document.forms['addPartnerForm'].submit();
+	//loadPartnerList();
+	
+	/*
+	$('#addUpdatePartnerDiv').on('change', function () {
+	    $('#addUpdatePartnerDiv').parent('form').submit();
+	});
+	*/
+	
+	
+	//alert("inside add partner");
+	lockScreen();
+	$.ajax({
+      type: "POST",
+      url: 'addPartnerForm.action',
+      data: getParamsForDiv('addUpdatePartnerDiv'),
+      success: function(json) {
+    	var type = json.response;
+		//alert("after  add partner");
+		jQuery('#addUpdatePartnerDiv').dialog('destroy').remove();
+		
+		unLockScreen();
+		
+		loadPartnerList();
+		
+      }
+     });
+     
+	
+     
+}
+
+//show update partner form
+function showUpdatePartnerForm( dataSetId, dataElementId, optionSetId, partnerStartDate , partnerEndDate )
+{
+  //  jQuery('#addNewPeriod').dialog('destroy').remove();
+
+	var dataSetId = $( "#dataSetId" ).val();
+   	var optionSetId = $( "#optionSetId" ).val();
+	var dataElementId = $( "#dataElementId" ).val();
+
+	if ( dataSetId == "-1" )
+    {
+        showWarningMessage( "Please Select DataSet" );
+
+        return false;
+    }
+
+    else if( optionSetId == "-1" )
+    {
+        showWarningMessage( "Please Select Partner" );
+        return false;
+    }
+
+    else if( dataElementId == "-1" )
+    {
+        showWarningMessage( "Please Select DataElement" );
+        return false;
+    }
+	else
+	{ 		
+		jQuery('#addUpdatePartnerDiv').dialog('destroy').remove();
+		jQuery('<div id="addUpdatePartnerDiv">' ).load( 'showUpdatePartnerForm.action?dataSetId='+ dataSetId + "&optionSetId=" + optionSetId + "&dataElementId=" + dataElementId + "&startDate=" + partnerStartDate + "&endDate=" + partnerEndDate ).dialog({
+	        title: 'Update Partner Information',
+	        maximize: true,
+	        closable: true,
+	        modal:true,
+	        overlay:{background:'#000000', opacity:0.1},
+	        width: 600,
+	        height: 500
+		});
+	}
+    
+}
+
+// update partner form
+function updatePartner()
+{
+	lockScreen();
+	
+	$.ajax({
+      type: "POST",
+      url: 'updatePartnerForm.action',
+      data: getParamsForDiv('addUpdatePartnerDiv'),
+      success: function(json) {
+		var type = json.response;
+		
+		jQuery('#addUpdatePartnerDiv').dialog('destroy').remove();
+		unLockScreen();
+		loadPartnerList();
+		
+      }
+     });
+}
+
+// close the window
+function closePopUpWindow()
+{
+	jQuery('#addUpdatePartnerDiv').dialog('destroy').remove();
+}
+
+function getParamsForDiv( partnerDiv )
+{
+	var params = '';
+	
+	//alert("Inside  PARAM");
+	
+	var dataSetId = getFieldValue('dataSetId');
+	params += '&dataSetId=' + dataSetId;
+	
+	var optionSetId = getFieldValue('optionSetId');
+	params += '&optionSetId=' + optionSetId;
+	
+	var dataElementId = getFieldValue('dataElementId');
+	params += '&dataElementId=' + dataElementId;
+	
+	var startDate = getFieldValue('startDate');
+	params += '&startDate=' + startDate;
+	
+	var endDate = getFieldValue('endDate');
+	params += '&endDate=' + endDate;
+	
+	//alert( "1 " + params )
+	
+	//params += "&" + getParamStringPartner( 'selectedOrganisationUnit', 'selectedOrganisationUnit' )
+	
+	//alert( "2 " + params );
+	
+	/*
+	jQuery("#" + partnerDiv + " :input").each(function()
+		{
+			var elementId = $(this).attr('id');
+			
+			if( $(this).attr('type') == 'checkbox' )
+			{
+				var checked = jQuery(this).attr('checked') ? true : false;
+				params += elementId + "=" + checked + "&";
+			}			
+			else if( $(this).attr('type') != 'button' )
+			{
+				var value = "";
+				if( jQuery(this).val() != '' )
+				{
+					value = htmlEncode(jQuery(this).val());
+				}
+				params += elementId + "="+ value + "&";
+			}
+			
+		});
+	*/
+	
+	//getParamStringPartner( elementId, param )
+	
+	//selectedUnits
+	
+	//params += "&" + getParamStringPartner( 'selectedUnits', 'selectedUnits' )
+	
+	//alert( "Final PARAM : " + params );
+	
+	return params;
+}
+
+
+function getParamStringPartner( elementId, param )
+{
+    var result = "";
+	var list = jQuery( "#" + elementId ).children();
+	
+	list.each( function( i, item ){
+		result += param + "=" + item.value;
+		result += (i < list.length-1) ? "&" : "";
+	});
+	
+	return result;
+}
+
+
+
+// Remove/Delete partnerDetails
+function removePartner( dataSetId, dataElementId, optionSetId, startDate, endDate )
+{
+	var result = window.confirm( i18n_confirm_delete );
+	
+	if ( result )
+	{
+		lockScreen();
+		$.ajax({
+		    type: "POST",
+		    url: 'removePartner.action?dataSetId='+ dataSetId + "&dataElementId=" + dataElementId + "&optionSetId=" + optionSetId + "&startDate=" + startDate + "&endDate=" + endDate,
+		    	success: function( json ) 
+		    	{
+		    		unLockScreen();
+		    		loadPartnerList();
+				}
+			});
+	}
+}
+
+
 // Load DataElement and Period List
 function loadDataElementAndPeriod()
 {
-
 	var dataSetId = $( '#dataSetId' ).val();
 	
 	if ( dataSetId == "-1" )
@@ -79,3 +375,33 @@
 	
 }
 
+
+
+/**
+ * Clock screen by mask *
+ */
+/*
+function lockScreen()
+{
+	jQuery.blockUI({ message: i18n_waiting , css: { 
+		border: 'none', 
+		padding: '15px', 
+		backgroundColor: '#000', 
+		'-webkit-border-radius': '10px', 
+		'-moz-border-radius': '10px', 
+		opacity: .5, 
+		color: '#fff'			
+	} }); 
+}
+*/
+
+/**
+ * unClock screen *
+ */
+/*
+function unLockScreen()
+{
+	jQuery.unblockUI();
+}
+*/
+

=== modified file 'local/in/dhis-web-maintenance-rbf/src/main/webapp/dhis-web-maintenance-rbf/javascript/utilizationRule.js'
--- local/in/dhis-web-maintenance-rbf/src/main/webapp/dhis-web-maintenance-rbf/javascript/utilizationRule.js	2014-06-20 10:21:56 +0000
+++ local/in/dhis-web-maintenance-rbf/src/main/webapp/dhis-web-maintenance-rbf/javascript/utilizationRule.js	2014-11-20 06:34:00 +0000
@@ -134,11 +134,11 @@
 }
 
 
-function getParamsForDiv( equipmentDiv )
+function getParamsForDiv( utilizationRateDiv )
 {
 	var params = '';
 	
-	jQuery("#" + equipmentDiv + " :input").each(function()
+	jQuery("#" + utilizationRateDiv + " :input").each(function()
 		{
 			var elementId = $(this).attr('id');
 			

=== modified file 'local/in/dhis-web-maintenance-rbf/src/main/webapp/dhis-web-maintenance-rbf/loadDataEntryForm.vm'
--- local/in/dhis-web-maintenance-rbf/src/main/webapp/dhis-web-maintenance-rbf/loadDataEntryForm.vm	2014-11-17 05:54:11 +0000
+++ local/in/dhis-web-maintenance-rbf/src/main/webapp/dhis-web-maintenance-rbf/loadDataEntryForm.vm	2014-11-20 06:34:00 +0000
@@ -136,7 +136,7 @@
             <!--<td><label>$!pbfDataValue.getOption().getDisplayName()</label></td>-->				
 			
 			#if( $pbfDataValue.getOption().getDisplayName() && $!pbfDataValue.getOption().getDisplayName() != "" )
-					<td><label>$!pbfDataValue.getOption().getDisplayName()</label></td>
+				<td><label>$!pbfDataValue.getOption().getDisplayName()</label></td>
 			#else
 				<td><label>Ministry of Health</label></td>
 			#end

=== modified file 'local/in/dhis-web-maintenance-rbf/src/main/webapp/dhis-web-maintenance-rbf/menu.vm'
--- local/in/dhis-web-maintenance-rbf/src/main/webapp/dhis-web-maintenance-rbf/menu.vm	2014-11-14 10:26:48 +0000
+++ local/in/dhis-web-maintenance-rbf/src/main/webapp/dhis-web-maintenance-rbf/menu.vm	2014-11-20 06:34:00 +0000
@@ -18,7 +18,7 @@
     	<li><a href="dataElementTariffManagement.action">$i18n.getString( "dataelement_tariff_target_management" )</a></li>
     #end	
 
-    #if( $auth.hasAccess( "dhis-web-maintenance-rbf", "partnerForm") )
+    #if( $auth.hasAccess( "dhis-web-maintenance-rbf", "partnerFundManagementForm") )
         <li><a href="partnerFundManagementForm.action">$i18n.getString( "partner_management" )</a></li>
     #end
 	

=== added file 'local/in/dhis-web-maintenance-rbf/src/main/webapp/dhis-web-maintenance-rbf/partnerDateList.vm'
--- local/in/dhis-web-maintenance-rbf/src/main/webapp/dhis-web-maintenance-rbf/partnerDateList.vm	1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-maintenance-rbf/src/main/webapp/dhis-web-maintenance-rbf/partnerDateList.vm	2014-11-20 06:34:00 +0000
@@ -0,0 +1,64 @@
+<script type="text/javascript">
+    jQuery(document).ready(function(){	
+		tableSorter( 'listTable' );	
+	});
+    
+</script>
+#if( $partnerDateList.size() > 0 )	
+<table class="mainPageTable">
+	<tr>
+		<td>
+			<table class="listTable" id="listTable"> 
+				<colgroup>
+					<col width="30"/>
+					<col />
+					<col />
+					<col/>
+					<col width="250"/>
+				</colgroup>   
+				<thead>
+					<tr>
+						<th>#</th>
+						<th>$i18n.getString( "start_date" )</th>
+						<th>$i18n.getString( "end_date" )</th>
+						<th>$i18n.getString( "# of Facilities" )</th> 
+						<th class="{sorter: false}" style="text-align:left">$i18n.getString( "operations" )</th>
+					</tr>
+				</thead>
+				<tbody id="list">   
+					#set( $count=1 )
+					#set( $mark = false )
+					
+					#foreach( $partnerDate in $partnerDateList )
+						
+						<tr #alternate($mark) id="tr${partnerDate}">
+							<td>
+								$count
+							</td>
+							
+							#set($partnerStartDate = $!partnerDate.split(":")[0])
+							#set($partnerEndDate = $!partnerDate.split(":")[1])
+							
+							#set( $mapKey = $dataSetId + ":" + $dataElementId + ":" + $optionSetId + ":" + $!partnerDate.split(":")[0] + ":" + $!partnerDate.split(":")[1] )
+							
+							<td>$partnerStartDate</td>
+							<td>$partnerEndDate</td>
+							<td>$!partnerOrgUnitCountMap.get( $mapKey )</td>
+						
+							<td>
+								<a href="javascript:showUpdatePartnerForm( '$dataSetId', '$dataElementId', '$optionSetId', '$partnerStartDate', '$partnerEndDate'  )" title='$i18n.getString( "edit" )'><img src="../images/edit.png" alt='$i18n.getString( "edit" )'></a>
+								<a href="javascript:removePartner( '$dataSetId', '$dataElementId', '$optionSetId', '$partnerStartDate', '$partnerEndDate' )" title='$i18n.getString( "remove" )'><img src="images/deleteRed.png" alt='$i18n.getString( "remove" )'></a>
+							</td>                               
+						</tr>
+						#set( $mark = !$mark)
+						#set($count = $count + 1)
+					#end
+				</tbody>
+			</table>
+		</td>
+	</tr>
+</table>
+
+#else
+	No Record Exits
+#end
\ No newline at end of file

=== modified file 'local/in/dhis-web-maintenance-rbf/src/main/webapp/dhis-web-maintenance-rbf/partnerForm.vm'
--- local/in/dhis-web-maintenance-rbf/src/main/webapp/dhis-web-maintenance-rbf/partnerForm.vm	2014-11-15 11:24:03 +0000
+++ local/in/dhis-web-maintenance-rbf/src/main/webapp/dhis-web-maintenance-rbf/partnerForm.vm	2014-11-20 06:34:00 +0000
@@ -1,6 +1,23 @@
-
+## Macro for generating the jQuery validation rules
+#macro( validate $type $require )
+  #if( $type == "NUMBER" )
+    {validate:{ number:true #if($require), required:true #end }}
+  #elseif( $require )
+    {validate:{required:true}}
+  #end
+#end
 <script type="text/javascript">
 
+//selection.setListenerFunction();
+
+/*
+function orgUnitHasBeenSelected( orgUnitIds )
+{
+
+}
+selection.setListenerFunction();
+*/
+
     function formValidations()
     {
         /*
@@ -50,11 +67,32 @@
 
 </script>
 
+<script type="text/javascript">
+    
+    jQuery(document).ready( function(){
+
+        currentDiv = 'addPartnerForm';
+        isSubmit = true;
+        jQuery("#addPartnerForm").validate({
+                 meta:"validate"
+                ,errorElement:"span"
+                ,submitHandler: function(form)
+                    {
+                        if( isSubmit ) 
+                        {
+                            addPartner();
+                        }
+                    }
+            });
+    }); 
+    
+	
+	
+</script>
 
 <h3>$i18n.getString( "partner_management" )</h3>
 
-<form id="partnerForm" name="partnerForm" action="partnerFormResult.action" method="post" onsubmit="return formValidations()" >
-
+<form id="addPartnerForm" name="addPartnerForm" method="post" >
     <table>
         <tr>
             <td><label for="dataSetId">$i18n.getString( "dataSet" )</label></td>
@@ -101,7 +139,7 @@
 
         <tr >
             <td style="width:40%;">Start Date <b class="mandatory">*</b> </td>
-            <td style="width:60%;"><input type="text" id="startDate" style="width:100%;" name = "startDate" />
+            <td style="width:60%;"><input type="text" id="startDate" style="width:100%;" name = "startDate" class="{validate:{required:true}}" />
                 <script type="text/javascript">
                     datePicker( 'startDate' );
                 </script>
@@ -110,7 +148,7 @@
 
         <tr >
             <td style="width:40%;">End Date <b class="mandatory">*</b> </td>
-            <td style="width:60%;"><input type="text" id="endDate" style="width:100%;" name = "endDate"  />
+            <td style="width:60%;"><input type="text" id="endDate" style="width:100%;" name = "endDate" class="{validate:{required:true}}" />
                 <script type="text/javascript">
                     datePicker( 'endDate' );
                 </script>
@@ -118,17 +156,21 @@
         </tr>
 
     </table>
-
+	
+	<!--<div id="selectionTree" style="width:328px; height:200px; overflow:auto; border:1px solid #ccc; margin-bottom: 8px;"></div>-->
+	
     <table id="selectionTable">
-        <tr>
+        
+		<tr>
             <td>
                 #organisationUnitSelectionTree( false, true, false )
             </td>
         </tr>
+		
         <tr>
             <td>
-                <input type="submit" id="saveButton" value="$i18n.getString( 'save' )" onclick="formValidations();" style="width:10em"/>
-                <input type="button" id="cancelButton" value="$i18n.getString( 'cancel' )" onclick="dialogWindowClose();" style="width:10em"/>
+                <input type="submit" id="saveButton" value="$i18n.getString( 'save' )"  style="width:10em"/>
+                <input type="button" id="cancelButton" value="$i18n.getString( 'cancel' )" onclick="closePopUpWindow();" style="width:10em"/>
             </td>
         </tr>
     </table>

=== modified file 'local/in/dhis-web-maintenance-rbf/src/main/webapp/dhis-web-maintenance-rbf/partnerFundManagement.vm'
--- local/in/dhis-web-maintenance-rbf/src/main/webapp/dhis-web-maintenance-rbf/partnerFundManagement.vm	2014-11-15 11:24:03 +0000
+++ local/in/dhis-web-maintenance-rbf/src/main/webapp/dhis-web-maintenance-rbf/partnerFundManagement.vm	2014-11-20 06:34:00 +0000
@@ -1,74 +1,31 @@
-<script type="text/javascript">
-
-
-    window.onload=function(){
-        jQuery('#addNewPeriod').dialog({autoOpen: false});
-    }
-
- function showAddParentForm()
-    {
-      //  jQuery('#addNewPeriod').dialog('destroy').remove();
-
-		var dataSetId = $( "#dataSetId" ).val();
-       	var optionSetId = $( "#optionSetId" ).val();
- 		var dataElementId = $( "#dataElementId" ).val();
-
-		if ( dataSetId == "-1" )
-        {
-            showWarningMessage( "Please Select DataSet" );
-
-            return false;
-        }
-
-        else if( optionSetId == "-1" )
-        {
-            showWarningMessage( "Please Select Partner" );
-            return false;
-        }
-
-        else if( dataElementId == "-1" )
-        {
-            showWarningMessage( "Please Select DataElement" );
-            return false;
-        }
-		else
-		{ 		
-        jQuery('<div id="addNewPeriod">' ).load( 'partnerForm.action?dataSetId='+ dataSetId + "&optionSetId=" + optionSetId + "&dataElementId=" + dataElementId).dialog({
-            title: 'Add New Period',
-            maximize: true,
-            closable: true,
-            modal:true,
-            overlay:{background:'#000000', opacity:0.1},
-            width: 600,
-            height: 500
-        });
-	}
-        
- }
-
-    function showParentList(){
-        jQuery('#showList' ).load( 'partnerDataList.action?dataSetId='+ dataSetId + "&optionSetId=" + optionSetId + "&dataElementId=" + dataElementId).dialog({
-            title: 'Add New Period',
-            maximize: true,
-            closable: true,
-            modal:true,
-            overlay:{background:'#000000', opacity:0.1},
-            width: 600,
-            height: 500
-        });
-    }
-
-</script>
+<style>
+    #overlayPartner {
+    z-index:9998;
+    position:absolute;
+    top:0;
+    bottom:0;
+    left:0;
+    width:100%;
+    background:#000;
+    opacity:0.45;
+    -moz-opacity:0.45;
+    filter:alpha(opacity=45);
+    visibility:hidden;   
+    }
+    #overlayImgPartner{ width: 50px; height: 50px; z-index: 9999; position: absolute; left:50%}
+</style>
+<div id="overlayPartner">
+    <div id="overlayImgPartner"><img  width="50" height="50" src="images/ajax-loader.gif" style="margin:auto;position:fixed;top: 50%;left: 50%;"/></div>
+</div>
+
 
 
 <h3>$i18n.getString( "partner_management" )</h3>
 
-<form id="partnerFundForm" name="partnerFundForm" action="partnerFormResult.action" method="post" onsubmit="return formValidations()" >
-
     <table>
         <tr>
             <td><label for="dataSetId">$i18n.getString( "dataSet" )</label></td>
-            <td><select id="dataSetId" name="dataSetId" style="width:220px" onchange="loadDataElementAndPeriod()" >
+            <td><select id="dataSetId" name="dataSetId" style="width:220px" onchange="loadDataElementAndPeriod()" #if( $dataSets.size() == 0 ) disabled="disabled" #end >
                 <option value="-1">[$i18n.getString( "select" )]</option>
                 #foreach( $dataSet in $dataSets )
                     <option value="$dataSet.id" text="$dataSet.name">$encoder.htmlEncode( $dataSet.name )</option>
@@ -79,7 +36,7 @@
 
         <tr>
             <td><label for="partner">$i18n.getString( "partner" )</label></td>
-            <td><select id="optionSetId" name="optionSetId" style="width:220px" >
+            <td><select id="optionSetId" name="optionSetId" style="width:220px" #if( $dataSets.size() == 0 ) disabled="disabled" #end >
                 <option value="-1">[$i18n.getString( "select" )]</option>
                 #foreach( $option in $options )
                     <option value="$option.id" text="$option.name">$encoder.htmlEncode( $option.name )</option>
@@ -91,7 +48,7 @@
         <tr>
             <td><label>$i18n.getString( "dataElement" )</label></td>
             <td>
-                <select id="dataElementId" name = "dataElementId" style="width:220px" >
+                <select id="dataElementId" name = "dataElementId" style="width:220px"  onchange="loadPartnerList();" #if( $dataSets.size() == 0 ) disabled="disabled" #end >
                     <option value="-1">[$i18n.getString( "select" )]</option>
                 </select>
             </td>
@@ -101,36 +58,17 @@
     <div style="width:100%">
         <input type="button" value="Add New Period" style="float:right;" id="openPeriod" onclick="showAddParentForm();" />
     </div>
-    <br/><br/>
-
-
-
-    <div id="showList"></div>
-
-  <!--  <div style="width:100%;" id="periodTable">
-
-       <table id="periodDetails" name="periodDetails" class="mainPageTable">
-            <thead >
-            <tr >
-                <th >Start Date</th>
-                <th >End Date</th>
-                <th ># of Facilities</th>
-            </tr>
-            </thead>
-
-            <tbody>
-                <tr>
-                    <td></td>
-                    <td></td>
-                    <td></td>
-                </tr>
-            </tbody>
-        </table>
-    </div>
-    
-     <div style="width:100%">
-        <input type="submit" value="Save" style="float:right;" id="save" />
-        <input type="button" value="Cancel" style="float:right;" id="cancel" />
-    </div> -->
-
-    </form>
\ No newline at end of file
+    <br/>
+
+#parse( "/dhis-web-commons/loader/loader.vm" )
+<div id='partnerListDiv'></div> <!-- Partner List -->
+<div id='addUpdatePartnerDiv'></div> <!-- Add/Update Partner  --> 
+ 
+<script type="text/javascript">
+
+var i18n_select_dataelement = '$encoder.jsEscape( $i18n.getString( "select_dataElement" ) , "'")';
+var i18n_confirm_delete = '$encoder.jsEscape( $i18n.getString( "confirm_delete_partner" ) , "'" )';
+jQuery( document ).ready( function()
+{
+});
+</script>

=== added file 'local/in/dhis-web-maintenance-rbf/src/main/webapp/dhis-web-maintenance-rbf/partnerFundManagement_old.vm'
--- local/in/dhis-web-maintenance-rbf/src/main/webapp/dhis-web-maintenance-rbf/partnerFundManagement_old.vm	1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-maintenance-rbf/src/main/webapp/dhis-web-maintenance-rbf/partnerFundManagement_old.vm	2014-11-20 06:34:00 +0000
@@ -0,0 +1,136 @@
+<script type="text/javascript">
+
+
+    window.onload=function(){
+        jQuery('#addNewPeriod').dialog({autoOpen: false});
+    }
+
+ function showAddParentForm()
+    {
+      //  jQuery('#addNewPeriod').dialog('destroy').remove();
+
+		var dataSetId = $( "#dataSetId" ).val();
+       	var optionSetId = $( "#optionSetId" ).val();
+ 		var dataElementId = $( "#dataElementId" ).val();
+
+		if ( dataSetId == "-1" )
+        {
+            showWarningMessage( "Please Select DataSet" );
+
+            return false;
+        }
+
+        else if( optionSetId == "-1" )
+        {
+            showWarningMessage( "Please Select Partner" );
+            return false;
+        }
+
+        else if( dataElementId == "-1" )
+        {
+            showWarningMessage( "Please Select DataElement" );
+            return false;
+        }
+		else
+		{ 		
+        jQuery('<div id="addNewPeriod">' ).load( 'partnerForm.action?dataSetId='+ dataSetId + "&optionSetId=" + optionSetId + "&dataElementId=" + dataElementId).dialog({
+            title: 'Add New Period',
+            maximize: true,
+            closable: true,
+            modal:true,
+            overlay:{background:'#000000', opacity:0.1},
+            width: 600,
+            height: 500
+        });
+	}
+        
+ }
+
+    function showParentList(){
+        jQuery('#showList' ).load( 'partnerDataList.action?dataSetId='+ dataSetId + "&optionSetId=" + optionSetId + "&dataElementId=" + dataElementId).dialog({
+            title: 'Add New Period',
+            maximize: true,
+            closable: true,
+            modal:true,
+            overlay:{background:'#000000', opacity:0.1},
+            width: 600,
+            height: 500
+        });
+    }
+
+</script>
+
+
+<h3>$i18n.getString( "partner_management" )</h3>
+
+<form id="partnerFundForm" name="partnerFundForm" action="partnerFormResult.action" method="post" onsubmit="return formValidations()" >
+
+    <table>
+        <tr>
+            <td><label for="dataSetId">$i18n.getString( "dataSet" )</label></td>
+            <td><select id="dataSetId" name="dataSetId" style="width:220px" onchange="loadDataElementAndPeriod()" >
+                <option value="-1">[$i18n.getString( "select" )]</option>
+                #foreach( $dataSet in $dataSets )
+                    <option value="$dataSet.id" text="$dataSet.name">$encoder.htmlEncode( $dataSet.name )</option>
+                #end
+            </select>
+            </td>
+        </tr>
+
+        <tr>
+            <td><label for="partner">$i18n.getString( "partner" )</label></td>
+            <td><select id="optionSetId" name="optionSetId" style="width:220px" >
+                <option value="-1">[$i18n.getString( "select" )]</option>
+                #foreach( $option in $options )
+                    <option value="$option.id" text="$option.name">$encoder.htmlEncode( $option.name )</option>
+                #end
+            </select>
+            </td>
+        </tr>
+
+        <tr>
+            <td><label>$i18n.getString( "dataElement" )</label></td>
+            <td>
+                <select id="dataElementId" name = "dataElementId" style="width:220px" >
+                    <option value="-1">[$i18n.getString( "select" )]</option>
+                </select>
+            </td>
+        </tr>
+    </table>
+
+    <div style="width:100%">
+        <input type="button" value="Add New Period" style="float:right;" id="openPeriod" onclick="showAddParentForm();" />
+    </div>
+    <br/><br/>
+
+
+
+    <div id="showList"></div>
+
+  <!--  <div style="width:100%;" id="periodTable">
+
+       <table id="periodDetails" name="periodDetails" class="mainPageTable">
+            <thead >
+            <tr >
+                <th >Start Date</th>
+                <th >End Date</th>
+                <th ># of Facilities</th>
+            </tr>
+            </thead>
+
+            <tbody>
+                <tr>
+                    <td></td>
+                    <td></td>
+                    <td></td>
+                </tr>
+            </tbody>
+        </table>
+    </div>
+    
+     <div style="width:100%">
+        <input type="submit" value="Save" style="float:right;" id="save" />
+        <input type="button" value="Cancel" style="float:right;" id="cancel" />
+    </div> -->
+
+    </form>
\ No newline at end of file

=== added file 'local/in/dhis-web-maintenance-rbf/src/main/webapp/dhis-web-maintenance-rbf/updatePartnerForm.vm'
--- local/in/dhis-web-maintenance-rbf/src/main/webapp/dhis-web-maintenance-rbf/updatePartnerForm.vm	1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-maintenance-rbf/src/main/webapp/dhis-web-maintenance-rbf/updatePartnerForm.vm	2014-11-20 06:34:00 +0000
@@ -0,0 +1,86 @@
+## Macro for generating the jQuery validation rules
+#macro( validate $type $require )
+  #if( $type == "NUMBER" )
+    {validate:{ number:true #if($require), required:true #end }}
+  #elseif( $require )
+    {validate:{required:true}}
+  #end
+#end
+
+<script type="text/javascript">
+    
+    jQuery(document).ready( function(){
+
+        currentDiv = 'updatePartnerForm';
+        isSubmit = true;
+        jQuery("#updatePartnerForm").validate({
+                 meta:"validate"
+                ,errorElement:"span"
+                ,submitHandler: function(form)
+                    {
+                        if( isSubmit ) 
+                        {
+                            updatePartner();
+                        }
+                    }
+            });
+    }); 
+    
+</script>
+
+<h3>$i18n.getString( "partner_management" )</h3>
+
+<form id="updatePartnerForm" name="updatePartnerForm"  method="post">
+    <table>
+        <tr>
+            <td><label for="dataSetId">$i18n.getString( "dataSet" )</label></td>
+            <td><input type="hidden" id="dataSetId" name="dataSetId" value="$dataSet.id">$dataSet.name</td>
+        </tr>
+
+        <tr>
+            <td><label for="partner">$i18n.getString( "partner" )</label></td>
+            <td><input type="hidden" id="optionSetId" name="optionSetId" value="$option.id">$option.name</td>
+            
+        </tr>
+
+        <tr>
+            <td><label>$i18n.getString( "dataElement" )</label></td>
+			<td><input type="hidden"  id="dataElementId" name="dataElementId" value="$dataElement.id">$dataElement.name</td>
+            
+        </tr>
+        <tr>
+            <td style="width:40%;">Start Date <b class="mandatory">*</b> </td>
+            <td style="width:60%;"><input type="text" id="startDate" style="width:100%;" name = "startDate" class="{validate:{required:true}}" value="$startDate" />
+                <script type="text/javascript">
+                    datePicker( 'startDate' );
+                </script>
+            </td>
+        </tr>
+
+        <tr >
+            <td style="width:40%;">End Date <b class="mandatory">*</b> </td>
+            <td style="width:60%;"><input type="text" id="endDate" style="width:100%;" name = "endDate" class="{validate:{required:true}}" value="$endDate" />
+                <script type="text/javascript">
+                    datePicker( 'endDate' );
+                </script>
+            </td>
+        </tr>
+
+    </table>
+	
+	<!--<div id="selectionTree" style="width:328px; height:200px; overflow:auto; border:1px solid #ccc; margin-bottom: 8px;"></div>-->
+    <table id="selectionTable">
+        <tr>
+            <td>
+                #organisationUnitSelectionTree( false, true, false )
+            </td>
+        </tr>
+        <tr>
+            <td>
+                <input type="submit" id="saveButton" value="$i18n.getString( 'save' )"  style="width:10em"/>
+                <input type="button" id="cancelButton" value="$i18n.getString( 'cancel' )" onclick="closePopUpWindow();" style="width:10em"/>
+            </td>
+        </tr>
+    </table>
+
+</form>

=== modified file 'local/in/dhis-web-maintenance-rbf/src/main/webapp/dhis-web-maintenance-rbf/welcome.vm'
--- local/in/dhis-web-maintenance-rbf/src/main/webapp/dhis-web-maintenance-rbf/welcome.vm	2014-11-14 10:26:48 +0000
+++ local/in/dhis-web-maintenance-rbf/src/main/webapp/dhis-web-maintenance-rbf/welcome.vm	2014-11-20 06:34:00 +0000
@@ -5,11 +5,11 @@
     <!-- action name, Text Title, image id -->
 
     #if( $auth.hasAccess( "dhis-web-maintenance-rbf", "pbfDataEntry") )
-	    #introListImgItem( "pbfDataEntry.action" "pbf_dataentry" "dataelement" )
+	    #introListImgItem( "pbfDataEntry.action" "pbf_dataentry" "pbf_data_entry" )
 	#end
 
 	#if( $auth.hasAccess( "dhis-web-maintenance-rbf", "qualityScoreDataEntry") )
-	    #introListImgItem( "qualityScoreDataEntry.action" "quality_score_entry" "dataelement" )
+	    #introListImgItem( "qualityScoreDataEntry.action" "quality_score_entry" "minmaxvaluegeneration" )
 	#end
 
 	#if( $auth.hasAccess( "dhis-web-maintenance-rbf", "qualityMaxDataEntry") )
@@ -17,19 +17,19 @@
     #end
 
     #if( $auth.hasAccess( "dhis-web-maintenance-rbf", "dataElementTariffManagement") )
-        #introListImgItem( "dataElementTariffManagement.action" "dataelement_tariff_target_management" "groupset" )
+        #introListImgItem( "dataElementTariffManagement.action" "dataelement_tariff_target_management" "dataelement_tariff_target" )
     #end
 
-    #if( $auth.hasAccess( "dhis-web-maintenance-rbf", "partnerForm") )
-        #introListImgItem( "partnerForm.action" "partner_management" "category" )
+    #if( $auth.hasAccess( "dhis-web-maintenance-rbf", "partnerFundManagementForm") )
+        #introListImgItem( "partnerFundManagementForm.action" "partner_management" "partner" )
     #end
 
     #if( $auth.hasAccess( "dhis-web-maintenance-rbf", "bankDetailsManagement") )
-        #introListImgItem( "bankDetailsManagement.action" "bank_details_management" "category" )
+        #introListImgItem( "bankDetailsManagement.action" "bank_details_management" "bank_details" )
     #end
 
     #if( $auth.hasAccess( "dhis-web-maintenance-rbf", "utilizationRuleManagement") )
-        #introListImgItem( "utilizationRuleManagement.action" "utilization_rule_management" "category" )
+        #introListImgItem( "utilizationRuleManagement.action" "utilization_rule_management" "utilization" )
     #end
 
     #if( $auth.hasAccess( "dhis-web-maintenance-rbf", "qualityScorePaymentList") )
@@ -37,20 +37,20 @@
     #end
 
     #if( $auth.hasAccess( "dhis-web-maintenance-rbf", "aggregationQueryList") )
-        #introListImgItem( "aggregationQueryList.action" "aggregation_query_list" "sqlview" )
+		 #introListImgItem( "aggregationQueryList.action" "aggregation_query_list" "sqlview" )
          #introListImgItem( "runAggregationQueryForm.action" "manual_aggregation" "scheduling" )
     #end
 
     #if( $auth.hasAccess( "dhis-web-maintenance-rbf", "reportManagement") )
-        #introListImgItem( "reportManagement.action" "Report Management" "indicator" )
+        #introListImgItem( "reportManagement.action" "report_management" "indicator" )
         #introListImgItem( "pbfReportForm.action" "pbf_report" "reporttable" )
     #end
 
     #if( $auth.hasAccess( "dhis-web-maintenance-rbf", "getAllLookups") )
-        #introListImgItem( "getAllLookups.action" "Lookup" "search" )
+        #introListImgItem( "getAllLookups.action" "lookup" "search" )
     #end
     #if( $auth.hasAccess( "dhis-web-maintenance-rbf", "getPaymentAdjustmentDetail") )
-        #introListImgItem( "getPaymentAdjustmentDetail.action" "payment_adjustment" "sqlview" )
+        #introListImgItem( "getPaymentAdjustmentDetail.action" "payment_adjustment" "payment" )
     #end