← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 15196: RBF: Extending Tariffmgt to set tariff for parent and orgunit group comination; API for QualitySc...

 

------------------------------------------------------------
revno: 15196
committer: Bharath <chbharathk@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2014-05-08 12:03:37 +0100
message:
  RBF: Extending Tariffmgt to set tariff for parent and orgunit group comination; API for QualityScorePayment object
added:
  local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/api/QualityScorePayment.java
  local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/api/QualityScorePaymentService.java
  local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/api/QualityScorePaymentStore.java
  local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/impl/DefaultQualityScorePaymentService.java
  local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/impl/HibernateQualityScorePaymentStore.java
  local/in/dhis-web-maintenance-rbf/src/main/resources/org/hisp/dhis/rbf/hibernate/QualityScorePayment.hbm.xml
modified:
  dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/DefaultImportService.java
  dhis-2/dhis-web/dhis-web-portal/india-pom.xml
  local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/action/AddTariffDataAction.java
  local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/action/DeleteTariffDataAction.java
  local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/action/LoadTariffDetailsAction.java
  local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/action/ValidateTariffDataAction.java
  local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/api/TariffDataValue.java
  local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/api/TariffDataValueService.java
  local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/api/TariffDataValueStore.java
  local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/dataentry/LoadDataEntryFormAction.java
  local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/dataentry/SaveValueAction.java
  local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/impl/DefaultTariffDataValueService.java
  local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/impl/HibernateTariffDataValueStore.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/hibernate/TariffDataValue.hbm.xml
  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/pbfDataEntry.js
  local/in/dhis-web-maintenance-rbf/src/main/webapp/dhis-web-maintenance-rbf/loadDataElementsforTariff.vm
  local/in/dhis-web-maintenance-rbf/src/main/webapp/dhis-web-maintenance-rbf/loadTariffData.vm


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

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/DefaultImportService.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/DefaultImportService.java	2014-05-05 18:01:22 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/DefaultImportService.java	2014-05-08 11:03:37 +0000
@@ -123,7 +123,7 @@
                 log.info( "Saved zipstream to file: " + tempZipFile.getAbsolutePath() );
 
                 zipFile = new ZipFile( tempZipFile );
-
+                
                 xmlDataStream = new BufferedInputStream( ZipAnalyzer.getTransformableStream( zipFile ) );
 
             }

=== modified file 'dhis-2/dhis-web/dhis-web-portal/india-pom.xml'
--- dhis-2/dhis-web/dhis-web-portal/india-pom.xml	2014-04-22 15:46:19 +0000
+++ dhis-2/dhis-web/dhis-web-portal/india-pom.xml	2014-05-08 11:03:37 +0000
@@ -2,21 +2,21 @@
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
   xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd";>
   <modelVersion>4.0.0</modelVersion>
-  
+
   <parent>
     <groupId>org.hisp.dhis</groupId>
     <artifactId>dhis-web</artifactId>
     <version>2.16-SNAPSHOT</version>
   </parent>
-  
+
   <artifactId>dhis-web-india-portal</artifactId>
   <packaging>war</packaging>
   <name>DHIS Web Portal</name>
-  
+
   <build>
     <finalName>dhis</finalName>
   </build>
-  
+
   <dependencies>
 
     <dependency>
@@ -28,6 +28,10 @@
 
     <dependency>
       <groupId>org.hisp.dhis</groupId>
+      <artifactId>dhis-api</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.hisp.dhis</groupId>
       <artifactId>dhis-web-commons</artifactId>
     </dependency>
     <dependency>
@@ -35,6 +39,10 @@
       <artifactId>dhis-web-commons-resources</artifactId>
       <type>war</type>
     </dependency>
+    <dependency>
+      <groupId>org.hisp.dhis</groupId>
+      <artifactId>dhis-service-core</artifactId>
+    </dependency>
 
     <!-- Web-API modules -->
 
@@ -176,26 +184,43 @@
       <version>${project.version}</version>
       <type>war</type>
     </dependency>
-    
-	
-	<!-- India modules -->    
+    <dependency>
+      <groupId>org.hisp.dhis</groupId>
+      <artifactId>dhis-web-event-capture</artifactId>
+      <version>${project.version}</version>
+      <type>war</type>
+    </dependency>
+    <dependency>
+      <groupId>org.hisp.dhis</groupId>
+      <artifactId>dhis-web-event-reports</artifactId>
+      <version>${project.version}</version>
+      <type>war</type>
+    </dependency>
+    <dependency>
+      <groupId>org.hisp.dhis</groupId>
+      <artifactId>dhis-web-tracker-capture</artifactId>
+      <version>${project.version}</version>
+      <type>war</type>
+    </dependency>
+    <dependency>
+      <groupId>org.hisp.dhis</groupId>
+      <artifactId>dhis-web-maintenance-appmanager</artifactId>
+      <version>${project.version}</version>
+      <type>war</type>
+    </dependency>
+	
+	
+	<!-- India Modules -->
+	
 	<dependency>
       <groupId>org.hisp.dhis</groupId>
-      <artifactId>dhis-web-maintenance-ccem</artifactId>
-      <version>${project.version}</version>
-      <type>war</type>
-    </dependency>
-    <dependency>
-      <groupId>org.hisp.dhis</groupId>
-      <artifactId>dhis-web-coldchain</artifactId>
+      <artifactId>dhis-web-maintenance-pbf</artifactId>
       <version>${project.version}</version>
       <type>war</type>
     </dependency>
 	
   </dependencies>
-  
   <properties>
     <rootDir>../../</rootDir>
   </properties>
-
 </project>

=== modified file 'local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/action/AddTariffDataAction.java'
--- local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/action/AddTariffDataAction.java	2014-04-27 08:51:10 +0000
+++ local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/action/AddTariffDataAction.java	2014-05-08 11:03:37 +0000
@@ -7,6 +7,7 @@
 import org.hisp.dhis.dataelement.DataElementService;
 import org.hisp.dhis.dataset.DataSet;
 import org.hisp.dhis.dataset.DataSetService;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.organisationunit.OrganisationUnitGroup;
 import org.hisp.dhis.organisationunit.OrganisationUnitGroupService;
 import org.hisp.dhis.organisationunit.OrganisationUnitService;
@@ -84,19 +85,22 @@
     
     private Integer orgUnitGroupId;
     
-    public void setOrgUnitGroupId(Integer orgUnitGroupId) {
-		this.orgUnitGroupId = orgUnitGroupId;
-	}
-
-	public void setTarget(String target) {
-		this.target = target;
-	}
-
-	public void setTargetPercentage(String targetPercentage) {
-		this.targetPercentage = targetPercentage;
-	}
-
-	public void setDataElementId( String dataElementId )
+    public void setOrgUnitGroupId(Integer orgUnitGroupId)
+    {
+	this.orgUnitGroupId = orgUnitGroupId;
+    }
+
+    public void setTarget(String target) 
+    {
+	this.target = target;
+    }
+
+    public void setTargetPercentage(String targetPercentage) 
+    {
+	this.targetPercentage = targetPercentage;
+    }
+
+    public void setDataElementId( String dataElementId )
     {
         this.dataElementId = dataElementId;
     }
@@ -140,13 +144,13 @@
 
         DataElement dataElement = dataElementService.getDataElement( Integer.parseInt( dataElementId ) );
 
-        //OrganisationUnit organisationUnit = organisationUnitService.getOrganisationUnit( orgUnitUid );
+        OrganisationUnit organisationUnit = organisationUnitService.getOrganisationUnit( orgUnitUid );
         
         OrganisationUnitGroup orgUnitGroup = orgUnitGroupService.getOrganisationUnitGroup( orgUnitGroupId );
 
         DataSet dataSet = dataSetService.getDataSet( Integer.parseInt( pbfType ) );
         
-        TariffDataValue tariffDataValue = tariffDataValueService.getTariffDataValue( orgUnitGroup, dataElement, dataSet, sDate, eDate );
+        TariffDataValue tariffDataValue = tariffDataValueService.getTariffDataValue( organisationUnit, orgUnitGroup, dataElement, dataSet, sDate, eDate );
 
         if ( tariffDataValue == null )
         {
@@ -167,8 +171,9 @@
             tariffDataValue.setStoredBy( currentUserService.getCurrentUsername() );
             tariffDataValue.setDataElement( dataElement );
             tariffDataValue.setDataSet( dataSet );
-            //tariffDataValue.setOrganisationUnit( organisationUnit );
+            tariffDataValue.setOrganisationUnit( organisationUnit );
             tariffDataValue.setOrgUnitGroup( orgUnitGroup );
+            tariffDataValue.setOrgUnitLevel( organisationUnit.getOrganisationUnitLevel() );
             
             tariffDataValueService.addTariffDataValue( tariffDataValue );
             System.out.println("Tariff Data Added");

=== modified file 'local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/action/DeleteTariffDataAction.java'
--- local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/action/DeleteTariffDataAction.java	2014-04-30 05:26:01 +0000
+++ local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/action/DeleteTariffDataAction.java	2014-05-08 11:03:37 +0000
@@ -116,13 +116,13 @@
         DataElement dataElement = dataElementService.getDataElement( dataElementId );
         DataSet dataSet = dataSetService.getDataSet( dataSetId );
         
-        //OrganisationUnit organisationUnit = organisationUnitService.getOrganisationUnit( organisationUnitId );
+        OrganisationUnit organisationUnit = organisationUnitService.getOrganisationUnit( organisationUnitId );
         
         OrganisationUnitGroup orgUnitGroup = orgUnitGroupService.getOrganisationUnitGroup( orgUnitGroupId );
         
         //TariffDataValue tariffDataValue = tariffDataValueService.getTariffDataValue( organisationUnit, dataElement, dataSet, sDate, eDate );
         
-        TariffDataValue tariffDataValue = tariffDataValueService.getTariffDataValue( orgUnitGroup, dataElement, dataSet, sDate, eDate );
+        TariffDataValue tariffDataValue = tariffDataValueService.getTariffDataValue( organisationUnit, orgUnitGroup, dataElement, dataSet, sDate, eDate );
         
         tariffDataValueService.deleteTariffDataValue( tariffDataValue );
 

=== modified file 'local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/action/LoadTariffDetailsAction.java'
--- local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/action/LoadTariffDetailsAction.java	2014-04-30 05:26:01 +0000
+++ local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/action/LoadTariffDetailsAction.java	2014-05-08 11:03:37 +0000
@@ -161,8 +161,7 @@
 
         selecteddataElement = dataElementService.getDataElementByName( dataElementName );
 
-        // OrganisationUnit organisationUnit =
-        // organisationUnitService.getOrganisationUnit( orgUnitUid );
+        OrganisationUnit organisationUnit = organisationUnitService.getOrganisationUnit( orgUnitUid );
 
         OrganisationUnitGroup orgUnitGroup = orgUnitGroupService.getOrganisationUnitGroup( orgUnitGroupId );
 
@@ -172,9 +171,10 @@
         // tariffDataValueService.getTariffDataValues( organisationUnit,
         // selecteddataElement ) );
 
-        tariffList = new ArrayList<TariffDataValue>( tariffDataValueService.getTariffDataValues( orgUnitGroup,
-            selecteddataElement ) );
+        tariffList = new ArrayList<TariffDataValue>( tariffDataValueService.getTariffDataValues( orgUnitGroup, organisationUnit, selecteddataElement ) );
 
+        System.out.println( tariffList.size() + " : " + orgUnitGroup.getId() + " : " + organisationUnit.getId() + " : " + selecteddataElement.getId() );
+        
         List<Lookup> lookups = new ArrayList<Lookup>( lookupService.getAllLookupsByType( Lookup.DS_PBF_TYPE ) );
 
         for ( Lookup lookup : lookups )

=== modified file 'local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/action/ValidateTariffDataAction.java'
--- local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/action/ValidateTariffDataAction.java	2014-04-30 05:26:01 +0000
+++ local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/action/ValidateTariffDataAction.java	2014-05-08 11:03:37 +0000
@@ -154,14 +154,13 @@
 
         DataElement dataElement = dataElementService.getDataElement( Integer.parseInt( dataElementId ) );
 
-        // OrganisationUnit organisationUnit =
-        // organisationUnitService.getOrganisationUnit( orgUnitUid );
+        OrganisationUnit organisationUnit = organisationUnitService.getOrganisationUnit( orgUnitUid );
 
         OrganisationUnitGroup orgUnitGroup = orgUnitGroupService.getOrganisationUnitGroup( orgUnitGroupId );
 
         DataSet dataSet = dataSetService.getDataSet( Integer.parseInt( pbfType ) );
 
-        List<TariffDataValue> tariffDataValues = new ArrayList<TariffDataValue>( tariffDataValueService.getTariffDataValues( orgUnitGroup, dataElement ) );
+        List<TariffDataValue> tariffDataValues = new ArrayList<TariffDataValue>( tariffDataValueService.getTariffDataValues( orgUnitGroup, organisationUnit, dataElement ) );
         // boolean status = false;
         for ( TariffDataValue tdv : tariffDataValues )
         {
@@ -177,15 +176,15 @@
             }
         }
 
-        TariffDataValue tariffDataValue = tariffDataValueService.getTariffDataValue( orgUnitGroup, dataElement, dataSet, sDate, eDate );
+        TariffDataValue tariffDataValue = tariffDataValueService.getTariffDataValue( organisationUnit, orgUnitGroup, dataElement, dataSet, sDate, eDate );
         
         if ( tariffDataValue == null )
         {
-            String value = tariffDataValueService.getTariffDataValue( orgUnitGroup.getId(), dataSet.getId(), dataElement.getId(), startDate );
+            String value = tariffDataValueService.getTariffDataValue(  orgUnitGroup.getId(), organisationUnit.getId(), dataSet.getId(), dataElement.getId(), startDate );
             
             if ( value == null  )
             {
-                String enddateValue = tariffDataValueService.getTariffDataValue( orgUnitGroup.getId(), dataSet.getId(), dataElement.getId(), endDate );
+                String enddateValue = tariffDataValueService.getTariffDataValue( orgUnitGroup.getId(), organisationUnit.getId(), dataSet.getId(), dataElement.getId(), endDate );
                 
                 if ( enddateValue != null  )
                 {
@@ -201,8 +200,7 @@
 
                 return ERROR;
             }
-        }
-        
+        }        
         else
         {
             message = "Data Already Exists, Please Specify Another Date";

=== added file 'local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/api/QualityScorePayment.java'
--- local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/api/QualityScorePayment.java	1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/api/QualityScorePayment.java	2014-05-08 11:03:37 +0000
@@ -0,0 +1,106 @@
+package org.hisp.dhis.rbf.api;
+
+import java.io.Serializable;
+
+public class QualityScorePayment implements Serializable
+{
+
+    private int id;
+    
+    private Double startRange;
+    
+    private Double endRange;
+    
+    private Double addQtyPayment;
+    
+    // -------------------------------------------------------------------------
+    // Constructors
+    // -------------------------------------------------------------------------
+    public QualityScorePayment()
+    {
+        
+    }
+    
+    public QualityScorePayment( Double startRange, Double endRange, Double addQtyPayment )
+    {
+        
+    }
+    
+    // -------------------------------------------------------------------------
+    // hashCode and equals
+    // -------------------------------------------------------------------------
+
+    @Override
+    public boolean equals( Object o )
+    {
+        if ( this == o )
+        {
+            return true;
+        }
+
+        if ( o == null )
+        {
+            return false;
+        }
+
+        if ( !(o instanceof QualityScorePayment ) )
+        {
+            return false;
+        }
+
+        final QualityScorePayment other = (QualityScorePayment) o;
+
+        return startRange.equals( other.getStartRange() ) && endRange.equals( other.getEndRange() );
+    }
+
+    @Override
+    public int hashCode()
+    {        
+        return id;
+    }
+
+    // -------------------------------------------------------------------------
+    // Getters and setters
+    // -------------------------------------------------------------------------
+
+    public int getId()
+    {
+        return id;
+    }
+
+    public void setId( int id )
+    {
+        this.id = id;
+    }
+
+    public Double getStartRange()
+    {
+        return startRange;
+    }
+
+    public void setStartRange( Double startRange )
+    {
+        this.startRange = startRange;
+    }
+
+    public Double getEndRange()
+    {
+        return endRange;
+    }
+
+    public void setEndRange( Double endRange )
+    {
+        this.endRange = endRange;
+    }
+
+    public Double getAddQtyPayment()
+    {
+        return addQtyPayment;
+    }
+
+    public void setAddQtyPayment( Double addQtyPayment )
+    {
+        this.addQtyPayment = addQtyPayment;
+    }
+    
+}

=== added file 'local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/api/QualityScorePaymentService.java'
--- local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/api/QualityScorePaymentService.java	1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/api/QualityScorePaymentService.java	2014-05-08 11:03:37 +0000
@@ -0,0 +1,23 @@
+package org.hisp.dhis.rbf.api;
+
+import java.util.Collection;
+
+public interface QualityScorePaymentService
+{
+
+    String ID = QualityScorePaymentService.class.getName();
+
+    // -------------------------------------------------------------------------
+    // QualityScorePayment
+    // -------------------------------------------------------------------------
+    
+    void addQualityScorePayment( QualityScorePayment qualityScorePayment );
+
+    void updateQualityScorePayment( QualityScorePayment qualityScorePayment );
+
+    void deleteQualityScorePayment( QualityScorePayment qualityScorePayment );
+
+    QualityScorePayment getQualityScorePayment( int id );
+
+    Collection<QualityScorePayment> getAllQualityScorePayments();
+}

=== added file 'local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/api/QualityScorePaymentStore.java'
--- local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/api/QualityScorePaymentStore.java	1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/api/QualityScorePaymentStore.java	2014-05-08 11:03:37 +0000
@@ -0,0 +1,22 @@
+package org.hisp.dhis.rbf.api;
+
+import java.util.Collection;
+
+public interface QualityScorePaymentStore
+{
+    String ID = QualityScorePaymentStore.class.getName();
+
+    // -------------------------------------------------------------------------
+    // QualityScorePayment
+    // -------------------------------------------------------------------------
+    
+    void addQualityScorePayment( QualityScorePayment qualityScorePayment );
+
+    void updateQualityScorePayment( QualityScorePayment qualityScorePayment );
+
+    void deleteQualityScorePayment( QualityScorePayment qualityScorePayment );
+
+    QualityScorePayment getQualityScorePayment( int id );
+
+    Collection<QualityScorePayment> getAllQualityScorePayments();
+}

=== modified file 'local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/api/TariffDataValue.java'
--- local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/api/TariffDataValue.java	2014-04-26 11:27:06 +0000
+++ local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/api/TariffDataValue.java	2014-05-08 11:03:37 +0000
@@ -7,6 +7,7 @@
 import org.hisp.dhis.dataset.DataSet;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.organisationunit.OrganisationUnitGroup;
+import org.hisp.dhis.organisationunit.OrganisationUnitLevel;
 
 public class TariffDataValue
     implements Serializable
@@ -15,6 +16,8 @@
     private OrganisationUnitGroup orgUnitGroup;
 
     private OrganisationUnit organisationUnit;
+    
+    private Integer orgUnitLevel;
 
     private DataElement dataElement;
 
@@ -70,6 +73,21 @@
         this.targetPercentage = targetPercentage;
     }
 
+    public TariffDataValue( OrganisationUnitGroup orgUnitGroup, OrganisationUnit organisationUnit, Integer orgUnitLevel, DataElement dataElement, DataSet dataSet,
+        Date startDate, Date endDate, Double value, Integer target, Double targetPercentage )
+    {
+        this.orgUnitGroup = orgUnitGroup;
+        this.organisationUnit = organisationUnit;
+        this.orgUnitLevel = orgUnitLevel;
+        this.dataElement = dataElement;
+        this.dataSet = dataSet;
+        this.startDate = startDate;
+        this.endDate = endDate;
+        this.value = value;
+        this.target = target;
+        this.targetPercentage = targetPercentage;
+    }
+
     // -------------------------------------------------------------------------
     // hashCode and equals
     // -------------------------------------------------------------------------
@@ -95,7 +113,7 @@
         final TariffDataValue other = (TariffDataValue) o;
 
         return dataElement.equals( other.getDataElement() ) && dataSet.equals( other.getDataSet() )
-            && organisationUnit.equals( other.getOrganisationUnit() );
+            && organisationUnit.equals( other.getOrganisationUnit() ) && orgUnitGroup.equals( other.getOrgUnitGroup() );
     }
 
     @Override
@@ -107,6 +125,7 @@
         result = result * prime + dataSet.hashCode();
         result = result * prime + dataElement.hashCode();
         result = result * prime + orgUnitGroup.hashCode();
+        result = result * prime + organisationUnit.hashCode();
 
         return result;
     }
@@ -115,11 +134,22 @@
     // Getters and setters
     // -------------------------------------------------------------------------
 
+    
     public OrganisationUnit getOrganisationUnit()
     {
         return organisationUnit;
     }
 
+    public Integer getOrgUnitLevel()
+    {
+        return orgUnitLevel;
+    }
+
+    public void setOrgUnitLevel( Integer orgUnitLevel )
+    {
+        this.orgUnitLevel = orgUnitLevel;
+    }
+
     public void setOrganisationUnit( OrganisationUnit organisationUnit )
     {
         this.organisationUnit = organisationUnit;

=== modified file 'local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/api/TariffDataValueService.java'
--- local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/api/TariffDataValueService.java	2014-04-30 05:26:01 +0000
+++ local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/api/TariffDataValueService.java	2014-05-08 11:03:37 +0000
@@ -39,4 +39,16 @@
     Collection<TariffDataValue> getTariffDataValues( OrganisationUnitGroup orgUnitGroup, DataElement dataElement );
     
     String getTariffDataValue( Integer orgunitgroupId, Integer dataSetId, Integer dataElementId, String date );
+    
+    
+    TariffDataValue getTariffDataValue( OrganisationUnit organisationUnit, OrganisationUnitGroup orgUnitGroup, DataElement dataElement, DataSet dataSet, Date startDate, Date endDate );
+    
+    Collection<TariffDataValue> getTariffDataValues( OrganisationUnit organisationUnit, OrganisationUnitGroup orgUnitGroup, DataSet dataSet );
+    
+    Collection<TariffDataValue> getTariffDataValues( OrganisationUnitGroup orgUnitGroup, OrganisationUnit organisationUnit, DataElement dataElement );
+    
+    Map<Integer, Double> getTariffDataValues( OrganisationUnitGroup orgUnitGroup, OrganisationUnit organisationUnit, DataSet dataSet, Period period );
+    
+    String getTariffDataValue( Integer orgunitgroupId, Integer organisationUnitId, Integer dataSetId, Integer dataElementId, String date );
+
 }

=== modified file 'local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/api/TariffDataValueStore.java'
--- local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/api/TariffDataValueStore.java	2014-04-30 05:26:01 +0000
+++ local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/api/TariffDataValueStore.java	2014-05-08 11:03:37 +0000
@@ -40,4 +40,14 @@
     
     String getTariffDataValue( Integer orgunitgroupId, Integer dataSetId, Integer dataElementId, String date );
     
+    TariffDataValue getTariffDataValue( OrganisationUnit organisationUnit, OrganisationUnitGroup orgUnitGroup, DataElement dataElement, DataSet dataSet, Date startDate, Date endDate );
+    
+    Collection<TariffDataValue> getTariffDataValues( OrganisationUnit organisationUnit, OrganisationUnitGroup orgUnitGroup, DataSet dataSet );
+    
+    Collection<TariffDataValue> getTariffDataValues( OrganisationUnitGroup orgUnitGroup, OrganisationUnit organisationUnit, DataElement dataElement );
+    
+    Map<Integer, Double> getTariffDataValues( OrganisationUnitGroup orgUnitGroup, OrganisationUnit organisationUnit, DataSet dataSet, Period period );
+    
+    String getTariffDataValue( Integer orgunitgroupId, Integer organisationUnitId, Integer dataSetId, Integer dataElementId, String date );
+    
 }

=== modified file 'local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/dataentry/LoadDataEntryFormAction.java'
--- local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/dataentry/LoadDataEntryFormAction.java	2014-04-30 05:26:01 +0000
+++ local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/dataentry/LoadDataEntryFormAction.java	2014-05-08 11:03:37 +0000
@@ -257,14 +257,13 @@
         else
         {
             tariff_setting_authority = (int) tariff_authority.getValue();
-
         }
 
         OrganisationUnitGroup orgUnitGroup = findPBFOrgUnitGroupforTariff( organisationUnit );
         
         if( orgUnitGroup != null )
         {
-        	tariffDataValueMap.putAll( tariffDataValueService.getTariffDataValues( orgUnitGroup, dataSet, period ) );
+            tariffDataValueMap.putAll( tariffDataValueService.getTariffDataValues( orgUnitGroup, dataSet, period ) );
         }
         
         /*
@@ -279,8 +278,7 @@
 
         pbfDataValueMap = new HashMap<DataElement, PBFDataValue>();
 
-        Set<PBFDataValue> pbfDataValues = new HashSet<PBFDataValue>( pbfDataValueService.getPBFDataValues(
-            organisationUnit, dataSet, period ) );
+        Set<PBFDataValue> pbfDataValues = new HashSet<PBFDataValue>( pbfDataValueService.getPBFDataValues( organisationUnit, dataSet, period ) );
         for ( PBFDataValue pbfDataValue : pbfDataValues )
         {
             DataElement de = pbfDataValue.getDataElement();
@@ -318,7 +316,7 @@
                 pbfDataValue.setStoredBy( currentUserService.getCurrentUsername() );
                 pbfDataValue.setTimestamp( new Date() );
 
-                pbfDataValueService.addPBFDataValue( pbfDataValue );
+                //pbfDataValueService.addPBFDataValue( pbfDataValue );
                 pbfDataValueMap.put( de, pbfDataValue );
             }
             else

=== modified file 'local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/dataentry/SaveValueAction.java'
--- local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/dataentry/SaveValueAction.java	2014-04-26 11:27:06 +0000
+++ local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/dataentry/SaveValueAction.java	2014-05-08 11:03:37 +0000
@@ -106,14 +106,21 @@
     
     public void setPbfDataValueService(PBFDataValueService pbfDataValueService) 
     {
-		this.pbfDataValueService = pbfDataValueService;
-	}
+	this.pbfDataValueService = pbfDataValueService;
+    }
     
     // -------------------------------------------------------------------------
     // Input
     // -------------------------------------------------------------------------
 
-	private String value;
+    private String tariffAmt;
+    
+    public void setTariffAmt( String tariffAmt )
+    {
+        this.tariffAmt = tariffAmt;
+    }
+
+    private String value;
 
     public void setValue( String value )
     {
@@ -124,10 +131,10 @@
     
     public void setValueType(String valueType) 
     {
-		this.valueType = valueType;
-	}
+	this.valueType = valueType;
+    }
 
-	private String dataElementId;
+    private String dataElementId;
 
     public void setDataElementId( String dataElementId )
     {
@@ -161,15 +168,15 @@
     
     public void setPeriodIso(String periodIso) 
     {
-		this.periodIso = periodIso;
-	}
+	this.periodIso = periodIso;
+    }
     
     private String dataSetId;
     
-	public void setDataSetId(String dataSetId) 
-	{
-		this.dataSetId = dataSetId;
-	}
+    public void setDataSetId(String dataSetId) 
+    {
+	this.dataSetId = dataSetId;
+    }
     
     
     // -------------------------------------------------------------------------
@@ -177,7 +184,7 @@
     // -------------------------------------------------------------------------
 
 
-	private int statusCode = 0;
+    private int statusCode = 0;
 
     public int getStatusCode()
     {
@@ -317,12 +324,20 @@
                 
             	if( valueType.equals("1") )
             	{
-            		pbfDataValue.setQuantityReported( Integer.parseInt( value ) );
+            	    pbfDataValue.setQuantityReported( Integer.parseInt( value ) );
+            	    try
+            	    {
+            	        pbfDataValue.setTariffAmount( Double.parseDouble( tariffAmt ) );
+            	    }
+            	    catch( Exception e )
+            	    {
+            	    }
             	}
             	else if( valueType.equals("2") )
             	{
-            		pbfDataValue.setQuantityValidated( Integer.parseInt( value ) );
+            	    pbfDataValue.setQuantityValidated( Integer.parseInt( value ) );
             	}
+            	
             	pbfDataValue.setStoredBy(storedBy);
             	pbfDataValue.setTimestamp(now);
                 pbfDataValueService.addPBFDataValue(pbfDataValue);
@@ -332,25 +347,24 @@
         }
         else
         {
-        	if( valueType.equals("1") )
-        	{
-        		pbfDataValue.setQuantityReported( Integer.parseInt( value ) );
-        	}
-        	else if( valueType.equals("2") )
-        	{
-        		pbfDataValue.setQuantityValidated( Integer.parseInt( value ) );
-        	}
-        	
-        	pbfDataValue.setStoredBy(storedBy);
-        	
-        	pbfDataValue.setTimestamp(now);
+            if( valueType.equals("1") )
+            {
+        	pbfDataValue.setQuantityReported( Integer.parseInt( value ) );
+            }
+            else if( valueType.equals("2") )
+            {
+        	pbfDataValue.setQuantityValidated( Integer.parseInt( value ) );
+            }
+        	
+            pbfDataValue.setStoredBy(storedBy);
+        	
+            pbfDataValue.setTimestamp(now);
 
-        	pbfDataValueService.updatePBFDataValue( pbfDataValue );
+            pbfDataValueService.updatePBFDataValue( pbfDataValue );
         	
             System.out.println("Value Updated");
         }
 
-
         return SUCCESS;
     }
 

=== added file 'local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/impl/DefaultQualityScorePaymentService.java'
--- local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/impl/DefaultQualityScorePaymentService.java	1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/impl/DefaultQualityScorePaymentService.java	2014-05-08 11:03:37 +0000
@@ -0,0 +1,58 @@
+package org.hisp.dhis.rbf.impl;
+
+import java.util.Collection;
+
+import org.hisp.dhis.rbf.api.QualityScorePayment;
+import org.hisp.dhis.rbf.api.QualityScorePaymentService;
+import org.hisp.dhis.rbf.api.QualityScorePaymentStore;
+
+public class DefaultQualityScorePaymentService implements QualityScorePaymentService
+{
+
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
+
+    private QualityScorePaymentStore qualityScorePaymentStore;
+
+    public void setQualityScorePaymentStore( QualityScorePaymentStore qualityScorePaymentStore )
+    {
+        this.qualityScorePaymentStore = qualityScorePaymentStore;
+    }
+
+    // -------------------------------------------------------------------------
+    // Implementation
+    // -------------------------------------------------------------------------
+
+    @Override
+    public void addQualityScorePayment( QualityScorePayment qualityScorePayment )
+    {
+        qualityScorePaymentStore.addQualityScorePayment( qualityScorePayment );
+    }
+
+    @Override
+    public void updateQualityScorePayment( QualityScorePayment qualityScorePayment )
+    {
+        qualityScorePaymentStore.updateQualityScorePayment( qualityScorePayment );
+    }
+
+    @Override
+    public void deleteQualityScorePayment( QualityScorePayment qualityScorePayment )
+    {
+        qualityScorePaymentStore.deleteQualityScorePayment( qualityScorePayment );
+        
+    }
+
+    @Override
+    public QualityScorePayment getQualityScorePayment( int id )
+    {
+        return qualityScorePaymentStore.getQualityScorePayment( id );
+    }
+
+    @Override
+    public Collection<QualityScorePayment> getAllQualityScorePayments()
+    {
+        return qualityScorePaymentStore.getAllQualityScorePayments();
+    }
+
+}

=== modified file 'local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/impl/DefaultTariffDataValueService.java'
--- local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/impl/DefaultTariffDataValueService.java	2014-04-30 05:26:01 +0000
+++ local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/impl/DefaultTariffDataValueService.java	2014-05-08 11:03:37 +0000
@@ -107,5 +107,28 @@
         return tariffDataValueStore.getTariffDataValue( orgunitgroupId, dataSetId, dataElementId, date );
     }
     
-    
+    public TariffDataValue getTariffDataValue( OrganisationUnit organisationUnit, OrganisationUnitGroup orgUnitGroup, DataElement dataElement, DataSet dataSet, Date startDate, Date endDate )
+    {
+        return tariffDataValueStore.getTariffDataValue( organisationUnit, orgUnitGroup, dataElement, dataSet, startDate, endDate );
+    }
+    
+    public Collection<TariffDataValue> getTariffDataValues( OrganisationUnit organisationUnit, OrganisationUnitGroup orgUnitGroup, DataSet dataSet )
+    {
+        return tariffDataValueStore.getTariffDataValues( organisationUnit, orgUnitGroup, dataSet );
+    }
+    
+    public Collection<TariffDataValue> getTariffDataValues( OrganisationUnitGroup orgUnitGroup, OrganisationUnit organisationUnit, DataElement dataElement )
+    {
+        return tariffDataValueStore.getTariffDataValues( orgUnitGroup, organisationUnit, dataElement );
+    }
+    
+    public Map<Integer, Double> getTariffDataValues( OrganisationUnitGroup orgUnitGroup, OrganisationUnit organisationUnit, DataSet dataSet, Period period )
+    {
+        return tariffDataValueStore.getTariffDataValues( orgUnitGroup, organisationUnit, dataSet, period );
+    }
+    
+    public String getTariffDataValue( Integer orgunitgroupId, Integer organisationUnitId, Integer dataSetId, Integer dataElementId, String date )
+    {
+        return tariffDataValueStore.getTariffDataValue( orgunitgroupId, organisationUnitId, dataSetId, dataElementId, date );
+    }
 }

=== added file 'local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/impl/HibernateQualityScorePaymentStore.java'
--- local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/impl/HibernateQualityScorePaymentStore.java	1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/impl/HibernateQualityScorePaymentStore.java	2014-05-08 11:03:37 +0000
@@ -0,0 +1,79 @@
+package org.hisp.dhis.rbf.impl;
+
+import java.util.Collection;
+
+import org.hibernate.Criteria;
+import org.hibernate.Session;
+import org.hibernate.SessionFactory;
+import org.hibernate.criterion.Restrictions;
+import org.hisp.dhis.rbf.api.QualityScorePayment;
+import org.hisp.dhis.rbf.api.QualityScorePaymentStore;
+
+public class HibernateQualityScorePaymentStore implements QualityScorePaymentStore
+{
+
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
+
+    private SessionFactory sessionFactory;
+
+    public void setSessionFactory( SessionFactory sessionFactory )
+    {
+        this.sessionFactory = sessionFactory;
+    }
+
+    // -------------------------------------------------------------------------
+    // Implementation
+    // -------------------------------------------------------------------------
+
+    @Override
+    public void addQualityScorePayment( QualityScorePayment qualityScorePayment )
+    {
+        Session session = sessionFactory.getCurrentSession();
+
+        session.save( qualityScorePayment );
+
+        session.flush();
+    }
+
+    @Override
+    public void updateQualityScorePayment( QualityScorePayment qualityScorePayment )
+    {
+        Session session = sessionFactory.getCurrentSession();
+
+        session.update( qualityScorePayment );
+
+        session.flush();
+    }
+
+    @Override
+    public void deleteQualityScorePayment( QualityScorePayment qualityScorePayment )
+    {
+        Session session = sessionFactory.getCurrentSession();
+
+        session.delete( qualityScorePayment );
+    }
+
+    @Override
+    public QualityScorePayment getQualityScorePayment( int id )
+    {
+        Session session = sessionFactory.getCurrentSession();
+
+        Criteria criteria = session.createCriteria( QualityScorePayment.class );
+        criteria.add( Restrictions.eq( "id", id ) );
+        
+        return (QualityScorePayment) criteria.uniqueResult();
+    }
+
+    @Override
+    public Collection<QualityScorePayment> getAllQualityScorePayments()
+    {
+        Session session = sessionFactory.getCurrentSession();
+
+        Criteria criteria = session.createCriteria( QualityScorePayment.class );
+
+        return criteria.list();        
+    }
+    
+}

=== modified file 'local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/impl/HibernateTariffDataValueStore.java'
--- local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/impl/HibernateTariffDataValueStore.java	2014-04-30 05:26:01 +0000
+++ local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/impl/HibernateTariffDataValueStore.java	2014-05-08 11:03:37 +0000
@@ -83,6 +83,22 @@
 
         return (TariffDataValue) criteria.uniqueResult();
     }
+    
+    @Override
+    public TariffDataValue getTariffDataValue( OrganisationUnit organisationUnit, OrganisationUnitGroup orgUnitGroup, DataElement dataElement, DataSet dataSet, Date startDate, Date endDate )
+    {
+        Session session = sessionFactory.getCurrentSession();
+
+        Criteria criteria = session.createCriteria( TariffDataValue.class );
+        criteria.add( Restrictions.eq( "organisationUnit", organisationUnit ) );
+        criteria.add( Restrictions.eq( "orgUnitGroup", orgUnitGroup ) );
+        criteria.add( Restrictions.eq( "dataElement", dataElement ) );
+        criteria.add( Restrictions.eq( "dataSet", dataSet ) );
+        criteria.add( Restrictions.eq( "startDate", startDate ) );
+        criteria.add( Restrictions.eq( "endDate", endDate ) );
+
+        return (TariffDataValue) criteria.uniqueResult();
+    }
 
     @Override
     public TariffDataValue getTariffDataValue( OrganisationUnitGroup orgUnitGroup, DataElement dataElement, DataSet dataSet, Date startDate, Date endDate )
@@ -116,7 +132,20 @@
 
         Criteria criteria = session.createCriteria( TariffDataValue.class );
         criteria.add( Restrictions.eq( "organisationUnit", organisationUnit ) );
-        criteria.add( Restrictions.eq( "organisationUnitGroup", dataSet ) );
+        criteria.add( Restrictions.eq( "dataSet", dataSet ) );
+
+        return criteria.list();
+    }
+
+    @Override
+    public Collection<TariffDataValue> getTariffDataValues( OrganisationUnit organisationUnit, OrganisationUnitGroup orgUnitGroup, DataSet dataSet )
+    {
+        Session session = sessionFactory.getCurrentSession();
+
+        Criteria criteria = session.createCriteria( TariffDataValue.class );
+        criteria.add( Restrictions.eq( "organisationUnit", organisationUnit ) );
+        criteria.add( Restrictions.eq( "orgUnitGroup", orgUnitGroup ) );
+        criteria.add( Restrictions.eq( "dataSet", dataSet ) );
 
         return criteria.list();
     }
@@ -128,7 +157,7 @@
 
         Criteria criteria = session.createCriteria( TariffDataValue.class );
         criteria.add( Restrictions.eq( "orgUnitGroup", orgUnitGroup ) );
-        criteria.add( Restrictions.eq( "organisationUnitGroup", dataSet ) );
+        criteria.add( Restrictions.eq( "dataSet", dataSet ) );
 
         return criteria.list();
     }
@@ -145,6 +174,20 @@
 
         return criteria.list();
     }
+    
+    @Override
+    public Collection<TariffDataValue> getTariffDataValues( OrganisationUnitGroup orgUnitGroup, OrganisationUnit organisationUnit, DataElement dataElement )
+    {
+        Session session = sessionFactory.getCurrentSession();
+
+        Criteria criteria = session.createCriteria( TariffDataValue.class );
+        criteria.add( Restrictions.eq( "organisationUnit", organisationUnit ) );
+        criteria.add( Restrictions.eq( "orgUnitGroup", orgUnitGroup ) );
+        criteria.add( Restrictions.eq( "dataElement", dataElement ) );
+        criteria.addOrder(Order.asc("dataSet"));
+
+        return criteria.list();
+    }
 
     @Override
     public Collection<TariffDataValue> getTariffDataValues( OrganisationUnitGroup orgUnitGroup, DataElement dataElement )
@@ -225,6 +268,60 @@
         return tariffDataValueMap;
     }
     
+    public Map<Integer, Double> getTariffDataValues( OrganisationUnitGroup orgUnitGroup, OrganisationUnit organisationUnit, DataSet dataSet, Period period )
+    {
+        Map<Integer, Double> tariffDataValueMap = new HashMap<Integer, Double>();
+        
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
+        String curPeriod = simpleDateFormat.format( period.getEndDate() );
+        
+        try
+        {
+            /*String query = "SELECT dataelementid, value FROM tariffdatavalue " +
+                            " WHERE " +
+                                " orgunitgroupid = " + orgUnitGroup.getId() + " AND " +
+                                " organisationunitid = " + organisationUnit.getId() + " AND " +
+                                " datasetid = " + dataSet.getId() + " AND " +
+                                " startdate <= '" + curPeriod + "' AND "+ 
+                                " enddate >= '" + curPeriod +"'";
+            */
+            
+            String query = "select td.value,td.dataelementid from "+
+                            "( " +
+                                "select max(asd.orgunitlevelid) as level,asd.dataelementid,asd.orgunitgroupid,datasetid " +
+                                " from " +
+                                    "( "+
+                                        " select td.orgunitgroupid,td.organisationunitid,td.datasetid,td.dataelementid,td.orgunitlevelid,td.value " +
+                                            " from tariffdatavalue td "+
+                                            " where '" + curPeriod + "'  between date(td.startdate) and date(td.enddate) " +
+                                                " and orgunitgroupid in ( " + orgUnitGroup.getId() + ") " +
+                                                " and datasetid in ( " +dataSet.getId() + ") "+
+                                                " )asd "+
+                                                " group by asd.dataelementid,asd.orgunitgroupid,datasetid " +
+                                                " )sag1 " +
+                                                " inner join tariffdatavalue td on td.dataelementid=sag1.dataelementid " +
+                                                " where td.orgunitgroupid=sag1.orgunitgroupid " + 
+                                                " and td.datasetid=sag1.datasetid " +
+                                                " and sag1.level=td.orgunitlevelid " +
+                                                " and td.organisationunitid in ("+ organisationUnit.getId() +") ";
+            
+            //System.out.println("Query: " + query );
+            SqlRowSet rs = jdbcTemplate.queryForRowSet( query );
+            while ( rs.next() )
+            {
+                Integer dataElementId = rs.getInt( 1 );
+                Double value = rs.getDouble( 2 );
+                tariffDataValueMap.put( dataElementId, value );
+                //System.out.println( dataElementId + " : " + value );
+            }
+        }
+        catch( Exception e )
+        {
+            System.out.println("In getTariffDataValues Exception :"+ e.getMessage() );
+        }
+        
+        return tariffDataValueMap;
+    }
     
     public String getTariffDataValue( Integer orgunitgroupId, Integer dataSetId, Integer dataElementId, String date )
     {
@@ -267,5 +364,46 @@
         return value; 
     }
     
+    public String getTariffDataValue( Integer orgunitgroupId, Integer organisationUnitId, Integer dataSetId, Integer dataElementId, String date )
+    {
+        String value = null;
+        
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat( "yyyy-MM-dd" );
+        
+        try
+        {
+            String query = "select startdate, enddate from tariffdatavalue " + 
+                " WHERE " +
+                " orgunitgroupid = " + orgunitgroupId + " AND " +
+                " organisationunitid = " + organisationUnitId + " AND " +
+                " datasetid = " + dataSetId + " AND " +
+                " dataelementid = " + dataElementId + " AND " +
+                " startdate <= '" + date + "' AND "+ 
+                " enddate >= '" + date +"'";
+            
+            //System.out.println( " query is --: " + query );
+            
+            SqlRowSet rs = jdbcTemplate.queryForRowSet( query );
+
+            if ( rs.next() )
+            {
+                Date sDate = rs.getDate( 1 );
+                
+                Date eDate = rs.getDate( 2 );
+                
+                if ( sDate != null && eDate != null  )
+                {
+                    value  = simpleDateFormat.format( sDate ) + " To " + simpleDateFormat.format( eDate ) ;
+                }
+            }
+
+        }
+        catch ( Exception e )
+        {
+            System.out.println("In getTariffDataValues Exception :"+ e.getMessage() );
+        }
+        
+        return value; 
+    }
    
 }

=== 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-04-26 11:27:06 +0000
+++ local/in/dhis-web-maintenance-rbf/src/main/resources/META-INF/dhis/beans.xml	2014-05-08 11:03:37 +0000
@@ -51,6 +51,14 @@
         <property name="bankDetailsStore" ref="org.hisp.dhis.rbf.api.BankDetailsStore" />
     </bean>
     
+    <bean id="org.hisp.dhis.rbf.api.QualityScorePaymentStore" class="org.hisp.dhis.rbf.impl.HibernateQualityScorePaymentStore">
+        <property name="sessionFactory" ref="sessionFactory" />
+    </bean>
+
+    <bean id="org.hisp.dhis.rbf.api.QualityScorePaymentService" class="org.hisp.dhis.rbf.impl.DefaultQualityScorePaymentService">
+        <property name="qualityScorePaymentStore" ref="org.hisp.dhis.rbf.api.QualityScorePaymentStore" />
+    </bean>
+    
 	<!-- Home page -->
 	<bean id="org.hisp.dhis.rbf.action.NoAction" class="org.hisp.dhis.rbf.action.NoAction" scope="prototype">
     </bean>

=== added file 'local/in/dhis-web-maintenance-rbf/src/main/resources/org/hisp/dhis/rbf/hibernate/QualityScorePayment.hbm.xml'
--- local/in/dhis-web-maintenance-rbf/src/main/resources/org/hisp/dhis/rbf/hibernate/QualityScorePayment.hbm.xml	1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-maintenance-rbf/src/main/resources/org/hisp/dhis/rbf/hibernate/QualityScorePayment.hbm.xml	2014-05-08 11:03:37 +0000
@@ -0,0 +1,22 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC
+  "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+  "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd";>
+
+<hibernate-mapping>
+
+    <class name="org.hisp.dhis.rbf.api.QualityScorePayment" table="qualityscorepayment">
+
+	   <id name="id" column="qualityscorepaymentid">
+	      <generator class="native" />
+	    </id>
+	    
+	    <property name="startRange" column="startrange" />
+	
+	    <property name="endRange" column="endRange" />   
+	         
+	    <property name="addQtyPayment" column="addqtypayment" />
+
+    </class>
+    
+</hibernate-mapping>
\ No newline at end of file

=== modified file 'local/in/dhis-web-maintenance-rbf/src/main/resources/org/hisp/dhis/rbf/hibernate/TariffDataValue.hbm.xml'
--- local/in/dhis-web-maintenance-rbf/src/main/resources/org/hisp/dhis/rbf/hibernate/TariffDataValue.hbm.xml	2014-04-26 11:27:06 +0000
+++ local/in/dhis-web-maintenance-rbf/src/main/resources/org/hisp/dhis/rbf/hibernate/TariffDataValue.hbm.xml	2014-05-08 11:03:37 +0000
@@ -6,11 +6,12 @@
 <hibernate-mapping>
   <class name="org.hisp.dhis.rbf.api.TariffDataValue" table="tariffdatavalue">
 
-    <composite-id>
-      <!-- <key-many-to-one name="organisationUnit" class="org.hisp.dhis.organisationunit.OrganisationUnit" column="organisationunitid" foreign-key="fk_tariffdatavalue_organisationunitid" />-->
-      <key-many-to-one name="orgUnitGroup" class="org.hisp.dhis.organisationunit.OrganisationUnitGroup" column="orgunitgroupid" foreign-key="fk_tariffdatavalue_organisationunitgroupid" />      
+    <composite-id>      
+      <key-many-to-one name="orgUnitGroup" class="org.hisp.dhis.organisationunit.OrganisationUnitGroup" column="orgunitgroupid" foreign-key="fk_tariffdatavalue_organisationunitgroupid" />
+      <key-many-to-one name="organisationUnit" class="org.hisp.dhis.organisationunit.OrganisationUnit" column="organisationunitid" foreign-key="fk_tariffdatavalue_organisationunitid" />      
       <key-many-to-one name="dataSet" class="org.hisp.dhis.dataset.DataSet" column="datasetid" foreign-key="fk_tariffdatavalue_datasetid" />
       <key-many-to-one name="dataElement" class="org.hisp.dhis.dataelement.DataElement" column="dataelementid" foreign-key="fk_tariffdatavalue_dataelementid" />
+      <key-property name="orgUnitLevel" column="orgunitlevelid" />
       <key-property name="startDate" column="startdate" />
       <key-property name="endDate" column="enddate" />
     </composite-id>

=== 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-04-30 05:26:01 +0000
+++ local/in/dhis-web-maintenance-rbf/src/main/resources/struts.xml	2014-05-08 11:03:37 +0000
@@ -18,7 +18,7 @@
 		<action name="dataElementTariffManagement" class="org.hisp.dhis.rbf.action.GetDataElementforTariffAction">
 			<result name="success" type="velocity">/main.vm</result>
 			<param name="page">/dhis-web-maintenance-rbf/loadDataElementsforTariff.vm</param>
-			<param name="menu">/dhis-web-maintenance-rbf/menu.vm</param>
+			<param name="menu">/dhis-web-maintenance-rbf/tariffMenu.vm</param>
 			<param name="javascripts">../dhis-web-commons/ouwt/ouwt.js,../dhis-web-commons/javascripts/ext/ext-all.js,javascript/TransformGrid.js,javascript/dataElement_combo.js</param>
 			<param name="stylesheets">../dhis-web-commons/javascripts/ext/resources/css/ext-all-gray.css</param>
 		</action>

=== modified file 'local/in/dhis-web-maintenance-rbf/src/main/webapp/dhis-web-maintenance-rbf/javascript/pbfDataEntry.js'
--- local/in/dhis-web-maintenance-rbf/src/main/webapp/dhis-web-maintenance-rbf/javascript/pbfDataEntry.js	2014-04-26 11:27:06 +0000
+++ local/in/dhis-web-maintenance-rbf/src/main/webapp/dhis-web-maintenance-rbf/javascript/pbfDataEntry.js	2014-05-08 11:03:37 +0000
@@ -96,7 +96,7 @@
 
 }
 
-function saveValue(dataElementId,optionComboId)
+function saveValue( dataElementId,optionComboId )
 {
 	var period = document.getElementById("selectedPeriodId").value;
 	var valueId = "dataelement"+dataElementId+":"+optionComboId;
@@ -168,6 +168,9 @@
 		valueId = "pbfdv_qty_validated_"+dataElementId;
 	}
 	
+	var tariffValueId = "pbfdv_tariff_amt_"+dataElementId;
+	var tariffAmt = document.getElementById( tariffValueId ).value;
+	
 	var fieldId = "#"+valueId;
 	var defaultValue = document.getElementById(valueId).defaultValue;
 	var value = document.getElementById( valueId ).value;
@@ -180,6 +183,7 @@
 				'dataSetId' : dataSetId,
 				'organisationUnitId' : $("#selectedOrgunitID").val(),
 				'periodIso' : period,
+				'tariffAmt' : tariffAmt,
 				'value' : value
     };
     jQuery.ajax( {

=== modified file 'local/in/dhis-web-maintenance-rbf/src/main/webapp/dhis-web-maintenance-rbf/loadDataElementsforTariff.vm'
--- local/in/dhis-web-maintenance-rbf/src/main/webapp/dhis-web-maintenance-rbf/loadDataElementsforTariff.vm	2014-04-30 05:26:01 +0000
+++ local/in/dhis-web-maintenance-rbf/src/main/webapp/dhis-web-maintenance-rbf/loadDataElementsforTariff.vm	2014-05-08 11:03:37 +0000
@@ -39,7 +39,7 @@
     Ext.tip.QuickTipManager.init();
     // Simple ComboBox using the data store
     var simpleCombo = Ext.create('Ext.form.field.ComboBox', {
-		fieldLabel: 'Select DataElement',
+		fieldLabel: '',
         renderTo: 'simpleCombo',
         displayField: 'name',
         labelWidth: 115,
@@ -59,7 +59,8 @@
         				$('#loadTariffDetails').load("loadTariffDetails.action", 
             				{
             					dataElementName:dataElementName,
-								orgUnitGroupId : $( "#orgUnitGroupId" ).val()
+								orgUnitGroupId : $( "#orgUnitGroupId" ).val(),
+								orgUnitUid:$("#orgUnitUid").val()
             				}
             				, function( ){            										
         				});
@@ -70,7 +71,8 @@
   $('#loadTariffDetails').load("loadTariffDetails.action", 
             				{
             					dataElementName : $('#dataElementName').val(),								
-								orgUnitGroupId : $( "#orgUnitGroupId" ).val()
+								orgUnitGroupId : $( "#orgUnitGroupId" ).val(),
+								orgUnitUid : $("#orgUnitUid").val()
             				}
             				, function( ){  
 							loadExtTariff();
@@ -108,36 +110,15 @@
 
 function organisationUnitSelected( orgUnits, orgUnitNames )
 {
-	var countryTags = $levelOrgUnitIds;
-	var bValue = false;
-	for(var i=0;i<=countryTags.length-1;i++)
-	{
-    	if(countryTags[i] == orgUnits[0] )
-    	{
-    		bValue = true;
-    	}
-	}
-	if(bValue == false)
-	{
-		document.getElementById('simpleCombo').style.display = 'none';
-		setFieldValue("orgUnit", orgUnitNames[0]);
-        disable('orgUnit');
-		document.getElementById('loadTariffDetails').style.display = 'none';
-		alert('Please Select Correct level OrgUnit');
-	}
-	else
-	{
 		document.getElementById('simpleCombo').style.display = 'block';
         enable('orgUnit'); 
 		setFieldValue("orgUnit", orgUnitNames[0]);
 		setFieldValue("orgUnitUid", orgUnits[0]);
 		document.getElementById('loadTariffDetails').style.display = 'block';
-		if($('#dataElementName').val() != '')
+		if( $('#dataElementName').val() != '' && $( "#orgUnitGroupId" ).val() != "-1" )
 		{
 			getTariffData();	
-		}		
-	}
-	
+		}
 }
 
 selection.setListenerFunction( organisationUnitSelected );
@@ -178,16 +159,29 @@
 <br/>
 <input type="hidden" name="orgUnitUid" id="orgUnitUid" />
 <input type="hidden" name="dataElementName" id="dataElementName" value="" />
-<table width="60%">
+<div class="inputCriteria" style="height:130px;">
+<table >	
+    <tr>
+        <td>Orgainsation Unit: </td>
+        <td>
+        	<input type="text" id="orgUnit" name="orgUnit" readonly size="55" />
+        	<input type="hidden" id="orgUnit" name="orgUnit" readonly size="55" style="display:none" />
+        </td>
+        <td>&nbsp;</td>
+    </tr>
+    <tr>
+        <td >&nbsp;</td>
+        <td >&nbsp;</td>
+    </tr>
 	<tr>
-		<td>Orgainsation Unit Group: &nbsp;&nbsp;&nbsp; 
+		<td>Orgainsation Unit Group: </td>
+		<td> 
 		    <select id="orgUnitGroupId" name="orgUnitGroupId" onchange="javascript:orgUnitGroupChange()" style="width:52%">
                 <option value="-1">[Please select]</option>		    	
                 #foreach( $orgUnitGroup in $orgUnitGroups )
                 	<option value="$!orgUnitGroup.id">$!orgUnitGroup.name</option>
                 #end
-      		</select>
-      		<input type="hidden" id="orgUnit" name="orgUnit" readonly size="55" style="display:none" />
+      		</select>      		
       	</td>
 		<td >&nbsp;</td>
 	</tr>
@@ -196,10 +190,12 @@
 		<td >&nbsp;</td>
     </tr>
 	<tr>
-		<td ><div id="simpleCombo" style="display:none;"></div></td>
+		<td>Select DataElement: </td>
+		<td><div id="simpleCombo" style="display:none;"></div></td>
 		<td ><input type="button" id="addDataElement" value="Add DataElement" disabled style="display:none;"/></td>
 	</tr>
 </table>
+</div>
 <br/><br/><br/>
 <div id="loadTariffDetails" style="width:85%"></div>
 	
\ No newline at end of file

=== modified file 'local/in/dhis-web-maintenance-rbf/src/main/webapp/dhis-web-maintenance-rbf/loadTariffData.vm'
--- local/in/dhis-web-maintenance-rbf/src/main/webapp/dhis-web-maintenance-rbf/loadTariffData.vm	2014-04-30 05:26:01 +0000
+++ local/in/dhis-web-maintenance-rbf/src/main/webapp/dhis-web-maintenance-rbf/loadTariffData.vm	2014-05-08 11:03:37 +0000
@@ -122,10 +122,11 @@
 		
 });
 
-	function deleteTariffDataValue( organisationUnitId, dataElementId, dataSetId, startDate, endDate)
+	function deleteTariffDataValue( organisationUnitId, orgUnitGroupId, dataElementId, dataSetId, startDate, endDate)
 	{
 		var dataValue = {		        		
-		        		'orgUnitGroupId' : $( "#orgUnitGroupId" ).val(),
+		        		'orgUnitGroupId' : orgUnitGroupId,
+		        		'orgUnitUid' : organisationUnitId,
 						'dataElementId' : dataElementId,								
 						'dataSetId' : dataSetId,
 						'startDate' : startDate,
@@ -149,9 +150,10 @@
 	    }
 	}
 
-	function editTariffDataValue( organisationUnitId, dataElementId, dataSetId, startDate, endDate, value, target, targetPercentage )
+	function editTariffDataValue( organisationUnitId, orgUnitGroupId, dataElementId, dataSetId, startDate, endDate, value, target, targetPercentage )
 	{	
 		validateAddTariff();
+		
 		$( "#addTariff" ).dialog('option', 'title', 'Edit Tariff');
 		$('#pbfType option[value='+dataSetId+']').attr('selected','selected');
 		$('#pbfType').attr('disabled','disabled');
@@ -182,6 +184,7 @@
         		        			'startDate' : $("#startDate").val(),
         							'endDate' : $("#endDate").val(),
 									'orgUnitGroupId': $( "#orgUnitGroupId" ).val(),
+									'orgUnitUid' : $("#orgUnitUid").val(),
 									'dataElementId' : $("#dataElementId").val()
         		    			};
 								jQuery.ajax( {
@@ -214,6 +217,7 @@
         		        			'startDate' : $("#startDate").val(),
         							'endDate' : $("#endDate").val(),									
 									'orgUnitGroupId': $( "#orgUnitGroupId" ).val(),
+									'orgUnitUid' : $("#orgUnitUid").val(),
 									'dataElementId' : $("#dataElementId").val(),									
 									'target' : $("#target").val(),
 									'targetPercentage' : $("#targetPercentage").val(),
@@ -240,7 +244,7 @@
 			alert( "Inside Error " + json.message );
 	    }
 		
-		 function addTariffSuccess( json )
+		function addTariffSuccess( json )
 	    {	
 			$('#pbfType option[value=-1]').attr('selected','selected');
 			$("#pbfType ").removeAttr('disabled');
@@ -321,10 +325,10 @@
 				<td data-sorter="shortDate" data-date-format="yyyymmdd">$simpleDateFormat.format($!tariff.endDate)</td>
 			##if($updateAuthority == 'Yes')
 	            <td>
-					<a href="javascript:deleteTariffDataValue('$tariff.orgUnitGroup.id','$tariff.dataElement.id','$tariff.dataSet.id','$tariff.startDate','$tariff.endDate')">
+					<a href="javascript:deleteTariffDataValue('$tariff.organisationUnit.id','$tariff.orgUnitGroup.id','$tariff.dataElement.id','$tariff.dataSet.id','$tariff.startDate','$tariff.endDate')">
 						<img src="images/delete.png" width="17px"/>
 					</a>
-					<a href="javascript:editTariffDataValue('$tariff.orgUnitGroup.id','$tariff.dataElement.id','$tariff.dataSet.id','$tariff.startDate','$tariff.endDate','$tariff.value','$!tariff.target','$!tariff.targetPercentage')">
+					<a href="javascript:editTariffDataValue('$tariff.organisationUnit.id','$tariff.orgUnitGroup.id','$tariff.dataElement.id','$tariff.dataSet.id','$tariff.startDate','$tariff.endDate','$tariff.value','$!tariff.target','$!tariff.targetPercentage')">
 						<img src="../images/edit.png" alt="$i18n.getString( 'edit' )" width="17px"/>
 					</a>				
 				</td>
@@ -334,6 +338,7 @@
     </tbody>
 </table>
 </div>
+
 <div id="addTariff" title="Add New Tariff">
 	<table style="width:100%;table-layout:fixed;">
 		<tr >
@@ -381,8 +386,6 @@
 		<tr >
 			<td style="width:40%;">Target % </td>
 			<td style="width:60%;"><input type="text" id="targetPercentage" style="width:100%;" value="" onblur="validateAddTariff()" /></td>
-        </tr>
-		
-		
+        </tr>				
     </table>
 </div>
\ No newline at end of file