← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 16267: local/in Maintenance RBF work in progress

 

------------------------------------------------------------
revno: 16267
committer: Mithilesh Kumar Thakur <mithilesh.hisp@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2014-07-28 10:27:00 +0100
message:
  local/in Maintenance RBF work in progress
added:
  local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/dataentry/SaveValueInDataValueAction.java
modified:
  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/HibernateUtilizationRateStore.java
  local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/quality/dataentry/LoadQualityScoreDetailsAction.java
  local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/quality/dataentry/SaveQualityValueAction.java
  local/in/dhis-web-maintenance-rbf/src/main/resources/META-INF/dhis/beans.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/dataEntrySelection.vm
  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/qualityScoreDataEntry.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/loadQualityScoreEntryForm.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/dataentry/LoadDataEntryFormAction.java'
--- local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/dataentry/LoadDataEntryFormAction.java	2014-07-25 10:59:27 +0000
+++ local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/dataentry/LoadDataEntryFormAction.java	2014-07-28 09:27:00 +0000
@@ -48,6 +48,9 @@
     private final static String TARIFF_SETTING_AUTHORITY = "TARIFF_SETTING_AUTHORITY";
     private final static String UTILIZATION_RULE_DATAELEMENT_ATTRIBUTE = "UTILIZATION_RULE_DATAELEMENT_ATTRIBUTE";
     private final static String UTILIZATION_RATE_DATAELEMENT_ID = "UTILIZATION_RATE_DATAELEMENT_ID";
+    
+    private final static String TOTAL_PBF_DATAELEMENT_ID = "TOTAL_PBF_DATAELEMENT_ID";
+    
     // -------------------------------------------------------------------------
     // Dependencies
     // -------------------------------------------------------------------------
@@ -259,6 +262,14 @@
         return utilizationRate;
     }
     
+    private int totalDataElementId;
+    
+    public int getTotalDataElementId()
+    {
+        return totalDataElementId;
+    }
+
+    
     // -------------------------------------------------------------------------
     // Action implementation
     // -------------------------------------------------------------------------
@@ -267,7 +278,24 @@
     public String execute()
     {
         dataValueMap = new HashMap<String, String>();
-
+        
+        Constant totalDetId = constantService.getConstantByName( TOTAL_PBF_DATAELEMENT_ID );
+        DataElement totalDataElement = dataElementService.getDataElement( (int) totalDetId.getValue() );
+        totalDataElementId = 0;
+        if( totalDataElement != null )
+        {
+            totalDataElementId = totalDataElement.getId();
+        }
+        
+        /*
+        String abc = null;
+        System.out.println( " Test ABC " +  abc );
+        
+        String abc1;
+        abc1 = "pppp";
+        System.out.println( " Test ABC " +  abc1 );
+        */
+        
         //Lookup lookup = lookupService.getLookupByName( Lookup.OC_TARIFF );
 
         //Lookup lookup2 = lookupService.getLookupByName( Lookup.QV_TARIFF );
@@ -476,6 +504,7 @@
             }
         }
         
+        
         utilizationRatesMap = new HashMap<Integer, String>( utilizationRateService.getUtilizationRates() );
         
         /*

=== 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-06-20 10:21:56 +0000
+++ local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/dataentry/SaveValueAction.java	2014-07-28 09:27:00 +0000
@@ -347,7 +347,7 @@
             	pbfDataValue.setTimestamp(now);
                 pbfDataValueService.addPBFDataValue(pbfDataValue);
                 
-                System.out.println("Value Added");
+                System.out.println(" PBF Value Added");
             }
         }
         else
@@ -372,7 +372,7 @@
 
             pbfDataValueService.updatePBFDataValue( pbfDataValue );
         	
-            System.out.println("Value Updated");
+            System.out.println(" PBF Value Updated");
         }
 
         return SUCCESS;

=== added file 'local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/dataentry/SaveValueInDataValueAction.java'
--- local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/dataentry/SaveValueInDataValueAction.java	1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/dataentry/SaveValueInDataValueAction.java	2014-07-28 09:27:00 +0000
@@ -0,0 +1,291 @@
+package org.hisp.dhis.rbf.dataentry;
+
+import java.util.Date;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.hisp.dhis.dataelement.DataElement;
+import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
+import org.hisp.dhis.dataelement.DataElementCategoryService;
+import org.hisp.dhis.dataelement.DataElementService;
+import org.hisp.dhis.datavalue.DataValue;
+import org.hisp.dhis.datavalue.DataValueService;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.organisationunit.OrganisationUnitService;
+import org.hisp.dhis.period.Period;
+import org.hisp.dhis.period.PeriodType;
+import org.hisp.dhis.rbf.quality.dataentry.SaveDataValueAction;
+import org.hisp.dhis.user.CurrentUserService;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Mithilesh Kumar Thakur
+ */
+public class SaveValueInDataValueAction implements Action
+{
+    private static final Log log = LogFactory.getLog( SaveDataValueAction.class );
+
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
+
+    private CurrentUserService currentUserService;
+
+    public void setCurrentUserService( CurrentUserService currentUserService )
+    {
+        this.currentUserService = currentUserService;
+    }
+
+    private DataElementService dataElementService;
+
+    public void setDataElementService( DataElementService dataElementService )
+    {
+        this.dataElementService = dataElementService;
+    }
+
+    private DataValueService dataValueService;
+
+    public void setDataValueService( DataValueService dataValueService )
+    {
+        this.dataValueService = dataValueService;
+    }
+    
+    private DataElementCategoryService categoryService;
+
+    public void setCategoryService( DataElementCategoryService categoryService )
+    {
+        this.categoryService = categoryService;
+    }
+
+    private OrganisationUnitService organisationUnitService;
+
+    public void setOrganisationUnitService( OrganisationUnitService organisationUnitService )
+    {
+        this.organisationUnitService = organisationUnitService;
+    }
+
+    
+    // -------------------------------------------------------------------------
+    // Input
+    // -------------------------------------------------------------------------
+
+    private String value;
+
+    public void setValue( String value )
+    {
+        this.value = value;
+    }
+    
+    private String dataElementId;
+
+    public void setDataElementId( String dataElementId )
+    {
+        this.dataElementId = dataElementId;
+    }
+    
+    private String organisationUnitId;
+
+    public void setOrganisationUnitId( String organisationUnitId )
+    {
+        this.organisationUnitId = organisationUnitId;
+    }
+   
+    private String periodIso;
+
+    public void setPeriodIso(String periodIso) 
+    {
+        this.periodIso = periodIso;
+    }
+    
+    private String overAllScoreValue;
+    
+    public void setOverAllScoreValue( String overAllScoreValue )
+    {
+        this.overAllScoreValue = overAllScoreValue;
+    }
+    
+    private String overAllScoreDeId;
+    
+    public void setOverAllScoreDeId( String overAllScoreDeId )
+    {
+        this.overAllScoreDeId = overAllScoreDeId;
+    }
+    
+    // -------------------------------------------------------------------------
+    // Output
+    // -------------------------------------------------------------------------
+    
+    private int statusCode = 0;
+
+    public int getStatusCode()
+    {
+        return statusCode;
+    }
+
+    // -------------------------------------------------------------------------
+    // Action implementation
+    // -------------------------------------------------------------------------
+
+    public String execute()
+    {
+        Period period = PeriodType.getPeriodFromIsoString(periodIso);
+        
+        if ( period == null )
+        {
+            return logError( "Illegal period identifier: " + periodIso );
+        }
+
+        OrganisationUnit organisationUnit = organisationUnitService.getOrganisationUnit( organisationUnitId );
+
+        if ( organisationUnit == null )
+        {
+            return logError( "Invalid organisation unit identifier: " + organisationUnitId );
+        }
+
+        DataElement dataElement = dataElementService.getDataElement( Integer.parseInt( dataElementId ) );
+
+        if ( dataElement == null )
+        {
+            return logError( "Invalid data element identifier: " + dataElementId );
+        }
+
+        DataElementCategoryOptionCombo optionCombo = categoryService.getDefaultDataElementCategoryOptionCombo();
+
+        String storedBy = currentUserService.getCurrentUsername();
+
+        Date now = new Date();
+
+        if ( storedBy == null )
+        {
+            storedBy = "[unknown]";
+        }
+
+        if( value == null )
+        {
+            value = "";
+        }
+        
+        if ( value != null )
+        {
+            value = value.trim();
+        }
+
+        // ---------------------------------------------------------------------
+        // Update data
+        // ---------------------------------------------------------------------
+
+        DataValue dataValue = dataValueService.getDataValue( dataElement, period, organisationUnit, optionCombo);
+       
+        if ( dataValue == null )
+        {
+            if ( value != null && (!value.trim().equals( "" ) || !value.equalsIgnoreCase( "-1" ))  )
+            {
+                dataValue = new DataValue();
+                
+                dataValue.setPeriod(period);
+                dataValue.setDataElement(dataElement);
+                dataValue.setSource(organisationUnit);
+                dataValue.setCategoryOptionCombo(optionCombo);
+                
+                dataValue.setValue( value.trim() );
+                dataValue.setLastUpdated( now );
+                dataValue.setStoredBy( storedBy );
+                
+                dataValueService.addDataValue( dataValue );
+            }
+            
+            System.out.println( " Value Addedd in dataValue Table de: "+ dataElement.getId() + " org unit Id : " + organisationUnit.getId() + "  Period Id : " + period.getId() + "  Value : " + value );
+        }
+        else
+        {
+            if( !(value.trim().equalsIgnoreCase( dataValue.getValue() ) ) )
+            {
+                dataValue.setValue( value.trim() );
+                dataValue.setLastUpdated( now );
+                dataValue.setStoredBy( storedBy );                
+                dataValueService.updateDataValue( dataValue );
+            }
+            
+            System.out.println( " Value Updated in dataValue Table de: " + dataElement.getId() + " org unit Id : " + organisationUnit.getId() + "  Period Id : " + period.getId() + "  Value : " + value );  
+            
+        }
+        
+        
+        
+        
+        
+        
+        // for saving Over All Score
+        
+        /*
+        if ( overAllScoreValue != null && overAllScoreDeId != null )
+        {
+            overAllScoreValue = overAllScoreValue.trim();
+            
+            DataElement overAllScoreDataElement = dataElementService.getDataElement( Integer.parseInt( overAllScoreDeId ) );
+
+            if ( overAllScoreDataElement == null )
+            {
+                return logError( "Invalid dataelement identifier: " + overAllScoreDeId );
+            }
+            
+            DataValue overAllScoreDataValue = dataValueService.getDataValue( overAllScoreDataElement, period, organisationUnit, optionCombo );
+            
+            if ( overAllScoreDataValue == null )
+            {
+                if ( overAllScoreValue != null && (!overAllScoreValue.trim().equals( "" ) )  )
+                {
+                    overAllScoreDataValue = new DataValue();
+                    
+                    overAllScoreDataValue.setPeriod( period );
+                    overAllScoreDataValue.setDataElement( overAllScoreDataElement );
+                    overAllScoreDataValue.setSource(organisationUnit);
+                    overAllScoreDataValue.setCategoryOptionCombo( optionCombo );
+                    
+                    overAllScoreDataValue.setValue( overAllScoreValue.trim() );
+                    //overAllScoreDataValue.setTimestamp( now );
+                    overAllScoreDataValue.setLastUpdated( now );
+                    
+                    overAllScoreDataValue.setStoredBy( storedBy );
+                    
+                    dataValueService.addDataValue( overAllScoreDataValue );
+                }
+            }
+            else
+            {
+                if( !(overAllScoreValue.trim().equalsIgnoreCase( overAllScoreDataValue.getValue() ) ) )
+                {
+                    overAllScoreDataValue.setValue( overAllScoreValue.trim() );
+                    //overAllScoreDataValue.setTimestamp( now );
+                    overAllScoreDataValue.setLastUpdated( now );
+                    overAllScoreDataValue.setStoredBy( storedBy );                
+                    dataValueService.updateDataValue( overAllScoreDataValue );
+              }            
+            }
+            
+        }
+        */
+        
+        
+        return SUCCESS;
+    }
+
+    // -------------------------------------------------------------------------
+    // Supportive methods
+    // -------------------------------------------------------------------------
+
+    private String logError( String message )
+    {
+        return logError( message, 1 );
+    }
+
+    private String logError( String message, int statusCode )
+    {
+        log.info( message );
+
+        this.statusCode = statusCode;
+
+        return SUCCESS;
+    }
+}

=== modified file 'local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/impl/HibernateUtilizationRateStore.java'
--- local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/impl/HibernateUtilizationRateStore.java	2014-07-25 10:59:27 +0000
+++ local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/impl/HibernateUtilizationRateStore.java	2014-07-28 09:27:00 +0000
@@ -142,7 +142,7 @@
                 
                 String value = startRange + ":" + endRange + ":" + tariff;
                 utilizationRatesMap.put( dataElementId, value );
-                System.out.println( dataElementId + " : " + value );
+                //System.out.println( dataElementId + " : " + value );
             }
         }
         catch( Exception e )

=== modified file 'local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/quality/dataentry/LoadQualityScoreDetailsAction.java'
--- local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/quality/dataentry/LoadQualityScoreDetailsAction.java	2014-07-23 11:47:17 +0000
+++ local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/quality/dataentry/LoadQualityScoreDetailsAction.java	2014-07-28 09:27:00 +0000
@@ -46,7 +46,9 @@
     private final static String TARIFF_SETTING_AUTHORITY = "TARIFF_SETTING_AUTHORITY";
 
     private final static String QUALITY_MAX_DATAELEMENT = "QUALITY_MAX_DATAELEMENT";
-
+    
+    private final static String OVER_ALL_QUALITY_SCORE_DATAELEMENT_ID = "OVER_ALL_QUALITY_SCORE_DATAELEMENT_ID";
+    
     // -------------------------------------------------------------------------
     // Dependencies
     // -------------------------------------------------------------------------
@@ -188,11 +190,19 @@
     {
         return qualityScorePayments;
     }
-
+    
+    private int overAllQtyDataElementId;
+    
+    public int getOverAllQtyDataElementId()
+    {
+        return overAllQtyDataElementId;
+    }
+    
     // -------------------------------------------------------------------------
     // Action implementation
     // -------------------------------------------------------------------------
 
+
     public String execute()
         throws Exception
     {
@@ -213,6 +223,19 @@
             tariff_setting_authority = (int) tariff_authority.getValue();
         }
         
+        Constant overAllQtyDetId = constantService.getConstantByName( OVER_ALL_QUALITY_SCORE_DATAELEMENT_ID );
+        DataElement overAllDataElement = dataElementService.getDataElement( (int) overAllQtyDetId.getValue() );
+        overAllQtyDataElementId = 0;
+        if( overAllDataElement != null )
+        {
+            overAllQtyDataElementId = overAllDataElement.getId();
+        }
+        
+        
+        
+        
+        
+        
         Constant qualityMaxDataElement = constantService.getConstantByName( QUALITY_MAX_DATAELEMENT );
         OrganisationUnit organisationUnit = organisationUnitService.getOrganisationUnit( orgUnitId );
         

=== modified file 'local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/quality/dataentry/SaveQualityValueAction.java'
--- local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/quality/dataentry/SaveQualityValueAction.java	2014-05-31 13:40:53 +0000
+++ local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/quality/dataentry/SaveQualityValueAction.java	2014-07-28 09:27:00 +0000
@@ -89,28 +89,27 @@
     }
 
     private QualityMaxValueService qualityMaxValueService;
-    
-    public void setQualityMaxValueService(
-			QualityMaxValueService qualityMaxValueService) {
-		this.qualityMaxValueService = qualityMaxValueService;
-	}
-    
+
+    public void setQualityMaxValueService( QualityMaxValueService qualityMaxValueService )
+    {
+        this.qualityMaxValueService = qualityMaxValueService;
+    }
+
     @Autowired
     private OrganisationUnitGroupService orgUnitGroupService;
-    
-    
+
     // -------------------------------------------------------------------------
     // Input
     // -------------------------------------------------------------------------
 
-	private String value;
+    private String value;
 
     public void setValue( String value )
     {
         this.value = value;
     }
 
-	private String dataElementId;
+    private String dataElementId;
 
     public void setDataElementId( String dataElementId )
     {
@@ -123,41 +122,40 @@
     {
         this.organisationUnitId = organisationUnitId;
     }
-   
+
     private String orgUnitGroupId;
-    
-    public void setOrgUnitGroupId(String orgUnitGroupId) 
-    {
-		this.orgUnitGroupId = orgUnitGroupId;
-	}
-
-	private String dataSetId;
-    
-	public void setDataSetId(String dataSetId) 
-	{
-		this.dataSetId = dataSetId;
-	}
-    
-	private String startDate ;
-    
-    public void setStartDate(String startDate) 
-    {
-		this.startDate = startDate;
-	}
-    
-    private String endDate ;
-    
-	public void setEndDate(String endDate) 
-	{
-		this.endDate = endDate;
-	}
-    
-	
+
+    public void setOrgUnitGroupId( String orgUnitGroupId )
+    {
+        this.orgUnitGroupId = orgUnitGroupId;
+    }
+
+    private String dataSetId;
+
+    public void setDataSetId( String dataSetId )
+    {
+        this.dataSetId = dataSetId;
+    }
+
+    private String startDate;
+
+    public void setStartDate( String startDate )
+    {
+        this.startDate = startDate;
+    }
+
+    private String endDate;
+
+    public void setEndDate( String endDate )
+    {
+        this.endDate = endDate;
+    }
+
     // -------------------------------------------------------------------------
     // Output
     // -------------------------------------------------------------------------
 
-	private int statusCode = 0;
+    private int statusCode = 0;
 
     public int getStatusCode()
     {
@@ -168,35 +166,37 @@
     // Action implementation
     // -------------------------------------------------------------------------
 
-    public String execute() throws Exception
+    public String execute()
+        throws Exception
     {
-    	
+
         OrganisationUnit organisationUnit = organisationUnitService.getOrganisationUnit( organisationUnitId );
 
         if ( organisationUnit == null )
         {
             return logError( "Invalid organisation unit identifier: " + organisationUnitId );
         }
-        
-        DataElement dataElement = dataElementService.getDataElement( Integer.parseInt(dataElementId) );
+
+        DataElement dataElement = dataElementService.getDataElement( Integer.parseInt( dataElementId ) );
 
         if ( dataElement == null )
         {
             return logError( "Invalid data element identifier: " + dataElementId );
         }
-       
+
         DataSet dataSet = dataSetService.getDataSet( Integer.parseInt( dataSetId ) );
         if ( dataSet == null )
         {
             return logError( "Invalid dataset identifier: " + dataSetId );
         }
-        
-        OrganisationUnitGroup orgUnitGroup = orgUnitGroupService.getOrganisationUnitGroup( Integer.parseInt( orgUnitGroupId ) );
+
+        OrganisationUnitGroup orgUnitGroup = orgUnitGroupService.getOrganisationUnitGroup( Integer
+            .parseInt( orgUnitGroupId ) );
         if ( orgUnitGroup == null )
         {
             return logError( "Invalid orgunitgroup identifier: " + orgUnitGroupId );
         }
-        
+
         String storedBy = currentUserService.getCurrentUsername();
 
         Date now = new Date();
@@ -221,52 +221,52 @@
         // ---------------------------------------------------------------------
 
         String valid = ValidationUtils.dataValueIsValid( value, dataElement );
-        
+
         if ( valid != null )
         {
             return logError( valid, 3 );
         }
-        
+
         SimpleDateFormat dateFormat = new SimpleDateFormat( "yyyy-MM-dd" );
         Date sDate = dateFormat.parse( startDate );
         Date eDate = dateFormat.parse( endDate );
-        
-        QualityMaxValue qualityMaxValue = qualityMaxValueService.getQualityMaxValue( orgUnitGroup, organisationUnit, dataElement, dataSet, sDate, eDate );
+
+        QualityMaxValue qualityMaxValue = qualityMaxValueService.getQualityMaxValue( orgUnitGroup, organisationUnit,
+            dataElement, dataSet, sDate, eDate );
 
         if ( qualityMaxValue == null )
         {
             if ( value != null )
             {
-            	qualityMaxValue = new QualityMaxValue( );
-            	
-            	qualityMaxValue.setDataSet(dataSet);
-            	qualityMaxValue.setDataElement(dataElement);
-            	qualityMaxValue.setOrganisationUnit(organisationUnit);
-            	qualityMaxValue.setOrgUnitGroup( orgUnitGroup );
-            	
-            	qualityMaxValue.setValue(Double.parseDouble(value));
-            	qualityMaxValue.setStartDate(sDate);
-            	qualityMaxValue.setEndDate(eDate);
-            	
-            	qualityMaxValue.setStoredBy(storedBy);
-            	qualityMaxValue.setTimestamp(now);
-            	qualityMaxValueService.addQuantityMaxValue(qualityMaxValue);
-                
-                System.out.println("Value Added");
+                qualityMaxValue = new QualityMaxValue();
+
+                qualityMaxValue.setDataSet( dataSet );
+                qualityMaxValue.setDataElement( dataElement );
+                qualityMaxValue.setOrganisationUnit( organisationUnit );
+                qualityMaxValue.setOrgUnitGroup( orgUnitGroup );
+
+                qualityMaxValue.setValue( Double.parseDouble( value ) );
+                qualityMaxValue.setStartDate( sDate );
+                qualityMaxValue.setEndDate( eDate );
+
+                qualityMaxValue.setStoredBy( storedBy );
+                qualityMaxValue.setTimestamp( now );
+                qualityMaxValueService.addQuantityMaxValue( qualityMaxValue );
+
+                System.out.println( "Value Added" );
             }
         }
         else
         {
-        	qualityMaxValue.setStoredBy(storedBy);        	
-        	qualityMaxValue.setTimestamp(now);
-        	
-        	qualityMaxValue.setValue(Double.parseDouble(value));
-        	
-        	qualityMaxValueService.updateQuantityMaxValue(qualityMaxValue);
-            System.out.println("Value Updated");
+            qualityMaxValue.setStoredBy( storedBy );
+            qualityMaxValue.setTimestamp( now );
+
+            qualityMaxValue.setValue( Double.parseDouble( value ) );
+
+            qualityMaxValueService.updateQuantityMaxValue( qualityMaxValue );
+            System.out.println( "Value Updated" );
         }
 
-
         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-07-23 11:47:17 +0000
+++ local/in/dhis-web-maintenance-rbf/src/main/resources/META-INF/dhis/beans.xml	2014-07-28 09:27:00 +0000
@@ -203,6 +203,25 @@
 		<property name="dataSetService" ref="org.hisp.dhis.dataset.DataSetService" />
 		<property name="pbfDataValueService" ref="org.hisp.dhis.rbf.api.PBFDataValueService" />			
 	</bean>
+
+
+    <!-- Save Value In DataValue-->
+    
+    <bean id="org.hisp.dhis.rbf.dataentry.SaveValueInDataValueAction"  class="org.hisp.dhis.rbf.dataentry.SaveValueInDataValueAction" scope="prototype">
+		<property name="currentUserService" ref="org.hisp.dhis.user.CurrentUserService" />
+		<property name="dataElementService" ref="org.hisp.dhis.dataelement.DataElementService" />
+		<property name="dataValueService" ref="org.hisp.dhis.datavalue.DataValueService" />
+		<property name="categoryService" ref="org.hisp.dhis.dataelement.DataElementCategoryService" />
+		<property name="organisationUnitService" ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
+	</bean>
+
+
+
+
+
+
+
+
     
     <!-- Quality Max Data Entry -->
     

=== 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-07-23 11:47:17 +0000
+++ local/in/dhis-web-maintenance-rbf/src/main/resources/struts.xml	2014-07-28 09:27:00 +0000
@@ -133,6 +133,18 @@
 			/dhis-web-maintenance-rbf/status.vm</result>
 		<param name="onExceptionReturn">plainTextError</param>					
 	</action>
+
+	<!-- Save Value In DataValue-->
+	<action name="saveValueInDataValue"
+		class="org.hisp.dhis.rbf.dataentry.SaveValueInDataValueAction">
+		<result name="success" type="velocity-json">
+			/dhis-web-maintenance-rbf/status.vm</result>
+		<param name="onExceptionReturn">plainTextError</param>					
+	</action>
+
+
+
+
 	
 	<!-- Quality Max Data Entry -->
 	

=== modified file 'local/in/dhis-web-maintenance-rbf/src/main/webapp/dhis-web-maintenance-rbf/dataEntrySelection.vm'
--- local/in/dhis-web-maintenance-rbf/src/main/webapp/dhis-web-maintenance-rbf/dataEntrySelection.vm	2014-06-20 10:21:56 +0000
+++ local/in/dhis-web-maintenance-rbf/src/main/webapp/dhis-web-maintenance-rbf/dataEntrySelection.vm	2014-07-28 09:27:00 +0000
@@ -143,6 +143,8 @@
 
 var i18n_select_dataset = '$encoder.jsEscape( $i18n.getString( "select_dataSet" ) , "'")';
 
+var i18n_saving_value_failed_status_code = '$encoder.jsEscape( $i18n.getString( "saving_value_failed_status_code" ) , "'")';
+
 
 jQuery( document ).ready( function()
 {

=== 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-06-20 10:21:56 +0000
+++ local/in/dhis-web-maintenance-rbf/src/main/webapp/dhis-web-maintenance-rbf/javascript/pbfDataEntry.js	2014-07-28 09:27:00 +0000
@@ -166,6 +166,9 @@
 	else if( valueType == 2 )
 	{
 		valueId = "pbfdv_qty_validated_"+dataElementId;
+		
+		saveDataInDataValue( dataElementId );
+		
 	}
 	
 	else
@@ -232,6 +235,153 @@
 	}
 }
 
+// save qty validated in dataValue table
+function saveDataInDataValue( dataElementId )
+{	
+	//alert ( " Inside Save qty validated in dataValue table " );
+	
+	var period = document.getElementById("selectedPeriodId").value;
+	var valueId  = "pbfdv_qty_validated_"+dataElementId;
+
+	var fieldId = "#"+valueId;
+	var defaultValue = document.getElementById(valueId).defaultValue;
+	var value = document.getElementById(valueId).value;
+
+	if( defaultValue != value )
+	{
+       var dataValue = {
+            'dataElementId' : dataElementId,        
+            'organisationUnitId' : $("#selectedOrgunitID").val(),
+            'periodIso' : period,
+            'value' : value
+        };
+    
+       jQuery.ajax( {
+            url: 'saveValueInDataValue.action',
+            data: dataValue,
+            dataType: 'json',
+            success: handleSuccess,
+            error: handleError
+        } );
+	}
+
+	function handleSuccess( json )
+	{
+       var code = json.c;
+       if ( code == '0' || code == 0) // Value successfully saved on server
+       {
+    	  markValue( fieldId, COLOR_GREEN );
+       }
+       else if ( code == 2 )
+       {
+           markValue( fieldId, COLOR_RED );
+           window.alert( i18n_saving_value_failed_dataset_is_locked );
+       }
+       else // Server error during save
+       {
+           markValue( fieldId, COLOR_RED );
+           window.alert( i18n_saving_value_failed_status_code + '\n\n' + code );
+       }
+	}
+
+	function handleError( jqXHR, textStatus, errorThrown )
+	{       
+       markValue( fieldId, COLOR_RED );
+	}
+
+	function markValue( fieldId, color )
+	{
+       document.getElementById(valueId).style.backgroundColor = color;	   
+	}	
+}
+
+
+
+function saveTotalValueInDataValue()
+{	
+	//alert ( " Inside Save Total in dataValue table " );
+	var period = document.getElementById("selectedPeriodId").value;
+	
+	var totalDeId  = document.getElementById("totalDataElementId").value;
+	
+	//alert( totalDeId );
+	
+	var totalDeFieldId = "#"+totalDeId;
+	
+	var defaultValue = document.getElementById("all-total").defaultValue;
+	var value = document.getElementById("all-total").value;
+	//alert( value );
+	
+	if( defaultValue != value )
+	{
+       var dataValue = {
+            'dataElementId' : totalDeId,        
+            'organisationUnitId' : $("#selectedOrgunitID").val(),
+            'periodIso' : period,
+            'value' : value
+        };
+    
+       jQuery.ajax( {
+            url: 'saveValueInDataValue.action',
+            data: dataValue,
+            dataType: 'json',
+            success: handleSuccess,
+            error: handleError
+        } );
+	}
+
+	function handleSuccess( json )
+	{
+       var code = json.c;
+       if ( code == '0' || code == 0) // Value successfully saved on server
+       {
+    	  markValue( totalDeFieldId, COLOR_GREEN );
+    	  
+       }
+       else if ( code == 2 )
+       {
+           markValue( totalDeFieldId, COLOR_RED );
+           window.alert( i18n_saving_value_failed_dataset_is_locked );
+       }
+       else // Server error during save
+       {
+           markValue( totalDeFieldId, COLOR_RED );
+           window.alert( i18n_saving_value_failed_status_code + '\n\n' + code );
+       }
+	}
+
+	function handleError( jqXHR, textStatus, errorThrown )
+	{       
+       markValue( totalDeFieldId, COLOR_RED );
+	}
+
+	function markValue( totalDeFieldId, color )
+	{
+       document.getElementById("all-total").style.backgroundColor = color;	   
+	}	
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
 // load periods
 function loadPeriods()
 {

=== modified file 'local/in/dhis-web-maintenance-rbf/src/main/webapp/dhis-web-maintenance-rbf/javascript/qualityScoreDataEntry.js'
--- local/in/dhis-web-maintenance-rbf/src/main/webapp/dhis-web-maintenance-rbf/javascript/qualityScoreDataEntry.js	2014-07-23 11:47:17 +0000
+++ local/in/dhis-web-maintenance-rbf/src/main/webapp/dhis-web-maintenance-rbf/javascript/qualityScoreDataEntry.js	2014-07-28 09:27:00 +0000
@@ -103,7 +103,9 @@
 	
 	var overAllScoreValue = document.getElementById("all-total").value;
 	
-	var overAllScoreDeId = "126";
+	//var overAllScoreDeId = "126";
+	
+	var overAllScoreDeId  = document.getElementById("overAllQtyDataElementId").value;
 	
 	var overAllScorefieldId = "#"+overAllScoreDeId;
 	

=== 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-07-23 11:47:17 +0000
+++ local/in/dhis-web-maintenance-rbf/src/main/webapp/dhis-web-maintenance-rbf/loadDataEntryForm.vm	2014-07-28 09:27:00 +0000
@@ -41,6 +41,7 @@
     #end
 </select>
 
+<input type="hidden" id='totalDataElementId' name = 'totalDataElementId' value="$!totalDataElementId" />
 
 #set( $tabIndex = 1 )
 #if ( $dataElements.size() > 0)
@@ -337,6 +338,10 @@
 					allTotal = allTotal + total;
 					
 					$('#all-total').val(allTotal);
+					
+					saveTotalValueInDataValue();
+					
+					
                 }
 				
 				

=== modified file 'local/in/dhis-web-maintenance-rbf/src/main/webapp/dhis-web-maintenance-rbf/loadQualityScoreEntryForm.vm'
--- local/in/dhis-web-maintenance-rbf/src/main/webapp/dhis-web-maintenance-rbf/loadQualityScoreEntryForm.vm	2014-07-23 11:47:17 +0000
+++ local/in/dhis-web-maintenance-rbf/src/main/webapp/dhis-web-maintenance-rbf/loadQualityScoreEntryForm.vm	2014-07-28 09:27:00 +0000
@@ -25,6 +25,9 @@
         <option value="$!qualityScorePayment.addQtyPayment">$qualityScorePayment.getStartRange()-$!qualityScorePayment.endRange</option>
     #end
 </select>
+
+<input type="hidden" id='overAllQtyDataElementId' name = 'overAllQtyDataElementId' value="$!overAllQtyDataElementId" />
+
 #set( $tabIndex = 1 )
 #if ( $dataElements.size() > 0)